From nobody Mon Sep 16 19:49:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+101648+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+101648+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1679557322; cv=none; d=zohomail.com; s=zohoarc; b=aiHvLhVbZrmJyw0QsZqF1OkQcV9IyStKZQQpperDLUlgQbp54+PTIQuOXxyMTELcqL5VSAZnnp+AzkmrUwepQbefIwfJ4b0m7wOYIWov+GxJiPJ7TUMCVmIAsHdkCgP5OsY+EceA7hU//xqWdpx4F/dNhPgPmTJb12NZpeuMib0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1679557322; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=Tll1J4N2CLZemHfwV1RJc/kDT+rWE7QeCdG5i83Sobs=; b=fdKCxUSdD/48nEIJF9eFbi8E7VRJSfWkCVJ6yFplO5fHxX28iKlIc1002ZV8md4IJmrnpjQNteGzlslLzPwQ37vaRBeG9lPbilSukAsxKxVr1zO4ot/RkOigVyObWJOKrAPVpZcHq+RGI/KPNFUsRHyRhJkiq783lWuycqPeKrM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+101648+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1679557322898456.59558065176054; Thu, 23 Mar 2023 00:42:02 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id UjiNYY1788612xaMnw5JbRXe; Thu, 23 Mar 2023 00:42:01 -0700 X-Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web11.66779.1679557305298569223 for ; Thu, 23 Mar 2023 00:42:01 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="425699901" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="425699901" X-Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2023 00:42:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10657"; a="684616906" X-IronPort-AV: E=Sophos;i="5.98,283,1673942400"; d="scan'208";a="684616906" X-Received: from shwdeopenlab702.ccr.corp.intel.com ([10.239.55.92]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2023 00:41:59 -0700 From: "duntan" To: devel@edk2.groups.io Cc: Eric Dong , Ray Ni , Rahul Kumar , Gerd Hoffmann Subject: [edk2-devel] [Patch V4 20/21] UefiCpuPkg/CpuPageTableLib: Add RandomTest for PAE paging Date: Thu, 23 Mar 2023 15:40:56 +0800 Message-Id: <20230323074057.549-21-dun.tan@intel.com> In-Reply-To: <20230323074057.549-1-dun.tan@intel.com> References: <20230323074057.549-1-dun.tan@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,dun.tan@intel.com X-Gm-Message-State: 8R2OdEQztpgtnHkrFa1HQB77x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1679557321; bh=wxaNzZ5hGZx60kLbg6HF4QxNUWTAnzTpV2NIQPzpHao=; h=Cc:Date:From:Reply-To:Subject:To; b=qMYYrJM+43wK+TgZkoZipKN7H5KUqnQxzT32C1R+ugJveluyb/S+RA/FI+eeHu53BIq AYTDqAkTTmhcK5wFt/vQPwsoDgqZ/rj2Xy8cWx82buysCoI57cZYr3r9kJ8ilP3J47TfR px+ZRWrn7b92H71ZnGBJoOoRetdSlujmP78= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1679557325763100009 Content-Type: text/plain; charset="utf-8" Add RandomTest for PAE paging. Signed-off-by: Dun Tan Cc: Eric Dong Cc: Ray Ni Cc: Rahul Kumar Cc: Gerd Hoffmann Reviewed-by: Ray Ni --- UefiCpuPkg/Library/CpuPageTableLib/UnitTest/CpuPageTableLibUnitTestHost.c = | 2 ++ UefiCpuPkg/Library/CpuPageTableLib/UnitTest/RandomTest.c = | 3 +-- UefiCpuPkg/Library/CpuPageTableLib/UnitTest/TestHelper.c = | 12 ++++++++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/UefiCpuPkg/Library/CpuPageTableLib/UnitTest/CpuPageTableLibUni= tTestHost.c b/UefiCpuPkg/Library/CpuPageTableLib/UnitTest/CpuPageTableLibUn= itTestHost.c index e1efc84c82..8554eefa39 100644 --- a/UefiCpuPkg/Library/CpuPageTableLib/UnitTest/CpuPageTableLibUnitTestHo= st.c +++ b/UefiCpuPkg/Library/CpuPageTableLib/UnitTest/CpuPageTableLibUnitTestHo= st.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 C= ase1", TestCaseforRandomTest, NULL, NULL, &mTestContextPagingPae); AddTestCase (RandomTestCase, "Random Test for Paging4Level", "Random Tes= t Case1", TestCaseforRandomTest, NULL, NULL, &mTestContextPaging4Level); AddTestCase (RandomTestCase, "Random Test for Paging4Level1G", "Random T= est Case2", TestCaseforRandomTest, NULL, NULL, &mTestContextPaging4Level1GB= ); AddTestCase (RandomTestCase, "Random Test for Paging5Level", "Random Tes= t Case3", TestCaseforRandomTest, NULL, NULL, &mTestContextPaging5Level); diff --git a/UefiCpuPkg/Library/CpuPageTableLib/UnitTest/RandomTest.c b/Uef= iCpuPkg/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/Uef= iCpuPkg/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); Ind= ex++) { + 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, MaxLe= afLevel, 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. --=20 2.31.1.windows.1 -=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 (#101648): https://edk2.groups.io/g/devel/message/101648 Mute This Topic: https://groups.io/mt/97796399/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-