From: "Min Xu" <min.m.xu@intel.com>
To: devel@edk2.groups.io
Cc: Min Xu <min.m.xu@intel.com>,
Michael D Kinney <michael.d.kinney@intel.com>,
Liming Gao <gaoliming@byosoft.com.cn>,
Zhiguang Liu <zhiguang.liu@intel.com>,
James Bottomley <jejb@linux.ibm.com>,
James Bottomley <James.Bottomley@HansenPartnership.com>,
Jiewen Yao <jiewen.yao@intel.com>,
Gerd Hoffmann <kraxel@redhat.com>,
Brijesh Singh <brijesh.singh@amd.com>,
Erdem Aktas <erdemaktas@google.com>,
Tom Lendacky <thomas.lendacky@amd.com>
Subject: [PATCH V3 4/7] OvmfPkg: Add CcProbeLib
Date: Sun, 17 Apr 2022 11:01:10 +0800 [thread overview]
Message-ID: <9b76a0c7fb98c84f4df2ad904bf3fa516551fa1a.1650163941.git.min.m.xu@intel.com> (raw)
In-Reply-To: <cover.1650163941.git.min.m.xu@intel.com>
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3902
This is the OvmfPkg specific CcProbeLib. It checks the Ovmf WorkArea
(PcdOvmfWorkAreaBase) to return the guest type.
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
---
OvmfPkg/Library/CcProbeLib/CcProbeLib.c | 31 +++++++++++++++++++++++
OvmfPkg/Library/CcProbeLib/CcProbeLib.inf | 25 ++++++++++++++++++
2 files changed, 56 insertions(+)
create mode 100644 OvmfPkg/Library/CcProbeLib/CcProbeLib.c
create mode 100644 OvmfPkg/Library/CcProbeLib/CcProbeLib.inf
diff --git a/OvmfPkg/Library/CcProbeLib/CcProbeLib.c b/OvmfPkg/Library/CcProbeLib/CcProbeLib.c
new file mode 100644
index 000000000000..b4babcb423f7
--- /dev/null
+++ b/OvmfPkg/Library/CcProbeLib/CcProbeLib.c
@@ -0,0 +1,31 @@
+/** @file
+
+ CcProbeLib is used to probe the Confidential computing guest type.
+
+ Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Library/CcProbeLib.h>
+#include <WorkArea.h>
+
+/**
+ Probe the ConfidentialComputing Guest type. See defition of
+ CC_GUEST_TYPE in <ConfidentialComputingGuestAttr.h>.
+
+ @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/CcProbeLib.inf b/OvmfPkg/Library/CcProbeLib/CcProbeLib.inf
new file mode 100644
index 000000000000..5300c9ba2644
--- /dev/null
+++ b/OvmfPkg/Library/CcProbeLib/CcProbeLib.inf
@@ -0,0 +1,25 @@
+## @file
+# CcProbeLib is used to probe Confidential Computing guest type.
+#
+# Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = CcProbeLib
+ FILE_GUID = 05184ec9-abb0-4491-8584-e388639a7c48
+ MODULE_TYPE = BASE
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = CcProbeLib
+
+[Sources]
+ CcProbeLib.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ OvmfPkg/OvmfPkg.dec
+
+[Pcd]
+ gUefiOvmfPkgTokenSpaceGuid.PcdOvmfWorkAreaBase
--
2.29.2.windows.2
next prev parent reply other threads:[~2022-04-17 3:01 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-17 3:01 [PATCH V3 0/7] Introduce CcProbe in MdePkg Min Xu
2022-04-17 3:01 ` [PATCH V3 1/7] MdePkg: Add CC_GUEST_TYPE in ConfidentialComputingGuestAttr.h Min Xu
2022-04-18 13:47 ` Lendacky, Thomas
2022-04-18 14:01 ` Min Xu
2022-04-19 6:48 ` Gerd Hoffmann
2022-04-17 3:01 ` [PATCH V3 2/7] OvmfPkg: Replace GUEST_TYPE with CC_GUEST_TYPE Min Xu
2022-04-17 3:01 ` [PATCH V3 3/7] MdePkg: Add CcProbeLib Min Xu
2022-04-17 3:01 ` Min Xu [this message]
2022-04-17 3:01 ` [PATCH V3 5/7] OvmfPkg: Add CcProbeLib in *.dsc Min Xu
2022-04-18 15:01 ` Lendacky, Thomas
2022-04-17 3:01 ` [PATCH V3 6/7] MdePkg: Probe Cc guest in BaseIoLibIntrinsicSev Min Xu
2022-04-17 3:01 ` [PATCH V3 7/7] OvmfPkg: Call CcProbe in SecMain.c instead of TsIsEnabled Min Xu
2022-04-17 3:22 ` [PATCH V3 0/7] Introduce CcProbe in MdePkg Yao, Jiewen
2022-04-17 3:30 ` 回复: " gaoliming
2022-04-18 15:27 ` Lendacky, Thomas
2022-04-18 23:49 ` [edk2-devel] " Min Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9b76a0c7fb98c84f4df2ad904bf3fa516551fa1a.1650163941.git.min.m.xu@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox