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 6C16A941806 for ; Fri, 5 Jan 2024 12:50:10 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=QTu2BPZ2zJVtbYZvGQsY8VVz4JNZGtprRfibor4J4R8=; 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=1704459009; v=1; b=X80I55lYiK/yJY3UoxaYEvo1d5MF6lHvjM3eCwXv4a7ZjWMVRrdu22wdo33aQILF+Wf8mZ8X ciSXm5cKvTFemF3bulgbBhRMWSBSWe1g9T0S6Uu9i9cVhFgRklYQL9EEt2vhojMJTyskdFtJEwZ P6CBL92zaXPE+OtWytWR73CY= X-Received: by 127.0.0.2 with SMTP id JzKCYY7687511xLgRw3kFIfO; Fri, 05 Jan 2024 04:50:09 -0800 X-Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) by mx.groups.io with SMTP id smtpd.web11.22603.1704459007461988164 for ; Fri, 05 Jan 2024 04:50:08 -0800 X-IronPort-AV: E=McAfee;i="6600,9927,10943"; a="387950041" X-IronPort-AV: E=Sophos;i="6.04,333,1695711600"; d="scan'208";a="387950041" X-Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jan 2024 04:49:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10943"; a="871229608" X-IronPort-AV: E=Sophos;i="6.04,333,1695711600"; d="scan'208";a="871229608" X-Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by FMSMGA003.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 05 Jan 2024 04:49:50 -0800 X-Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 5 Jan 2024 04:49:49 -0800 X-Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 5 Jan 2024 04:49:49 -0800 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; Fri, 5 Jan 2024 04:49:49 -0800 X-Received: from NAM04-MW2-obe.outbound.protection.outlook.com (104.47.73.168) 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; Fri, 5 Jan 2024 04:49:49 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VS7eaY/9G0oy5mBuJjWzgOc1YEYCt5Lkuicas0hmNpqa/fQn0k0ZSfDm5fu3lUUn6XUdVbqheLaWtHBchlAXd9FiOanPQttEEimDkIXr0Kl7zSKfscque3jPqIpWcKk44iF4nlmg25x6WYm89J/CKlp1IFWtR/NjqZZeTgST2LHVJwoOita+qw5hT5kVYsIF0vrchyCKsRj9YPju1R2/uK0E6uCmRJ3RebVWq27NtLzLSL9p1jxt8+l3wTUhG8FI07fm0vraPF6FEu2W7NRrtEdNZqZxymgLi9MOIBVOrxVQAGnJ4HfpMOfIAq8ETGvKilRNJOhnJ/j+Fin/ljHvOw== 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=x7XR8jTtaCuEzpbtDVJTs8hrSMd3chEby10AeZoiZx0=; b=HhJovtaqVdPlfrYkdJLbJJrXvS1I0wNYo1U643TDk9eNiLf4yRGTn6zXK7hAdDvLcBX7FyLT68Q+wIfX2G48yYRLzh1S92tpIKS3sgU7N1YiCc5DTwGUskkVei55TsRBRd68SyWD6Vc0+Hns6/aTQh4MH1IjGaAPY3yZqVMJWT6GfNw5UU25KvCIrqx3TsDmqBV4J/wHDjZ+sXrUc6fwwL1+TV8COy8OYOe/i9CH7PtEK/sODrI4tJqUyXOEQpg4GT0Lyl2bomJnQpuJJ37pL5tJHwEnvt/iRJVNZQkx5GEsb/eJiqk0BUDU5zx1Tv3uMqPmWcrv1WO5tDUbUCTW4Q== 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 MN6PR11MB8244.namprd11.prod.outlook.com (2603:10b6:208:470::14) by MN0PR11MB6035.namprd11.prod.outlook.com (2603:10b6:208:376::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.17; Fri, 5 Jan 2024 12:49:47 +0000 X-Received: from MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::3fea:ca2b:2ef7:e3d4]) by MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::3fea:ca2b:2ef7:e3d4%4]) with mapi id 15.20.7159.015; Fri, 5 Jan 2024 12:49:47 +0000 From: "Ni, Ray" To: Chao Li , "devel@edk2.groups.io" CC: "Dong, Eric" , "Kumar, Rahul R" , Gerd Hoffmann , Leif Lindholm , Ard Biesheuvel , "Sami Mujawar" , Sunil V L , "Warkentin, Andrei" Subject: Re: [edk2-devel] [PATCH v6 12/36] UefiCpuPkg: Add CpuMmuLib.h to UefiCpuPkg Thread-Topic: [PATCH v6 12/36] UefiCpuPkg: Add CpuMmuLib.h to UefiCpuPkg Thread-Index: AQHaP7uvDsQ3TUnQlU++lX0mTp93MrDLK89Q Date: Fri, 5 Jan 2024 12:49:47 +0000 Message-ID: References: <20240105094118.2279380-1-lichao@loongson.cn> <20240105094337.2280354-1-lichao@loongson.cn> In-Reply-To: <20240105094337.2280354-1-lichao@loongson.cn> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MN6PR11MB8244:EE_|MN0PR11MB6035:EE_ x-ms-office365-filtering-correlation-id: 106c2032-ca59-40c5-8080-08dc0deccc6f x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: eMBpZ9nCiceo4XRgGYuVb6KgLD8etgN7fbiUmWxJgnMk5mDT0rjr7vxBdTERpSf2Xwau/G8TG6Tmp0evhrt8gLIiyNxOhEPyRsoJQZMXYlEw5zbWXyiIlSZtVPeJpLmwrzeuyxZninV+G5J4s/lWJvwwuMHcofnOjKz0FpiGVHNYof5Ya28kqJZVKnQBTTy1VWJDRHt2xQmvXv5z3HZrnoY9m8HAlUA435ettgTzEUq1e4n6aSwWA8Rz3LU0jf54rk44L2seryyqA1sgEwTrBvCfpL8awu06dj8J88lzQo9qehr7rgiF5nP2N9zZGdWnn7YN0dWTeWGbwp6PnYn0zPgrbWNZMI6PEHPRvHEXeX6grESd5iayLpZmHeFakX9wPIWHJ/VSr/zoBSSXAgxAEffY8qpHhV8qWWs911K7IgsnVFpH4lPdd73fAQgTbAtbGL6+c49fbSVMnGXmwHmjY0Vu7uNpH3XgvOYjcA0JSm69EEA9wiNUvtEqGkaVJyu8oIqKzbxLqJcp3LcjgXm+9FwF7rpdXvqvQYILJBlak80eFpHtiBEeD9M8EznP0RlaggAC/U25Ap9HLz8L72YOYvjQvBDexSTh8vEuibhURiw= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?e+4ZsCAiWHDV3rjFyAkn4AIcUU9BWcTXaN5sSLBQaTyex+sLrDvUDCjqcjr2?= =?us-ascii?Q?3Ke+5KWyfEf92/l/sLtNjtezZjFxLCeNoGetmFxGqivtWnfy788EX9ZM9DXj?= =?us-ascii?Q?vTgPit9v5+s9ckwT1kY6M+sFm/N8mPw0IT7Z72ywJfibcsmRcqUzrK1xJxWJ?= =?us-ascii?Q?ioIdyqKMsehRtp8iVV81Td69G/2/K5luz86V6SuUrbOi1LAZ/Qi1zhh+oAek?= =?us-ascii?Q?FRYarKk7ZdKvFK5yAEG34T8GJpGQNAPv311Nd49ZycPFkmK5ihAYJc12mFgk?= =?us-ascii?Q?erFZfEcZ3iaqzPzAPTlrnDHIMXIbpfhxixbZXEP+gD44sEV4Adcc9TfH0LVh?= =?us-ascii?Q?M/VQSUDff0LpFWBgUfhoiCynSjL+T2G1miya9brkW7TnBcAevnMssXfO3AWY?= =?us-ascii?Q?9daLM2NF4ldXVd0sLZqtZ3y1Vgt0jEv8gSF6HdsF4GKYMm9Q2w/2hYrzf5/W?= =?us-ascii?Q?9tRhiLz6q9Dq5qa+vwx/zoebYT7OmWPhLg39kVjvfIFtfVWckYowOYSZyAJ5?= =?us-ascii?Q?/JSqlgcHKVVMDtADZFMiWgDFMNT9bD5U+siFFVtaL0IT5WaJF1/9WPBWFnVY?= =?us-ascii?Q?NwjeQrLs+liEVhI967u8YRIW5ce9wfKLWHaTPUP6CzW6aHHMODZ9/2l9CYCp?= =?us-ascii?Q?usYKKF9xbk3lrSOUpEDiYO5+EgQLmKxTHrCZgGaJR5iRcsoMbFTBtfDxYLVL?= =?us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S-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN6PR11MB8244.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 106c2032-ca59-40c5-8080-08dc0deccc6f X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Jan 2024 12:49:47.2500 (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: LxVzuNjOk7MIGjGXic6xufoO65VJE7jVhEPmh0pgkeX+thMiBK3BQDa8camdrdKOMPwusja72B7pu6ZA5mCeEw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR11MB6035 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,ray.ni@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: HjG4bGeMmO4YIJUnxgFcYOknx7686176AA= 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=X80I55lY; 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 Reviewed-by: Ray Ni Thanks, Ray > -----Original Message----- > From: Chao Li > Sent: Friday, January 5, 2024 5:44 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 v6 12/36] 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 > Reviewed-by: Andrei Warkentin > --- > UefiCpuPkg/Include/Library/CpuMmuLib.h | 62 > ++++++++++++++++++++++++++ > UefiCpuPkg/UefiCpuPkg.dec | 4 ++ > 2 files changed, 66 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..f88ec4eb2e > --- /dev/null > +++ b/UefiCpuPkg/Include/Library/CpuMmuLib.h > @@ -0,0 +1,62 @@ > +/** @file > + > + Copyright (c) 2024 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 > + > +typedef struct { > + EFI_PHYSICAL_ADDRESS PhysicalBase; > + EFI_VIRTUAL_ADDRESS VirtualBase; > + UINTN Length; > + UINTN Attributes; > +} MEMORY_REGION_DESCRIPTOR; > + > +/** > + Finds the first of the length and memory properties of the memory regi= on > corresponding > + to the specified base address. > + > + @param[in] BaseAddress To find the base address of the mem= ory > region. > + @param[in, out] RegionLength Pointer holding: > + - At entry, the length of the memo= ry region > + expected to be found. > + - At exit, the length of the memor= y region found. > + @param[out] RegionAttributes Properties of the memory region fou= nd. > + > + @retval EFI_SUCCESS The corresponding memory area was successfully > found > + EFI_NOT_FOUND No memory area found > +**/ > +EFI_STATUS > +EFIAPI > +GetMemoryRegionAttributes ( > + IN UINTN BaseAddress, > + IN 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 se= t > the Attributes. > + @param[in] Length The length of the memory region to set the > Attributes. > + @param[in] Attributes The Attributes to be set. > + @param[in] AttributeMask Mask of memory attributes to take into > account. > + > + @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 84f61254bb..9b11a3da72 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 (#113278): https://edk2.groups.io/g/devel/message/113278 Mute This Topic: https://groups.io/mt/103540105/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/19134562= 12/xyzzy [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-