From nobody Sun May 19 01:26:59 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+97469+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+97469+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1671117057; cv=none; d=zohomail.com; s=zohoarc; b=gFSZAOG3tlYWhPyzK4uGHSkJSeA6P8aarVI0TbQHuAA1oAV0bC8rmoptFPoJYka2YHwzWnRJ5jxUInG+obGnxWxydNNyE4H9k9+Z/II5b4DnAGTt+noN2gd/GiEPdo8ueOFt90iLMSgnSujmv41pr97EXtHvkso7QCuV8/0IHj4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671117057; h=Content-Type: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=bIJP9F+gol7/xEabTD7DpTB0SMo1Ikex4xyGFgIFK3I=; b=QnZAInH2POmjkwDBDJecW8jkE6FIe2XoFijaDT4vE12pF6uXV+kVtUuOBGGGg28VTK69XoYYcpA52sjWVPxbZdvREsfa1V4L8N8Ro7zuNqp8BTOXWK18uQ2ChJ0hCZ7wtL3+35Vu5uOVYJwMPsMfAabyj8w4Ht+fs6hJKs9o+CA= 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+97469+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 1671117057105215.875356876904; Thu, 15 Dec 2022 07:10:57 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id GJbcYY1788612x4QzOwopRnC; Thu, 15 Dec 2022 07:10:56 -0800 X-Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mx.groups.io with SMTP id smtpd.web10.135614.1671117052986226917 for ; Thu, 15 Dec 2022 07:10:56 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10561"; a="299048790" X-IronPort-AV: E=Sophos;i="5.96,247,1665471600"; d="scan'208";a="299048790" X-Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Dec 2022 07:10:55 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10561"; a="773759877" X-IronPort-AV: E=Sophos;i="5.96,247,1665471600"; d="scan'208";a="773759877" X-Received: from bholthau-mobl1.ger.corp.intel.com (HELO sboeuf-mobl.home) ([10.252.60.50]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Dec 2022 07:10:14 -0800 From: "Boeuf, Sebastien" To: devel@edk2.groups.io Cc: jiewen.yao@intel.com, min.m.xu@intel.com, kraxel@redhat.com, sebastien.boeuf@intel.com Subject: [edk2-devel] [PATCH v2 1/3] OvmfPkg/PlatformInitLib: Differentiate TDX case for Cloud Hypervisor Date: Thu, 15 Dec 2022 16:10:02 +0100 Message-Id: <4b74449fbc48ed50be509cb0e3d1ba2e9ec1913f.1671116367.git.sebastien.boeuf@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,sebastien.boeuf@intel.com X-Gm-Message-State: PapbZu7NtOrJC0A453sX7PMnx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1671117056; bh=jDCLVBOLuIeQYU1WFQyhveixDgyGtqpbFcMrtFuuS7c=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=eHL6bDszdf2Cr3M8TvXSH+U2v1mr9uCYSVl25ufnlmohdp31tHahUQ6WCSzNGlM3V52 b58kGkAL4kQbMkU0YI6ZChSPDMqxBY9ecA6BG/itEbK9LvDS0xlwIg1LcUVsQI1Igv+OR 5ARw2xdcL6+YMHAKvF9wQkL9NsFZWtvf8Sg= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1671117057324100006 Content-Type: text/plain; charset="utf-8" From: Sebastien Boeuf Rely on the CcProbe() function to identify when running on TDX. This allows the firmware to follow a different codepath for Cloud Hypervisor, which means it doesn't rely on PVH to find out about memory below 4GiB. instead it falls back onto the CMOS to retrieve that information. Signed-off-by: Sebastien Boeuf --- OvmfPkg/Library/PlatformInitLib/MemDetect.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/OvmfPkg/Library/PlatformInitLib/MemDetect.c b/OvmfPkg/Library/= PlatformInitLib/MemDetect.c index b8feae4309..6dbdbf9306 100644 --- a/OvmfPkg/Library/PlatformInitLib/MemDetect.c +++ b/OvmfPkg/Library/PlatformInitLib/MemDetect.c @@ -26,6 +26,7 @@ Module Name: // #include #include +#include #include #include #include @@ -312,7 +313,9 @@ PlatformGetSystemMemorySizeBelow4gb ( UINT8 Cmos0x34; UINT8 Cmos0x35; =20 - if (PlatformInfoHob->HostBridgeDevId =3D=3D CLOUDHV_DEVICE_ID) { + if ((PlatformInfoHob->HostBridgeDevId =3D=3D CLOUDHV_DEVICE_ID) && + (CcProbe () !=3D CcGuestTypeIntelTdx)) + { // Get the information from PVH memmap return (UINT32)GetHighestSystemMemoryAddressFromPvhMemmap (TRUE); } --=20 2.34.1 --------------------------------------------------------------------- Intel Corporation SAS (French simplified joint stock company) Registered headquarters: "Les Montalets"- 2, rue de Paris,=20 92196 Meudon Cedex, France Registration Number: 302 456 199 R.C.S. NANTERRE Capital: 5 208 026.16 Euros This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. -=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 (#97469): https://edk2.groups.io/g/devel/message/97469 Mute This Topic: https://groups.io/mt/95690238/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 Sun May 19 01:26:59 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+97470+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+97470+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1671117060; cv=none; d=zohomail.com; s=zohoarc; b=ORPs7Bdc1N5Gec5uz/y+8V/DB2W+ZdRSn7Xcf9pPAavQqQAZBxtQHpLkbngPc2T5lGPFJxkzi4RhK6vne246S0fwDTP+Z4PWWgaM7AstSzonVrzvCTn/0N2gMFS1g+PE9lbRJemJwnwZE6O2eBmPAxgPc0if/QNGC5ZfQo6gCoY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671117060; h=Content-Type: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=6DVF+UDPoibiKsYvZys4N0/eWEmpbbd3P9EFsRRKeTw=; b=akPVrHxU2TtE27jm8Z4Q72//4gfroVd9r8ZFTcW+pBU70rN/hRKuI++XuuhAMHC3T37pr8TCe5EjD3Fmhd1A/bLwny3ve6rxtSMuKtdOybAhsp/QoRF87laW/YOkMbvqkv4xbjby8kAVGSRMsGOknt6v+yR63CpxsMO9HEY9tjs= 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+97470+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 1671117060396722.8358719119358; Thu, 15 Dec 2022 07:11:00 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id Op8EYY1788612xQ9Y2CIHIhw; Thu, 15 Dec 2022 07:10:59 -0800 X-Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mx.groups.io with SMTP id smtpd.web10.135614.1671117052986226917 for ; Thu, 15 Dec 2022 07:10:58 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10561"; a="299048818" X-IronPort-AV: E=Sophos;i="5.96,247,1665471600"; d="scan'208";a="299048818" X-Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Dec 2022 07:10:58 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10561"; a="773759953" X-IronPort-AV: E=Sophos;i="5.96,247,1665471600"; d="scan'208";a="773759953" X-Received: from bholthau-mobl1.ger.corp.intel.com (HELO sboeuf-mobl.home) ([10.252.60.50]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Dec 2022 07:10:18 -0800 From: "Boeuf, Sebastien" To: devel@edk2.groups.io Cc: jiewen.yao@intel.com, min.m.xu@intel.com, kraxel@redhat.com, sebastien.boeuf@intel.com Subject: [edk2-devel] [PATCH v2 2/3] OvmfPkg/PlatformInitLib: Transfer GUID Extension HOB Date: Thu, 15 Dec 2022 16:10:03 +0100 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,sebastien.boeuf@intel.com X-Gm-Message-State: 2NEWL5MVuF8asgaaLtHpbDJox1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1671117059; bh=WIexnQihuc1lON8r8EDB9a3H7ztP330HF+KvoDPpM/I=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=wX5PZy9CQroUNW/VfFImPcwfPg0YlF/yZdDURMp4xbppX9kg0B8nBL4gCSGJGqO+Afw PA/JbowCME+GS0XHGXAESGkdr0TKybRRBnONdXYR11ZoaYEsiQ5oGP/9x9CIP26XU4H9C 7Q4mngiz+1ofv93nR/ke3/+/prs2wcYYewk= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1671117061387100002 Content-Type: text/plain; charset="utf-8" From: Sebastien Boeuf This is required for passing the ACPI tables from the VMM up to the guest OS. They are transferred through this GUID extension. Signed-off-by: Jiaqi Gao Signed-off-by: Sebastien Boeuf --- OvmfPkg/Library/PlatformInitLib/IntelTdx.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/OvmfPkg/Library/PlatformInitLib/IntelTdx.c b/OvmfPkg/Library/P= latformInitLib/IntelTdx.c index acd114e38e..55ca3ecaa1 100644 --- a/OvmfPkg/Library/PlatformInitLib/IntelTdx.c +++ b/OvmfPkg/Library/PlatformInitLib/IntelTdx.c @@ -547,6 +547,7 @@ TransferTdxHobList ( EFI_PEI_HOB_POINTERS Hob; EFI_RESOURCE_TYPE ResourceType; EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute; + VOID *GuidedData; =20 // // PcdOvmfSecGhcbBase is used as the TD_HOB in Tdx guest. @@ -577,6 +578,10 @@ TransferTdxHobList ( Hob.MemoryAllocation->AllocDescriptor.MemoryType ); break; + case EFI_HOB_TYPE_GUID_EXTENSION: + GuidedData =3D (VOID *)(&Hob.Guid->Name + 1); + BuildGuidDataHob (&Hob.Guid->Name, GuidedData, Hob.Guid->Header.Ho= bLength - sizeof (EFI_HOB_GUID_TYPE)); + break; } =20 Hob.Raw =3D GET_NEXT_HOB (Hob); --=20 2.34.1 --------------------------------------------------------------------- Intel Corporation SAS (French simplified joint stock company) Registered headquarters: "Les Montalets"- 2, rue de Paris,=20 92196 Meudon Cedex, France Registration Number: 302 456 199 R.C.S. NANTERRE Capital: 5 208 026.16 Euros This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. -=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 (#97470): https://edk2.groups.io/g/devel/message/97470 Mute This Topic: https://groups.io/mt/95690239/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 Sun May 19 01:26:59 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+97471+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+97471+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1671117060; cv=none; d=zohomail.com; s=zohoarc; b=mMtHZHiD8H+PkzIgbf6ykW9g9/Jxp5cqeJDK8/Ue+fl+exMCN24AVmH55J3V8EMZw6nCJYvFZERniLYqc/FIw3I1vaysHZmN48mAJrjrd6ov9JYItZWPvRzMR2gvrS/c1gIkbYG0Xqgbkvvh9Fpe7x2kiXT1AU5mLIr8xHGFThA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671117060; h=Content-Type: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=K6I4qxTGqNPnkF6Y6bTa5TGx8SVZuGInL+Dou1GdHdg=; b=l4JLAqTUakJ5108/a+GlcD4n53lBwdi0141Nxvj/Y5vxSamEuQWnRKfGzeyLR/8YotexfMnGHDbZ59zQ6gVZQe1/u4aYOX38rCYeqG4UiyzpngfG/cWgstlx9GrwExhcfXmnCsO5xcdnxI6bS7svu73CNUL3wYMoTU32ZVH8g/Y= 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+97471+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 1671117060955725.6025413064219; Thu, 15 Dec 2022 07:11:00 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id cNpnYY1788612xvU9hpCDcoa; Thu, 15 Dec 2022 07:11:00 -0800 X-Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mx.groups.io with SMTP id smtpd.web10.135614.1671117052986226917 for ; Thu, 15 Dec 2022 07:11:00 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10561"; a="299048831" X-IronPort-AV: E=Sophos;i="5.96,247,1665471600"; d="scan'208";a="299048831" X-Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Dec 2022 07:10:59 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10561"; a="773759999" X-IronPort-AV: E=Sophos;i="5.96,247,1665471600"; d="scan'208";a="773759999" X-Received: from bholthau-mobl1.ger.corp.intel.com (HELO sboeuf-mobl.home) ([10.252.60.50]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Dec 2022 07:10:21 -0800 From: "Boeuf, Sebastien" To: devel@edk2.groups.io Cc: jiewen.yao@intel.com, min.m.xu@intel.com, kraxel@redhat.com, sebastien.boeuf@intel.com Subject: [edk2-devel] [PATCH v2 3/3] OvmfPkg/AcpiPlatformDxe: Differentiate TDX case for Cloud Hypervisor Date: Thu, 15 Dec 2022 16:10:04 +0100 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,sebastien.boeuf@intel.com X-Gm-Message-State: ZyuVZYH9W29SATBXg390p7KBx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1671117060; bh=8cEoA3eM8zeUfvH2O8CW+Wtd59oLpIpc+8k208URn0o=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=fAFBH7NRc9zE64ujTls9YPu2n2jFfC37y32HiUgjhu98bzz+xmhQt1sUv6kROgaxa6F /GjeuJsF1PkOztkacNXQeekPN5lRSYIFbMIZHK6OMW/3S7acyHyWnS8/wQo4phgJJDadb wKKHb83R8Rhk9zg6RNXhSj7ne7SxAdx8FW8= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1671117061457100004 Content-Type: text/plain; charset="utf-8" From: Sebastien Boeuf Rely on CcProbe() to identify when running on TDX so that ACPI tables can be retrieved differently for Cloud Hypervisor. Instead of relying on the PVH structure to find the RSDP pointer, the tables are individually passed through the HOB. Signed-off-by: Jiaqi Gao Signed-off-by: Sebastien Boeuf --- ArmVirtPkg/ArmVirtQemu.dsc | 1 + OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c | 8 +- OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h | 6 ++ OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf | 3 + OvmfPkg/AcpiPlatformDxe/CloudHvAcpi.c | 87 +++++++++++++++++++++ OvmfPkg/OvmfPkg.dec | 1 + 6 files changed, 105 insertions(+), 1 deletion(-) diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc index f77443229e..1dea715e9e 100644 --- a/ArmVirtPkg/ArmVirtQemu.dsc +++ b/ArmVirtPkg/ArmVirtQemu.dsc @@ -68,6 +68,7 @@ VirtNorFlashPlatformLib|ArmVirtPkg/Library/NorFlashQemuLib/NorFlashQemuL= ib.inf =20 CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf + CcProbeLib|MdePkg/Library/CcProbeLibNull/CcProbeLibNull.inf BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf PlatformBootManagerLib|ArmVirtPkg/Library/PlatformBootManagerLib/Platfor= mBootManagerLib.inf PlatformBmPrintScLib|OvmfPkg/Library/PlatformBmPrintScLib/PlatformBmPrin= tScLib.inf diff --git a/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c b/OvmfPkg/AcpiPlatformD= xe/AcpiPlatform.c index fcfb9703bd..0cc3d958be 100644 --- a/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c +++ b/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c @@ -9,6 +9,8 @@ =20 #include // CLOUDHV_DEVICE_ID =20 +#include // CcProbe(), CcGuestTypeIntelTdx + #include "AcpiPlatform.h" =20 /** @@ -33,7 +35,11 @@ InstallAcpiTables ( =20 HostBridgeDevId =3D PcdGet16 (PcdOvmfHostBridgePciDevId); if (HostBridgeDevId =3D=3D CLOUDHV_DEVICE_ID) { - Status =3D InstallCloudHvTables (AcpiTable); + if (CcProbe () =3D=3D CcGuestTypeIntelTdx) { + Status =3D InstallCloudHvTablesTdx (AcpiTable); + } else { + Status =3D InstallCloudHvTables (AcpiTable); + } } else { Status =3D InstallQemuFwCfgTables (AcpiTable); } diff --git a/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h b/OvmfPkg/AcpiPlatformD= xe/AcpiPlatform.h index 342339750d..3ec5098658 100644 --- a/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h +++ b/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h @@ -19,6 +19,12 @@ typedef struct { =20 typedef struct S3_CONTEXT S3_CONTEXT; =20 +EFI_STATUS +EFIAPI +InstallCloudHvTablesTdx ( + IN EFI_ACPI_TABLE_PROTOCOL *AcpiProtocol + ); + EFI_STATUS EFIAPI InstallCloudHvTables ( diff --git a/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf b/OvmfPkg/AcpiPlat= formDxe/AcpiPlatformDxe.inf index 09daf30bcd..1647a90add 100644 --- a/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf +++ b/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf @@ -45,6 +45,8 @@ QemuFwCfgS3Lib UefiBootServicesTableLib UefiDriverEntryPoint + HobLib + CcProbeLib =20 [Protocols] gEfiAcpiTableProtocolGuid # PROTOCOL ALWAYS_CONSUMED @@ -53,6 +55,7 @@ =20 [Guids] gRootBridgesConnectedEventGroupGuid + gUefiOvmfPkgTdxAcpiHobGuid =20 [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration diff --git a/OvmfPkg/AcpiPlatformDxe/CloudHvAcpi.c b/OvmfPkg/AcpiPlatformDx= e/CloudHvAcpi.c index ff59600d3e..cbe8bb9b0c 100644 --- a/OvmfPkg/AcpiPlatformDxe/CloudHvAcpi.c +++ b/OvmfPkg/AcpiPlatformDxe/CloudHvAcpi.c @@ -7,14 +7,101 @@ =20 **/ =20 +#include // EFI_ACPI_DESC= RIPTION_HEADER #include // CLOUDHV_RSDP_= ADDRESS #include // hvm_start_info #include // CpuDeadLoop() #include // DEBUG() #include // PcdGet32() +#include // GetFirstGuidH= ob(), GetNextGuidHob() +#include // gBS + +#include +#include +#include // QEMU_ACPI_TAB= LE_NOTIFY_PROTOCOL =20 #include "AcpiPlatform.h" =20 +EFI_HANDLE mChAcpiHandle =3D NULL; +QEMU_ACPI_TABLE_NOTIFY_PROTOCOL mChAcpiNotifyProtocol; + +EFI_STATUS +EFIAPI +InstallCloudHvTablesTdx ( + IN EFI_ACPI_TABLE_PROTOCOL *AcpiProtocol + ) +{ + EFI_STATUS Status; + UINTN TableHandle; + + EFI_PEI_HOB_POINTERS Hob; + EFI_ACPI_DESCRIPTION_HEADER *CurrentTable; + EFI_ACPI_DESCRIPTION_HEADER *DsdtTable; + + DsdtTable =3D NULL; + TableHandle =3D 0; + + Hob.Guid =3D (EFI_HOB_GUID_TYPE *)GetFirstGuidHob (&gUefiOvmfPkgTdxAcpiH= obGuid); + + while (Hob.Guid !=3D NULL) { + CurrentTable =3D (EFI_ACPI_DESCRIPTION_HEADER *)(&Hob.Guid->Name + 1); + if (!AsciiStrnCmp ((CHAR8 *)&CurrentTable->Signature, "DSDT", 4)) { + DsdtTable =3D CurrentTable; + } else { + // + // Install the tables + // + Status =3D AcpiProtocol->InstallAcpiTable ( + AcpiProtocol, + CurrentTable, + CurrentTable->Length, + &TableHandle + ); + for (UINTN i =3D 0; i < CurrentTable->Length; i++) { + DEBUG ((DEBUG_INFO, " %x", *((UINT8 *)CurrentTable + i))); + } + + DEBUG ((DEBUG_INFO, "\n")); + } + + Hob.Raw =3D GET_NEXT_HOB (Hob.Raw); + Hob.Guid =3D (EFI_HOB_GUID_TYPE *)GetNextGuidHob (&gUefiOvmfPkgTdxAcpi= HobGuid, Hob.Raw); + } + + // + // Install DSDT table. If we reached this point without finding the DSDT, + // then we're out of sync with the hypervisor, and cannot continue. + // + if (DsdtTable =3D=3D NULL) { + DEBUG ((DEBUG_INFO, "%a: no DSDT found\n", __FUNCTION__)); + ASSERT (FALSE); + } + + Status =3D AcpiProtocol->InstallAcpiTable ( + AcpiProtocol, + DsdtTable, + DsdtTable->Length, + &TableHandle + ); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + return Status; + } + + // + // Install a protocol to notify that the ACPI table provided by CH is + // ready. + // + gBS->InstallProtocolInterface ( + &mChAcpiHandle, + &gQemuAcpiTableNotifyProtocolGuid, + EFI_NATIVE_INTERFACE, + &mChAcpiNotifyProtocol + ); + + return EFI_SUCCESS; +} + // Get the ACPI tables from EBDA start EFI_STATUS EFIAPI diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec index 5f5556c67c..a350bb8f84 100644 --- a/OvmfPkg/OvmfPkg.dec +++ b/OvmfPkg/OvmfPkg.dec @@ -151,6 +151,7 @@ gConfidentialComputingSevSnpBlobGuid =3D {0x067b1f5f, 0xcf26, 0x44c5, {= 0x85, 0x54, 0x93, 0xd7, 0x77, 0x91, 0x2d, 0x42}} gUefiOvmfPkgPlatformInfoGuid =3D {0xdec9b486, 0x1f16, 0x47c7, {= 0x8f, 0x68, 0xdf, 0x1a, 0x41, 0x88, 0x8b, 0xa5}} gVMMBootOrderGuid =3D {0x668f4529, 0x63d0, 0x4bb5, {= 0xb6, 0x5d, 0x6f, 0xbb, 0x9d, 0x36, 0xa4, 0x4a}} + gUefiOvmfPkgTdxAcpiHobGuid =3D {0x6a0c5870, 0xd4ed, 0x44f4, {= 0xa1, 0x35, 0xdd, 0x23, 0x8b, 0x6f, 0x0c, 0x8d}} =20 [Ppis] # PPI whose presence in the PPI database signals that the TPM base addre= ss --=20 2.34.1 --------------------------------------------------------------------- Intel Corporation SAS (French simplified joint stock company) Registered headquarters: "Les Montalets"- 2, rue de Paris,=20 92196 Meudon Cedex, France Registration Number: 302 456 199 R.C.S. NANTERRE Capital: 5 208 026.16 Euros This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. -=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 (#97471): https://edk2.groups.io/g/devel/message/97471 Mute This Topic: https://groups.io/mt/95690240/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-