From nobody Thu May 16 07:46:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+88970+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+88970+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1650164500; cv=none; d=zohomail.com; s=zohoarc; b=gtw9hDXqcxA+UVxlJU6e/9ekHIFdo8gh58MCVSlBh9I1hi98g27HF2abXR6z+cxG5At9Gv2FNCOoJi+PKZFPJTEqEVJx4yVSrnGB2aPDCZIjX/Wu6xWukRWTU28kvFwNmpz7xC1m25z0NmaV2BCY8VlB9LpGohRFkoDu03QxkbU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650164500; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=PPCaUW1Ffjk53AWE9JDmniu1gE6GynTP+OuuGxZGyiM=; b=BBjQ3vHeI0R0mJ8gzlmnQumyOVtwi5K2o1yWFYaI1bOZ/vKujvu8F7fTpjHoRRwrEp2XwPayqJZFAhzU8lQJPK6xHgAweklzKlrV4wrrlBb794hVLPvtLz6Go0XPIqfGNoIot28HmYuJvsnc0Th0K9x22DZn3W583NjwTM/dPMc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+88970+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1650164500700174.78195443516063; Sat, 16 Apr 2022 20:01:40 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id oavSYY1788612xUi3sNCyvq1; Sat, 16 Apr 2022 20:01:40 -0700 X-Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web11.25369.1650164497717213024 for ; Sat, 16 Apr 2022 20:01:38 -0700 X-IronPort-AV: E=McAfee;i="6400,9594,10318"; a="349806183" X-IronPort-AV: E=Sophos;i="5.90,266,1643702400"; d="scan'208";a="349806183" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2022 20:01:37 -0700 X-IronPort-AV: E=Sophos;i="5.90,266,1643702400"; d="scan'208";a="575044266" X-Received: from mxu9-mobl1.ccr.corp.intel.com ([10.255.29.191]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2022 20:01:34 -0700 From: "Min Xu" To: devel@edk2.groups.io Cc: Min Xu , Michael D Kinney , Liming Gao , Zhiguang Liu , James Bottomley , Jiewen Yao , Gerd Hoffmann , Brijesh Singh , Erdem Aktas , Tom Lendacky Subject: [edk2-devel] [PATCH V3 1/7] MdePkg: Add CC_GUEST_TYPE in ConfidentialComputingGuestAttr.h Date: Sun, 17 Apr 2022 11:01:07 +0800 Message-Id: In-Reply-To: References: MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,min.m.xu@intel.com X-Gm-Message-State: dNS2SVef3gvCDzWG680YOa8Sx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1650164500; bh=djMUoQ7zdJFeZxcepxqBYsps6XS1jdXqzPw1tzehIBc=; h=Cc:Date:From:Reply-To:Subject:To; b=bKCvSBjDfHcpMwZnxwbazGTi7usfOv4Lnze55LO4T+pbjvDfOu1zJHBNGyo0Du/V6pj tqOYeWde0VMfX+J0/I8ejDT5HlNtTcn3Qr47spq2QDnI0AqiB/5XrMQEMBAQUqOtkdqBr F4eWHIhfPiV3Xq+VeNcTBmb1PmSTJVNHhNw= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1650164501859100002 Content-Type: text/plain; charset="utf-8" BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3902 The confidential computing guest type (GUEST_TYPE) was defined in OvmfPkg/Include/WorkArea.h. Now it is to be moved to MdePkg/Include/ConfidentialComputingGuestAttr.h and renamed as CC_GUEST_TYPE. There are 2 reasons for this change. 1. CC_GUEST_TYPE is a generic definition and will be used in CcProbeLib which is defined in MdePkg. 2. Based on the latest edk2 coding style: - First character should be upper case - Must contain lower case characters - No white space characters - Global variable name must start with a 'g' As the first step CC_GUEST_TYPE is defined in this patch. In the next patch GUEST_TYPE will be deleted. This is to make sure the bisect work correctly. Cc: Michael D Kinney Cc: Liming Gao Cc: Zhiguang Liu Cc: James Bottomley Cc: Jiewen Yao Cc: Gerd Hoffmann Cc: Brijesh Singh Cc: Erdem Aktas Cc: Tom Lendacky Signed-off-by: Min Xu Acked-by: Gerd Hoffmann Reviewed-by: Tom Lendacky --- MdePkg/Include/ConfidentialComputingGuestAttr.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/MdePkg/Include/ConfidentialComputingGuestAttr.h b/MdePkg/Inclu= de/ConfidentialComputingGuestAttr.h index dd2541c6dcdf..9e9424a01559 100644 --- a/MdePkg/Include/ConfidentialComputingGuestAttr.h +++ b/MdePkg/Include/ConfidentialComputingGuestAttr.h @@ -1,5 +1,5 @@ /** @file -Definitions for Confidential Computing Attribute +Definitions for Confidential Computing Guest Attributes =20 Copyright (c) 2021 AMD Inc. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent @@ -9,6 +9,15 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #ifndef CONFIDENTIAL_COMPUTING_GUEST_ATTR_H_ #define CONFIDENTIAL_COMPUTING_GUEST_ATTR_H_ =20 +// +// Confidential computing guest type +// +typedef enum { + CCGuestTypeNonEncrypted =3D 0, + CCGuestTypeAmdSev, + CCGuestTypeIntelTdx, +} CC_GUEST_TYPE; + typedef enum { /* The guest is running with memory encryption disabled. */ CCAttrNotEncrypted =3D 0, --=20 2.29.2.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#88970): https://edk2.groups.io/g/devel/message/88970 Mute This Topic: https://groups.io/mt/90516972/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu May 16 07:46:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+88971+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+88971+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1650164501; cv=none; d=zohomail.com; s=zohoarc; b=LSWBMtFpFLmKOlq4Q1VbVWHO5X4+X57EKUMJMZZJCr8IVpEztpE9C86m68LTfprHFM7fWm0TLnUNXN00GRHRCXw9PkQlInj8IGzWHLXcTn+yGr26/Ze7sJ6ovrceGyxbL8ZJ50rBAXRcuFLpWSv4zQpNBmDAN3RbMsXT3pp24sQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650164501; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=Le5yvCU4eKEF94TRj8opy4pDoyAYYpF2bUYIPL8Nh5Q=; b=AnpEsdyYQRzZLj5vQInIZQoVuH5bnX34c/gLT8fAFW6DdyykYUQCrbPg26GPOYbMYTvcdi2i5uXyGi1tFTRx3MFa4/4p4s0p0mDsCEQC8M8OyziCzb3fyeFvbZuXH0VNAz/mve/kZfbRjLjykhiVRI4HuvJz7HYIu8yynrs0eVo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+88971+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1650164501375797.2647142670892; Sat, 16 Apr 2022 20:01:41 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id USBcYY1788612xvXJSFZkYkw; Sat, 16 Apr 2022 20:01:41 -0700 X-Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web11.25369.1650164497717213024 for ; Sat, 16 Apr 2022 20:01:40 -0700 X-IronPort-AV: E=McAfee;i="6400,9594,10318"; a="349806192" X-IronPort-AV: E=Sophos;i="5.90,266,1643702400"; d="scan'208";a="349806192" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2022 20:01:40 -0700 X-IronPort-AV: E=Sophos;i="5.90,266,1643702400"; d="scan'208";a="575044273" X-Received: from mxu9-mobl1.ccr.corp.intel.com ([10.255.29.191]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2022 20:01:37 -0700 From: "Min Xu" To: devel@edk2.groups.io Cc: Min Xu , Michael D Kinney , Liming Gao , Zhiguang Liu , James Bottomley , Jiewen Yao , Gerd Hoffmann , Brijesh Singh , Erdem Aktas , Tom Lendacky Subject: [edk2-devel] [PATCH V3 2/7] OvmfPkg: Replace GUEST_TYPE with CC_GUEST_TYPE Date: Sun, 17 Apr 2022 11:01:08 +0800 Message-Id: In-Reply-To: References: MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,min.m.xu@intel.com X-Gm-Message-State: ykL7C4mRUzC5xv4cGw8frRIyx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1650164501; bh=9ZcJRhwc0Ne2rC3HpHKzijDK38rFTQdrry1krljiZTg=; h=Cc:Date:From:Reply-To:Subject:To; b=uIptT855t/OGShviFkbzH1PAVvYpjRuM9ebr+2WmxluC8nprQz4M9nkyb8o6aQ8tK1I mKgi7bUGOkwscE9zcutpdkT5b37f2FO+BdbHj1Mpo3z0vhJ76Mlh84GBz+RXQW3AOZHDv rZ2bzB6C6c7wc22kA8w9DEC0s06Q6KqRuTs= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1650164501925100006 Content-Type: text/plain; charset="utf-8" BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3902 Replace GUEST_TYPE with CC_GUEST_TYPE which is defined in MdePkg/Include/ConfidentialComputingGuestAttr.h. Cc: Michael D Kinney Cc: Liming Gao Cc: Zhiguang Liu Cc: James Bottomley Cc: Jiewen Yao Cc: Gerd Hoffmann Cc: Brijesh Singh Cc: Erdem Aktas Cc: Tom Lendacky Signed-off-by: Min Xu Reviewed-by: Tom Lendacky --- OvmfPkg/Include/WorkArea.h | 9 +-------- .../BaseMemEncryptSevLib/PeiMemEncryptSevLibInternal.c | 2 +- .../BaseMemEncryptSevLib/SecMemEncryptSevLibInternal.c | 2 +- OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPei.c | 2 +- OvmfPkg/Sec/AmdSev.c | 2 +- 5 files changed, 5 insertions(+), 12 deletions(-) diff --git a/OvmfPkg/Include/WorkArea.h b/OvmfPkg/Include/WorkArea.h index b67edd14e79f..bf56fc4a6f65 100644 --- a/OvmfPkg/Include/WorkArea.h +++ b/OvmfPkg/Include/WorkArea.h @@ -10,14 +10,7 @@ #ifndef __OVMF_WORK_AREA_H__ #define __OVMF_WORK_AREA_H__ =20 -// -// Guest type for the work area -// -typedef enum { - GUEST_TYPE_NON_ENCRYPTED, - GUEST_TYPE_AMD_SEV, - GUEST_TYPE_INTEL_TDX, -} GUEST_TYPE; +#include =20 // // Confidential computing work area header definition. Any change diff --git a/OvmfPkg/Library/BaseMemEncryptSevLib/PeiMemEncryptSevLibIntern= al.c b/OvmfPkg/Library/BaseMemEncryptSevLib/PeiMemEncryptSevLibInternal.c index 3f8f91a5da12..fb9d3cbd3645 100644 --- a/OvmfPkg/Library/BaseMemEncryptSevLib/PeiMemEncryptSevLibInternal.c +++ b/OvmfPkg/Library/BaseMemEncryptSevLib/PeiMemEncryptSevLibInternal.c @@ -36,7 +36,7 @@ GetSevEsWorkArea ( // // If its not SEV guest then SevEsWorkArea is not valid. // - if ((WorkArea =3D=3D NULL) || (WorkArea->Header.GuestType !=3D GUEST_TYP= E_AMD_SEV)) { + if ((WorkArea =3D=3D NULL) || (WorkArea->Header.GuestType !=3D CCGuestTy= peAmdSev)) { return NULL; } =20 diff --git a/OvmfPkg/Library/BaseMemEncryptSevLib/SecMemEncryptSevLibIntern= al.c b/OvmfPkg/Library/BaseMemEncryptSevLib/SecMemEncryptSevLibInternal.c index 80aceba01bcf..238e29e2a175 100644 --- a/OvmfPkg/Library/BaseMemEncryptSevLib/SecMemEncryptSevLibInternal.c +++ b/OvmfPkg/Library/BaseMemEncryptSevLib/SecMemEncryptSevLibInternal.c @@ -36,7 +36,7 @@ GetSevEsWorkArea ( // // If its not SEV guest then SevEsWorkArea is not valid. // - if ((WorkArea =3D=3D NULL) || (WorkArea->Header.GuestType !=3D GUEST_TYP= E_AMD_SEV)) { + if ((WorkArea =3D=3D NULL) || (WorkArea->Header.GuestType !=3D CCGuestTy= peAmdSev)) { return NULL; } =20 diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPei.c b/OvmfPkg/Library/= QemuFwCfgLib/QemuFwCfgPei.c index b8230613dcea..1b8133bf5ad6 100644 --- a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPei.c +++ b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgPei.c @@ -35,7 +35,7 @@ QemuFwCfgIsTdxGuest ( CONFIDENTIAL_COMPUTING_WORK_AREA_HEADER *CcWorkAreaHeader; =20 CcWorkAreaHeader =3D (CONFIDENTIAL_COMPUTING_WORK_AREA_HEADER *)FixedPcd= Get32 (PcdOvmfWorkAreaBase); - return (CcWorkAreaHeader !=3D NULL && CcWorkAreaHeader->GuestType =3D=3D= GUEST_TYPE_INTEL_TDX); + return (CcWorkAreaHeader !=3D NULL && CcWorkAreaHeader->GuestType =3D=3D= CCGuestTypeIntelTdx); } =20 /** diff --git a/OvmfPkg/Sec/AmdSev.c b/OvmfPkg/Sec/AmdSev.c index d8fd35650d7d..0da6b36020fc 100644 --- a/OvmfPkg/Sec/AmdSev.c +++ b/OvmfPkg/Sec/AmdSev.c @@ -251,7 +251,7 @@ IsSevGuest ( =20 WorkArea =3D (OVMF_WORK_AREA *)FixedPcdGet32 (PcdOvmfWorkAreaBase); =20 - return ((WorkArea !=3D NULL) && (WorkArea->Header.GuestType =3D=3D GUEST= _TYPE_AMD_SEV)); + return ((WorkArea !=3D NULL) && (WorkArea->Header.GuestType =3D=3D CCGue= stTypeAmdSev)); } =20 /** --=20 2.29.2.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#88971): https://edk2.groups.io/g/devel/message/88971 Mute This Topic: https://groups.io/mt/90516973/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu May 16 07:46:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+88972+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+88972+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1650164503; cv=none; d=zohomail.com; s=zohoarc; b=dpY46V4iO2pR7AtsA7bLT53MtYOeds3xg8GjOqSoDPNTv+49JhBA4fX4XAe7rSrY43XKWrhaCaIVfGYfHD6gyM5U0dDHmUgnyp2+KRLHTButybKkZG+k0AVu3qH/ZDR8yxuatIbm/cj01Za+5TeX0+eADWh5If0RiyA9FV7N7uE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650164503; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=27rsD+Tmen2t7hvQeOwbuVsRbwxgEDbPykrD7hSFqgs=; b=DV/OlCgBDrJcCDEZp8VBkX1ikBbeAOJdIizqm+KlDMhQvWnBR/BpyM+s5UtfIs5bS4P972DthZchjqduAHYkI0XPjMFqktMw+BNJ+tHyPKYR/uvCBctiRsKobI+Hm9MGtSLFsOWKnY1IkjQ0nAxK0OyWao2Mg9cf34Wj0pdpjWs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+88972+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1650164503897915.0312823068773; Sat, 16 Apr 2022 20:01:43 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id MrfSYY1788612xcCL82KpgbA; Sat, 16 Apr 2022 20:01:43 -0700 X-Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web11.25369.1650164497717213024 for ; Sat, 16 Apr 2022 20:01:42 -0700 X-IronPort-AV: E=McAfee;i="6400,9594,10318"; a="349806222" X-IronPort-AV: E=Sophos;i="5.90,266,1643702400"; d="scan'208";a="349806222" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2022 20:01:42 -0700 X-IronPort-AV: E=Sophos;i="5.90,266,1643702400"; d="scan'208";a="575044300" X-Received: from mxu9-mobl1.ccr.corp.intel.com ([10.255.29.191]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2022 20:01:40 -0700 From: "Min Xu" To: devel@edk2.groups.io Cc: Min Xu , Michael D Kinney , Liming Gao , Zhiguang Liu , James Bottomley , Jiewen Yao , Gerd Hoffmann Subject: [edk2-devel] [PATCH V3 3/7] MdePkg: Add CcProbeLib Date: Sun, 17 Apr 2022 11:01:09 +0800 Message-Id: In-Reply-To: References: MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,min.m.xu@intel.com X-Gm-Message-State: RMjDuOWeSn6JKgQNV9d8snY9x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1650164503; bh=WnPhLx1NLKpvRwE/GXfSlIHhUdyQR5YXB+oc/myNUbU=; h=Cc:Date:From:Reply-To:Subject:To; b=jyhyjKSqqhoQtKTTJSqQf5CuYahUU7I7302u/kSWLBw3OxGd78IkrovCC1FZkCtg1fF l2NYToCt4bHAMS/tyqBwsGJORS+wLZXDbvHXbeQAbm4Ys90PXPcdrB6vaA5PaOZziCh5f QA6Tr2g3a0w7WYfAVz/TVsLlFWwjerA/xNw= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1650164505809100002 Content-Type: text/plain; charset="utf-8" BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3902 CcProbeLib is used to probe the Confidential Computing guest type. This library is designed to run on SEC / PEI / DXE phases. A null instance of the library always returns CCGuestTypeNonEncrypted. A platform specific CcProbeLib will be implemented, for example, in OvmfPkg. Cc: Michael D Kinney Cc: Liming Gao Cc: Zhiguang Liu Cc: James Bottomley Cc: Jiewen Yao Cc: Gerd Hoffmann Signed-off-by: Min Xu Reviewed-by: Tom Lendacky --- MdePkg/Include/Library/CcProbeLib.h | 26 +++++++++++++++++++ .../Library/CcProbeLibNull/CcProbeLibNull.c | 26 +++++++++++++++++++ .../Library/CcProbeLibNull/CcProbeLibNull.inf | 21 +++++++++++++++ MdePkg/MdePkg.dec | 5 ++++ MdePkg/MdePkg.dsc | 1 + 5 files changed, 79 insertions(+) create mode 100644 MdePkg/Include/Library/CcProbeLib.h create mode 100644 MdePkg/Library/CcProbeLibNull/CcProbeLibNull.c create mode 100644 MdePkg/Library/CcProbeLibNull/CcProbeLibNull.inf diff --git a/MdePkg/Include/Library/CcProbeLib.h b/MdePkg/Include/Library/C= cProbeLib.h new file mode 100644 index 000000000000..2857dddfb2d3 --- /dev/null +++ b/MdePkg/Include/Library/CcProbeLib.h @@ -0,0 +1,26 @@ +/** @file + +Copyright (c) 2022, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef CC_PROBE_LIB_H_ +#define CC_PROBE_LIB_H_ + +#include + +/** + Probe the ConfidentialComputing Guest type. See defition of + CC_GUEST_TYPE in . + + @return The guest type + +**/ +UINT8 +EFIAPI +CcProbe ( + VOID + ); + +#endif diff --git a/MdePkg/Library/CcProbeLibNull/CcProbeLibNull.c b/MdePkg/Librar= y/CcProbeLibNull/CcProbeLibNull.c new file mode 100644 index 000000000000..152d900eb099 --- /dev/null +++ b/MdePkg/Library/CcProbeLibNull/CcProbeLibNull.c @@ -0,0 +1,26 @@ +/** @file + + Null stub of CcProbeLib + + Copyright (c) 2022, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +/** + Probe the ConfidentialComputing Guest type. See defition of + CC_GUEST_TYPE in . + + @return The guest type + +**/ +UINT8 +EFIAPI +CcProbe ( + VOID + ) +{ + return CCGuestTypeNonEncrypted; +} diff --git a/MdePkg/Library/CcProbeLibNull/CcProbeLibNull.inf b/MdePkg/Libr= ary/CcProbeLibNull/CcProbeLibNull.inf new file mode 100644 index 000000000000..f37c25f73439 --- /dev/null +++ b/MdePkg/Library/CcProbeLibNull/CcProbeLibNull.inf @@ -0,0 +1,21 @@ +## @file +# CcProbeLib null instance. +# +# Copyright (c) 2022, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D CcProbeLibNull + FILE_GUID =3D B15D67FE-0DAC-4316-8E26-8A6b85E43782 + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D CcProbeLib + +[Sources] + CcProbeLibNull.c + +[Packages] + MdePkg/MdePkg.dec diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index 1934c9840423..faeb28c80cbd 100644 --- a/MdePkg/MdePkg.dec +++ b/MdePkg/MdePkg.dec @@ -267,6 +267,11 @@ # RegisterFilterLib|Include/Library/RegisterFilterLib.h =20 + ## @libraryclass This library provides interfances to probe Confidenti= alComputing guest type. + # + # + CcProbeLib|Include/Library/CcProbeLib.h + [LibraryClasses.IA32, LibraryClasses.X64, LibraryClasses.AARCH64] ## @libraryclass Provides services to generate random number. # diff --git a/MdePkg/MdePkg.dsc b/MdePkg/MdePkg.dsc index d6a7af412be7..c8d282882ec1 100644 --- a/MdePkg/MdePkg.dsc +++ b/MdePkg/MdePkg.dsc @@ -130,6 +130,7 @@ MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib= .inf =20 MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.inf + MdePkg/Library/CcProbeLibNull/CcProbeLibNull.inf =20 [Components.IA32, Components.X64, Components.ARM, Components.AARCH64] # --=20 2.29.2.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#88972): https://edk2.groups.io/g/devel/message/88972 Mute This Topic: https://groups.io/mt/90516974/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu May 16 07:46:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+88973+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+88973+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1650164507; cv=none; d=zohomail.com; s=zohoarc; b=fq1ra4VKht3KuPNSzjzhpCnxQaz/B0HTy7e0m02C6dypciE6876yUR2LYerqjVcW8YzATsis23zXtSayy4q06k0wJZnG90+gcAoZNxBN4Rt9nBurRbSofXr8rZQ8lfPTczeir/Kmyn0qqBk4wGd/u9PgatI8c+LmfXrpZnspOOk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650164507; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=neVzB8cqHPhLQfrQ7BhNruJs5CedeL8gjkIyUcQcgx4=; b=MaB346cGetxVnhAej/4GrhqYRNKbWuzr9mycDnBcF0aaje5elnFa3uTSzl+ftEQZguW/Bbe287CpoRJ5PPcQFn9P0sG67GcLl5AEZqIKKesocRR4KrW7+IxpInth8T9OmQtia/jaEn2yvd3oedwwQaacW/RNn2ZGxTYhc5uDQN4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+88973+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1650164507738798.8989838708236; Sat, 16 Apr 2022 20:01:47 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id Vp7BYY1788612xf82ioTDPNJ; Sat, 16 Apr 2022 20:01:47 -0700 X-Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web11.25369.1650164497717213024 for ; Sat, 16 Apr 2022 20:01:47 -0700 X-IronPort-AV: E=McAfee;i="6400,9594,10318"; a="349806253" X-IronPort-AV: E=Sophos;i="5.90,266,1643702400"; d="scan'208";a="349806253" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2022 20:01:45 -0700 X-IronPort-AV: E=Sophos;i="5.90,266,1643702400"; d="scan'208";a="575044331" X-Received: from mxu9-mobl1.ccr.corp.intel.com ([10.255.29.191]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2022 20:01:42 -0700 From: "Min Xu" To: devel@edk2.groups.io Cc: Min Xu , Michael D Kinney , Liming Gao , Zhiguang Liu , James Bottomley , James Bottomley , Jiewen Yao , Gerd Hoffmann , Brijesh Singh , Erdem Aktas , Tom Lendacky Subject: [edk2-devel] [PATCH V3 4/7] OvmfPkg: Add CcProbeLib Date: Sun, 17 Apr 2022 11:01:10 +0800 Message-Id: <9b76a0c7fb98c84f4df2ad904bf3fa516551fa1a.1650163941.git.min.m.xu@intel.com> In-Reply-To: References: MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,min.m.xu@intel.com X-Gm-Message-State: fuULTXlNMlbCPIjTraKrFXwsx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1650164507; bh=aUxkbtjdp2QDhI1vYrtDLgOTJr5wup83Vp21fQSMn7U=; h=Cc:Date:From:Reply-To:Subject:To; b=ROA7qyC3zHpY54R7by+O5/CxbFwx/ft6iu3y9+mBaP7zNuSmHt8VrBqr1xJS2hul/Gc yFM672AkHft6r9zT8cfOJkn04FfFufGEL81pqN/Yq40fhNK0cHMrMVmqGQA+RqHy9YyTo qFzE6rXRDuR6fzOqLdQu1yumdangbunZ2aY= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1650164509738100002 Content-Type: text/plain; charset="utf-8" BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3902 This is the OvmfPkg specific CcProbeLib. It checks the Ovmf WorkArea (PcdOvmfWorkAreaBase) to return the guest type. Cc: Michael D Kinney Cc: Liming Gao Cc: Zhiguang Liu Cc: James Bottomley Cc: James Bottomley Cc: Jiewen Yao Cc: Gerd Hoffmann Cc: Brijesh Singh Cc: Erdem Aktas Cc: Tom Lendacky Signed-off-by: Min Xu Reviewed-by: Tom Lendacky --- 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/CcPr= obeLib/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.
+ 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 =3D (OVMF_WORK_AREA *)FixedPcdGet32 (PcdOvmfWorkAreaBase); + + return WorkArea !=3D NULL ? WorkArea->Header.GuestType : CCGuestTypeNonE= ncrypted; +} diff --git a/OvmfPkg/Library/CcProbeLib/CcProbeLib.inf b/OvmfPkg/Library/Cc= ProbeLib/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.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D CcProbeLib + FILE_GUID =3D 05184ec9-abb0-4491-8584-e388639a7c48 + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D CcProbeLib + +[Sources] + CcProbeLib.c + +[Packages] + MdePkg/MdePkg.dec + OvmfPkg/OvmfPkg.dec + +[Pcd] + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfWorkAreaBase --=20 2.29.2.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#88973): https://edk2.groups.io/g/devel/message/88973 Mute This Topic: https://groups.io/mt/90516976/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu May 16 07:46:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+88974+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+88974+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1650164509; cv=none; d=zohomail.com; s=zohoarc; b=GIHEMWYx/u5uiQaar+wIRB1Q3RBRPscTnIlNyBdvxUEMeoX3nYfM4kuZr1U1ISwbv9V8ptuChayz/yk++u8WlD+kUPqpsD81FHhftFKHJF91t2TcW5Lg5kiDjcmWHYQXpyzFQibKAHjhVc/QjSikoQNtyruyELBNqC6HOMjmw5A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650164509; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=c9A0+bsWMJi0Ru0uQi8lyAK3C5ve9CGvRwRK4XNxKcg=; b=C0X9kCpzIWjXTDoy2gvBWIDq9nbhSwl4hSBYNMit3md1PDTqiW/+CC3EDX3CdobSrhaOPEac37l4rFB97WLy2UnYALdjbo0fhxLw2GIASPHqfLna2+oBlpafd6qI8qaCF9BDW2tKGCwx0vpDIJBwNc2bHif/omubaUOjW2iwHzM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+88974+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1650164509838792.7058272934032; Sat, 16 Apr 2022 20:01:49 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 2LJMYY1788612xfkqJXOl1hl; Sat, 16 Apr 2022 20:01:49 -0700 X-Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web11.25369.1650164497717213024 for ; Sat, 16 Apr 2022 20:01:48 -0700 X-IronPort-AV: E=McAfee;i="6400,9594,10318"; a="349806271" X-IronPort-AV: E=Sophos;i="5.90,266,1643702400"; d="scan'208";a="349806271" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2022 20:01:48 -0700 X-IronPort-AV: E=Sophos;i="5.90,266,1643702400"; d="scan'208";a="575044354" X-Received: from mxu9-mobl1.ccr.corp.intel.com ([10.255.29.191]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2022 20:01:45 -0700 From: "Min Xu" To: devel@edk2.groups.io Cc: Min Xu , James Bottomley , James Bottomley , Jiewen Yao , Gerd Hoffmann , Brijesh Singh , Erdem Aktas , Tom Lendacky Subject: [edk2-devel] [PATCH V3 5/7] OvmfPkg: Add CcProbeLib in *.dsc Date: Sun, 17 Apr 2022 11:01:11 +0800 Message-Id: <096c8e5825b643a323c8856dfdf3e231b31d6731.1650163941.git.min.m.xu@intel.com> In-Reply-To: References: MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,min.m.xu@intel.com X-Gm-Message-State: VwA9uoj7DB4RRToTZ08IdWl8x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1650164509; bh=avVCCY9Nql6F8+aIHJ3lxDbAxWWmHq/tMjfTyjVvJx4=; h=Cc:Date:From:Reply-To:Subject:To; b=s+gFToGAQ4caBjnMdTMK1L8eQOSyy/ThSDij/h2mFb21V8akfg7mqtY7N8GtJXbQjIF zxG4uDGgEoqT9TrOjQfNEHX5U2nt/97s8aTL24VKbOvp7kL8Ue5KZkHFVkJMXzVy9UmoZ xxevEnwbxEiY27qHPq3rbseVmJIpzwx1UHA= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1650164511737100006 Content-Type: text/plain; charset="utf-8" BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3902 CcProbeLib is imported in BaseIoLibIntrinsicSev. OvmfPkg/Library/CcProbeLib is the OvmfPkg version which checks OvmfWorkArea to return the Cc guest type. It is included in OvmfPkgX64.dsc and IntelTdx/IntelTdxX64.dsc. Other .dsc include the MdePkg/Library/CcProbeLibNull because Cc guest is not supported in those projects. Cc: James Bottomley Cc: James Bottomley Cc: Jiewen Yao Cc: Gerd Hoffmann Cc: Brijesh Singh Cc: Erdem Aktas Cc: Tom Lendacky Signed-off-by: Min Xu Reviewed-by: Tom Lendacky --- OvmfPkg/AmdSev/AmdSevX64.dsc | 1 + OvmfPkg/Bhyve/BhyveX64.dsc | 1 + OvmfPkg/CloudHv/CloudHvX64.dsc | 1 + OvmfPkg/IntelTdx/IntelTdxX64.dsc | 1 + OvmfPkg/Microvm/MicrovmX64.dsc | 1 + OvmfPkg/OvmfPkgIa32.dsc | 1 + OvmfPkg/OvmfPkgIa32X64.dsc | 1 + OvmfPkg/OvmfPkgX64.dsc | 1 + OvmfPkg/OvmfXen.dsc | 1 + 9 files changed, 9 insertions(+) diff --git a/OvmfPkg/AmdSev/AmdSevX64.dsc b/OvmfPkg/AmdSev/AmdSevX64.dsc index fcdc3efab204..1c088f25fa4b 100644 --- a/OvmfPkg/AmdSev/AmdSevX64.dsc +++ b/OvmfPkg/AmdSev/AmdSevX64.dsc @@ -149,6 +149,7 @@ PciCapLib|OvmfPkg/Library/BasePciCapLib/BasePciCapLib.inf PciCapPciSegmentLib|OvmfPkg/Library/BasePciCapPciSegmentLib/BasePciCapPc= iSegmentLib.inf PciCapPciIoLib|OvmfPkg/Library/UefiPciCapPciIoLib/UefiPciCapPciIoLib.inf + CcProbeLib|MdePkg/Library/CcProbeLibNull/CcProbeLibNull.inf IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHo= okStatusCodeLibNull.inf SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc index e1b6b8e15f36..a8fa4d38ab60 100644 --- a/OvmfPkg/Bhyve/BhyveX64.dsc +++ b/OvmfPkg/Bhyve/BhyveX64.dsc @@ -146,6 +146,7 @@ PciCapLib|OvmfPkg/Library/BasePciCapLib/BasePciCapLib.inf PciCapPciSegmentLib|OvmfPkg/Library/BasePciCapPciSegmentLib/BasePciCapPc= iSegmentLib.inf PciCapPciIoLib|OvmfPkg/Library/UefiPciCapPciIoLib/UefiPciCapPciIoLib.inf + CcProbeLib|MdePkg/Library/CcProbeLibNull/CcProbeLibNull.inf IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHo= okStatusCodeLibNull.inf SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf diff --git a/OvmfPkg/CloudHv/CloudHvX64.dsc b/OvmfPkg/CloudHv/CloudHvX64.dsc index 20f3bc340807..d1c85f60c768 100644 --- a/OvmfPkg/CloudHv/CloudHvX64.dsc +++ b/OvmfPkg/CloudHv/CloudHvX64.dsc @@ -158,6 +158,7 @@ PciCapLib|OvmfPkg/Library/BasePciCapLib/BasePciCapLib.inf PciCapPciSegmentLib|OvmfPkg/Library/BasePciCapPciSegmentLib/BasePciCapPc= iSegmentLib.inf PciCapPciIoLib|OvmfPkg/Library/UefiPciCapPciIoLib/UefiPciCapPciIoLib.inf + CcProbeLib|MdePkg/Library/CcProbeLibNull/CcProbeLibNull.inf IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHo= okStatusCodeLibNull.inf SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf diff --git a/OvmfPkg/IntelTdx/IntelTdxX64.dsc b/OvmfPkg/IntelTdx/IntelTdxX6= 4.dsc index 245155d41b30..73a6c30096a8 100644 --- a/OvmfPkg/IntelTdx/IntelTdxX64.dsc +++ b/OvmfPkg/IntelTdx/IntelTdxX64.dsc @@ -135,6 +135,7 @@ PciCapLib|OvmfPkg/Library/BasePciCapLib/BasePciCapLib.inf PciCapPciSegmentLib|OvmfPkg/Library/BasePciCapPciSegmentLib/BasePciCapPc= iSegmentLib.inf PciCapPciIoLib|OvmfPkg/Library/UefiPciCapPciIoLib/UefiPciCapPciIoLib.inf + CcProbeLib|OvmfPkg/Library/CcProbeLib/CcProbeLib.inf IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHo= okStatusCodeLibNull.inf SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf diff --git a/OvmfPkg/Microvm/MicrovmX64.dsc b/OvmfPkg/Microvm/MicrovmX64.dsc index 59580ccd4691..c9c843e116a9 100644 --- a/OvmfPkg/Microvm/MicrovmX64.dsc +++ b/OvmfPkg/Microvm/MicrovmX64.dsc @@ -156,6 +156,7 @@ PciCapLib|OvmfPkg/Library/BasePciCapLib/BasePciCapLib.inf PciCapPciSegmentLib|OvmfPkg/Library/BasePciCapPciSegmentLib/BasePciCapPc= iSegmentLib.inf PciCapPciIoLib|OvmfPkg/Library/UefiPciCapPciIoLib/UefiPciCapPciIoLib.inf + CcProbeLib|MdePkg/Library/CcProbeLibNull/CcProbeLibNull.inf IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHo= okStatusCodeLibNull.inf SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc index e4218b01f0fc..9e4ecd21fb17 100644 --- a/OvmfPkg/OvmfPkgIa32.dsc +++ b/OvmfPkg/OvmfPkgIa32.dsc @@ -154,6 +154,7 @@ PciCapLib|OvmfPkg/Library/BasePciCapLib/BasePciCapLib.inf PciCapPciSegmentLib|OvmfPkg/Library/BasePciCapPciSegmentLib/BasePciCapPc= iSegmentLib.inf PciCapPciIoLib|OvmfPkg/Library/UefiPciCapPciIoLib/UefiPciCapPciIoLib.inf + CcProbeLib|MdePkg/Library/CcProbeLibNull/CcProbeLibNull.inf IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHo= okStatusCodeLibNull.inf SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc index a80cdaacb8bc..75fb8095eec2 100644 --- a/OvmfPkg/OvmfPkgIa32X64.dsc +++ b/OvmfPkg/OvmfPkgIa32X64.dsc @@ -158,6 +158,7 @@ PciCapLib|OvmfPkg/Library/BasePciCapLib/BasePciCapLib.inf PciCapPciSegmentLib|OvmfPkg/Library/BasePciCapPciSegmentLib/BasePciCapPc= iSegmentLib.inf PciCapPciIoLib|OvmfPkg/Library/UefiPciCapPciIoLib/UefiPciCapPciIoLib.inf + CcProbeLib|MdePkg/Library/CcProbeLibNull/CcProbeLibNull.inf IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHo= okStatusCodeLibNull.inf SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc index fb2899f8a1be..2e534d0d2478 100644 --- a/OvmfPkg/OvmfPkgX64.dsc +++ b/OvmfPkg/OvmfPkgX64.dsc @@ -165,6 +165,7 @@ PciCapLib|OvmfPkg/Library/BasePciCapLib/BasePciCapLib.inf PciCapPciSegmentLib|OvmfPkg/Library/BasePciCapPciSegmentLib/BasePciCapPc= iSegmentLib.inf PciCapPciIoLib|OvmfPkg/Library/UefiPciCapPciIoLib/UefiPciCapPciIoLib.inf + CcProbeLib|OvmfPkg/Library/CcProbeLib/CcProbeLib.inf IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHo= okStatusCodeLibNull.inf SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc index 7bd594c6e263..8d420cf54371 100644 --- a/OvmfPkg/OvmfXen.dsc +++ b/OvmfPkg/OvmfXen.dsc @@ -147,6 +147,7 @@ PciCapLib|OvmfPkg/Library/BasePciCapLib/BasePciCapLib.inf PciCapPciSegmentLib|OvmfPkg/Library/BasePciCapPciSegmentLib/BasePciCapPc= iSegmentLib.inf PciCapPciIoLib|OvmfPkg/Library/UefiPciCapPciIoLib/UefiPciCapPciIoLib.inf + CcProbeLib|MdePkg/Library/CcProbeLibNull/CcProbeLibNull.inf IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHo= okStatusCodeLibNull.inf SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf --=20 2.29.2.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#88974): https://edk2.groups.io/g/devel/message/88974 Mute This Topic: https://groups.io/mt/90516977/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu May 16 07:46:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+88975+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+88975+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1650164512; cv=none; d=zohomail.com; s=zohoarc; b=AB9w1QCsTjuRf8iwRmuGnLWyOygXWRd6NUw2yOc/Xal8JGkQws0vGVuthXQ8CH0jIHH5Zt6ciIyCvM7uBZ6qQ88UsuWaaJocHtevyzPTyWHZbOIEfeuKuRd8ogrveJHEHcwdIvc0I14R6fQWgsMeTXlklxB3xK0AZiKKaALI2tM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650164512; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=mdAe+lnwikSiIyiYhSgrJvDQs+bTw3fWMKoXwgWKb5s=; b=PgSjOOvRddJNOE2a61FVJWJ8STvXN6rKss3gjHXadWu3nHEh3a21voui1pd9bpuq/OQxfVltFos4EHL9iNEJLiNy5ya3Lc1ToPP5w3ZQlSf/ANmRbwhVj3OA3ABAtZwkUVo9rwJBPWvZYmeO+MzIlALEpZEf25nw9/SqCrLuLD0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+88975+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1650164512360743.002325479438; Sat, 16 Apr 2022 20:01:52 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id i6nUYY1788612xS9CYlGn2Vu; Sat, 16 Apr 2022 20:01:52 -0700 X-Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web11.25369.1650164497717213024 for ; Sat, 16 Apr 2022 20:01:51 -0700 X-IronPort-AV: E=McAfee;i="6400,9594,10318"; a="349806289" X-IronPort-AV: E=Sophos;i="5.90,266,1643702400"; d="scan'208";a="349806289" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2022 20:01:50 -0700 X-IronPort-AV: E=Sophos;i="5.90,266,1643702400"; d="scan'208";a="575044378" X-Received: from mxu9-mobl1.ccr.corp.intel.com ([10.255.29.191]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2022 20:01:48 -0700 From: "Min Xu" To: devel@edk2.groups.io Cc: Min Xu , Michael D Kinney , Liming Gao , Zhiguang Liu , James Bottomley , James Bottomley , Jiewen Yao , Gerd Hoffmann Subject: [edk2-devel] [PATCH V3 6/7] MdePkg: Probe Cc guest in BaseIoLibIntrinsicSev Date: Sun, 17 Apr 2022 11:01:12 +0800 Message-Id: <691f7730593f6eec692344fb0c59afb31c343c6c.1650163941.git.min.m.xu@intel.com> In-Reply-To: References: MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,min.m.xu@intel.com X-Gm-Message-State: 7A47gbsE7R7hLe5nv28tjeBkx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1650164512; bh=ux6jT+BTIVEbR2GE8u82U0VUEwgFsPmRPWNqAbTwhag=; h=Cc:Date:From:Reply-To:Subject:To; b=sy6SrX4rPyUyJvvfaa+Lbt0RjWhogU8TUuL278kTfItPzLKq9cp15uxfDFM9wxXyMiI ChL9Oc9usWGyiiwOoQptbf0JVawglnzwcsT30RClyMV8OMfOjgrulcQ47U56JCPwnCu4D Exaxl8NTshG8ZwdAFVsxWpXF8X47AQml4N4= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1650164513759100010 Content-Type: text/plain; charset="utf-8" BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3902 Bad IO performance in SEC phase is observed after TDX features was introduced. (after commit b6b2de884864 - "MdePkg: Support mmio for Tdx guest in BaseIoLibIntrinsic"). This is because IsTdxGuest() will be called in each MMIO operation. It is trying to cache the result of the probe in the efi data segment. However, that doesn't work in SEC, because the data segment is read only (so the write seems to succeed but a read will always return the original value), leading to us calling TdIsEnabled() check for every mmio we do, which is causing the slowdown because it's very expensive. This patch is to call CcProbe instead of TdIsEnabled in IsTdxGuest. Null instance of CcProbe always returns CCGuestTypeNonEncrypted. Its OvmfPkg version returns the guest type in Ovmf work area. Cc: Michael D Kinney Cc: Liming Gao Cc: Zhiguang Liu Cc: James Bottomley Cc: James Bottomley Cc: Jiewen Yao Cc: Gerd Hoffmann Signed-off-by: Min Xu Reviewed-by: Tom Lendacky --- .../BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf | 1 + .../Library/BaseIoLibIntrinsic/IoLibInternalTdx.c | 13 ++----------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf b/= MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf index 7fe1c60f046e..e1b8298ac451 100644 --- a/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf +++ b/MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf @@ -55,6 +55,7 @@ DebugLib BaseLib RegisterFilterLib + CcProbeLib =20 [LibraryClasses.X64] TdxLib diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLibInternalTdx.c b/MdePkg/= Library/BaseIoLibIntrinsic/IoLibInternalTdx.c index 1e539dbfbbad..8af6fc35c591 100644 --- a/MdePkg/Library/BaseIoLibIntrinsic/IoLibInternalTdx.c +++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLibInternalTdx.c @@ -10,6 +10,7 @@ #include #include #include +#include #include "IoLibTdx.h" =20 // Size of TDVMCALL Access, including IO and MMIO @@ -22,9 +23,6 @@ #define TDVMCALL_ACCESS_READ 0 #define TDVMCALL_ACCESS_WRITE 1 =20 -BOOLEAN mTdxEnabled =3D FALSE; -BOOLEAN mTdxProbed =3D FALSE; - /** Check if it is Tdx guest. =20 @@ -38,14 +36,7 @@ IsTdxGuest ( VOID ) { - if (mTdxProbed) { - return mTdxEnabled; - } - - mTdxEnabled =3D TdIsEnabled (); - mTdxProbed =3D TRUE; - - return mTdxEnabled; + return CcProbe () =3D=3D CCGuestTypeIntelTdx; } =20 /** --=20 2.29.2.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#88975): https://edk2.groups.io/g/devel/message/88975 Mute This Topic: https://groups.io/mt/90516978/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Thu May 16 07:46:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+88976+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+88976+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1650164514; cv=none; d=zohomail.com; s=zohoarc; b=XzJvv9aVB9oecuRF7EybCg6E8DNrgw67ESROB5TJWwFPmjte55Sa3Z7/9vrnSWFv6+cNYZFzicWWrloegFoW51W8QYa2zkL00uyWYNxyPAMaXdozVnGyZTyxnWXJYnxtnpPE2Qm4Keodbw5fKQ87o5c4glese4yEL6mGyZiaosc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1650164514; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=uCzq/YECfLVmqIeY89oH7HRLLR7DGMwtj7RrfrTjFBg=; b=lK5KBg3jKpESY+QszxolhJzSueDU64ZJZxdJepsIgdCEKtIy0ikkGQehfAWEGTc2D60iYil1jdyjdYdN25/uv2li1bqD3e0lZFiv8kdAwyDHWP+63Ese4WeHafouch+NeQlZsC/MA4ZGZ1ku9GwP1kOUwB5AZ97gP06mr10Ynsg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+88976+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1650164514849792.254571901248; Sat, 16 Apr 2022 20:01:54 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id I7oPYY1788612xDOT10MoXqy; Sat, 16 Apr 2022 20:01:54 -0700 X-Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web11.25369.1650164497717213024 for ; Sat, 16 Apr 2022 20:01:53 -0700 X-IronPort-AV: E=McAfee;i="6400,9594,10318"; a="349806299" X-IronPort-AV: E=Sophos;i="5.90,266,1643702400"; d="scan'208";a="349806299" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2022 20:01:53 -0700 X-IronPort-AV: E=Sophos;i="5.90,266,1643702400"; d="scan'208";a="575044389" X-Received: from mxu9-mobl1.ccr.corp.intel.com ([10.255.29.191]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2022 20:01:50 -0700 From: "Min Xu" To: devel@edk2.groups.io Cc: Min Xu , James Bottomley , Jiewen Yao , Gerd Hoffmann , Brijesh Singh , Erdem Aktas , Tom Lendacky Subject: [edk2-devel] [PATCH V3 7/7] OvmfPkg: Call CcProbe in SecMain.c instead of TsIsEnabled Date: Sun, 17 Apr 2022 11:01:13 +0800 Message-Id: In-Reply-To: References: MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,min.m.xu@intel.com X-Gm-Message-State: mNPJcAqamUDRvbCmIniKXFBwx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1650164514; bh=8eEPuxHYak0TqJpZACE8vBL3k/6GkG09lGbzJHAFNLM=; h=Cc:Date:From:Reply-To:Subject:To; b=j356gLG5eFcMCwDNKdzcaYFCKFW1+NsmmCSjeftN/6cCVocvj+C9XxuRndOqDIiXwHV SXLMenT0uttzuDkb4UFrWVN4IiNooS/zTIjyJI1VQhut+Kqf1oUnGm2bH36ACJ1K4JoJt 8s1Zn3kPTyCdOnUyU3gKyLNbyzES5QlzMiM= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1650164515744100014 Content-Type: text/plain; charset="utf-8" BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3902 TdIsEnabled() uses the CPUID instruction. At this point, exception handling is not established and a CPUID instruction will generate a #VC and cause the booting guest to crash. CcProbe() checks Ovmf work area to return the guest type. So call of CcProbe() instead of TdIsEnabled() to fix the above issue. Cc: James Bottomley Cc: Jiewen Yao Cc: Gerd Hoffmann Cc: Brijesh Singh Cc: Erdem Aktas Cc: Tom Lendacky Signed-off-by: Min Xu Reviewed-by: Tom Lendacky --- OvmfPkg/IntelTdx/Sec/SecMain.c | 6 +++--- OvmfPkg/IntelTdx/Sec/SecMain.inf | 1 + OvmfPkg/Sec/SecMain.c | 5 +++-- OvmfPkg/Sec/SecMain.inf | 1 + 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/OvmfPkg/IntelTdx/Sec/SecMain.c b/OvmfPkg/IntelTdx/Sec/SecMain.c index 26d56be335e1..160e56071103 100644 --- a/OvmfPkg/IntelTdx/Sec/SecMain.c +++ b/OvmfPkg/IntelTdx/Sec/SecMain.c @@ -25,7 +25,7 @@ #include #include #include - +#include #include =20 #define SEC_IDT_ENTRY_COUNT 34 @@ -61,7 +61,7 @@ SecCoreStartupWithStack ( UINT32 Index; volatile UINT8 *Table; =20 - if (TdIsEnabled ()) { + if (CcProbe () =3D=3D CCGuestTypeIntelTdx) { // // For Td guests, the memory map info is in TdHobLib. It should be pro= cessed // first so that the memory is accepted. Otherwise access to the unacc= epted @@ -119,7 +119,7 @@ SecCoreStartupWithStack ( // AsmWriteIdtr (&IdtDescriptor); =20 - if (TdIsEnabled ()) { + if (CcProbe () =3D=3D CCGuestTypeIntelTdx) { // // InitializeCpuExceptionHandlers () should be called in Td guests so = that // #VE exceptions can be handled correctly. diff --git a/OvmfPkg/IntelTdx/Sec/SecMain.inf b/OvmfPkg/IntelTdx/Sec/SecMai= n.inf index df2e749c3505..9cf1249d02e5 100644 --- a/OvmfPkg/IntelTdx/Sec/SecMain.inf +++ b/OvmfPkg/IntelTdx/Sec/SecMain.inf @@ -49,6 +49,7 @@ CpuExceptionHandlerLib PeilessStartupLib PlatformInitLib + CcProbeLib =20 [Pcd] gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesBase diff --git a/OvmfPkg/Sec/SecMain.c b/OvmfPkg/Sec/SecMain.c index ca9717a7b526..25da91b37577 100644 --- a/OvmfPkg/Sec/SecMain.c +++ b/OvmfPkg/Sec/SecMain.c @@ -28,6 +28,7 @@ #include #include #include +#include #include "AmdSev.h" =20 #define SEC_IDT_ENTRY_COUNT 34 @@ -738,7 +739,7 @@ SecCoreStartupWithStack ( volatile UINT8 *Table; =20 #if defined (TDX_GUEST_SUPPORTED) - if (TdIsEnabled ()) { + if (CcProbe () =3D=3D CCGuestTypeIntelTdx) { // // For Td guests, the memory map info is in TdHobLib. It should be pro= cessed // first so that the memory is accepted. Otherwise access to the unacc= epted @@ -828,7 +829,7 @@ SecCoreStartupWithStack ( } =20 #if defined (TDX_GUEST_SUPPORTED) - if (TdIsEnabled ()) { + if (CcProbe () =3D=3D CCGuestTypeIntelTdx) { // // InitializeCpuExceptionHandlers () should be called in Td guests so = that // #VE exceptions can be handled correctly. diff --git a/OvmfPkg/Sec/SecMain.inf b/OvmfPkg/Sec/SecMain.inf index 4b5b089ccd69..27100595aeca 100644 --- a/OvmfPkg/Sec/SecMain.inf +++ b/OvmfPkg/Sec/SecMain.inf @@ -54,6 +54,7 @@ LocalApicLib MemEncryptSevLib CpuExceptionHandlerLib + CcProbeLib =20 [Ppis] gEfiTemporaryRamSupportPpiGuid # PPI ALWAYS_PRODUCED --=20 2.29.2.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#88976): https://edk2.groups.io/g/devel/message/88976 Mute This Topic: https://groups.io/mt/90516980/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-