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 087C0D80121 for ; Wed, 13 Dec 2023 05:17:49 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=y9ezVHw+MojZSHwu6t6x46Gvnp0PRu+lfksUvGesro8=; 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=1702444668; v=1; b=k1L+9laxNAkzX15lNg4Htt7u40rkp8W3GkDUOC3eWxQCdqHsoVcgcLQNRu2/hKig2Ym4E/0z Evfc3TTeG3KrKBqeNv5uiDJJZERwsk9/wMHzdQGYFk7KMoM9C2juey2+PmbQ0wUc0DTVVCIQFtP nniWv0iKdReaFKl4J8PPbEhg= X-Received: by 127.0.0.2 with SMTP id uNtXYY7687511xWwdrqJEquv; Tue, 12 Dec 2023 21:17:48 -0800 X-Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) by mx.groups.io with SMTP id smtpd.web11.29594.1702444667431109201 for ; Tue, 12 Dec 2023 21:17:47 -0800 X-IronPort-AV: E=McAfee;i="6600,9927,10922"; a="385333337" X-IronPort-AV: E=Sophos;i="6.04,272,1695711600"; d="scan'208";a="385333337" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Dec 2023 21:17:38 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10922"; a="802756394" X-IronPort-AV: E=Sophos;i="6.04,272,1695711600"; d="scan'208";a="802756394" X-Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by orsmga008.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 12 Dec 2023 21:17:37 -0800 X-Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 12 Dec 2023 21:17:37 -0800 X-Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) 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 via Frontend Transport; Tue, 12 Dec 2023 21:17:37 -0800 X-Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.101) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Tue, 12 Dec 2023 21:17:36 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R9lGBZBSYOVZc0qBIcx18kMMqXKUj/5U1RsJ8PvceFKVmJUTZAHoTGxcqInHW1IJ8DucpCYyWG8JVyVvTNxoa2hUJmbRZJNxg7xSJAsG3/sN+wIiawSXyde/7ENjuF6oVCocX0eQg4FmAgTXES2rlKEqWVnIgozXo1npwrczBJjvojUpnOaKj/v3R33fcoLBw7o8YssajfBb8p6Pqiw847sd4psN7Eiq3oYKjkkEgDpoHlbpd0zLi/cIXTTpzvzEBkfwNc/qDkldIaR6fleuPv2nG+IWIwVfK4eF1yJ8XrW9CirhIRZ+us7froJMfqiU7VNYAjbvyJiBJRr9uOcXng== 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=jJsH2kp6xkhbZV6fSGojQ1pAUuo1CJZDBm97n/h7GsE=; b=gBwrCQcMKcFq6aeBIUUzKuW1nLGwhJth9cQtmmKvteFFR78Qe4qlfpakUM3EViJ5z7uMe1iETTpb9LjIkqqSh52QpFyrouAyrlw6Wuv4oROCPSOCiimjk4u1l8ics5Nu4nR9ugl4jbr1fZ9xsbhs9SjgQcacwNZyZgJndr7STeg1N8HBuNpBoirxZPAEvGXJ0x5EcdPeNXhnjrAzP0qG92596ZAuNueBWRO1r3hqG6ei0vMQthMa+dtaQOXJDplzIYsmuSJTHxcFQy1pudZS1/V4lila4S9fc6shXwprxAQHYZkCZYacAIc0ocmlLEOXpHIjxP9VLb4XpB+VVwh8wA== 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 CH3PR11MB7842.namprd11.prod.outlook.com (2603:10b6:610:128::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.33; Wed, 13 Dec 2023 05:17:33 +0000 X-Received: from MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::b614:1f5e:8b0c:9858]) by MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::b614:1f5e:8b0c:9858%4]) with mapi id 15.20.7091.022; Wed, 13 Dec 2023 05:17:33 +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 v4 12/37] UefiCpuPkg: Add CpuMmuLib.h to UefiCpuPkg Thread-Topic: [PATCH v4 12/37] UefiCpuPkg: Add CpuMmuLib.h to UefiCpuPkg Thread-Index: AQHaLPzqsky57o/efE+SL962QL3lb7CmrCRg Date: Wed, 13 Dec 2023 05:17:33 +0000 Message-ID: References: <20231212130932.2467028-1-lichao@loongson.cn> <20231212131216.2470799-1-lichao@loongson.cn> In-Reply-To: <20231212131216.2470799-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_|CH3PR11MB7842:EE_ x-ms-office365-filtering-correlation-id: d2719801-9d36-4c42-c80d-08dbfb9acff1 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: jPBFSA2wyvT+32CIerndw6MP1EWHpyPDc6rW7E+0TCLwQ34P+QJ646QSa5IHE8gSxy35Y2ueKG/iXT4s3p7l5VDed9PBKnMBPLDAknZ0m3CPYn+1J9Kcw23lYns7IwbiQJZrZUWYrWCFgeUftz4/1Tcmsxes7SWeOim68oj2s40cQ1OTCTEUQ63i85/7nPVqhtYmE5GGsvoynDjDDyQLDmqHYMkI5XxK7l4N3LaI1rVuNF966Jugd20MHFmVdhkZW1+EvJB/3xBs/Kfigrz3yt9T+1fWhRY8rIEu0QMDcLuLfamy9eZzsGU2proJiIYnOTTw0xqRRTsijpoQBKmLEt5oqD3NdsnxPyDsJgulN2rs0Rqe+fvOJwihnccJ/jNnGchOizI76VVqagK0SGHF2hZ3OVhzojDZg0CSqng0EsTtawPMT7kt12aKwjgJ4Q9RVxh5JJtqcyMyT/kwO6R8zgOTDhI8vTWbWR1yFAu/cLtfkoCPD5a1ZNiSk17CYqMBp8lFqmr56KxngVSezW0KNAu71I5NfBe6FhiENaEwUi2Vl/4La1PgqjbqZDqJimbwFYYZY5qrqWhoGQ5qFh77n8rH41Xv2eLejZZ4iAin2UFAQhrXnCBwRTMM4TODLe+U x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?rpgfXLaJwtm392VQFr7GTcc0RtYYdizvNgEVDJyHuOmHGLKkWU5b4jTels+C?= =?us-ascii?Q?3meS0CG/GaeKQcl/YLiaOsY6mFsMPz98wN8bdRjppfGgsiTKcGeX0722Wfbn?= =?us-ascii?Q?lmSq4b7PQnupts1lriHFVpnWh+D2/qW6s8CRr4lzUx1L/hjPiqgap9v3LzsR?= =?us-ascii?Q?cLBlJSsUu1b8qUoic+CcXuh6kthkmnbKhE2dLGkLBnYrsRm5+AwjO9UkNNTa?= =?us-ascii?Q?DplHJgWoHjD9TxBDRGA3GpVvkAZisKXBTmQJ5+qmGqYGyAL0KlDAd9dNWb6b?= =?us-ascii?Q?6l7hC+iJFp7uXd9XSEmjXQibUffqF/7xTaWX9X5+s75kq8BeLgNWTlHQgeyJ?= =?us-ascii?Q?fuBCNRghxNqh3aiOwCHCEQPa/Qu2Q08U3mVkWlngisNLfvONss0zRLilQPD9?= =?us-ascii?Q?EWLeEAkY5vqC5nRnN7iLmP2n8LgYMuZPdDGQTlA6b1RJGsWPr9gdWxTCzEi3?= =?us-ascii?Q?kIHENDrC3rIXj14s/UbUl5p6WwIs615EQMVTHMyF4lFFLGTNTUXA59WvFnH4?= =?us-ascii?Q?iP0oTTRrhyx+TmXTWvj4Mn1zLbFRe21XZ7pmtcumMB43a2Hp496H5MP3tq8/?= =?us-ascii?Q?GKsuYgyXv88tMMVIZeKaXOPfIsU3cFZ/fD6JWhBW5SelmYBg9KLAA17fxzl9?= =?us-ascii?Q?qbzcaKu0CHJlXGciMWYpeyxbVD5RI/JO4jhTdCb77IdoDDXGAy9NjTbv7UK2?= =?us-ascii?Q?cQZCQetu42RhgSzrZ4wJdNkUScKW46yMs72DaemBe76z9OV+Y7iw7Uw0SR4E?= =?us-ascii?Q?oINf2exa9X0HYmb8EBsXBztV/WHAE3UHA+ZU/4hVJ4cbznmq0GAALUK56KqN?= =?us-ascii?Q?o+aVXW9NTwfd4XY9WB5J0sFadfBg6aq6xE06aG/U05QFK2pTUCA9OnrSs/a4?= =?us-ascii?Q?J/n4be7bxUtoz0cU39GTC3Z4vZSYDasBZbhfRaaS60S7sGzvFQoe7qAHgv3t?= =?us-ascii?Q?Y2FbTTMvAbjGd0V8PXTMFr5hbuKU++eCyf+/TzQgEBp53G5yNSOtZZQUYOpB?= =?us-ascii?Q?UwQCfwF8qHTteEay33q95nI2LEeeH/C3NFF41X8H6A2YXDYRFbTRDPqyh3tQ?= =?us-ascii?Q?elVIWnl4fTVvTZDMCXXm6XTHpmgnGeEK3d4SCk4ee9+rGMuoecrjSYAlyn/m?= =?us-ascii?Q?h2EpmRz68/DfN0Sm/KSMFGq3V9J5AJDklI+K+LgbE4a38koNdMyL0EHJ7NDb?= =?us-ascii?Q?mmz+GPv1hZL4DPPnmdlTzr/TADwRfg1Px20IRPrCNn62VK19Vqj5zjz6yjEj?= =?us-ascii?Q?A+YHHqm4TluQ18GB4qJXX+99cmZqiYFZThymC18HYc9PZTA9t95yscKrqS8c?= =?us-ascii?Q?hvCOieE985dG9In1c+H12qCd1jIiS/tZEiHcmplllYk5L2mkF4cNZum3cOgf?= =?us-ascii?Q?jA3xonWOHGIFB52CPDPoqceH20MHIqwB3ie5R2HrlTOC6y7W+b8RbwKVIYTW?= =?us-ascii?Q?krkvH32Ve5bCttivR7X1z/vIzubnuYSbT8MIAEiVxrOKeqhlTYuhtuS5vTyX?= =?us-ascii?Q?WgeiZ3kXY5DZQfrANsclqYQicJgJWW1EOQOzEeuyVl0CStRVibF0sd6HlG2a?= =?us-ascii?Q?RmbqsWS0YL3fxqmi47c=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: d2719801-9d36-4c42-c80d-08dbfb9acff1 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Dec 2023 05:17:33.4748 (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: nfNbFRF6914dUKrEmwrET+HVjoG6x2KNaqSS9b5w1y9aaIUwXqiJL7PGboml+9ykRPjG/SIYjUkkWJEgxcKouA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR11MB7842 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: WvGwq03x6A0DUj5S9AwSmqnwx7686176AA= 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=k1L+9lax; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}") Chao, Thanks for providing such a cleaner lib API. Only 2 comments in below: > + > +#define EFI_MEMORY_CACHETYPE_MASK (EFI_MEMORY_UC | \ > + EFI_MEMORY_WC | \ > + EFI_MEMORY_WT | \ > + EFI_MEMORY_WB | \ > + EFI_MEMORY_UCE \ > + ) 1. Why do you need to define the EFI_MEMORY_CACHETYPE_MASK here? Can you just mention that the following APIs only return 5 bits: UC/WC/WT/W= B/UCE without defining the EFI_MEMORY_CACHETYPE_MASK? > + > +typedef struct { > + EFI_PHYSICAL_ADDRESS PhysicalBase; > + EFI_VIRTUAL_ADDRESS VirtualBase; > + UINTN Length; > + UINTN Attributes; > +} MEMORY_REGION_DESCRIPTOR; > + > +/** > + 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 > region. > + @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 > +EFIAPI > +GetMemoryRegionAttributes ( > + IN UINTN BaseAddress, > + IN UINTN EndAddress, > + OUT UINTN *RegionLength, > + OUT UINTN *RegionAttributes > + ); 2. If the actual memory ranges are as follows: [0 - 1M, UC] [1M - 1G, WB] What's the result of following call: a. GetMemoryRegionAttributes (512KB, 1MB) b. GetMemoryRegionAttributes (512KB, 2MB) -=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 (#112466): https://edk2.groups.io/g/devel/message/112466 Mute This Topic: https://groups.io/mt/103129095/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-