From nobody Mon Sep 16 19:35:37 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+101746+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+101746+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1679637681; cv=none; d=zohomail.com; s=zohoarc; b=Euv07NnJ8fhay8NtfVgFKdGXhSA1CfdKP7Aw0HwzfO/h5QBc/q4BKQsSm3hlMDib2u0WUhrTE1I6adeS6fJHyUPjXAXnQR8pM+YrvLdEUrLzjyqE9zs/C9MzH/Zp99mH6Wb0xp+dgvallyvUAAPKwu1b+/k0mIkJIIXb53dhVDw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1679637681; 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=WfaISIVnaxF1e6aH0F+BI3FQcVi7J/BvL5CANiMXdLY=; b=kokfv7UavsaklHz8X3KamJSbbZge4M3C4FV4ibZVYUaRVm90uLRQzZEM1+bH459hCAgCy5HFVM9BJvM5heTg+veCPIiJnyQx3zyCB6E9f4zS3kLg0Drtn3vqDIUuRRqYxynmLAIOhwy5TLIGJ3sLiPiRbfOAv6JOBhhKU2suRfQ= 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+101746+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 167963768147750.845971032957436; Thu, 23 Mar 2023 23:01:21 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id Apz1YY1788612xvsv8pBkofu; Thu, 23 Mar 2023 23:01:21 -0700 X-Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mx.groups.io with SMTP id smtpd.web11.94534.1679637641374533517 for ; Thu, 23 Mar 2023 23:01:20 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10658"; a="320094102" X-IronPort-AV: E=Sophos;i="5.98,286,1673942400"; d="scan'208";a="320094102" X-Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2023 23:01:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10658"; a="1012122343" X-IronPort-AV: E=Sophos;i="5.98,286,1673942400"; d="scan'208";a="1012122343" X-Received: from shwdeopenlab702.ccr.corp.intel.com ([10.239.55.92]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2023 23:01:18 -0700 From: "duntan" To: devel@edk2.groups.io Cc: Eric Dong , Ray Ni , Rahul Kumar , Gerd Hoffmann Subject: [edk2-devel] [Patch V5 21/22] UefiCpuPkg/CpuPageTableLib: Add RandomTest for PAE paging Date: Fri, 24 Mar 2023 14:00:19 +0800 Message-Id: <20230324060020.940-22-dun.tan@intel.com> In-Reply-To: <20230324060020.940-1-dun.tan@intel.com> References: <20230324060020.940-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: paECyDULJIFpcHVTwDkST73jx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1679637681; bh=33eALp0PXmcOJ4hR2EtdTZ9Hdvy+rCvxMzaNgtcDSTw=; h=Cc:Date:From:Reply-To:Subject:To; b=YrgAnr2DqLG74iOIb8Rp7zInAvGh2PpH5wcwCiWPoxqAj5crfmDAJMHgZSR8/TFDLXk 2nLA120pyv4MPBoZ2UimmY9reFq3jwLMRhPqP3sOmVmwlTZQZaT1cOZa26ZmvaUygv7Co qHa4jQGbKNcEONO/jkLvCogy50Y3929o4sM= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1679637683436100001 Content-Type: text/plain; charset="utf-8" Add RandomTest for PAE paging. Signed-off-by: Dun Tan Cc: Eric Dong Reviewed-by: Ray Ni Cc: Rahul Kumar Tested-by: Gerd Hoffmann Acked-by: Gerd Hoffmann --- 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 4303095579..d3fb9e2fcb 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 2db49f7de7..f7a77d00e7 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 (#101746): https://edk2.groups.io/g/devel/message/101746 Mute This Topic: https://groups.io/mt/97818244/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-