From nobody Mon Feb 9 23:39:48 2026 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-