From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web11.72432.1679578832727362541 for ; Thu, 23 Mar 2023 06:40:32 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=bbqvodSJ; spf=pass (domain: intel.com, ip: 192.55.52.93, 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=1679578832; x=1711114832; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=2Ag1SWCHrFfJLwN1NFQJrMV5m+z2ZzJRKu7KpYfYn0s=; b=bbqvodSJMzGmu98C5eyveAbVv40BLpDbxNfKjhQ7N1yT+WlQXpnGZ+je bh2s5kS+IyiRe3ey1HnWqwERrn0D6BU3BJFaN5N+4S30ovFmf++YrkvQt OW7mXkL6cr0RX1BArrYdvPwKHrriWudeUWDzT3FAuKSTH49kgX8ewy7Pb lNOyrFi51l1Oya8gTewsMJ7aBtkNEJ6YtrdE4YxoxsAvMCMy1gf8+8iCL r3XfgUVkiZVp2EdW3BwyVxUdGKw0XeI8EO2XaL1R3d0BS2gglxWFKj3JX oPHko2gGdR8xDhGb3Qhp+VUZF8GpOSAlaeQTYMdNmqSOnttDKUW2bkO33 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="336995840" X-IronPort-AV: E=Sophos;i="5.98,285,1673942400"; d="scan'208";a="336995840" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2023 06:40:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="712658827" X-IronPort-AV: E=Sophos;i="5.98,285,1673942400"; d="scan'208";a="712658827" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orsmga008.jf.intel.com with ESMTP; 23 Mar 2023 06:40:31 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) 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.21; Thu, 23 Mar 2023 06:40:31 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX610.amr.corp.intel.com (10.22.229.23) 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 06:40:31 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx610.amr.corp.intel.com (10.22.229.23) 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 06:40:31 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.48) by edgegateway.intel.com (134.134.137.103) 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 06:40:31 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cUK0GJyBgQesXW+8xh60jkieKu/gQo0OQoq4k9Y4e0zkpbjEaHlIhIve9yDOW+czQG1YoGfCre+7IvEVAMoyCPHJ3gZwbyDs+o8yh7YkV/otKqWxZHr97NuyDBMpWy7YUSX6u++jW/QBHiurW1FeJzEdtpzDhWl81Sa47iuEs7i5cnJy+E9jGYdVuS5vrmpkIXwgOTuxxeeXog3LpG/N+ZFenDvYuWqxXrD1Yun0pnfKV+d8ggRCuD3xrC1CvYbBkk4cXdgoh0URr79lpgEG5KAa8L2G/FjDkxvhGsXu6TMU6p3chSXYNXbMrmloJ7ZHWZlXHxgWPUtL7D8ViQnD7w== 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=CMaL3JZMzhDmWQ5XuyTx8iIiBW0ZyzGk5OvNg5Iv8Fo=; b=aH4j6KGQETdxoEp51c2AoHqHDVOEG8/ydMIV1iGEzfhGsIaw923MPxyejEQCC2tQDW4NcrTA/PR20+++KvyTWvdbBtTHMeAq9zfDPYVnBQotcOzzPU2ckz0bIV0aYaGxTbSCztoC3N5dJVtwKIiMHJo53+uFPAS3Jo27azoGrHBJ3Qishop27USj0mfQtcx3KoIEMWhjitVnVMTfnVqaRn+mX+xSu3s9yFJGFvMUl+3uVl0sI5Anf7stZxK5DMcZXrdTx7PQGV3u0iV+BCU3ftRWdiAT/qmx01fBmBJfQGzw1ovS3N8XQ2RgUIeYEE6J0mJZJ9gKtYB1WLo/3IWEog== 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 SA1PR11MB8328.namprd11.prod.outlook.com (2603:10b6:806:376::13) 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 13:40:23 +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 13:40:23 +0000 From: "Ni, Ray" To: "Tan, Dun" , "devel@edk2.groups.io" CC: "Dong, Eric" , "Kumar, Rahul R" , Gerd Hoffmann Subject: Re: [Patch V4 20/21] UefiCpuPkg/CpuPageTableLib: Add RandomTest for PAE paging Thread-Topic: [Patch V4 20/21] UefiCpuPkg/CpuPageTableLib: Add RandomTest for PAE paging Thread-Index: AQHZXVr3HFZVPmBMLkCyyyd2S5wKQq8IX0bw Date: Thu, 23 Mar 2023 13:40:23 +0000 Message-ID: References: <20230323074057.549-1-dun.tan@intel.com> <20230323074057.549-21-dun.tan@intel.com> In-Reply-To: <20230323074057.549-21-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_|SA1PR11MB8328:EE_ x-ms-office365-filtering-correlation-id: 964f7c5b-356d-46a7-6ab1-08db2ba426f5 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: dBA78JJsJAc/3ynHSzGeNW5e3HYIpdIRGjnjXZ2RAKdppXM0tKJFXXzMvaFuqcMzS/Buc+qDOdUwYSA5hbQDalpIvkSDlLnv/sP/ffW/DvnG7vu22OdBC1VEXkKIgl8c7s9RMSd+9muDamr+BLPAs3zdzyz9+hjU2CtyXlmBPg78dltGDcglTTbnTsFt/ckPB23E15j9ql8Ob1c4RXv+hljXacAs51EEdk4Sq8zPcP6NEUoXxzpF06CRUyxWC4DppFiT6kFl3XeJLdDl2p0RPuXP91r3y7PIvZgKynGAZiLPMdVm0QL64wUuCyw7GEh+vMy5ylFvEadz5K1zj+1jr9tWwWth5micRkqr5td7WcwcKGKEN+rQ6gcnH+83t6NVq6CAp+LAiybob6Vi+bjL3W5MCvfZXS5038azaskuyGqXYW4gcKA7anpIpQkc3xL4Gz4nNyqvOxO/18ZdYUE1yo+fUPWttEiDkyaiT6oLtrljCDMSh2lA/syRBK8nKquCbFjO30VEoz4rgZBIkcPbKGJ+Vfvge4toisPI7wvz+OrCLvbdu0AI8ONEWh6pEONtMw+Oie0CpzoWnZ7OnHpD+dpv6QOBFC2y4gV02rtlsDp9TNvfnBjeu3NrSwlaESLYavO9vP9sfnY4ZeEh3RHpnLU10EtCWKnHld338YsAm/tDKdYPPCRZZbzhEXXqqqqPBKai7rCAjwCofUxIUbTm/A== 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)(376002)(366004)(39860400002)(396003)(136003)(346002)(451199018)(53546011)(6506007)(33656002)(38070700005)(82960400001)(83380400001)(55016003)(38100700002)(9686003)(186003)(26005)(122000001)(8936002)(54906003)(41300700001)(52536014)(5660300002)(478600001)(86362001)(110136005)(8676002)(66476007)(66446008)(64756008)(4326008)(66556008)(66946007)(76116006)(19627235002)(316002)(7696005)(2906002)(71200400001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?A86v4cI6qCkWLMBX/0+2D03kFGVMAQ28b4kNDhkJ14m0Y6csUf488QJexGYK?= =?us-ascii?Q?qYLnaL6xoz9o30KfPNclO3I5SDgCmwvfDSpYVE6yfy6D23YQ5FsYdXkFCgMi?= =?us-ascii?Q?JdCzuvyuivXdiN4lMPb2PBw4p6/dOH1LJ0wRB/le7Xv9Nm8tBzikTmpqaBGw?= =?us-ascii?Q?fTpHC0SU7gEvDGz17HgQE17FGo9yHZ/TYADwGWurw77ImeNq88FlhwrkFWU5?= =?us-ascii?Q?Nic0cFfQz+5p885H4z5iOzzeEmcj3QXLtXeX4oyFg2ZcFzs/a8KAIqLi1pQf?= =?us-ascii?Q?8G1D/ZUvYmodndpa5FCGqV6ccf8IfdWkg4mNNxpMhBoy4u3ntIin+tVqIHyp?= =?us-ascii?Q?cPHnNIX+hSpv6wkHsjprlR27BK447luZvXDwcRbGCvnhjNFei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DWM4j3c/ne3wDemIhJbf4MiSI9jLrF69CVgczDefKmwS6hN?= =?us-ascii?Q?GqKzVApy+VRoZVLYkS2EUqC1MK54MKnwUYSo6B29lnB33RWNNi6YR7P8/Nfk?= =?us-ascii?Q?yZER6IFTk92TYEzCkkwjyRVl2l4OVyEjRjPWITIDQIzSPuwJW74yqkk/ozed?= =?us-ascii?Q?Ru2LBAKauJUTE7wlHJkVK6kxtzCCoj8x/5jhKpEpQxtalZvStzUYNqxUEzaO?= =?us-ascii?Q?d0ccvCj5oExXMBgADNGAayVnzN/e2oxtCJsdB2tyk5rqLFh+5Zabc1bfqVB3?= =?us-ascii?Q?qxB5JpOR2Wtn/qXEplYt4WS3aSPJvQqwq5cGLSfJ?= 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: 964f7c5b-356d-46a7-6ab1-08db2ba426f5 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Mar 2023 13:40:23.0993 (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: Jf+klSOfROCNsqQeOtBYiLx3/5tQIqXWiHhDOgaUQPVSAsqMj7atAx8zF1/LoKhejfYH5eoqY2LtT/5+DJ4iKA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR11MB8328 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 Reviewed-by: Ray Ni > -----Original Message----- > From: Tan, Dun > Sent: Thursday, March 23, 2023 3:41 PM > To: devel@edk2.groups.io > Cc: Dong, Eric ; Ni, Ray ; Kumar, > Rahul R ; Gerd Hoffmann > Subject: [Patch V4 20/21] UefiCpuPkg/CpuPageTableLib: Add RandomTest > for PAE paging >=20 > Add RandomTest for PAE paging. >=20 > Signed-off-by: Dun Tan > Cc: Eric Dong > Cc: Ray Ni > Cc: Rahul Kumar > Cc: Gerd Hoffmann > --- >=20 > UefiCpuPkg/Library/CpuPageTableLib/UnitTest/CpuPageTableLibUnitTestHo > st.c | 2 ++ > UefiCpuPkg/Library/CpuPageTableLib/UnitTest/RandomTest.c = | 3 > +-- > UefiCpuPkg/Library/CpuPageTableLib/UnitTest/TestHelper.c = | 12 > ++++++++---- > 3 files changed, 11 insertions(+), 6 deletions(-) >=20 > diff --git > a/UefiCpuPkg/Library/CpuPageTableLib/UnitTest/CpuPageTableLibUnitTest > Host.c > b/UefiCpuPkg/Library/CpuPageTableLib/UnitTest/CpuPageTableLibUnitTest > Host.c > index e1efc84c82..8554eefa39 100644 > --- > a/UefiCpuPkg/Library/CpuPageTableLib/UnitTest/CpuPageTableLibUnitTest > Host.c > +++ > b/UefiCpuPkg/Library/CpuPageTableLib/UnitTest/CpuPageTableLibUnitTest > Host.c > @@ -9,6 +9,7 @@ > #include "CpuPageTableLibUnitTest.h" >=20 > // ---------------------------------------------------------------------= -- PageMode-- > TestCount-TestRangeCount---RandomOptions > +static CPU_PAGE_TABLE_LIB_RANDOM_TEST_CONTEXT > mTestContextPagingPae =3D { PagingPae, 100, 20, USE_RANDOM_ARRAY }; > static CPU_PAGE_TABLE_LIB_RANDOM_TEST_CONTEXT > mTestContextPaging4Level =3D { Paging4Level, 100, 20, > USE_RANDOM_ARRAY }; > static CPU_PAGE_TABLE_LIB_RANDOM_TEST_CONTEXT > mTestContextPaging4Level1GB =3D { Paging4Level1GB, 100, 20, > USE_RANDOM_ARRAY }; > static CPU_PAGE_TABLE_LIB_RANDOM_TEST_CONTEXT > mTestContextPaging5Level =3D { Paging5Level, 100, 20, > USE_RANDOM_ARRAY }; > @@ -880,6 +881,7 @@ UefiTestMain ( > goto EXIT; > } >=20 > + AddTestCase (RandomTestCase, "Random Test for PagingPae", "Random > Test Case1", TestCaseforRandomTest, NULL, NULL, > &mTestContextPagingPae); > AddTestCase (RandomTestCase, "Random Test for Paging4Level", "Random > Test Case1", TestCaseforRandomTest, NULL, NULL, > &mTestContextPaging4Level); > AddTestCase (RandomTestCase, "Random Test for Paging4Level1G", > "Random Test Case2", TestCaseforRandomTest, NULL, NULL, > &mTestContextPaging4Level1GB); > AddTestCase (RandomTestCase, "Random Test for Paging5Level", "Random > Test Case3", TestCaseforRandomTest, NULL, NULL, > &mTestContextPaging5Level); > diff --git a/UefiCpuPkg/Library/CpuPageTableLib/UnitTest/RandomTest.c > b/UefiCpuPkg/Library/CpuPageTableLib/UnitTest/RandomTest.c > index 18a5010c30..7e79b01823 100644 > --- a/UefiCpuPkg/Library/CpuPageTableLib/UnitTest/RandomTest.c > +++ b/UefiCpuPkg/Library/CpuPageTableLib/UnitTest/RandomTest.c > @@ -258,10 +258,9 @@ ValidateAndRandomeModifyPageTable ( > UNIT_TEST_STATUS Status; > IA32_PAGING_ENTRY *PagingEntry; >=20 > - if ((PagingMode =3D=3D Paging32bit) || (PagingMode =3D=3D PagingPae) |= | > (PagingMode >=3D PagingModeMax)) { > + if ((PagingMode =3D=3D Paging32bit) || (PagingMode >=3D PagingModeMax)= ) { > // > // 32bit paging is never supported. > - // PAE paging will be supported later. > // > return UNIT_TEST_ERROR_TEST_FAILED; > } > diff --git a/UefiCpuPkg/Library/CpuPageTableLib/UnitTest/TestHelper.c > b/UefiCpuPkg/Library/CpuPageTableLib/UnitTest/TestHelper.c > index 22f179c21f..67776255c2 100644 > --- a/UefiCpuPkg/Library/CpuPageTableLib/UnitTest/TestHelper.c > +++ b/UefiCpuPkg/Library/CpuPageTableLib/UnitTest/TestHelper.c > @@ -175,10 +175,9 @@ IsPageTableValid ( > return UNIT_TEST_PASSED; > } >=20 > - if ((PagingMode =3D=3D Paging32bit) || (PagingMode =3D=3D PagingPae) |= | > (PagingMode >=3D PagingModeMax)) { > + if ((PagingMode =3D=3D Paging32bit) || (PagingMode >=3D PagingModeMax)= ) { > // > // 32bit paging is never supported. > - // PAE paging will be supported later. > // > return UNIT_TEST_ERROR_TEST_FAILED; > } > @@ -187,7 +186,12 @@ IsPageTableValid ( > MaxLevel =3D (UINT8)(PagingMode >> 8); >=20 > PagingEntry =3D (IA32_PAGING_ENTRY *)(UINTN)PageTable; > - for (Index =3D 0; Index < 512; Index++) { > + for (Index =3D 0; Index < ((PagingMode =3D=3D PagingPae) ? 4 : 512); I= ndex++) { > + if (PagingMode =3D=3D PagingPae) { > + UT_ASSERT_EQUAL (PagingEntry[Index].PdptePae.Bits.MustBeZero, 0); > + UT_ASSERT_EQUAL (PagingEntry[Index].PdptePae.Bits.MustBeZero2, 0); > + } > + > Status =3D IsPageTableEntryValid (&PagingEntry[Index], MaxLevel, > MaxLeafLevel, Index << (9 * MaxLevel + 3)); > if (Status !=3D UNIT_TEST_PASSED) { > return Status; > @@ -264,7 +268,7 @@ GetEntryFromPageTable ( > UINT64 Index; > IA32_PAGING_ENTRY *PagingEntry; >=20 > - if ((PagingMode =3D=3D Paging32bit) || (PagingMode =3D=3D PagingPae) |= | > (PagingMode >=3D PagingModeMax)) { > + if ((PagingMode =3D=3D Paging32bit) || (PagingMode >=3D PagingModeMax)= ) { > // > // 32bit paging is never supported. > // PAE paging will be supported later. > -- > 2.31.1.windows.1