From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <bounce+27952+117075+7686176+12367111@groups.io>
Received: from mail02.groups.io (mail02.groups.io [66.175.222.108])
	by spool.mail.gandi.net (Postfix) with ESMTPS id 2D62D740034
	for <rebecca@openfw.io>; Mon, 25 Mar 2024 02:32:00 +0000 (UTC)
DKIM-Signature: a=rsa-sha256; bh=bc81HAAwjvItFJCyATaYRfiSkmf4Utu1nOygPlpEJKg=;
 c=relaxed/simple; d=groups.io;
 h=From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:msip_labels:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type;
 s=20240206; t=1711333918; v=1;
 b=RCBbCq21tEzj3phF4sE56U7P7CUD2EsT7bdBKgYslnBjRAulVJXyW4fGlgtX+5POcUw5a92t
 WSAYP5vGjri2NcURVdYmL/MYec6xseNhKJLWiCFjMS6tPmeHEnsU0ReoFoycwPAgEnlhpMwes7L
 kb2YyA2mPke6aEbkxj2HbhzxMg1EVUvRPOsaMItNKvOXJnjfMdVJ59d2YEHfr9SYgVDAACquMm3
 rgDrmmcyIFKr6GrbeES7LFuknzKGakq3x7GFrOak7uXYE2HIIFmrCTUtuOV7kpbInZe0UD2oDpR
 qfB1OmoKmNhABlSj1Rem9X47T3WVK9EVLjJ3NFi/NBcmw==
X-Received: by 127.0.0.2 with SMTP id HgsBYY7687511xrm1QjJo2JD; Sun, 24 Mar 2024 19:31:58 -0700
X-Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18])
 by mx.groups.io with SMTP id smtpd.web11.43437.1711333918256230767
 for <devel@edk2.groups.io>;
 Sun, 24 Mar 2024 19:31:58 -0700
X-IronPort-AV: E=McAfee;i="6600,9927,11023"; a="6146357"
X-IronPort-AV: E=Sophos;i="6.07,152,1708416000"; 
   d="scan'208,217";a="6146357"
X-Received: from fmviesa009.fm.intel.com ([10.60.135.149])
  by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Mar 2024 19:31:57 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="6.07,152,1708416000"; 
   d="scan'208,217";a="15494393"
X-Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82])
  by fmviesa009.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 24 Mar 2024 19:31:58 -0700
X-Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by
 fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id
 15.1.2507.35; Sun, 24 Mar 2024 19:31:57 -0700
X-Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by
 fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id
 15.1.2507.35 via Frontend Transport; Sun, 24 Mar 2024 19:31:56 -0700
X-Received: from NAM02-DM3-obe.outbound.protection.outlook.com (104.47.56.40) by
 edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.1.2507.35; Sun, 24 Mar 2024 19:31:56 -0700
X-Received: from MN6PR11MB8244.namprd11.prod.outlook.com (2603:10b6:208:470::14)
 by IA0PR11MB7693.namprd11.prod.outlook.com (2603:10b6:208:401::7) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.31; Mon, 25 Mar
 2024 02:31:55 +0000
X-Received: from MN6PR11MB8244.namprd11.prod.outlook.com
 ([fe80::2c31:82b7:9f26:5817]) by MN6PR11MB8244.namprd11.prod.outlook.com
 ([fe80::2c31:82b7:9f26:5817%5]) with mapi id 15.20.7409.028; Mon, 25 Mar 2024
 02:31:55 +0000
From: "Ni, Ray" <ray.ni@intel.com>
To: Chao Li <lichao@loongson.cn>, "devel@edk2.groups.io"
	<devel@edk2.groups.io>
CC: "Kumar, Rahul R" <rahul.r.kumar@intel.com>, Gerd Hoffmann
	<kraxel@redhat.com>, Leif Lindholm <quic_llindhol@quicinc.com>, "Ard
 Biesheuvel" <ardb+tianocore@kernel.org>, Sami Mujawar <sami.mujawar@arm.com>,
	Sunil V L <sunilvl@ventanamicro.com>, "Warkentin, Andrei"
	<andrei.warkentin@intel.com>
