Skip to content

Commit

Permalink
OvmfPkg: Delete PcdTdxSharedPageMask
Browse files Browse the repository at this point in the history
PcdTdxSharedPageMask indicates the GPA Width which is defined in OvmfPkg.
But this PCD is used in MdePkg. We can call TdSharedPageMask() to do the
same job as PcdTdxSharedPageMask.
  • Loading branch information
mxu9 committed Apr 6, 2021
1 parent cea81a7 commit 59bf369
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 41 deletions.
3 changes: 0 additions & 3 deletions OvmfPkg/Library/BaseMemEncryptTdxLib/BaseMemEncryptTdxLib.inf
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,3 @@
TdxLib
TdxProbeLib

[Pcd]
gUefiOvmfPkgTokenSpaceGuid.PcdTdxSharedPageMask
gUefiOvmfPkgTokenSpaceGuid.PcdTdxDisableSharedMask
21 changes: 1 addition & 20 deletions OvmfPkg/Library/BaseMemEncryptTdxLib/MemoryEncryption.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ typedef enum {
ClearSharedBit
} TDX_PAGETABLE_MODE;

STATIC BOOLEAN mAddressEncMaskChecked = FALSE;
STATIC UINT64 mAddressEncMask;
STATIC PAGE_TABLE_POOL *mPageTablePool = NULL;

/**
Expand Down Expand Up @@ -63,21 +61,7 @@ GetMemEncryptionAddressMask (
VOID
)
{
if (mAddressEncMaskChecked) {
return mAddressEncMask;
}

mAddressEncMask = PcdGet64(PcdTdxSharedPageMask);

mAddressEncMaskChecked = TRUE;
DEBUG ((
DEBUG_INFO,
"%a:%a: AddressEncMask=0x%Lx\n",
gEfiCallerBaseName,
__FUNCTION__,
mAddressEncMask));

return mAddressEncMask;
return TdSharedPageMask();
}

/**
Expand Down Expand Up @@ -532,9 +516,6 @@ SetOrClearSharedBit(
}

Status = TdVmCall(TDVMCALL_MAPGPA, PhysicalAddress, Length, 0, 0, NULL);
if (PcdGetBool(PcdTdxDisableSharedMask) != TRUE) {
ASSERT(Status == 0);
}

//
// If changing shared to private, must accept-page again
Expand Down
2 changes: 0 additions & 2 deletions OvmfPkg/OvmfPkg.dec
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,6 @@

gUefiOvmfPkgTokenSpaceGuid.PcdOvmfImageSizeInKb|0|UINT32|0x58
gUefiOvmfPkgTokenSpaceGuid.PcdTdxAcceptPageChunkSize|0x2000|UINT64|0x59
gUefiOvmfPkgTokenSpaceGuid.PcdTdxDisableSharedMask|FALSE|BOOLEAN|0x5a
gUefiOvmfPkgTokenSpaceGuid.PcdTdxSetNxForStack|FALSE|BOOLEAN|0x5b
gUefiOvmfPkgTokenSpaceGuid.PcdTdxPteMemoryEncryptionAddressOrMask|0|UINT64|0x5c

Expand Down Expand Up @@ -379,7 +378,6 @@
# This PCD is only accessed if PcdSmmSmramRequire is TRUE (see below).
gUefiOvmfPkgTokenSpaceGuid.PcdQ35SmramAtDefaultSmbase|FALSE|BOOLEAN|0x34

gUefiOvmfPkgTokenSpaceGuid.PcdTdxSharedPageMask|0x0|UINT64|0x101
gUefiOvmfPkgTokenSpaceGuid.PcdTdRelocatedMailboxBase|0|UINT64|0x102

## This PCD records LAML field in TDX EVENTLOG ACPI table.
Expand Down
3 changes: 0 additions & 3 deletions OvmfPkg/OvmfPkgX64.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -603,9 +603,6 @@
#
!if $(TDX_IGNORE_VE_HLT) == TRUE
gUefiOvmfPkgTokenSpaceGuid.PcdIgnoreVeHalt|TRUE
!endif
!if $(TDX_DISABLE_SHARED_MASK) == TRUE
gUefiOvmfPkgTokenSpaceGuid.PcdTdxDisableSharedMask|TRUE
!endif
# 32M
gUefiOvmfPkgTokenSpaceGuid.PcdTdxAcceptPageChunkSize|0x2000000
Expand Down
11 changes: 0 additions & 11 deletions OvmfPkg/TdxDxe/TdxDxe.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ TdxDxeEntryPoint (
EFI_HOB_PLATFORM_INFO *PlatformInfo = NULL;
EFI_HOB_GUID_TYPE *GuidHob;
UINT32 CpuMaxLogicalProcessorNumber;
EFI_HOB_CPU * CpuHob;
TD_RETURN_DATA TdReturnData;

GuidHob = GetFirstGuidHob(&gUefiOvmfPkgTdxPlatformGuid);
Expand Down Expand Up @@ -185,15 +184,5 @@ TdxDxeEntryPoint (
ASSERT_RETURN_ERROR(PcdStatus);
}

if (PcdGetBool(PcdTdxDisableSharedMask) == TRUE) {
PcdStatus = PcdSet64S (PcdTdxSharedPageMask, 0);
ASSERT_RETURN_ERROR(PcdStatus);
} else {
CpuHob = GetFirstHob (EFI_HOB_TYPE_CPU);
ASSERT (CpuHob != NULL);
PcdStatus = PcdSet64S (PcdTdxSharedPageMask, (1ULL << (CpuHob->SizeOfMemorySpace - 1)));
ASSERT_RETURN_ERROR(PcdStatus);
}

return EFI_SUCCESS;
}
2 changes: 0 additions & 2 deletions OvmfPkg/TdxDxe/TdxDxe.inf
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,5 @@
gUefiOvmfPkgTokenSpaceGuid.PcdPciMmio64Size
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId
gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber
gUefiOvmfPkgTokenSpaceGuid.PcdTdxSharedPageMask
gUefiOvmfPkgTokenSpaceGuid.PcdUseTdxEmulation
gUefiOvmfPkgTokenSpaceGuid.PcdTdxDisableSharedMask
gUefiOvmfPkgTokenSpaceGuid.PcdTdRelocatedMailboxBase

0 comments on commit 59bf369

Please sign in to comment.