From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web08.25742.1639489321528370744 for ; Tue, 14 Dec 2021 05:42:07 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.com header.s=intel header.b=OvJsJbdi; spf=pass (domain: intel.com, ip: 192.55.52.136, mailfrom: min.m.xu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1639489326; x=1671025326; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=p17TJSAL5OasVK7dHRZSBdSL2Uo9m31aV523yqFvNio=; b=OvJsJbdi5YxyJAxG6lw03YxuP/XQepMUBc7vwVBJZzZuNcnGVJLio3vJ d89SPHL7MytZhK+sGwSOP13pLaBrfwpfm4yniNFzafCYilUPBFbEikYGQ VeoVr+qHEpFwAacj0jqGKHLzjM7peGeZ0DtQhyk5A5SNy+FblP8MXcFPT JMPkyFH5+ToWMq0twHNrwEaXP4eH9Txt3KeVffn+XqwRYQbApZrikR4Mm l5Pkq4t7BgoWGb4E30UNnQ3tYHo683chXe/AAPoK/9UoEwzqbGVZTVmRV GZIXMZPC/s3nrbPmEnUh7Z5Psr923aNDckZO8l3+j/vTDGP/KE8xDiChs Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10197"; a="218993667" X-IronPort-AV: E=Sophos;i="5.88,205,1635231600"; d="scan'208";a="218993667" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Dec 2021 05:42:05 -0800 X-IronPort-AV: E=Sophos;i="5.88,205,1635231600"; d="scan'208";a="465094234" Received: from mxu9-mobl1.ccr.corp.intel.com ([10.255.30.115]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Dec 2021 05:42:03 -0800 From: "Min Xu" To: devel@edk2.groups.io Cc: Min Xu , Michael D Kinney , Brijesh Singh , Erdem Aktas , James Bottomley , Jiewen Yao , Tom Lendacky , Gerd Hoffmann Subject: [PATCH 07/10] OvmfPkg: Update TdxDxe to set TDX PCDs Date: Tue, 14 Dec 2021 21:41:23 +0800 Message-Id: <20211214134126.869-8-min.m.xu@intel.com> X-Mailer: git-send-email 2.29.2.windows.2 In-Reply-To: <20211214134126.869-1-min.m.xu@intel.com> References: <20211214134126.869-1-min.m.xu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit RFC: https://bugzilla.tianocore.org/show_bug.cgi?id=3429 These PCDs are set in PEI phase in Config-A. But in Config-B PEI phase is skipped. So they're set here. Cc: Michael D Kinney Cc: Brijesh Singh Cc: Erdem Aktas Cc: James Bottomley Cc: Jiewen Yao Cc: Tom Lendacky Cc: Gerd Hoffmann Signed-off-by: Min Xu --- OvmfPkg/Include/Library/TdxPlatformLib.h | 4 ++-- OvmfPkg/TdxDxe/TdxDxe.c | 12 ++++++++++++ OvmfPkg/TdxDxe/TdxDxe.inf | 3 +++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/OvmfPkg/Include/Library/TdxPlatformLib.h b/OvmfPkg/Include/Library/TdxPlatformLib.h index a6118a0edd98..5463a6d7e55e 100644 --- a/OvmfPkg/Include/Library/TdxPlatformLib.h +++ b/OvmfPkg/Include/Library/TdxPlatformLib.h @@ -16,8 +16,8 @@ #include #include -#define FW_CFG_NX_STACK_ITEM "opt/ovmf/PcdSetNxForStack" -#define FW_CFG_SYSTEM_STATE_ITEM "etc/system-states" +#define FW_CFG_NX_STACK_ITEM "opt/ovmf/PcdSetNxForStack" +#define FW_CFG_SYSTEM_STATE_ITEM "etc/system-states" /** * Perform Platform initialization. diff --git a/OvmfPkg/TdxDxe/TdxDxe.c b/OvmfPkg/TdxDxe/TdxDxe.c index 36ef5c510771..63b069adefd3 100644 --- a/OvmfPkg/TdxDxe/TdxDxe.c +++ b/OvmfPkg/TdxDxe/TdxDxe.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -181,6 +182,17 @@ TdxDxeEntryPoint ( SetMmioSharedBit (); + #ifdef INTEL_TDX_FULL_FEATURE + PcdStatus = PcdSet64S (PcdConfidentialComputingGuestAttr, CCAttrIntelTdx); + ASSERT_RETURN_ERROR (PcdStatus); + + PcdStatus = PcdSetBoolS (PcdIa32EferChangeAllowed, FALSE); + ASSERT_RETURN_ERROR (PcdStatus); + + PcdStatus = PcdSet64S (PcdTdxSharedBitMask, TdSharedPageMask ()); + ASSERT_RETURN_ERROR (PcdStatus); + #endif + PlatformInfo = (EFI_HOB_PLATFORM_INFO *)GET_GUID_HOB_DATA (GuidHob); // diff --git a/OvmfPkg/TdxDxe/TdxDxe.inf b/OvmfPkg/TdxDxe/TdxDxe.inf index 077769bcf70c..b6335d86edbe 100644 --- a/OvmfPkg/TdxDxe/TdxDxe.inf +++ b/OvmfPkg/TdxDxe/TdxDxe.inf @@ -62,3 +62,6 @@ gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber gUefiCpuPkgTokenSpaceGuid.PcdCpuLocalApicBaseAddress gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFdBaseAddress + gEfiMdeModulePkgTokenSpaceGuid.PcdIa32EferChangeAllowed + gEfiMdePkgTokenSpaceGuid.PcdConfidentialComputingGuestAttr + gEfiMdeModulePkgTokenSpaceGuid.PcdTdxSharedBitMask -- 2.29.2.windows.2