Subject: Re: [edk2-devel] [PATCH v2 07/13] UefiCpuPkg: Add CpuMmuLib.h to UefiCpuPkg
Thread-Topic: [PATCH v2 07/13] UefiCpuPkg: Add CpuMmuLib.h to UefiCpuPkg
Thread-Index: AQHaeqKwCaJbYZZ8mEy2XpK3sTNxXLFHw1my
Date: Mon, 25 Mar 2024 02:31:54 +0000
Message-ID: <MN6PR11MB82441442AA57428BC60D460C8C362@MN6PR11MB8244.namprd11.prod.outlook.com>
References: <20240320084152.268323-1-lichao@loongson.cn>
 <20240320084319.276603-1-lichao@loongson.cn>
In-Reply-To: <20240320084319.276603-1-lichao@loongson.cn>
Accept-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
msip_labels: 
x-ms-publictraffictype: Email
x-ms-traffictypediagnostic: MN6PR11MB8244:EE_|IA0PR11MB7693:EE_
x-ms-office365-filtering-correlation-id: 0a10586f-4820-4697-2045-08dc4c73bcb1
x-ms-exchange-senderadcheck: 1
x-ms-exchange-antispam-relay: 0
x-microsoft-antispam-message-info: 0bY97rKmGyV2yJ7sIuzSXsdkIN2eFguF7d4DRcDDLxWmm6LyGNnr53ePdDwqCnTEBvJ0qPmamoUFMGCvpN/5dTaIK+zwjuNUljrYBVLUY3EhLfNiFCf0RBE1lFG9VZpKk3UOrx4CHM0UJzXLjLrY5ttCU2leKTxrZ+hkUuYFX2awp87uWNAmIUB+W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BmnI+ThdsFNre6bydTwu/5CRmx6ZeGsEjZNvXaCcqnYdM+9vOW3bQL9c?=
 =?us-ascii?Q?oCkoYVKCLXVtK7exc81eEYnM3CdK4zlqvOF6pqHLzCoL4r32Fc65HgJZZds+?=
 =?us-ascii?Q?wlWzmFdoOG8y4N/qMY0x2F7gvqBSdqKtZlUXNOKf+I3J5ZaZs233L/ANJTBg?=
 =?us-ascii?Q?w035u6wjvt0FehbmpcfWdYQYZxOz2qVnmk8U+yelt3TaPRcA/Ah2SYNJtqbu?=
 =?us-ascii?Q?cn7rs65duXTJc24R+rfkMf8SEIn0lycrNTt+bdQMq5p38kdfdAt4rTvcvd5q?=
 =?us-ascii?Q?YXuGumOGyZfrNysXq2w=3D?=
MIME-Version: 1.0
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: MN6PR11MB8244.namprd11.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 0a10586f-4820-4697-2045-08dc4c73bcb1
X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Mar 2024 02:31:55.0064
 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: X6JLvGUKBzI8364QK1XS3S8d/3niC9q97OTO8dy8owFUho51uJLuQi+kdOgAZZwN1C6jEe2HkbS42qHk8y3asw==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR11MB7693
X-OriginatorOrg: intel.com
Precedence: Bulk
List-Subscribe: <mailto:devel+subscribe@edk2.groups.io>
List-Help: <mailto:devel+help@edk2.groups.io>
Sender: devel@edk2.groups.io
List-Id: <devel.edk2.groups.io>
Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io
Resent-Date: Sun, 24 Mar 2024 19:31:58 -0700
Reply-To: devel@edk2.groups.io,ray.ni@intel.com
List-Unsubscribe-Post: List-Unsubscribe=One-Click
List-Unsubscribe: <https://edk2.groups.io/g/devel/leave/12367111/7686176/1913456212/plugh>
X-Gm-Message-State: moVxZEBQooXQQIQO4yZCE4UZx7686176AA=
Content-Language: en-US
Content-Type: multipart/alternative;
	boundary="_000_MN6PR11MB82441442AA57428BC60D460C8C362MN6PR11MB8244namp_"
X-GND-Status: LEGIT
Authentication-Results: spool.mail.gandi.net;
	dkim=pass header.d=groups.io header.s=20240206 header.b=RCBbCq21;
	dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none);
	spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io

--_000_MN6PR11MB82441442AA57428BC60D460C8C362MN6PR11MB8244namp_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Just curious, how many modules need to call this API?
If there is only one (I guess CpuDxe driver), should LoongArch CPU driver i=
mplement the logic internally so that the lib class/API can be avoided?

