From nobody Fri May 3 13:21:35 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+84211+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+84211+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1638369045; cv=none; d=zohomail.com; s=zohoarc; b=jsHu7Rws71TGaVKZVwZNVgCuDUWd5sIv3cUjcHYV51AFdQbEYMhd+sjDuW+wNpH/GRhd6uZ2m/DMtTJEWwxwSl78nGL5N1aEVNAvCon+EZeadjLheRdiBaKzdB7kwZQBzKpMP2o0ISQpZKVaM10c+PJz2PdT0Xw9SGiianz6eko= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638369045; 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=hEQFqjjyVjICAPbfCNB3gIkq6/36mgC8jUw3Aoe3WXA=; b=IVIqbYLqKMK5vC+gMstC5OvSpoWwuFtOvNcVdwxDfx3Tku5cTzU0W3nNR6PuswoTfa7kyCK7Xd+9JG1ByfXrKaW+bE94pUzUTO08J3dEdWs9SXDSRuVIY3JOvvjylrCwtYZGGND14/xZ6d5+fibrcZ/wp4z29ik9SENX/leNFOg= 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+84211+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 1638369045706391.6144591991268; Wed, 1 Dec 2021 06:30:45 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id AftHYY1788612xtAD1gIevXB; Wed, 01 Dec 2021 06:30:45 -0800 X-Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web12.90681.1638360143585272139 for ; Wed, 01 Dec 2021 04:02:24 -0800 X-IronPort-AV: E=McAfee;i="6200,9189,10184"; a="322689213" X-IronPort-AV: E=Sophos;i="5.87,278,1631602800"; d="scan'208";a="322689213" X-Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2021 04:02:18 -0800 X-IronPort-AV: E=Sophos;i="5.87,278,1631602800"; d="scan'208";a="596306870" X-Received: from rshussey-mobl1.ger.corp.intel.com (HELO sboeuf-mobl.home) ([10.252.26.82]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2021 04:02:14 -0800 From: sebastien.boeuf@intel.com To: devel@edk2.groups.io Cc: jiewen.yao@intel.com, jordan.l.justen@intel.com, kraxel@redhat.com, sebastien.boeuf@intel.com Subject: [edk2-devel] [PATCH 1/5] OvmfPkg: Handle Cloud Hypervisor host bridge Date: Wed, 1 Dec 2021 13:01:44 +0100 Message-Id: <699f8ae9384b47d66f35f3ab939014190049cdab.1638351613.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: zwKEdDA2aBLk4FAv9FWALsYFx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1638369045; bh=ZeBNCQUVbnJBgfh+Da0+DZPsWkT5aOrpJw881ogL574=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=ho8PFgkxsP68P7G6XXW9PbkOWVm7IQ/MwkPraH79JjaBgwPrSymNLpxrvsPDbJi3/PL vSIkLhlC5ul/k5+bR0r9dVArTx0sc9cOtATA4I7DpRbnyZ0YYAbdH1P+TNAMaBWEwIsen 1LC5EJGJaIkZoOFcPopZmRCfJTgoWTS5Y/Q= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1638369047833100001 Content-Type: text/plain; charset="utf-8" From: Sebastien Boeuf Handle things differently when the detected host bridge matches the Cloud Hypervisor PCI host bridge identifier. Signed-off-by: Rob Bradford Signed-off-by: Sebastien Boeuf --- OvmfPkg/Csm/CsmSupportLib/LegacyInterrupt.c | 1 + OvmfPkg/Csm/CsmSupportLib/LegacyRegion.c | 1 + OvmfPkg/Csm/CsmSupportLib/LegacyRegion.h | 1 + OvmfPkg/Include/IndustryStandard/CloudHv.h | 35 +++++++++++ OvmfPkg/Include/OvmfPlatforms.h | 1 + .../Library/AcpiTimerLib/BaseAcpiTimerLib.c | 3 + .../AcpiTimerLib/BaseRomAcpiTimerLib.c | 4 ++ .../Library/AcpiTimerLib/DxeAcpiTimerLib.c | 3 + .../PlatformBootManagerLib/BdsPlatform.c | 1 + .../ResetSystemLib/BaseResetShutdown.c | 3 + .../Library/ResetSystemLib/DxeResetShutdown.c | 11 +++- OvmfPkg/PlatformPei/MemDetect.c | 63 ++++++++++--------- OvmfPkg/PlatformPei/Platform.c | 11 +++- 13 files changed, 105 insertions(+), 33 deletions(-) create mode 100644 OvmfPkg/Include/IndustryStandard/CloudHv.h diff --git a/OvmfPkg/Csm/CsmSupportLib/LegacyInterrupt.c b/OvmfPkg/Csm/CsmS= upportLib/LegacyInterrupt.c index 97ca21945f..50c9322911 100644 --- a/OvmfPkg/Csm/CsmSupportLib/LegacyInterrupt.c +++ b/OvmfPkg/Csm/CsmSupportLib/LegacyInterrupt.c @@ -189,6 +189,7 @@ LegacyInterruptInstall ( mLegacyInterruptDevice =3D LEGACY_INT_DEV_PIIX4; break; case INTEL_Q35_MCH_DEVICE_ID: + case CLOUDHV_DEVICE_ID: // Cloud Hypervisor host bridge mLegacyInterruptDevice =3D LEGACY_INT_DEV_Q35; break; default: diff --git a/OvmfPkg/Csm/CsmSupportLib/LegacyRegion.c b/OvmfPkg/Csm/CsmSupp= ortLib/LegacyRegion.c index fe9ae27c9d..9d6d6faf48 100644 --- a/OvmfPkg/Csm/CsmSupportLib/LegacyRegion.c +++ b/OvmfPkg/Csm/CsmSupportLib/LegacyRegion.c @@ -474,6 +474,7 @@ LegacyRegionInit ( mRegisterValues =3D mRegisterValues440; break; case INTEL_Q35_MCH_DEVICE_ID: + case CLOUDHV_DEVICE_ID: // Cloud Hypervisor host bridge mRegisterValues =3D mRegisterValuesQ35; break; default: diff --git a/OvmfPkg/Csm/CsmSupportLib/LegacyRegion.h b/OvmfPkg/Csm/CsmSupp= ortLib/LegacyRegion.h index e18cb97949..71df8f5fb2 100644 --- a/OvmfPkg/Csm/CsmSupportLib/LegacyRegion.h +++ b/OvmfPkg/Csm/CsmSupportLib/LegacyRegion.h @@ -17,6 +17,7 @@ #include #include #include +#include =20 #include #include diff --git a/OvmfPkg/Include/IndustryStandard/CloudHv.h b/OvmfPkg/Include/I= ndustryStandard/CloudHv.h new file mode 100644 index 0000000000..6ab18ad50d --- /dev/null +++ b/OvmfPkg/Include/IndustryStandard/CloudHv.h @@ -0,0 +1,35 @@ +/** @file + Various defines related to Cloud Hypervisor + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ +#ifndef __CLOUDHV_H__ +#define __CLOUDHV_H__ + +// +// Host Bridge Device ID +// +#define CLOUDHV_DEVICE_ID 0x0d57 + +// +// ACPI timer address +// +#define CLOUDHV_ACPI_TIMER_IO_ADDRESS 0xb008 + +// +// ACPI shutdown device address +// +#define CLOUDHV_ACPI_SHUTDOWN_IO_ADDRESS 0x03c0 + +// +// 32-bit MMIO memory hole base address +// +#define CLOUDHV_MMIO_HOLE_ADDRESS 0xc0000000 + +// +// 32-bit MMIO memory hole size +// +#define CLOUDHV_MMIO_HOLE_SIZE 0x38000000 + +#endif // __CLOUDHV_H__ diff --git a/OvmfPkg/Include/OvmfPlatforms.h b/OvmfPkg/Include/OvmfPlatform= s.h index 3b85593b70..ad0b0d2803 100644 --- a/OvmfPkg/Include/OvmfPlatforms.h +++ b/OvmfPkg/Include/OvmfPlatforms.h @@ -16,6 +16,7 @@ #include #include #include +#include =20 // // OVMF Host Bridge DID Address diff --git a/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.c b/OvmfPkg/Libr= ary/AcpiTimerLib/BaseAcpiTimerLib.c index 7c593e8be1..e182ac2b7d 100644 --- a/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.c +++ b/OvmfPkg/Library/AcpiTimerLib/BaseAcpiTimerLib.c @@ -55,6 +55,9 @@ AcpiTimerLibConstructor ( AcpiCtlReg =3D POWER_MGMT_REGISTER_Q35 (ICH9_ACPI_CNTL); AcpiEnBit =3D ICH9_ACPI_CNTL_ACPI_EN; break; + case CLOUDHV_DEVICE_ID: + mAcpiTimerIoAddr =3D CLOUDHV_ACPI_TIMER_IO_ADDRESS; + return RETURN_SUCCESS; default: DEBUG ((DEBUG_ERROR, "%a: Unknown Host Bridge Device ID: 0x%04x\n", __FUNCTION__, HostBridgeDevId)); diff --git a/OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.c b/OvmfPkg/L= ibrary/AcpiTimerLib/BaseRomAcpiTimerLib.c index 52f3ea2dbf..a223153b2b 100644 --- a/OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.c +++ b/OvmfPkg/Library/AcpiTimerLib/BaseRomAcpiTimerLib.c @@ -53,6 +53,8 @@ AcpiTimerLibConstructor ( AcpiCtlReg =3D POWER_MGMT_REGISTER_Q35 (ICH9_ACPI_CNTL); AcpiEnBit =3D ICH9_ACPI_CNTL_ACPI_EN; break; + case CLOUDHV_DEVICE_ID: + return RETURN_SUCCESS; default: DEBUG ((DEBUG_ERROR, "%a: Unknown Host Bridge Device ID: 0x%04x\n", __FUNCTION__, HostBridgeDevId)); @@ -107,6 +109,8 @@ InternalAcpiGetTimerTick ( case INTEL_Q35_MCH_DEVICE_ID: Pmba =3D POWER_MGMT_REGISTER_Q35 (ICH9_PMBASE); break; + case CLOUDHV_DEVICE_ID: + return IoRead32 (CLOUDHV_ACPI_TIMER_IO_ADDRESS); default: DEBUG ((DEBUG_ERROR, "%a: Unknown Host Bridge Device ID: 0x%04x\n", __FUNCTION__, HostBridgeDevId)); diff --git a/OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.c b/OvmfPkg/Libra= ry/AcpiTimerLib/DxeAcpiTimerLib.c index 09076c0ade..3c9efb926f 100644 --- a/OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.c +++ b/OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.c @@ -50,6 +50,9 @@ AcpiTimerLibConstructor ( case INTEL_Q35_MCH_DEVICE_ID: Pmba =3D POWER_MGMT_REGISTER_Q35 (ICH9_PMBASE); break; + case CLOUDHV_DEVICE_ID: + mAcpiTimerIoAddr =3D CLOUDHV_ACPI_TIMER_IO_ADDRESS; + return RETURN_SUCCESS; default: DEBUG ((DEBUG_ERROR, "%a: Unknown Host Bridge Device ID: 0x%04x\n", __FUNCTION__, HostBridgeDevId)); diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c b/OvmfPkg= /Library/PlatformBootManagerLib/BdsPlatform.c index 186401296a..50bfb45351 100644 --- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c +++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c @@ -1282,6 +1282,7 @@ PciAcpiInitialization ( PciWrite8 (PCI_LIB_ADDRESS (0, 0x1f, 0, 0x6b), PciHostIrqs[3]); // H break; case MICROVM_PSEUDO_DEVICE_ID: + case CLOUDHV_DEVICE_ID: return; default: if (XenDetected ()) { diff --git a/OvmfPkg/Library/ResetSystemLib/BaseResetShutdown.c b/OvmfPkg/L= ibrary/ResetSystemLib/BaseResetShutdown.c index 21c80e4323..ba92299a3c 100644 --- a/OvmfPkg/Library/ResetSystemLib/BaseResetShutdown.c +++ b/OvmfPkg/Library/ResetSystemLib/BaseResetShutdown.c @@ -40,6 +40,9 @@ ResetShutdown ( case INTEL_Q35_MCH_DEVICE_ID: AcpiPmBaseAddress =3D ICH9_PMBASE_VALUE; break; + case CLOUDHV_DEVICE_ID: + IoWrite8 (CLOUDHV_ACPI_SHUTDOWN_IO_ADDRESS, 5 << 2 | 1 << 5); + CpuDeadLoop (); default: ASSERT (FALSE); CpuDeadLoop (); diff --git a/OvmfPkg/Library/ResetSystemLib/DxeResetShutdown.c b/OvmfPkg/Li= brary/ResetSystemLib/DxeResetShutdown.c index 5a75c32df3..a1c59ad042 100644 --- a/OvmfPkg/Library/ResetSystemLib/DxeResetShutdown.c +++ b/OvmfPkg/Library/ResetSystemLib/DxeResetShutdown.c @@ -34,6 +34,9 @@ DxeResetInit ( case INTEL_Q35_MCH_DEVICE_ID: mAcpiPmBaseAddress =3D ICH9_PMBASE_VALUE; break; + case CLOUDHV_DEVICE_ID: + mAcpiPmBaseAddress =3D 0; + break; default: ASSERT (FALSE); CpuDeadLoop (); @@ -56,7 +59,11 @@ ResetShutdown ( VOID ) { - IoBitFieldWrite16 (mAcpiPmBaseAddress + 4, 10, 13, 0); - IoOr16 (mAcpiPmBaseAddress + 4, BIT13); + if (mAcpiPmBaseAddress =3D=3D 0) { + IoWrite8 (CLOUDHV_ACPI_SHUTDOWN_IO_ADDRESS, 5 << 2 | 1 << 5); + } else { + IoBitFieldWrite16 (mAcpiPmBaseAddress + 4, 10, 13, 0); + IoOr16 (mAcpiPmBaseAddress + 4, BIT13); + } CpuDeadLoop (); } diff --git a/OvmfPkg/PlatformPei/MemDetect.c b/OvmfPkg/PlatformPei/MemDetec= t.c index d736b85e0d..a534d7845d 100644 --- a/OvmfPkg/PlatformPei/MemDetect.c +++ b/OvmfPkg/PlatformPei/MemDetect.c @@ -16,6 +16,7 @@ Module Name: #include #include #include +#include #include #include =20 @@ -135,21 +136,24 @@ QemuUc32BaseInitialization ( UINT32 LowerMemorySize; UINT32 Uc32Size; =20 - if (mHostBridgeDevId =3D=3D 0xffff /* microvm */) { - return; - } - - if (mHostBridgeDevId =3D=3D INTEL_Q35_MCH_DEVICE_ID) { - // - // On q35, the 32-bit area that we'll mark as UC, through variable MTR= Rs, - // starts at PcdPciExpressBaseAddress. The platform DSC is responsible= for - // setting PcdPciExpressBaseAddress such that describing the - // [PcdPciExpressBaseAddress, 4GB) range require a very small number of - // variable MTRRs (preferably 1 or 2). - // - ASSERT (FixedPcdGet64 (PcdPciExpressBaseAddress) <=3D MAX_UINT32); - mQemuUc32Base =3D (UINT32)FixedPcdGet64 (PcdPciExpressBaseAddress); - return; + switch (mHostBridgeDevId) { + case INTEL_Q35_MCH_DEVICE_ID: + // + // On q35, the 32-bit area that we'll mark as UC, through variable M= TRRs, + // starts at PcdPciExpressBaseAddress. The platform DSC is responsib= le for + // setting PcdPciExpressBaseAddress such that describing the + // [PcdPciExpressBaseAddress, 4GB) range require a very small number= of + // variable MTRRs (preferably 1 or 2). + // + ASSERT (FixedPcdGet64 (PcdPciExpressBaseAddress) <=3D MAX_UINT32); + mQemuUc32Base =3D (UINT32)FixedPcdGet64 (PcdPciExpressBaseAddress); + return; + case 0xffff: /* microvm */ + return; + case CLOUDHV_DEVICE_ID: + Uc32Size =3D CLOUDHV_MMIO_HOLE_SIZE; + mQemuUc32Base =3D CLOUDHV_MMIO_HOLE_ADDRESS; + return; } =20 ASSERT (mHostBridgeDevId =3D=3D INTEL_82441_DEVICE_ID); @@ -778,21 +782,22 @@ QemuInitializeRam ( if (IsMtrrSupported ()) { MtrrGetAllMtrrs (&MtrrSettings); =20 - // - // MTRRs disabled, fixed MTRRs disabled, default type is uncached - // - ASSERT ((MtrrSettings.MtrrDefType & BIT11) =3D=3D 0); - ASSERT ((MtrrSettings.MtrrDefType & BIT10) =3D=3D 0); - ASSERT ((MtrrSettings.MtrrDefType & 0xFF) =3D=3D 0); - - // - // flip default type to writeback - // - SetMem (&MtrrSettings.Fixed, sizeof MtrrSettings.Fixed, 0x06); - ZeroMem (&MtrrSettings.Variables, sizeof MtrrSettings.Variables); - MtrrSettings.MtrrDefType |=3D BIT11 | BIT10 | 6; - MtrrSetAllMtrrs (&MtrrSettings); + if (mHostBridgeDevId !=3D CLOUDHV_DEVICE_ID) { + // + // MTRRs disabled, fixed MTRRs disabled, default type is uncached + // + ASSERT ((MtrrSettings.MtrrDefType & BIT11) =3D=3D 0); + ASSERT ((MtrrSettings.MtrrDefType & BIT10) =3D=3D 0); + ASSERT ((MtrrSettings.MtrrDefType & 0xFF) =3D=3D 0); =20 + // + // flip default type to writeback + // + SetMem (&MtrrSettings.Fixed, sizeof MtrrSettings.Fixed, 0x06); + ZeroMem (&MtrrSettings.Variables, sizeof MtrrSettings.Variables); + MtrrSettings.MtrrDefType |=3D BIT11 | BIT10 | 6; + MtrrSetAllMtrrs (&MtrrSettings); + } // // Set memory range from 640KB to 1MB to uncacheable // diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c index df2d9ad015..cad6a49680 100644 --- a/OvmfPkg/PlatformPei/Platform.c +++ b/OvmfPkg/PlatformPei/Platform.c @@ -346,6 +346,9 @@ MiscInitialization ( // BuildCpuHob (mPhysMemAddressWidth, 16); =20 + PcdStatus =3D PcdSet16S (PcdOvmfHostBridgePciDevId, mHostBridgeDevId); + ASSERT_RETURN_ERROR (PcdStatus); + // // Determine platform type and save Host Bridge DID to PCD // @@ -372,14 +375,18 @@ MiscInitialization ( MICROVM_PSEUDO_DEVICE_ID); ASSERT_RETURN_ERROR (PcdStatus); return; + case CLOUDHV_DEVICE_ID: + DEBUG ((DEBUG_INFO, "%a: Cloud Hypervisor host bridge\n", __FUNCTION= __)); + PcdStatus =3D PcdSet16S (PcdOvmfHostBridgePciDevId, + CLOUDHV_DEVICE_ID); + ASSERT_RETURN_ERROR (PcdStatus); + return; default: DEBUG ((DEBUG_ERROR, "%a: Unknown Host Bridge Device ID: 0x%04x\n", __FUNCTION__, mHostBridgeDevId)); ASSERT (FALSE); return; } - PcdStatus =3D PcdSet16S (PcdOvmfHostBridgePciDevId, mHostBridgeDevId); - ASSERT_RETURN_ERROR (PcdStatus); =20 // // If the appropriate IOspace enable bit is set, assume the ACPI PMBA has --=20 2.30.2 --------------------------------------------------------------------- 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: 4,572,000 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 (#84211): https://edk2.groups.io/g/devel/message/84211 Mute This Topic: https://groups.io/mt/87429204/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 Fri May 3 13:21:35 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+84212+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+84212+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1638369046; cv=none; d=zohomail.com; s=zohoarc; b=Anhv0Aut1pANWCAYQ8aBoz8v7vDc2LGqwAspSwlDKTVp6vwFwPZ7NNxXLchvrwRYZYCxPS9RvS4QRYZhHu1JyzN9LTsozoBLOIksJNCMcna3x3aaJWffpW8xhCfIbPqK6cOIU+a8GWRQWFe4OlGqgawDbpVVI7o4vGI5fKfMxhY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638369046; 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=h1ON0Ff/cfggPBE/FmjUVS9ly1oEps9h1vWKIn7wSWk=; b=cSsrKv7EeFMkS3aOJD3c2XjyJn46PFJqdNLgXuTKd5C/Kj1HJWUvhbLVaOCmSsqF6z++/jROw1Ws8HvFC1dWhe4n3kVm+Zz8mxfPoGUUAeLxFKjxYq1IUzt/OXQ5SKRiiSVOix3Vn+mlPiJTm1Ic1V75wPiq3qFi5RJIDtHTh5w= 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+84212+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 1638369046397194.70738551386273; Wed, 1 Dec 2021 06:30:46 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id HZ7qYY1788612xWfBtfxSyyu; Wed, 01 Dec 2021 06:30:46 -0800 X-Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web10.91141.1638360146736469616 for ; Wed, 01 Dec 2021 04:02:27 -0800 X-IronPort-AV: E=McAfee;i="6200,9189,10184"; a="236671917" X-IronPort-AV: E=Sophos;i="5.87,278,1631602800"; d="scan'208";a="236671917" X-Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2021 04:02:26 -0800 X-IronPort-AV: E=Sophos;i="5.87,278,1631602800"; d="scan'208";a="596307005" X-Received: from rshussey-mobl1.ger.corp.intel.com (HELO sboeuf-mobl.home) ([10.252.26.82]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2021 04:02:24 -0800 From: sebastien.boeuf@intel.com To: devel@edk2.groups.io Cc: jiewen.yao@intel.com, jordan.l.justen@intel.com, kraxel@redhat.com, sebastien.boeuf@intel.com Subject: [edk2-devel] [PATCH 2/5] OvmfPkg: Create global entry point for SMBIOS parsing Date: Wed, 1 Dec 2021 13:01:45 +0100 Message-Id: <2d3f6b15c1b6a944869cab87858e108a6131fe86.1638351613.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: 9CP66H3T2Q846NDiXSmKQ11ex1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1638369046; bh=eySQfbzNOVq25CiVrV1sZex91Kvw9tYnQbPLaXjBsY4=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=W/MIr9RkW9bnOX1k2zmh54lZgdveEtrwqo8R/qXclTNigmIu1+Lm6ffOMmEF9Xh3qFI Gkl6zNKYjl+vqGvGaAeX9cU+CyE4iLgr4zDWhRT4YZGGOSwkfYwsgUmYASsXMjFVBT3av duewMhWuANbFi2x7MN5EzKPVg2TdLLGpCMY= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1638369048023100005 Content-Type: text/plain; charset="utf-8" From: Sebastien Boeuf Move the generic entry point part out of Qemu.c to anticipate the addition of new ways of retrieving the SMBIOS table. Signed-off-by: Sebastien Boeuf --- OvmfPkg/SmbiosPlatformDxe/EntryPoint.c | 47 +++++++++++++++++++ OvmfPkg/SmbiosPlatformDxe/Qemu.c | 35 -------------- .../SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 1 + 3 files changed, 48 insertions(+), 35 deletions(-) create mode 100644 OvmfPkg/SmbiosPlatformDxe/EntryPoint.c diff --git a/OvmfPkg/SmbiosPlatformDxe/EntryPoint.c b/OvmfPkg/SmbiosPlatfor= mDxe/EntryPoint.c new file mode 100644 index 0000000000..d3b1836a04 --- /dev/null +++ b/OvmfPkg/SmbiosPlatformDxe/EntryPoint.c @@ -0,0 +1,47 @@ +/** @file + Find and extract SMBIOS data. + + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include // FreePool() + +#include "SmbiosPlatformDxe.h" + +UINT8 * +GetQemuSmbiosTables ( + VOID + ); + +/** + Installs SMBIOS information for OVMF + + @param ImageHandle Module's image handle + @param SystemTable Pointer of EFI_SYSTEM_TABLE + + @retval EFI_SUCCESS Smbios data successfully installed + @retval Other Smbios data was not installed + +**/ +EFI_STATUS +EFIAPI +SmbiosTablePublishEntry ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + UINT8 *SmbiosTables; + + Status =3D EFI_NOT_FOUND; + // + // Add QEMU SMBIOS data if found + // + SmbiosTables =3D GetQemuSmbiosTables (); + if (SmbiosTables !=3D NULL) { + Status =3D InstallAllStructures (SmbiosTables); + FreePool (SmbiosTables); + } + + return Status; +} diff --git a/OvmfPkg/SmbiosPlatformDxe/Qemu.c b/OvmfPkg/SmbiosPlatformDxe/Q= emu.c index a668c6ac21..56e720aa08 100644 --- a/OvmfPkg/SmbiosPlatformDxe/Qemu.c +++ b/OvmfPkg/SmbiosPlatformDxe/Qemu.c @@ -11,8 +11,6 @@ #include // PcdGetBool() #include // QemuFwCfgFindFile() =20 -#include "SmbiosPlatformDxe.h" - /** Locates and extracts the QEMU SMBIOS data if present in fw_cfg =20 @@ -48,36 +46,3 @@ GetQemuSmbiosTables ( =20 return QemuTables; } - -/** - Installs SMBIOS information for OVMF - - @param ImageHandle Module's image handle - @param SystemTable Pointer of EFI_SYSTEM_TABLE - - @retval EFI_SUCCESS Smbios data successfully installed - @retval Other Smbios data was not installed - -**/ -EFI_STATUS -EFIAPI -SmbiosTablePublishEntry ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_STATUS Status; - UINT8 *SmbiosTables; - - Status =3D EFI_NOT_FOUND; - // - // Add QEMU SMBIOS data if found - // - SmbiosTables =3D GetQemuSmbiosTables (); - if (SmbiosTables !=3D NULL) { - Status =3D InstallAllStructures (SmbiosTables); - FreePool (SmbiosTables); - } - - return Status; -} diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf b/OvmfPkg/Smbi= osPlatformDxe/SmbiosPlatformDxe.inf index eaee73110d..e239a631f2 100644 --- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf +++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf @@ -24,6 +24,7 @@ # =20 [Sources] + EntryPoint.c Qemu.c SmbiosPlatformDxe.c SmbiosPlatformDxe.h --=20 2.30.2 --------------------------------------------------------------------- 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: 4,572,000 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 (#84212): https://edk2.groups.io/g/devel/message/84212 Mute This Topic: https://groups.io/mt/87429205/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 Fri May 3 13:21:35 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+84213+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+84213+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1638369046; cv=none; d=zohomail.com; s=zohoarc; b=Ug313Xzbnek0grHqt36rMvg2rJKoLamxdHAtuOH8u9ms/auPWr1bNuqMRFBITO6VaG05bw5SFREO300wxb6qfxVYEjB6E3HRhYYKg9hhfTdKj8APx3ROT3imkdp0qkS0VPSs2yYV5LYsohRDOx6+XRQ+dU19l/8Fxm59bCrPxIs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638369046; 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=SQII+M1xDjMk7K7qx4DDGeSwMHPnH2jLuJDh/YWFbsw=; b=iIOyb3RfxD8dcSMp2/AsnKV0SQieiHIxV0ZAvPi36at3hz93Db18Py7srJp4FvR4zFLyeGEdQDua88YFkcrOTRbK/G6Y6KX7CkPugjG4YQTJGU63/FvUG7TyG+sJ8ivF4b5eTsfS75PtfaJJacGHphjp3j0bWcgBx/EUsUfWwLM= 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+84213+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 1638369046783844.0089951722981; Wed, 1 Dec 2021 06:30:46 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id U4ymYY1788612xACzk55nFvj; Wed, 01 Dec 2021 06:30:46 -0800 X-Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web10.91144.1638360157889179909 for ; Wed, 01 Dec 2021 04:02:38 -0800 X-IronPort-AV: E=McAfee;i="6200,9189,10184"; a="233946374" X-IronPort-AV: E=Sophos;i="5.87,278,1631602800"; d="scan'208";a="233946374" X-Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2021 04:02:35 -0800 X-IronPort-AV: E=Sophos;i="5.87,278,1631602800"; d="scan'208";a="596307141" X-Received: from rshussey-mobl1.ger.corp.intel.com (HELO sboeuf-mobl.home) ([10.252.26.82]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2021 04:02:33 -0800 From: sebastien.boeuf@intel.com To: devel@edk2.groups.io Cc: jiewen.yao@intel.com, jordan.l.justen@intel.com, kraxel@redhat.com, sebastien.boeuf@intel.com Subject: [edk2-devel] [PATCH 3/5] OvmfPkg: Retrieve SMBIOS from Cloud Hypervisor Date: Wed, 1 Dec 2021 13:01:46 +0100 Message-Id: <5b0c68b9298a088d283b7ebf78b5b542517c946d.1638351613.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: ifkvX1JQHfIcmSPOiwqCFLHFx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1638369046; bh=UJPUPY/9TftMXLFYQUgaUy9hHSzW5aBhdVcQg+vYtxc=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=sJvXgaEwCREfpJc0sp9bfY+L/7kiHMaRO0M6Y7c8C8P8LK6GcrPKeR4yO81R15zaXAL IEK1qbeZe7r5hXoZy3KDMentBE3wey/9Opqp9npFPdL9qrW5AptC7nmQjal1ZOgQmlGGd h6cignUFbxbZzUb4HIEOp0DrUN7UijZ9hyc= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1638369048427100009 Content-Type: text/plain; charset="utf-8" From: Sebastien Boeuf Add a fallback on the SMBIOS code to find the SMBIOS table for Cloud Hypervisor if it couldn't be found for Qemu through fw_cfg. Signed-off-by: Rob Bradford Signed-off-by: Sebastien Boeuf --- OvmfPkg/Include/IndustryStandard/CloudHv.h | 5 +++ OvmfPkg/SmbiosPlatformDxe/CloudHv.c | 32 +++++++++++++++++++ OvmfPkg/SmbiosPlatformDxe/EntryPoint.c | 23 +++++++++++-- .../SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 1 + 4 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 OvmfPkg/SmbiosPlatformDxe/CloudHv.c diff --git a/OvmfPkg/Include/IndustryStandard/CloudHv.h b/OvmfPkg/Include/I= ndustryStandard/CloudHv.h index 6ab18ad50d..ad0e170795 100644 --- a/OvmfPkg/Include/IndustryStandard/CloudHv.h +++ b/OvmfPkg/Include/IndustryStandard/CloudHv.h @@ -32,4 +32,9 @@ // #define CLOUDHV_MMIO_HOLE_SIZE 0x38000000 =20 +// +// SMBIOS address +// +#define CLOUDHV_SMBIOS_ADDRESS 0xf0000 + #endif // __CLOUDHV_H__ diff --git a/OvmfPkg/SmbiosPlatformDxe/CloudHv.c b/OvmfPkg/SmbiosPlatformDx= e/CloudHv.c new file mode 100644 index 0000000000..f56a810684 --- /dev/null +++ b/OvmfPkg/SmbiosPlatformDxe/CloudHv.c @@ -0,0 +1,32 @@ +/** @file + Find Cloud Hypervisor SMBIOS data. + + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include // CLOUDHV_SMBIOS_ADDRESS +#include // SMBIOS_TABLE_3_0_ENTRY_POINT + +/** + Locates and extracts the QEMU SMBIOS data if present in fw_cfg + + @return Address of extracted QEMU SMBIOS data + +**/ +UINT8 * +GetCloudHvSmbiosTables ( + VOID + ) +{ + SMBIOS_TABLE_3_0_ENTRY_POINT *CloudHvTables =3D (VOID *)CLOUDHV_SMBIOS_A= DDRESS; + + if (CloudHvTables->AnchorString[0] =3D=3D '_' && + CloudHvTables->AnchorString[1] =3D=3D 'S' && + CloudHvTables->AnchorString[2] =3D=3D 'M' && + CloudHvTables->AnchorString[3] =3D=3D '3' && + CloudHvTables->AnchorString[4] =3D=3D '_') { + return (UINT8*)(UINTN)CloudHvTables->TableAddress; + } + + return NULL; +} diff --git a/OvmfPkg/SmbiosPlatformDxe/EntryPoint.c b/OvmfPkg/SmbiosPlatfor= mDxe/EntryPoint.c index d3b1836a04..28faabb46a 100644 --- a/OvmfPkg/SmbiosPlatformDxe/EntryPoint.c +++ b/OvmfPkg/SmbiosPlatformDxe/EntryPoint.c @@ -8,6 +8,11 @@ =20 #include "SmbiosPlatformDxe.h" =20 +UINT8 * +GetCloudHvSmbiosTables ( + VOID + ); + UINT8 * GetQemuSmbiosTables ( VOID @@ -32,14 +37,28 @@ SmbiosTablePublishEntry ( { EFI_STATUS Status; UINT8 *SmbiosTables; + BOOLEAN FreeTables =3D FALSE; =20 Status =3D EFI_NOT_FOUND; // // Add QEMU SMBIOS data if found // SmbiosTables =3D GetQemuSmbiosTables (); - if (SmbiosTables !=3D NULL) { - Status =3D InstallAllStructures (SmbiosTables); + if (SmbiosTables =3D=3D NULL) { + SmbiosTables =3D GetCloudHvSmbiosTables (); + if (SmbiosTables =3D=3D NULL) { + return EFI_NOT_FOUND; + } + } else { + FreeTables =3D TRUE; + } + + Status =3D InstallAllStructures (SmbiosTables); + + // + // Free SmbiosTables if allocated by Qemu. + // + if (FreeTables) { FreePool (SmbiosTables); } =20 diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf b/OvmfPkg/Smbi= osPlatformDxe/SmbiosPlatformDxe.inf index e239a631f2..365d96241e 100644 --- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf +++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf @@ -24,6 +24,7 @@ # =20 [Sources] + CloudHv.c EntryPoint.c Qemu.c SmbiosPlatformDxe.c --=20 2.30.2 --------------------------------------------------------------------- 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: 4,572,000 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 (#84213): https://edk2.groups.io/g/devel/message/84213 Mute This Topic: https://groups.io/mt/87429206/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 Fri May 3 13:21:35 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+84214+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+84214+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1638369047; cv=none; d=zohomail.com; s=zohoarc; b=TO3MqjRnWMx2xvJvg1FsS7Mjh143+PuoIYdFmZllI6XjxCrnbD5pewirQ3TJgsJzj8lUB1hIXs6RWBWdOuot4JopXPTkQs3ppg9uVmJ/Axn4rpLM47cCACmIX7WU91Ecfk3pAvhh5eXFRg6qW4R9ndSH4B85WrJABGSC02nsl0w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638369047; 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=/6NmEtL4B0D6/3CBxdrxGhYOfa1B3UuqJu0xiuuLxrw=; b=nGUfgVkkWH2525a0FsVCjWtfPfUqTJOR9jOCeoSkQ0WXq5Wu0YE6nBcgvRs7ckujdfiH2sH7aObDRuKbQ4Yn8B9Q6E0qw6strBnxkcCwqiNgdio0IV6PYufWuZiuhtSWvF+Y1oRu0DSyCVSjROWdtWo6RD+ViF937TNT7J7OYts= 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+84214+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 1638369047245708.7481911700771; Wed, 1 Dec 2021 06:30:47 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id pxvOYY1788612x71PJhsNKRd; Wed, 01 Dec 2021 06:30:46 -0800 X-Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web09.91150.1638360163794067310 for ; Wed, 01 Dec 2021 04:02:43 -0800 X-IronPort-AV: E=McAfee;i="6200,9189,10184"; a="322689323" X-IronPort-AV: E=Sophos;i="5.87,278,1631602800"; d="scan'208";a="322689323" X-Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2021 04:02:43 -0800 X-IronPort-AV: E=Sophos;i="5.87,278,1631602800"; d="scan'208";a="596307258" X-Received: from rshussey-mobl1.ger.corp.intel.com (HELO sboeuf-mobl.home) ([10.252.26.82]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2021 04:02:41 -0800 From: sebastien.boeuf@intel.com To: devel@edk2.groups.io Cc: jiewen.yao@intel.com, jordan.l.justen@intel.com, kraxel@redhat.com, sebastien.boeuf@intel.com Subject: [edk2-devel] [PATCH 4/5] OvmfPkg: Generalize AcpiPlatformDxe Date: Wed, 1 Dec 2021 13:01:47 +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: Kc6GHAivRBZdrWIVW79eE91Yx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1638369046; bh=xRyinVtvMtCkvil3v1slAULQg86hfXAi7X2BksmTs7M=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=CkugqGKHDxIENWKCgejAGUgU4RpRzIhYQRZisunRZzKpO4zC684LJYjSDb2+OT8tHV2 Xknzv2YiTzSduQGaJ7XdAtPz5nlZoe4TIPLY76KQMWX6pCirxHJFcJfooC6cRYjrII5J/ yW27UxuLqR964h2jR1PpxmTeittSau4fxx4= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1638369048600100013 Content-Type: text/plain; charset="utf-8" From: Sebastien Boeuf Don't make the package Qemu centric so that we can introduce some alternative support for other VMMs not using the fw_cfg mechanism. Signed-off-by: Sebastien Boeuf Reviewed-by: Gerd Hoffmann --- ArmVirtPkg/ArmVirtQemu.dsc | 2 +- ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc | 2 +- ArmVirtPkg/ArmVirtQemuKernel.dsc | 2 +- .../{QemuFwCfgAcpiPlatform.c =3D> AcpiPlatform.c} | 4 ++-- .../{QemuFwCfgAcpiPlatformDxe.inf =3D> AcpiPlatformDxe.inf} | 4 ++-- OvmfPkg/AmdSev/AmdSevX64.dsc | 2 +- OvmfPkg/AmdSev/AmdSevX64.fdf | 2 +- OvmfPkg/Microvm/MicrovmX64.dsc | 2 +- OvmfPkg/Microvm/MicrovmX64.fdf | 2 +- OvmfPkg/OvmfPkgIa32.dsc | 2 +- OvmfPkg/OvmfPkgIa32.fdf | 2 +- OvmfPkg/OvmfPkgIa32X64.dsc | 2 +- OvmfPkg/OvmfPkgIa32X64.fdf | 2 +- OvmfPkg/OvmfPkgX64.dsc | 2 +- OvmfPkg/OvmfPkgX64.fdf | 2 +- 15 files changed, 17 insertions(+), 17 deletions(-) rename OvmfPkg/AcpiPlatformDxe/{QemuFwCfgAcpiPlatform.c =3D> AcpiPlatform.= c} (78%) rename OvmfPkg/AcpiPlatformDxe/{QemuFwCfgAcpiPlatformDxe.inf =3D> AcpiPlat= formDxe.inf} (90%) diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc index 891e065311..84c28b0c1d 100644 --- a/ArmVirtPkg/ArmVirtQemu.dsc +++ b/ArmVirtPkg/ArmVirtQemu.dsc @@ -543,7 +543,7 @@ ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.inf [Components.AARCH64] MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsRes= ourceTableDxe.inf - OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf { + OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf { NULL|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf } diff --git a/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc b/ArmVirtPkg/ArmVirtQemuF= vMain.fdf.inc index f6a538df72..d4df6dede0 100644 --- a/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc +++ b/ArmVirtPkg/ArmVirtQemuFvMain.fdf.inc @@ -145,7 +145,7 @@ READ_LOCK_STATUS =3D TRUE !if $(ARCH) =3D=3D AARCH64 INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf INF MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphic= sResourceTableDxe.inf - INF OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf + INF OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf =20 # # EBC support diff --git a/ArmVirtPkg/ArmVirtQemuKernel.dsc b/ArmVirtPkg/ArmVirtQemuKerne= l.dsc index a8bb83b288..8e82c5050f 100644 --- a/ArmVirtPkg/ArmVirtQemuKernel.dsc +++ b/ArmVirtPkg/ArmVirtQemuKernel.dsc @@ -458,7 +458,7 @@ ArmVirtPkg/PlatformHasAcpiDtDxe/PlatformHasAcpiDtDxe.inf [Components.AARCH64] MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsRes= ourceTableDxe.inf - OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf { + OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf { NULL|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf } diff --git a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatform.c b/OvmfPkg/Acpi= PlatformDxe/AcpiPlatform.c similarity index 78% rename from OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatform.c rename to OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c index 057a450af9..613a8ac97f 100644 --- a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatform.c +++ b/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c @@ -1,5 +1,5 @@ /** @file - OVMF ACPI Platform Driver using QEMU's fw-cfg interface + OVMF ACPI Platform Driver =20 Copyright (C) 2015, Red Hat, Inc. Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.
@@ -10,7 +10,7 @@ #include "AcpiPlatform.h" =20 /** - Effective entrypoint of QEMU fw-cfg Acpi Platform driver. + Effective entrypoint of Acpi Platform driver. =20 @param ImageHandle @param SystemTable diff --git a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf b/OvmfPkg= /AcpiPlatformDxe/AcpiPlatformDxe.inf similarity index 90% rename from OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf rename to OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf index dac25d1505..eedd3b5af3 100644 --- a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf +++ b/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf @@ -1,5 +1,5 @@ ## @file -# OVMF ACPI Platform Driver using QEMU's fw-cfg interface +# OVMF ACPI Platform Driver # # Copyright (c) 2008 - 2014, Intel Corporation. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent @@ -21,12 +21,12 @@ # =20 [Sources] + AcpiPlatform.c AcpiPlatform.h BootScript.c EntryPoint.c PciDecoding.c QemuFwCfgAcpi.c - QemuFwCfgAcpiPlatform.c =20 [Packages] MdeModulePkg/MdeModulePkg.dec diff --git a/OvmfPkg/AmdSev/AmdSevX64.dsc b/OvmfPkg/AmdSev/AmdSevX64.dsc index 5ee5445116..14ab027f63 100644 --- a/OvmfPkg/AmdSev/AmdSevX64.dsc +++ b/OvmfPkg/AmdSev/AmdSevX64.dsc @@ -773,7 +773,7 @@ # ACPI Support # MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf - OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf + OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsRes= ourceTableDxe.inf =20 # diff --git a/OvmfPkg/AmdSev/AmdSevX64.fdf b/OvmfPkg/AmdSev/AmdSevX64.fdf index 5662609886..5b61da2edd 100644 --- a/OvmfPkg/AmdSev/AmdSevX64.fdf +++ b/OvmfPkg/AmdSev/AmdSevX64.fdf @@ -271,7 +271,7 @@ INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf INF OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf =20 INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf -INF OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf +INF OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf INF MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphics= ResourceTableDxe.inf =20 INF FatPkg/EnhancedFatDxe/Fat.inf diff --git a/OvmfPkg/Microvm/MicrovmX64.dsc b/OvmfPkg/Microvm/MicrovmX64.dsc index 617f925395..2c6f932d95 100644 --- a/OvmfPkg/Microvm/MicrovmX64.dsc +++ b/OvmfPkg/Microvm/MicrovmX64.dsc @@ -751,7 +751,7 @@ # ACPI Support # MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf - OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf + OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.= inf MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsRes= ourceTableDxe.inf diff --git a/OvmfPkg/Microvm/MicrovmX64.fdf b/OvmfPkg/Microvm/MicrovmX64.fdf index 6314014f3d..459c639e5a 100644 --- a/OvmfPkg/Microvm/MicrovmX64.fdf +++ b/OvmfPkg/Microvm/MicrovmX64.fdf @@ -268,7 +268,7 @@ INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf INF OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf =20 INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf -INF OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf +INF OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf INF MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf INF MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorD= xe.inf INF MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphics= ResourceTableDxe.inf diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc index 6a5be97c05..61209e3db1 100644 --- a/OvmfPkg/OvmfPkgIa32.dsc +++ b/OvmfPkg/OvmfPkgIa32.dsc @@ -870,7 +870,7 @@ # ACPI Support # MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf - OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf + OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.= inf MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsRes= ourceTableDxe.inf diff --git a/OvmfPkg/OvmfPkgIa32.fdf b/OvmfPkg/OvmfPkgIa32.fdf index 775ea2d710..6b37238634 100644 --- a/OvmfPkg/OvmfPkgIa32.fdf +++ b/OvmfPkg/OvmfPkgIa32.fdf @@ -281,7 +281,7 @@ INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf INF OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf =20 INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf -INF OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf +INF OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf INF MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf INF MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorD= xe.inf INF MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphics= ResourceTableDxe.inf diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc index 71227d1b70..a4447508bc 100644 --- a/OvmfPkg/OvmfPkgIa32X64.dsc +++ b/OvmfPkg/OvmfPkgIa32X64.dsc @@ -884,7 +884,7 @@ # ACPI Support # MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf - OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf + OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.= inf MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsRes= ourceTableDxe.inf diff --git a/OvmfPkg/OvmfPkgIa32X64.fdf b/OvmfPkg/OvmfPkgIa32X64.fdf index 9d8695922f..88f3e16656 100644 --- a/OvmfPkg/OvmfPkgIa32X64.fdf +++ b/OvmfPkg/OvmfPkgIa32X64.fdf @@ -285,7 +285,7 @@ INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf INF OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf =20 INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf -INF OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf +INF OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf INF MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf INF MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorD= xe.inf INF MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphics= ResourceTableDxe.inf diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc index 52f7598cf1..6b1d8d3247 100644 --- a/OvmfPkg/OvmfPkgX64.dsc +++ b/OvmfPkg/OvmfPkgX64.dsc @@ -882,7 +882,7 @@ # ACPI Support # MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf - OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf + OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDxe.= inf MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsRes= ourceTableDxe.inf diff --git a/OvmfPkg/OvmfPkgX64.fdf b/OvmfPkg/OvmfPkgX64.fdf index b6cc3cabdd..c97c4ae16c 100644 --- a/OvmfPkg/OvmfPkgX64.fdf +++ b/OvmfPkg/OvmfPkgX64.fdf @@ -301,7 +301,7 @@ INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf INF OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf =20 INF MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf -INF OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf +INF OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf INF MdeModulePkg/Universal/Acpi/S3SaveStateDxe/S3SaveStateDxe.inf INF MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorD= xe.inf INF MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphics= ResourceTableDxe.inf --=20 2.30.2 --------------------------------------------------------------------- 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: 4,572,000 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 (#84214): https://edk2.groups.io/g/devel/message/84214 Mute This Topic: https://groups.io/mt/87429207/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 Fri May 3 13:21:35 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+84215+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+84215+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1638369047; cv=none; d=zohomail.com; s=zohoarc; b=C4Kw18iigLjwth3o/PoEb5H/lGpr4VCguBY1Te/oFCp4yD8QAwTn8RYAxcm2E2LjNBZYtXSkoNW7nK3+8TXoAOg2NNBCpCEJ8dz1oWCk4QgffjsHJXjH/UoFR3v0WOywjmRt+0EX9rbTDsx/3+cUd9cKmBueWeQ0fv4bw/K/SWQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638369047; 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=B1RDFfhPMalwg51HJjc4H/071UwNm/KXXFixgvI8FTo=; b=acyR8aARqb07eI526/zesLf3nxVKbQNy5l9qJmkrXOEk1Z6/QAFWkRE8+Kv8WcrqR0MSoM/IDFhzC2PQStpvcqo9BDtMsWu6WijJYzjBw3ScTnHDLuGYhUMq5uf5/3IpA5eDS3pVPUz2rVJySz6u2UzpQZypHpS8n5EDqY1kAmI= 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+84215+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 1638369047183542.4601858805737; Wed, 1 Dec 2021 06:30:47 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 0iChYY1788612xr9aVAAi5V5; Wed, 01 Dec 2021 06:30:46 -0800 X-Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mx.groups.io with SMTP id smtpd.web09.91152.1638360172880632302 for ; Wed, 01 Dec 2021 04:02:53 -0800 X-IronPort-AV: E=McAfee;i="6200,9189,10184"; a="223322224" X-IronPort-AV: E=Sophos;i="5.87,278,1631602800"; d="scan'208";a="223322224" X-Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2021 04:02:51 -0800 X-IronPort-AV: E=Sophos;i="5.87,278,1631602800"; d="scan'208";a="596307372" X-Received: from rshussey-mobl1.ger.corp.intel.com (HELO sboeuf-mobl.home) ([10.252.26.82]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2021 04:02:50 -0800 From: sebastien.boeuf@intel.com To: devel@edk2.groups.io Cc: jiewen.yao@intel.com, jordan.l.justen@intel.com, kraxel@redhat.com, sebastien.boeuf@intel.com Subject: [edk2-devel] [PATCH 5/5] OvmfPkg: Install ACPI tables for Cloud Hypervisor Date: Wed, 1 Dec 2021 13:01:48 +0100 Message-Id: <83041af43c916d2d89caabd6d7b002d1e30456d3.1638351613.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: TBOU5vYvUMxIQz2IpR2N9CcPx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1638369046; bh=Z4nk4paya+YBFeyucQBxKu8+dS+NeIHWCapPHpqy4rk=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=HRt7/6onOlZzjRsanEwVjxIHyKM3MyLVbEtaUYxMC4/xo55Ujf8dxdha9KaFVoJF2+s ammOUfSTbsYw3NEmZL5ZLSmFCySoq/RRuogwmZdczyJk0pjqljhnyOZv8e6rZs0SyRbGS m/qUz6WlPbW2b8Q8S4pk/5IUu4C1b8VkfXU= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1638369048549100011 Content-Type: text/plain; charset="utf-8" From: Sebastien Boeuf Adding support for retrieving the Cloud Hypervisor ACPI tables as a fallback mechanism if tables are not found through fw_cfg. Signed-off-by: Rob Bradford Signed-off-by: Sebastien Boeuf --- OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c | 4 + OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h | 6 + OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf | 1 + OvmfPkg/AcpiPlatformDxe/CloudHvAcpi.c | 117 ++++++++++++++++++++ OvmfPkg/Include/IndustryStandard/CloudHv.h | 5 + 5 files changed, 133 insertions(+) create mode 100644 OvmfPkg/AcpiPlatformDxe/CloudHvAcpi.c diff --git a/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c b/OvmfPkg/AcpiPlatformD= xe/AcpiPlatform.c index 613a8ac97f..abd1f550d4 100644 --- a/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c +++ b/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.c @@ -29,5 +29,9 @@ InstallAcpiTables ( EFI_STATUS Status; =20 Status =3D InstallQemuFwCfgTables (AcpiTable); + if (EFI_ERROR (Status)) { + Status =3D InstallCloudHvTables (AcpiTable); + } + return Status; } diff --git a/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h b/OvmfPkg/AcpiPlatformD= xe/AcpiPlatform.h index bd4c26f07f..bee48a93da 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 +InstallCloudHvTables ( + IN EFI_ACPI_TABLE_PROTOCOL *AcpiProtocol + ); + EFI_STATUS EFIAPI InstallQemuFwCfgTables ( diff --git a/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf b/OvmfPkg/AcpiPlat= formDxe/AcpiPlatformDxe.inf index eedd3b5af3..3ac9054d75 100644 --- a/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf +++ b/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf @@ -24,6 +24,7 @@ AcpiPlatform.c AcpiPlatform.h BootScript.c + CloudHvAcpi.c EntryPoint.c PciDecoding.c QemuFwCfgAcpi.c diff --git a/OvmfPkg/AcpiPlatformDxe/CloudHvAcpi.c b/OvmfPkg/AcpiPlatformDx= e/CloudHvAcpi.c new file mode 100644 index 0000000000..96c532cce6 --- /dev/null +++ b/OvmfPkg/AcpiPlatformDxe/CloudHvAcpi.c @@ -0,0 +1,117 @@ +/** @file + OVMF ACPI Cloud Hypervisor support + + Copyright (c) 2021, Intel Corporation. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include // CLOUDHV_RSDP_ADDRESS +#include // CpuDeadLoop() +#include // DEBUG() + +#include "AcpiPlatform.h" + +// Get the ACPI tables from EBDA start +EFI_STATUS +EFIAPI +InstallCloudHvTables ( + IN EFI_ACPI_TABLE_PROTOCOL *AcpiProtocol + ) +{ + EFI_STATUS Status; + UINTN TableHandle; + + EFI_ACPI_DESCRIPTION_HEADER *Xsdt; + VOID *CurrentTableEntry; + UINTN CurrentTablePointer; + EFI_ACPI_DESCRIPTION_HEADER *CurrentTable; + UINTN Index; + UINTN NumberOfTableEntries; + EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt2Table; + EFI_ACPI_DESCRIPTION_HEADER *DsdtTable; + Fadt2Table =3D NULL; + DsdtTable =3D NULL; + TableHandle =3D 0; + NumberOfTableEntries =3D 0; + EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER *AcpiRsdpStructurePtr =3D (= VOID *)CLOUDHV_RSDP_ADDRESS; + + // If XSDT table is found, just install its tables. + // Otherwise, try to find and install the RSDT tables. + // + if (AcpiRsdpStructurePtr->XsdtAddress) { + // + // Retrieve the addresses of XSDT and + // calculate the number of its table entries. + // + Xsdt =3D (EFI_ACPI_DESCRIPTION_HEADER *) (UINTN) + AcpiRsdpStructurePtr->XsdtAddress; + NumberOfTableEntries =3D (Xsdt->Length - + sizeof (EFI_ACPI_DESCRIPTION_HEADER)) / + sizeof (UINT64); + + // + // Install ACPI tables found in XSDT. + // + for (Index =3D 0; Index < NumberOfTableEntries; Index++) { + // + // Get the table entry from XSDT + // + CurrentTableEntry =3D (VOID *) ((UINT8 *) Xsdt + + sizeof (EFI_ACPI_DESCRIPTION_HEADER) + + Index * sizeof (UINT64)); + CurrentTablePointer =3D (UINTN) *(UINT64 *)CurrentTableEntry; + CurrentTable =3D (EFI_ACPI_DESCRIPTION_HEADER *) CurrentTablePointer; + + // + // Install the XSDT tables + // + Status =3D AcpiProtocol->InstallAcpiTable ( + AcpiProtocol, + CurrentTable, + CurrentTable->Length, + &TableHandle + ); + + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR(Status); + return Status; + } + + // + // Get the X-DSDT table address from the table FADT + // + if (!AsciiStrnCmp ((CHAR8 *) &CurrentTable->Signature, "FACP", 4)) { + Fadt2Table =3D (EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *) + (UINTN) CurrentTablePointer; + DsdtTable =3D (EFI_ACPI_DESCRIPTION_HEADER *) (UINTN) Fadt2Table-= >XDsdt; + } + } + } else { + return EFI_NOT_FOUND; + } + + // + // 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_ERROR, "%a: no DSDT found\n", __FUNCTION__)); + ASSERT (FALSE); + CpuDeadLoop (); + } + + Status =3D AcpiProtocol->InstallAcpiTable ( + AcpiProtocol, + DsdtTable, + DsdtTable->Length, + &TableHandle + ); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR(Status); + return Status; + } + + return EFI_SUCCESS; +} diff --git a/OvmfPkg/Include/IndustryStandard/CloudHv.h b/OvmfPkg/Include/I= ndustryStandard/CloudHv.h index ad0e170795..3a01dbb7d7 100644 --- a/OvmfPkg/Include/IndustryStandard/CloudHv.h +++ b/OvmfPkg/Include/IndustryStandard/CloudHv.h @@ -37,4 +37,9 @@ // #define CLOUDHV_SMBIOS_ADDRESS 0xf0000 =20 +// +// RSDP address +// +#define CLOUDHV_RSDP_ADDRESS 0xa0000 + #endif // __CLOUDHV_H__ --=20 2.30.2 --------------------------------------------------------------------- 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: 4,572,000 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 (#84215): https://edk2.groups.io/g/devel/message/84215 Mute This Topic: https://groups.io/mt/87429208/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-