From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web10.71630.1679575967255199091 for ; Thu, 23 Mar 2023 05:52:47 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=gFtsP0Bw; spf=pass (domain: intel.com, ip: 192.55.52.120, mailfrom: ray.ni@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679575967; x=1711111967; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=ytMaZHIPl+WGFZdz2cic53qfCvfjALmwgXu+/jxsbhI=; b=gFtsP0BwHpBEMxzMUyradMWE+y4MKBiwWpsZSsrfchpAzbbUwJfwSE+z r2Dy2muxKX6+LERs8OKz+H1FgfMDJ/Nkifz2erQ7MWaefaKXqSYjU2kUK /TOCezrRRq7xDCG52nHQhFm569sS2EiYPVmcFt39n1mJ3un9Lhcj0zJTG GMPf8Vq/Xfg3WNMToGK6BTPi5+2OoIAgNj9i9eTaDETcGCN0j/Pb9y5NB FbgO6qZB1+DFS/PWudtyS+1RY59HmOz4oj9DNfhLFm6qpP24c5ksxOYNH AgHR6fFenyuiyVd62sipTcARi2QHdNBPKEd8gycUWi6b11OPE9nD6V4Fq Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="338197654" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="338197654" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2023 05:52:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="675683426" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="675683426" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orsmga007.jf.intel.com with ESMTP; 23 Mar 2023 05:52:46 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) 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.21; Thu, 23 Mar 2023 05:52:46 -0700 Received: from fmsmsx601.amr.corp.intel.com (10.18.126.81) 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.21; Thu, 23 Mar 2023 05:52:45 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) 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.21 via Frontend Transport; Thu, 23 Mar 2023 05:52:45 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.169) 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.21; Thu, 23 Mar 2023 05:52:45 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ILhcZGr7wpsE/KUTKG7+nEw5f+eFcMvOyUm1upCz9uA90OI/N07zRw2IwQ/UXfjbDI5mw0ixHLmntvyFeYaE4W1AOJtr+jtNluqkuP+6TW6iNJ5rPJEfDBaVtBjLY7mIPgCfNKkPttoe0LcxSYwAmvNzlC5dw0uvS0JvK+n31Vwgvsy8sU2JW1tQK+NgiR0k8MXSCllEfcwlunEPvlu5S9SukZgTP8Ah1wfirZFhdTFQs68npivejaU0lbmZJ3vsmUxEqWqdMjBgLCD1fD5q++w91PSJk7pTSWgurblF3RLn35HkivhQtTmJaB58JjQkYSRsnd0cQ+fUi1glZGNt5A== 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=Nzgmo4GkkKThkg5GPVhQeNIDZ7W8yvzkbcnZdEPOgrk=; b=hfE98iRv6hFOs0yGeaTgb7s2UFU5vFEkiYdGD7/nOVooYcQuvzdB0eKiht60iURmcBu8QzJRMPrQbItaNMXdB0lcpG6P8WExNwO/rVfDl3EeiXr8Q/1Woe4IukGWXGqxuG4iXMblItlZt5Kw11m8zH/8p91dIL3z7l6h3oDSgWtJTLf2vSaZpHLaIkp3LhkBK/D2OO0NuOfydfs20/npWupIQCeVfyHduy6qkvJMMtogY6h8j440oCyD+fYJpChBJrnVq5aF0bAHkAELc4GxjhSe8MIXhIUOtTHUV9B6k6kYYbZaiGw9suYT3uIolUo42CqxB1eVntTua5rnvid74A== 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 Received: from MN6PR11MB8244.namprd11.prod.outlook.com (2603:10b6:208:470::14) by SJ2PR11MB7645.namprd11.prod.outlook.com (2603:10b6:a03:4c3::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.38; Thu, 23 Mar 2023 12:52:42 +0000 Received: from MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::ae07:e96a:4a24:8a69]) by MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::ae07:e96a:4a24:8a69%7]) with mapi id 15.20.6178.037; Thu, 23 Mar 2023 12:52:42 +0000 From: "Ni, Ray" To: "Tan, Dun" , "devel@edk2.groups.io" CC: "Dong, Eric" , "Kumar, Rahul R" , Gerd Hoffmann Subject: Re: [Patch V4 08/21] UefiCpuPkg/CpuPageTableLib:Add check for Mask and Attr Thread-Topic: [Patch V4 08/21] UefiCpuPkg/CpuPageTableLib:Add check for Mask and Attr Thread-Index: AQHZXVrp9suyNGIwO023H3PDJ3AIt68ITjxQ Date: Thu, 23 Mar 2023 12:52:42 +0000 Message-ID: References: <20230323074057.549-1-dun.tan@intel.com> <20230323074057.549-9-dun.tan@intel.com> In-Reply-To: <20230323074057.549-9-dun.tan@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MN6PR11MB8244:EE_|SJ2PR11MB7645:EE_ x-ms-office365-filtering-correlation-id: a8b58692-2f78-4046-1257-08db2b9d7dcc x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: ZHUEdQM4nTV94S+4n0j0kCbZSUs3DAviB1M+1KBlnON/y0XUjvKsNT/+T4fOPF9RtnwhKNpfbGmsl5f0oT3y/6wUQW4MszX0sjuZUqX4FFK69skWWAvMacXukccZzPzISUiIuwuClYB+PiuKTZ8aA4bxXwzw37nv6YdsgEEf7ObtLCwtO+g4qWd6xdYmUzT5sftz3u/SVe2VkmP/ztXFcbDYi0hhc/EnW2DAiKBAofzVYDLnIWU39gdEqhMkq6FW9UDOj+JNQMk73E1JSRej7FO1Qf5NRuWHJCTjVRspGpEDHCPzjyiGJrRrweWLCmak/uVP4S7Y2Gl/bV1T05qyArE7T/KNZT+Oh5fZaWdDv6F1E6eI3f3zcPzL/ELXiHR3hFxI06SBWp70UwucfSwA2FN+Hgz6fD6/7xqYb8y+Ez5+am8cL/ClfE0NupZSq3PshYKJb0fYcwWpdNHtoZM0Kh3//3KtuqGPfLngRLtyz+25StL2oeefYHk/nwlb7HGv9l03XmaS3t8brbkliDt47aU0H6trBOSnECX0RUINy+5bL7SaVWUf+QKnrctPxvUvXCWkQonPbrBdB2S4/ClcuLQBhNzLL3Cn//sz43dxyyOeudmmzAksWjJkWKBTr9/jtaGn5AE8sWQQmhxXWEulxozrTL1t4MhyqCG86E+gFEATQLfg87on5amMtzeJZ6F/3jTQKHV5NJSfdEjO6tbxug== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN6PR11MB8244.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(396003)(376002)(39860400002)(366004)(346002)(136003)(451199018)(76116006)(52536014)(66946007)(66556008)(66476007)(66446008)(64756008)(8936002)(41300700001)(86362001)(4326008)(8676002)(33656002)(38100700002)(122000001)(9686003)(6506007)(38070700005)(26005)(55016003)(83380400001)(186003)(316002)(7696005)(478600001)(71200400001)(54906003)(110136005)(82960400001)(2906002)(5660300002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?ErNPAgiLiwyTuFoC8lWIPx6Cii/sDeWFQLD4zGWUecfNiJoYldIdRL83CS+J?= =?us-ascii?Q?hJwZh+3/2c2/aNDolC/Na5kutOxBc8gRMYcX2mw5m9BHjO7ATe46fsb9ibSb?= =?us-ascii?Q?eKNGwNXhrLlnmIakT8Pm76suQAYV9D7t1g5B3mgPTk9RLK4okKd7GFomAO7w?= =?us-ascii?Q?qpqnmsTONuc49OY51vefS1Ntr74zq5cTswP92mNQCZmaR5D4Orr/n6yEYz02?= =?us-ascii?Q?YOXc5HZcoUkT+exLAMmMGWNuwI5gGmciYU0Z7bUXohIxLGP5/Wq1IVTsBgL2?= =?us-ascii?Q?j60ifbjURBE7rpKNqnpLrsCuJmUrllluYFgn26/bknFDniAmPvu5vqDa86gV?= =?us-ascii?Q?F32PtvzI4CR2zwGOVolqvRWeS0QdK46L8TzmNw5Pv5cZ5WQIQFdxF0IWlDeH?= =?us-ascii?Q?MPk1icklni8XPRiHndq7kqqPH8r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Q?uOw0PhUy2SL8U7dt49182gS6doK4IueKHvnvpcZU1RGMnUTqyr015cOZhioo?= =?us-ascii?Q?v6ol8bCq2F1T3NApdVsRvJU4sRkVcFWHFPEDmWsmY7/aTn+9o5BymAAn2uwR?= =?us-ascii?Q?NafO8t3PxABiqBQh3UHjYpwE4ZsT9tUK6jYL+i8fL4pnK0JPqInoOf2zF8vd?= =?us-ascii?Q?CxqvODz/fcmZ3zieQzg56k3sX3ktu7A9k82VFDQwGTVbuhoAMD6s+sdM3Z7f?= =?us-ascii?Q?pydrwZMAVD8/am3OnfGYPab+Oey2H9TGxRcb73xf?= 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: a8b58692-2f78-4046-1257-08db2b9d7dcc X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Mar 2023 12:52:42.3286 (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: myHokbnntringXcZapEwGeCI3D71VGdtKETe0IH1l5Q1vfU7GTsnaNtT0IX5jhxpCvdfY9TxL8W18f6uvsE4tQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR11MB7645 Return-Path: ray.ni@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable The commit message is very detailed. But the function header comments are not. Can you please update the function header comments to add 4 lines of @retval RETURN_INVALID_PARAMETER, each line describes one invalid case. It's ok to have multiple lines starting with @retval RETURN_INVALID_PARAMET= ER> > + // If (LinearAddress + Length - 1) is not in the same ParentPagingEn= try > with (LinearAddress + Offset), then the remaining child PagingEntry > + // starting from PagingEntryIndex of ParentPagingEntry is all covere= d by > [LinearAddress + Offset, LinearAddress + Length - 1]. > + // > + PagingEntryIndexEnd =3D (BitFieldRead64 (LinearAddress + Length - 1, > BitStart + 9, 63) !=3D BitFieldRead64 (LinearAddress + Offset, BitStart += 9, 63)) ? > 511 : > + (UINTN)BitFieldRead64 (LinearAddress + Length = - 1, BitStart, > BitStart + 9 - 1); > + PagingEntry =3D (IA32_PAGING_ENTRY > *)(UINTN)IA32_PNLE_PAGE_TABLE_BASE_ADDRESS (&ParentPagingEntry- > >Pnle); > + for (Index =3D PagingEntryIndex; Index <=3D PagingEntryIndexEnd; Ind= ex++) { > + if (PagingEntry[Index].Pce.Present =3D=3D 0) { > + // > + // [LinearAddress, LinearAddress + Length] contains non-present = range. > + // > + Status =3D IsAttributesAndMaskValidForNonPresentEntry (Attribute= , > Mask); > + if (RETURN_ERROR (Status)) { > + return Status; > + } > + > + break; Why break out of the loop when meeting a non-present entry?