Thanks,
Ray
________________________________
From: Chao Li <lichao@loongson.cn>
Sent: Wednesday, March 20, 2024 16:43
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Ni, Ray <ray.ni@intel.com>; Kumar, Rahul R <rahul.r.kumar@intel.com>; G=
erd Hoffmann <kraxel@redhat.com>; Leif Lindholm <quic_llindhol@quicinc.com>=
; Ard Biesheuvel <ardb+tianocore@kernel.org>; Sami Mujawar <sami.mujawar@ar=
m.com>; Sunil V L <sunilvl@ventanamicro.com>; Warkentin, Andrei <andrei.war=
kentin@intel.com>
Subject: [PATCH v2 07/13] UefiCpuPkg: Add CpuMmuLib.h to UefiCpuPkg

Add a new header file CpuMmuLib.h, whitch is referenced from
ArmPkg/Include/Library/ArmMmuLib.h. Currently, only support for
LoongArch64 is added, and more architectures can be accommodated in the
future.

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4734

Cc: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Sunil V L <sunilvl@ventanamicro.com>
Cc: Andrei Warkentin <andrei.warkentin@intel.com>
Signed-off-by: Chao Li <lichao@loongson.cn>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
---
 UefiCpuPkg/Include/Library/CpuMmuLib.h | 55 ++++++++++++++++++++++++++
 UefiCpuPkg/UefiCpuPkg.dec              |  4 ++
 2 files changed, 59 insertions(+)
 create mode 100644 UefiCpuPkg/Include/Library/CpuMmuLib.h

diff --git a/UefiCpuPkg/Include/Library/CpuMmuLib.h b/UefiCpuPkg/Include/Li=
brary/CpuMmuLib.h
new file mode 100644
index 0000000000..26d2d65524
--- /dev/null
+++ b/UefiCpuPkg/Include/Library/CpuMmuLib.h
@@ -0,0 +1,33 @@
+/** @file
+
+  Copyright (c) 2024 Loongson Technology Corporation Limited. All rights r=
eserved.<BR>
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef CPU_MMU_LIB_H_
+#define CPU_MMU_LIB_H_
+
+#include <Uefi/UefiBaseType.h>
+
+/**
+  Sets the Attributes  of the specified memory region.
+
+  @param[in]  BaseAddress    The base address of the memory region to set =
the Attributes.
+  @param[in]  Length         The length of the memory region to set the At=
tributes.
+  @param[in]  Attributes     The Attributes to be set.
+  @param[in]  AttributeMask  Mask of memory attributes to take into accoun=
t.
+
+  @retval  EFI_SUCCESS    The Attributes was set successfully
+**/
+EFI_STATUS
+EFIAPI
+SetMemoryRegionAttributes (
+  IN EFI_PHYSICAL_ADDRESS  BaseAddress,
+  IN UINTN                 Length,
+  IN UINTN                 Attributes,
+  IN UINT64                AttributeMask
+  );
+
+#endif // CPU_MMU_LIB_H_
diff --git a/UefiCpuPkg/UefiCpuPkg.dec b/UefiCpuPkg/UefiCpuPkg.dec
index 571b59b36f..ca744fab55 100644
--- a/UefiCpuPkg/UefiCpuPkg.dec
+++ b/UefiCpuPkg/UefiCpuPkg.dec
@@ -72,6 +72,10 @@ [LibraryClasses.RISCV64]
   ##
   RiscVMmuLib|Include/Library/BaseRiscVMmuLib.h

+[LibraryClasses.LoongArch64]
+  ##  @libraryclass  Provides functions for the memory management unit.
+  CpuMmuLib|Include/Library/CpuMmuLib.h
+
 [Guids]
   gUefiCpuPkgTokenSpaceGuid      =3D { 0xac05bf33, 0x995a, 0x4ed4, { 0xaa,=
 0xb8, 0xef, 0x7a, 0xe8, 0xf, 0x5c, 0xb0 }}
   gMsegSmramGuid                 =3D { 0x5802bce4, 0xeeee, 0x4e33, { 0xa1,=
 0x30, 0xeb, 0xad, 0x27, 0xf0, 0xe4, 0x39 }}
--
2.27.0



-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117075): https://edk2.groups.io/g/devel/message/117075
Mute This Topic: https://groups.io/mt/105041094/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-



