[edk2-devel] [PATCH 21/23] OvmfPkg: Add PcdUse1GPageTable support for TDX

Min Xu min.m.xu at intel.com
Thu Aug 12 11:57:00 UTC 2021


RFC: https://bugzilla.tianocore.org/show_bug.cgi?id=3429

Intel TDX uses 1G page table. But PcdUse1GPageTable is set to FALSE
by default in OvmfPkgX64.dsc. It gives no chance to support 1G page
table. To support 1G page table in TDX this PCD is set to TRUE in
OvmfPkgX64.dsc.

>From the code in VirtualMemory.c (MdeModulePkg\Core\DxeIplPeim\X64),
even PcdUse1GPageTable is TRUE, Page1GSupport is FALSE until more
checking is done. So setting PcdUse1GPageTable to TRUE is to give a
chance to check if 1G page table is supported.
  Page1GSupport = FALSE;
  if (PcdGetBool(PcdUse1GPageTable)) {
    AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL);
    if (RegEax >= 0x80000001) {
      AsmCpuid (0x80000001, NULL, NULL, NULL, &RegEdx);
      if ((RegEdx & BIT26) != 0) {
        Page1GSupport = TRUE;
      }
    }
  }

Cc: Ard Biesheuvel <ardb+tianocore at kernel.org>
Cc: Jordan Justen <jordan.l.justen at intel.com>
Cc: Brijesh Singh <brijesh.singh at amd.com>
Cc: Erdem Aktas <erdemaktas at google.com>
Cc: James Bottomley <jejb at linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao at intel.com>
Cc: Tom Lendacky <thomas.lendacky at amd.com>
Signed-off-by: Min Xu <min.m.xu at intel.com>
---
 OvmfPkg/OvmfPkgX64.dsc | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc
index b2e07233ebd6..97c923423d3f 100644
--- a/OvmfPkg/OvmfPkgX64.dsc
+++ b/OvmfPkg/OvmfPkgX64.dsc
@@ -576,6 +576,10 @@
   gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode|0x100
   gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData|0x100
 
+  #
+  # TDX need 1G PageTable support
+  gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable|TRUE
+
   #
   # Network Pcds
   #
-- 
2.29.2.windows.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#79177): https://edk2.groups.io/g/devel/message/79177
Mute This Topic: https://groups.io/mt/84837919/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list