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.web09.6263.1661821454207048478 for ; Mon, 29 Aug 2022 18:04:14 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=MmQJkBlq; spf=permerror, err=too many SPF records (domain: intel.com, ip: 192.55.52.136, mailfrom: min.m.xu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661821454; x=1693357454; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/YW0VcSS62qG2DJnMvGaBsTfwkr/ZVFDLDqawAYuI1s=; b=MmQJkBlqK7T5zl7njYahGIJ96A/ifsN4d98sAY2RYebgRRpVwN6KCpMU l0I4XH+N+sELGOOZ3IV1P0H1DMs0cZPQPE4MBWJDBjqMOPRiDHT8pYVGo xFVGRw1rUEh2K1rGZbY1xhM8XTF7F7hnsiF/nkzISmGN7lPai/k6sOo7p vsS97TB+Yj1cUyP4Hs/FkySi51GNNSanoiT98bLJV95o2ALlCjIz96qhn h8iQwr3Q96eL0PVH7Ar8w1+9Bytut49gVg4iv3HINVbIDq3U0qjq3v6Lz npEnGePR4Pb/YSkGn+kQvfF0W4q7nLacH9yEyW65ZYyhXR7AewPsOcASE Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10454"; a="274794053" X-IronPort-AV: E=Sophos;i="5.93,274,1654585200"; d="scan'208";a="274794053" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2022 18:03:55 -0700 X-IronPort-AV: E=Sophos;i="5.93,273,1654585200"; d="scan'208";a="672612255" Received: from mxu9-mobl1.ccr.corp.intel.com ([10.238.4.200]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2022 18:03:53 -0700 From: "Min Xu" To: devel@edk2.groups.io Cc: Min M Xu , Erdem Aktas , James Bottomley , Jiewen Yao , Gerd Hoffmann , Tom Lendacky Subject: [PATCH V5 1/2] OvmfPkg: Add SecPeiCcProbeLib Date: Tue, 30 Aug 2022 09:03:39 +0800 Message-Id: <8864b7692e80f47f9f00db7b252113ac9a87c8c1.1661817901.git.min.m.xu@intel.com> X-Mailer: git-send-email 2.29.2.windows.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Min M Xu BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3974 SecPeiCcProbeLib is designed to probe the Confidential Computing guest type in SEC/PEI phase. The CC guest type was set by each CC guest at the beginning of boot up and saved in PcdOvmfWorkArea. Cc: Erdem Aktas Cc: James Bottomley Cc: Jiewen Yao Cc: Gerd Hoffmann Cc: Tom Lendacky Acked-by: Gerd Hoffmann Signed-off-by: Min Xu --- OvmfPkg/Library/CcProbeLib/SecPeiCcProbeLib.c | 31 +++++++++++++++++++ .../Library/CcProbeLib/SecPeiCcProbeLib.inf | 25 +++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 OvmfPkg/Library/CcProbeLib/SecPeiCcProbeLib.c create mode 100644 OvmfPkg/Library/CcProbeLib/SecPeiCcProbeLib.inf diff --git a/OvmfPkg/Library/CcProbeLib/SecPeiCcProbeLib.c b/OvmfPkg/Library/CcProbeLib/SecPeiCcProbeLib.c new file mode 100644 index 000000000000..d698e5c8d7f8 --- /dev/null +++ b/OvmfPkg/Library/CcProbeLib/SecPeiCcProbeLib.c @@ -0,0 +1,31 @@ +/** @file + + CcProbeLib is used to probe the Confidential computing guest type. + + Copyright (c) 2022, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include + +/** + Probe the ConfidentialComputing Guest type. See defition of + CC_GUEST_TYPE in . + + @return The guest type + +**/ +UINT8 +EFIAPI +CcProbe ( + VOID + ) +{ + OVMF_WORK_AREA *WorkArea; + + WorkArea = (OVMF_WORK_AREA *)FixedPcdGet32 (PcdOvmfWorkAreaBase); + + return WorkArea != NULL ? WorkArea->Header.GuestType : CcGuestTypeNonEncrypted; +} diff --git a/OvmfPkg/Library/CcProbeLib/SecPeiCcProbeLib.inf b/OvmfPkg/Library/CcProbeLib/SecPeiCcProbeLib.inf new file mode 100644 index 000000000000..f63ed71e7c28 --- /dev/null +++ b/OvmfPkg/Library/CcProbeLib/SecPeiCcProbeLib.inf @@ -0,0 +1,25 @@ +## @file +# CcProbeLib is used to probe Confidential Computing guest type. +# +# Copyright (c) 2022, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = SecPeiCcProbeLib + FILE_GUID = 78eb7f2a-a42a-4b01-b160-5a05a0a52bac + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = CcProbeLib|SEC PEIM PEI_CORE + +[Sources] + SecPeiCcProbeLib.c + +[Packages] + MdePkg/MdePkg.dec + OvmfPkg/OvmfPkg.dec + +[Pcd] + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfWorkAreaBase -- 2.29.2.windows.2