--_000_MN6PR11MB82441442AA57428BC60D460C8C362MN6PR11MB8244namp_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html>
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dus-ascii"=
>
<style type=3D"text/css" style=3D"display:none;"> P {margin-top:0;margin-bo=
ttom:0;} </style>
</head>
<body dir=3D"ltr">
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; c=
olor: rgb(0, 0, 0);">
Just curious, how many modules need to call this API?</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; c=
olor: rgb(0, 0, 0);">
If there is only one (I guess CpuDxe driver), should LoongArch CPU driver i=
mplement the logic internally so that the lib class/API can be avoided?</di=
v>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; c=
olor: rgb(0, 0, 0);">
<br>
</div>
<div id=3D"Signature">
<div style=3D"font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, =
Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
Thanks,</div>
<div style=3D"font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, =
Calibri, Helvetica, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);">
Ray</div>
</div>
<div id=3D"appendonsend"></div>
<hr style=3D"display:inline-block;width:98%" tabindex=3D"-1">
<div id=3D"divRplyFwdMsg" dir=3D"ltr"><font face=3D"Calibri, sans-serif" st=
yle=3D"font-size:11pt" color=3D"#000000"><b>From:</b> Chao Li &lt;lichao@lo=
ongson.cn&gt;<br>
<b>Sent:</b> Wednesday, March 20, 2024 16:43<br>
<b>To:</b> devel@edk2.groups.io &lt;devel@edk2.groups.io&gt;<br>
<b>Cc:</b> Ni, Ray &lt;ray.ni@intel.com&gt;; Kumar, Rahul R &lt;rahul.r.kum=
ar@intel.com&gt;; Gerd Hoffmann &lt;kraxel@redhat.com&gt;; Leif Lindholm &l=
t;quic_llindhol@quicinc.com&gt;; Ard Biesheuvel &lt;ardb+tianocore@kernel.o=
rg&gt;; Sami Mujawar &lt;sami.mujawar@arm.com&gt;; Sunil V L &lt;sunilvl@ve=
ntanamicro.com&gt;;
 Warkentin, Andrei &lt;andrei.warkentin@intel.com&gt;<br>
