OvmfPkg: Update PlatformPei to support Tdx guest
RFC: https://bugzilla.tianocore.org/show_bug.cgi?id=3429 OvmfPkg/PlatformPei is updated to support Tdx guest. There are below major changes. - Set Tdx related PCDs - Publish Tdx RamRegions In this patch there is another new function BuildPlatformInfoHob (). This function builds EFI_HOB_PLATFORM_INFO which contains the HostBridgeDevId. The hob is built in both Td guest and Non-Td guest. Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Brijesh Singh <brijesh.singh@amd.com> Cc: Erdem Aktas <erdemaktas@google.com> Cc: James Bottomley <jejb@linux.ibm.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Tom Lendacky <thomas.lendacky@amd.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> Signed-off-by: Min Xu <min.m.xu@intel.com>
This commit is contained in:
51
OvmfPkg/PlatformPei/IntelTdx.c
Normal file
51
OvmfPkg/PlatformPei/IntelTdx.c
Normal file
@@ -0,0 +1,51 @@
|
||||
/** @file
|
||||
Initialize Intel TDX support.
|
||||
|
||||
Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#include <PiPei.h>
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/HobLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <IndustryStandard/Tdx.h>
|
||||
#include <IndustryStandard/QemuFwCfg.h>
|
||||
#include <Library/QemuFwCfgLib.h>
|
||||
#include <Library/PeiServicesLib.h>
|
||||
#include <Library/TdxLib.h>
|
||||
#include <Library/PlatformInitLib.h>
|
||||
#include <WorkArea.h>
|
||||
#include <ConfidentialComputingGuestAttr.h>
|
||||
#include "Platform.h"
|
||||
|
||||
/**
|
||||
This Function checks if TDX is available, if present then it sets
|
||||
the dynamic PCDs for Tdx guest.
|
||||
**/
|
||||
VOID
|
||||
IntelTdxInitialize (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
#ifdef MDE_CPU_X64
|
||||
RETURN_STATUS PcdStatus;
|
||||
|
||||
if (!TdIsEnabled ()) {
|
||||
return;
|
||||
}
|
||||
|
||||
PcdStatus = PcdSet64S (PcdConfidentialComputingGuestAttr, CCAttrIntelTdx);
|
||||
ASSERT_RETURN_ERROR (PcdStatus);
|
||||
|
||||
PcdStatus = PcdSet64S (PcdTdxSharedBitMask, TdSharedPageMask ());
|
||||
ASSERT_RETURN_ERROR (PcdStatus);
|
||||
|
||||
PcdStatus = PcdSetBoolS (PcdSetNxForStack, TRUE);
|
||||
ASSERT_RETURN_ERROR (PcdStatus);
|
||||
#endif
|
||||
}
|
Reference in New Issue
Block a user