From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 96BFF7803CC for ; Thu, 9 Nov 2023 01:18:05 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=SR0nszDnJaFzBwsuQ0dE/hRv3ZBZqim95XHjKzaUEUo=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1699492684; v=1; b=AO2Y4h0f9t69ISnfWdK3y02fM2OJP2PNHiEaM9Al47PPk0vIpvo8YSCukirrj045qTx05S9v /xnvjqp+EdsTFVonXjuD5xbZalLLeT/pXJUVRnlvx/jc3RvaH7TMA+xUlkU8kkJ8UygK70mYGbG wQR4/gnM/uKq0Ok1RnTLppZ4= X-Received: by 127.0.0.2 with SMTP id T2aVYY7687511x6VCbu3o1EJ; Wed, 08 Nov 2023 17:18:04 -0800 X-Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web10.111582.1699492683011067560 for ; Wed, 08 Nov 2023 17:18:03 -0800 X-IronPort-AV: E=McAfee;i="6600,9927,10888"; a="454194993" X-IronPort-AV: E=Sophos;i="6.03,287,1694761200"; d="scan'208";a="454194993" X-Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Nov 2023 17:18:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10888"; a="766823611" X-IronPort-AV: E=Sophos;i="6.03,287,1694761200"; d="scan'208";a="766823611" X-Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by fmsmga007.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 08 Nov 2023 17:18:01 -0800 X-Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Wed, 8 Nov 2023 17:18:01 -0800 X-Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Wed, 8 Nov 2023 17:18:01 -0800 X-Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34 via Frontend Transport; Wed, 8 Nov 2023 17:18:01 -0800 X-Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.101) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.34; Wed, 8 Nov 2023 17:18:00 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IsSUZyPfL2MOUIPf7azhJpMfiboN13mALxHMA01qlxpqoqdhjh+cd+pb1BuQuIW4mCaJpC+6mVS1DkUQbgu54ECCG8nEW1RXAcvAGluhXVDyNkx3polIsCY8cyB/tJEXcbWCz0nqu0HE0nPEwAZeHiLWWKI+Ucq/3A2WNTt5BMWqJZ/7/gZ3EzVxBw7ys5YeTeWYdJtu4tZ7aSoywTzK/xwgA+l3umKR8Pft0bqtZpUECgH+gKK6pYBmoqtUl+Fg0O4VPfzP/cpbnIRPkNEyKxy0XgNKIF1ERHyp4q56/pPoM3I+07fyxgyvu6ghvTiOSPBngZUf1fxTdYcBLZvhMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=UOeAjOh0O6JFIx7U0JOJ47T/rq002d0kGvnaFC8HC9k=; b=VqHi1/qTNrG1A1liuzpqNLo6E/og4X3rlO5AUhNKRXsnuwyAs/WVRdnGLLv9JRKH4KREKAwgYUDAqT/wyPo9Ot3nb/04P54zPmSkHiet2zODqlaVuPCCU/fVDX7uGA8eLKuGyEproAFWXTbfao9dl6qYkNZ4+2m5SGoiAydnW+BmxY13vVyVVbZSk1B7EciHGQcX9/OCH6F3WCIQNQKgJ6fwdBnUxU4DWbMGBnwQgMEkAE0RSYaKgmmIdR4o4O4iwxRu3093Y0XYMc+Os0iU4htXDxL+9NAlB0xZbaxrtAtOvh7zidlR439PGOJeOTy/EZVqMUxTh01gVpKMFSVeaA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none X-Received: from PH8PR11MB6856.namprd11.prod.outlook.com (2603:10b6:510:22b::7) by DM4PR11MB7255.namprd11.prod.outlook.com (2603:10b6:8:10d::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6954.28; Thu, 9 Nov 2023 01:17:53 +0000 X-Received: from PH8PR11MB6856.namprd11.prod.outlook.com ([fe80::ddf0:b3d6:2e5c:bd5e]) by PH8PR11MB6856.namprd11.prod.outlook.com ([fe80::ddf0:b3d6:2e5c:bd5e%3]) with mapi id 15.20.6954.028; Thu, 9 Nov 2023 01:17:53 +0000 From: "Andrei Warkentin" To: Chao Li , "devel@edk2.groups.io" CC: "Dong, Eric" , "Ni, Ray" , "Kumar, Rahul R" , Gerd Hoffmann , "Leif Lindholm" , Ard Biesheuvel , Sami Mujawar , Sunil V L Subject: Re: [edk2-devel] [PATCH v2 11/30] UefiCpuPkg: Add CpuMmuLib.h to UefiCpuPkg Thread-Topic: [PATCH v2 11/30] UefiCpuPkg: Add CpuMmuLib.h to UefiCpuPkg Thread-Index: AQHaEGFWDArOkxND4UaCXI/yrypmRrBxMKOg Date: Thu, 9 Nov 2023 01:17:53 +0000 Message-ID: References: <20231106032521.2251143-1-lichao@loongson.cn> <20231106032822.2284762-1-lichao@loongson.cn> In-Reply-To: <20231106032822.2284762-1-lichao@loongson.cn> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PH8PR11MB6856:EE_|DM4PR11MB7255:EE_ x-ms-office365-filtering-correlation-id: 220dab77-09c1-4c66-a482-08dbe0c1b27e x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: qdPnaqVrA+bE8AaX4JmrGmk/6RhMYl0z4u6obNkN820xvfrwbfrf1VdWz56Am2EKEKByo3/Yh0noj97tvgte+7iV0NTObA+RWpQu6fil7DMzJdPVokagYaOCXuuHSxzH4qDry9Q5pHt0ymcTkuxoiGjR4evP5OBznhbRP06pCzT0E/vagamfIu0aaOQLhB0w/kXMjV2Saut7LefiwIVNBFDXIQGT1V3xbrKXImAlZ3C4yuGabkPeO+3RissS/Uqsv8XvvsJ8LZgotqsZVGDWOYC7GQepvcw9Hdg4TPh5BvB8ckOnSLTNuqAFZpjDyzEWxzLH/kNCDHI6NYH/d/m9keIGtah8EtQjVsL6JvWfCPx0RyP6HNPOEsIZtuc/ewy8aUCbU9JM7huVY2FlnzAFHpaeTpWRm6rc4mOh1HG6g5j4dfAQCYl0pSojuqKl3NziBc4S2Ba2EILT1BXnHEgXXCuuoAjEYiY0eom7fyDlQzoYGJXuUTDmqoLaTxZsem+Nw3R4A+2DKPCaRwi8NVmThRVVQ9hfGA46gA0J5FpVKvhCzMNJLAMJk6SPM7xqHDKK8SkBIGr46zDV5sta8JfPpS/18DWDjOpxZtPuwCnkrL0= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?E3nOZBbxM+9HulSiQkw/5+JgxKD3gk5cLgtO3zoosSNpWSKFlwO9N+JDpD9z?= =?us-ascii?Q?LXQyQMzK/lvdtLkDjjUidKu1zUZOlftI/bVgKVGyyEynCELC5GTz4tQG3LOX?= =?us-ascii?Q?6Cw5jj6bNp+zkxffB8CaQYggvw4bSPDUh3NEbxw14Q2vILLtfCyVQCGS69IW?= =?us-ascii?Q?AXNr63bAyPwdcFrsDBFyxj4kLJ0sYX7RgsprJUTgg+IgpiwjWM6EPFUq/Jsg?= =?us-ascii?Q?A9/hi2/7R8bqZl4Y3z55y5F1u8MsRwvx9Gwn5a88f8dTNh3GVAgVfCxcv2ZT?= =?us-ascii?Q?hAEryxUq4DB3ztdeoh0FOlBybqvCpJoAC29Xfwx97JXf6VnoAmvpinGGvNn5?= =?us-ascii?Q?C2q82v6KX+Meu9lDcRXhgjBD6C6ifW0x+F4wOHnib8X5OsbLipIpL171QzrA?= =?us-ascii?Q?t1W1JQb0wZzTgTvnbzC1pvhqOkDCavvMdVp9mvdr2iLXa9dsVcIETaoqQBHr?= =?us-ascii?Q?W0E1DshpRbTA1pEWaSCDdt6Zr1XWpOqCWOEo7hieZjbqXwDwt0IjS1HRCaw2?= =?us-ascii?Q?x5tTGucG7VF5qC0lyN4ZF8uOKNgDquJCQBEWbz+nESEu5dlP8QajmcktoHS3?= =?us-ascii?Q?pRA4d4L3Gr7JZYT1T9LBa6aWs9djuUzyG7cdbdZLKGZ1+SSTYcoHDfv7kQ3A?= =?us-ascii?Q?uYGMnYfg4Qm8frPjOFad3j9QR5CxrHN/gyFgi5KPsufeg10Fd3aRpWzqfgWu?= =?us-ascii?Q?1QREkSFxOZQ+HNaitVGq4Yi6xDcnT8AgtXr5nEomrj+SwKjB1fcpHBqXD89/?= =?us-ascii?Q?Zi0SLZsB30FEqIbvGD7nY9ouxDz90fLj6fpRoDFsCeDUFfxouATxnSqETXse?= =?us-ascii?Q?r0/UN2EBT8GIjXLq8Hk0Qp1BLIzaAU6F2MuKOhyg37duHRQRjhhvIjbsxUc+?= =?us-ascii?Q?Y7T1/IBvSkAzQzb3Pu6w+qqK9Q9bCtGjQlJj61NpEq2iD8SjLbBvoRh/Ehvs?= =?us-ascii?Q?Kvbrqhlau0MnwO/3K9cpLPwIXxvxWHP0jUGobsGcP/cQTg3571af7ZkM22Z9?= =?us-ascii?Q?5nUIyjjB/fqG6mbO3eGZ6eKWsOONUzK3WqUwx+yUCNqFQY9sKjMbaDLhjja6?= =?us-ascii?Q?hlJj1BVQ83k71o121Ft9g1jdgFqcv2B0KeC86TuMg91t+fV/UTcU8PrCh2iE?= =?us-ascii?Q?FSKavkRmPzc+v43pu9aUBlPWn0VIjX+9LWoGGuGiBwmDYZEOf/sOBhJWGIcD?= =?us-ascii?Q?hGvJpWT4J7TMuqGe2kEGtNOeOkjRG0h3AAEynNC3ZGflxSYhu6Hj+OMgWBww?= =?us-ascii?Q?aWSE71sjqsod/J4myHqYM/puuYy6L0J9J5A2Bg2LxipbMDJeEvbfsUMqrdNp?= =?us-ascii?Q?1ASNfCAaiyOOsbTIXJ6XvrJ+UPmZoKf7m/KhY+V0Q3+sWlvfYNHE7v1IWf1T?= =?us-ascii?Q?dbONlpKqizOaOfez6gKdl6gM3XsbI/DeZhhyWAledDA3ZbY+aIZoWm/Uu/Cp?= =?us-ascii?Q?dO0VgdtZrsIZEnl/ETI6H9zsVrL7dfEAuJp+z6Lm2W7DQxBfdEbY1o/w03as?= =?us-ascii?Q?Xe5tPM8rqs4IdFFx2hEopARIwbYZr8DszHsSB7BebVqSNabFK/H4DnQhPWwD?= =?us-ascii?Q?lvhyeIKouUR3KojAB+xhm1PUbCnLYoE4i6zr5jaL?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH8PR11MB6856.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 220dab77-09c1-4c66-a482-08dbe0c1b27e X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Nov 2023 01:17:53.1008 (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: RjsIy3xpX1jf1JOif8NZYBte8/T4j/CvFqs95AkkzTjdPRP2QaxqkdvGt85jnNnHi/cyxHb5esjmslnZU4ZGbYl/vBxpGTSx2g/b9YeobrY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR11MB7255 X-OriginatorOrg: intel.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,andrei.warkentin@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: oY2ncLrGH7UufN6IpiauoKjcx7686176AA= Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=AO2Y4h0f; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}"); 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 Hi Chao, I see that you're adding a header, CpuMmuLib.h, but this header is not gene= ric - it includes a bunch of Loongson arch-specific "stuff".=20 I agree in principle that there's room for a generic CpuMmuLib, and I don't= think you ought to be on the hook to refactor ArmMmuLib, but I suggest mov= ing=20 the architecture-specific PTE #defines into MdePkg/Include similar to ./Mde= Pkg/Include/Register/RiscV64. (it would, though, be nice to at least record= the idea of moving ArmMmuLib to CpuMmuLib.... raise a BZ for that or somet= hing!) This will avoid the #ifdef MDE_CPU_LOONGARCH64 inside a generic Library hea= der. A > -----Original Message----- > From: Chao Li > Sent: Sunday, November 5, 2023 9:28 PM > To: devel@edk2.groups.io > Cc: Dong, Eric ; Ni, Ray ; Kumar, > Rahul R ; Gerd Hoffmann ; > Leif Lindholm ; Ard Biesheuvel > ; Sami Mujawar ; > Sunil V L ; Warkentin, Andrei > > Subject: [PATCH v2 11/30] UefiCpuPkg: Add CpuMmuLib.h to UefiCpuPkg >=20 > 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. >=20 > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4584 >=20 > Cc: Eric Dong > Cc: Ray Ni > Cc: Rahul Kumar > Cc: Gerd Hoffmann > Cc: Leif Lindholm > Cc: Ard Biesheuvel > Cc: Sami Mujawar > Cc: Sunil V L > Cc: Andrei Warkentin > Signed-off-by: Chao Li > --- > UefiCpuPkg/Include/Library/CpuMmuLib.h | 194 > +++++++++++++++++++++++++ > UefiCpuPkg/UefiCpuPkg.dec | 4 + > 2 files changed, 198 insertions(+) > create mode 100644 UefiCpuPkg/Include/Library/CpuMmuLib.h >=20 > diff --git a/UefiCpuPkg/Include/Library/CpuMmuLib.h > b/UefiCpuPkg/Include/Library/CpuMmuLib.h > new file mode 100644 > index 0000000000..8f524d31d4 > --- /dev/null > +++ b/UefiCpuPkg/Include/Library/CpuMmuLib.h > @@ -0,0 +1,194 @@ > +/** @file > + > + Copyright (c) 2023 Loongson Technology Corporation Limited. All > + rights reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef CPU_MMU_LIB_H_ > +#define CPU_MMU_LIB_H_ > + > +#include > + > +#ifdef MDE_CPU_LOONGARCH64 > + > +/* Page table property definitions */ > +#define PAGE_VALID_SHIFT 0 > +#define PAGE_DIRTY_SHIFT 1 > +#define PAGE_PLV_SHIFT 2 // 2~3, two bits > +#define CACHE_SHIFT 4 // 4~5, two bits > +#define PAGE_GLOBAL_SHIFT 6 > +#define PAGE_HUGE_SHIFT 6 // HUGE is a PMD bit > + > +#define PAGE_HGLOBAL_SHIFT 12 // HGlobal is a PMD bit > +#define PAGE_PFN_SHIFT 12 > +#define PAGE_PFN_END_SHIFT 48 > +#define PAGE_NO_READ_SHIFT 61 > +#define PAGE_NO_EXEC_SHIFT 62 > +#define PAGE_RPLV_SHIFT 63 > + > +/* Used by TLB hardware (placed in EntryLo*) */ > +#define PAGE_VALID ((UINTN)(1) << PAGE_VALID_SHIFT) > +#define PAGE_DIRTY ((UINTN)(1) << PAGE_DIRTY_SHIFT) > +#define PAGE_PLV ((UINTN)(3) << PAGE_PLV_SHIFT) > +#define PAGE_GLOBAL ((UINTN)(1) << PAGE_GLOBAL_SHIFT) > +#define PAGE_HUGE ((UINTN)(1) << PAGE_HUGE_SHIFT) > +#define PAGE_HGLOBAL ((UINTN)(1) << PAGE_HGLOBAL_SHIFT) #define > +PAGE_NO_READ ((UINTN)(1) << PAGE_NO_READ_SHIFT) #define > PAGE_NO_EXEC > +((UINTN)(1) << PAGE_NO_EXEC_SHIFT) > +#define PAGE_RPLV ((UINTN)(1) << PAGE_RPLV_SHIFT) > +#define CACHE_MASK ((UINTN)(3) << CACHE_SHIFT) > +#define PFN_SHIFT (EFI_PAGE_SHIFT - 12 + PAGE_PFN_SHIFT) > + > +#define PLV_KERNEL 0 > +#define PLV_USER 3 > + > +#define PAGE_USER (PLV_USER << PAGE_PLV_SHIFT) > +#define PAGE_KERNEL (PLV_KERN << PAGE_PLV_SHIFT) > + > +#define CACHE_SUC (0 << CACHE_SHIFT) // Strong-ordered UnCached > +#define CACHE_CC (1 << CACHE_SHIFT) // Coherent Cached > +#define CACHE_WUC (2 << CACHE_SHIFT) // Weak-ordered UnCached > + > +#define EFI_MEMORY_CACHETYPE_MASK (EFI_MEMORY_UC | \ > + EFI_MEMORY_WC | \ > + EFI_MEMORY_WT | \ > + EFI_MEMORY_WB | \ > + EFI_MEMORY_UCE \ > + ) > +#endif > + > +typedef struct { > + EFI_PHYSICAL_ADDRESS PhysicalBase; > + EFI_VIRTUAL_ADDRESS VirtualBase; > + UINTN Length; > + UINTN Attributes; > +} MEMORY_REGION_DESCRIPTOR; > + > +/** > + Converts EFI Attributes to corresponding architecture Attributes. > + > + @param[in] EfiAttributes Efi Attributes. > + > + @retval Corresponding architecture attributes. > +**/ > +UINTN > +EfiAttributeConverse ( > + IN UINTN EfiAttributes > + ); > + > +/** > + Finds the length and memory properties of the memory region > corresponding to the specified base address. > + > + @param[in] BaseAddress To find the base address of the memory > region. > + @param[in] EndAddress To find the end address of the memory regio= n. > + @param[out] RegionLength The length of the memory region found. > + @param[out] RegionAttributes Properties of the memory region found= . > + > + @retval EFI_SUCCESS The corresponding memory area was successfully > found > + EFI_NOT_FOUND No memory area found > +**/ > +EFI_STATUS > +GetMemoryRegionAttribute ( > + IN UINTN BaseAddress, > + IN UINTN EndAddress, > + OUT UINTN *RegionLength, > + OUT UINTN *RegionAttributes > + ); > + > +/** > + 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 > Attributes. > + @param[in] Attributes The Attributes to be set. > + > + @retval EFI_SUCCESS The Attributes was set successfully > +**/ > +EFI_STATUS > +SetMemoryAttributes ( > + IN EFI_PHYSICAL_ADDRESS BaseAddress, > + IN UINTN Length, > + IN UINTN Attributes > + ); > + > +/** > + Sets the non-executable Attributes for 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 > Attributes. > + > + @retval EFI_SUCCESS The Attributes was set successfully > +**/ > +EFI_STATUS > +SetMemoryRegionNoExec ( > + IN EFI_PHYSICAL_ADDRESS BaseAddress, > + IN UINTN Length > + ); > + > +/** > + Clears the non-executable Attributes for the specified memory region > + > + @param[in] BaseAddress The base address of the memory region to clea= r > the Attributes. > + @param[in] Length The length of the memory region to clear the > Attributes. > + > + @retval EFI_SUCCESS The Attributes was clear successfully > +**/ > +EFI_STATUS > +EFIAPI > +ClearMemoryRegionNoExec ( > + IN EFI_PHYSICAL_ADDRESS BaseAddress, > + IN UINT64 Length > + ); > + > +/** > + Sets the read-only Attributes for 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 > Attributes. > + > + @retval EFI_SUCCESS The Attributes was set successfully > +**/ > +EFI_STATUS > +EFIAPI > +SetMemoryRegionReadOnly ( > + IN EFI_PHYSICAL_ADDRESS BaseAddress, > + IN UINT64 Length > + ); > + > +/** > + Clears the read-only Attributes for the specified memory region > + > + @param[in] BaseAddress The base address of the memory region to clea= r > the Attributes. > + @param[in] Length The length of the memory region to clear the > Attributes. > + > + @retval EFI_SUCCESS The Attributes was clear successfully > +**/ > +EFI_STATUS > +EFIAPI > +ClearMemoryRegionReadOnly ( > + IN EFI_PHYSICAL_ADDRESS BaseAddress, > + IN UINT64 Length > + ); > + > +/** > + Create a page table and initialize the memory management unit(MMU). > + > + @param[in] MemoryTable A pointer to a memory ragion tabl= e. > + @param[out] TranslationTableBase A pointer to a translation table = base > address. > + @param[in out] TranslationTableSize A pointer to a translation table = base > size. > + > + @retval EFI_SUCCESS Configure MMU successfully. > + EFI_INVALID_PARAMETER MemoryTable is NULL. > + EFI_UNSUPPORTED Out of memory space or size not al= igned. > +**/ > +EFI_STATUS > +EFIAPI > +ConfigureMemoryManagementUint ( > + IN MEMORY_REGION_DESCRIPTOR *MemoryTable, > + OUT VOID **TranslationTableBase OPTIONAL, > + IN OUT UINTN *TranslationTableSize OPTIONAL > + ); > + > +#endif // CPU_MMU_LIB_H_ > diff --git a/UefiCpuPkg/UefiCpuPkg.dec b/UefiCpuPkg/UefiCpuPkg.dec index > 154b1d06fe..150beae981 100644 > --- a/UefiCpuPkg/UefiCpuPkg.dec > +++ b/UefiCpuPkg/UefiCpuPkg.dec > @@ -62,6 +62,10 @@ > ## @libraryclass Provides function for manipulating x86 paging struc= tures. > CpuPageTableLib|Include/Library/CpuPageTableLib.h >=20 > +[LibraryClasses.LoongArch64] > + ## @libraryclass Provides macros and functions for the memory > management unit. > + CpuMmuLib|Include/Library/CpuMmuLib.h > + > ## @libraryclass Provides functions for manipulating smram savestate > registers. > MmSaveStateLib|Include/Library/MmSaveStateLib.h >=20 > -- > 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 (#110936): https://edk2.groups.io/g/devel/message/110936 Mute This Topic: https://groups.io/mt/102413866/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-