<b>Subject:</b> [PATCH v2 07/13] UefiCpuPkg: Add CpuMmuLib.h to UefiCpuPkg<=
/font>
<div>&nbsp;</div>
</div>
<div class=3D"BodyFragment"><font size=3D"2"><span style=3D"font-size:11pt;=
">
<div class=3D"PlainText">Add a new header file CpuMmuLib.h, whitch is refer=
enced from<br>
ArmPkg/Include/Library/ArmMmuLib.h. Currently, only support for<br>
LoongArch64 is added, and more architectures can be accommodated in the<br>
future.<br>
<br>
BZ: <a href=3D"https://bugzilla.tianocore.org/show_bug.cgi?id=3D4734">https=
://bugzilla.tianocore.org/show_bug.cgi?id=3D4734</a><br>
<br>
Cc: Ray Ni &lt;ray.ni@intel.com&gt;<br>
Cc: Rahul Kumar &lt;rahul1.kumar@intel.com&gt;<br>
Cc: Gerd Hoffmann &lt;kraxel@redhat.com&gt;<br>
Cc: Leif Lindholm &lt;quic_llindhol@quicinc.com&gt;<br>
Cc: Ard Biesheuvel &lt;ardb+tianocore@kernel.org&gt;<br>
Cc: Sami Mujawar &lt;sami.mujawar@arm.com&gt;<br>
Cc: Sunil V L &lt;sunilvl@ventanamicro.com&gt;<br>
Cc: Andrei Warkentin &lt;andrei.warkentin@intel.com&gt;<br>
Signed-off-by: Chao Li &lt;lichao@loongson.cn&gt;<br>
Acked-by: Gerd Hoffmann &lt;kraxel@redhat.com&gt;<br>
---<br>
&nbsp;UefiCpuPkg/Include/Library/CpuMmuLib.h | 55 +++++++++++++++++++++++++=
+<br>
&nbsp;UefiCpuPkg/UefiCpuPkg.dec&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&nbsp; 4 ++<br>
&nbsp;2 files changed, 59 insertions(+)<br>
&nbsp;create mode 100644 UefiCpuPkg/Include/Library/CpuMmuLib.h<br>
<br>
diff --git a/UefiCpuPkg/Include/Library/CpuMmuLib.h b/UefiCpuPkg/Include/Li=
brary/CpuMmuLib.h<br>
new file mode 100644<br>
index 0000000000..26d2d65524<br>
--- /dev/null<br>
+++ b/UefiCpuPkg/Include/Library/CpuMmuLib.h<br>
@@ -0,0 +1,33 @@<br>
+/** @file<br>
+<br>
+&nbsp; Copyright (c) 2024 Loongson Technology Corporation Limited. All rig=
hts reserved.&lt;BR&gt;<br>
+<br>
+&nbsp; SPDX-License-Identifier: BSD-2-Clause-Patent<br>
+<br>
+**/<br>
+<br>
+#ifndef CPU_MMU_LIB_H_<br>
+#define CPU_MMU_LIB_H_<br>
+<br>
+#include &lt;Uefi/UefiBaseType.h&gt;<br>
+<br>
+/**<br>
+&nbsp; Sets the Attributes&nbsp; of the specified memory region.<br>
+<br>
+&nbsp; @param[in]&nbsp; BaseAddress&nbsp;&nbsp;&nbsp; The base address of =
the memory region to set the Attributes.<br>
+&nbsp; @param[in]&nbsp; Length&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp; The length of the memory region to set the Attributes.<br>
+&nbsp; @param[in]&nbsp; Attributes&nbsp;&nbsp;&nbsp;&nbsp; The Attributes =
to be set.<br>
+&nbsp; @param[in]&nbsp; AttributeMask&nbsp; Mask of memory attributes to t=
ake into account.<br>
+<br>
+&nbsp; @retval&nbsp; EFI_SUCCESS&nbsp;&nbsp;&nbsp; The Attributes was set =
successfully<br>
+**/<br>
+EFI_STATUS<br>
+EFIAPI<br>
+SetMemoryRegionAttributes (<br>
+&nbsp; IN EFI_PHYSICAL_ADDRESS&nbsp; BaseAddress,<br>
+&nbsp; IN UINTN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Length,<br>
+&nbsp; IN UINTN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Attributes,<br>
+&nbsp; IN UINT64&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AttributeMask<br>
+&nbsp; );<br>
+<br>
+#endif // CPU_MMU_LIB_H_<br>
diff --git a/UefiCpuPkg/UefiCpuPkg.dec b/UefiCpuPkg/UefiCpuPkg.dec<br>
index 571b59b36f..ca744fab55 100644<br>
--- a/UefiCpuPkg/UefiCpuPkg.dec<br>
+++ b/UefiCpuPkg/UefiCpuPkg.dec<br>
@@ -72,6 +72,10 @@ [LibraryClasses.RISCV64]<br>
&nbsp;&nbsp; ##<br>
&nbsp;&nbsp; RiscVMmuLib|Include/Library/BaseRiscVMmuLib.h<br>
&nbsp;<br>
+[LibraryClasses.LoongArch64]<br>
+&nbsp; ##&nbsp; @libraryclass&nbsp; Provides functions for the memory mana=
gement unit.<br>
+&nbsp; CpuMmuLib|Include/Library/CpuMmuLib.h<br>
+<br>
&nbsp;[Guids]<br>
&nbsp;&nbsp; gUefiCpuPkgTokenSpaceGuid&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =3D { =
0xac05bf33, 0x995a, 0x4ed4, { 0xaa, 0xb8, 0xef, 0x7a, 0xe8, 0xf, 0x5c, 0xb0=
 }}<br>
&nbsp;&nbsp; gMsegSmramGuid&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =3D { 0x5802bce4, 0xeeee, =
0x4e33, { 0xa1, 0x30, 0xeb, 0xad, 0x27, 0xf0, 0xe4, 0x39 }}<br>
-- <br>
2.27.0<br>
<br>
</div>
</span></font></div>
</body>
</html>


<div width=3D"1" style=3D"color:white;clear:both">_._,_._,_</div>
<hr>


Groups.io Links:<p>


 =20
    You receive all messages sent to this group.
 =20
 =20


<p>
<a target=3D"_blank" href=3D"https://edk2.groups.io/g/devel/message/117075"=
>View/Reply Online (#117075)</a> |


 =20

|

  <a target=3D"_blank" href=3D"https://groups.io/mt/105041094/7686176">Mute=
 This Topic</a>


| <a href=3D"https://edk2.groups.io/g/devel/post">New Topic</a>

<br>




<a href=3D"https://edk2.groups.io/g/devel/editsub/7686176">Your Subscriptio=
n</a> |
<a href=3D"mailto:devel+owner@edk2.groups.io">Contact Group Owner</a> |

<a href=3D"https://edk2.groups.io/g/devel/unsub">Unsubscribe</a>

 [rebecca@openfw.io]<br>
<div width=3D"1" style=3D"color:white;clear:both">_._,_._,_</div>


--_000_MN6PR11MB82441442AA57428BC60D460C8C362MN6PR11MB8244namp_--