From nobody Sun Dec 14 06:20:45 2025 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+84641+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+84641+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1639147376; cv=none; d=zohomail.com; s=zohoarc; b=iHHjBpp4xfDSUR7lGsia1co+k3D8UBb81fEEW+TewKSe7Fm9rgZbU1rDKWU9QNQsFDPBeZL2J+eKIJucw4gp4qSS8n0sg/o2aGP0wHxCKYgz4A9p199mYdgzeNAEsHsfBe/FwAZMXI7jixJstZLWSHVooBcJUoiseUPevThRZLw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639147376; 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=gW1F3aSRiX8gAIU0ciQuP2JJZkzrR0vOD4DkAF17Gew=; b=n1Xt3H9PJeqRewGGbBFwMS/BY0oAZvUsacaNM1v/90tI5SN/BhvQ1rnsXDaYWIELVCcvZKF4QZw768Lmzcl7vywyfvMuzBLlbLHwgHZm5jflQzYuoOd3cURzUhVPCbrw+DhQTHj1OW98GuXiT5xwtJJzUBhK7UpIcFXKriqrYsM= 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+84641+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 16391473769241013.6857788441306; Fri, 10 Dec 2021 06:42:56 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id pnS4YY1788612xyiWsgak1Pg; Fri, 10 Dec 2021 06:42:56 -0800 X-Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web12.7955.1639147375808804215 for ; Fri, 10 Dec 2021 06:42:56 -0800 X-IronPort-AV: E=McAfee;i="6200,9189,10193"; a="238299502" X-IronPort-AV: E=Sophos;i="5.88,195,1635231600"; d="scan'208";a="238299502" X-Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Dec 2021 06:42:32 -0800 X-IronPort-AV: E=Sophos;i="5.88,195,1635231600"; d="scan'208";a="503951560" X-Received: from gmarti2-mobl1.amr.corp.intel.com (HELO sboeuf-mobl.home) ([10.252.20.4]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Dec 2021 06:42:31 -0800 From: "Boeuf, Sebastien" 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 v7 3/5] OvmfPkg: Retrieve SMBIOS from Cloud Hypervisor Date: Fri, 10 Dec 2021 15:41:56 +0100 Message-Id: <293a4baf8b9fd4e81d3e4f9da257a8b52ddb4ea7.1639147041.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: 0qccpYL3M6Eu5OvncF5GfaUEx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1639147376; bh=eBU4bSeiKXIj7m9IQLnnCbF8WaNW3IKcV3DbFN9cqNQ=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=P0SPyZyi8s1ZIL9xBYOWcEgqgm4GzyfGUvrIwj0kuGvnCR6XRQr9uHliXqCkqTQcB2x Ce7J01DItf3Rhzg6PAjYceNE9YQ26kKNfX0Xuuek0MxDopa2XwnJ6ZuFbU/uFXYngNrF+ SgHq67cSMbtJc3nztcz/dixHWk1VBorobhg= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1639147378313100001 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. Reviewed-by: Gerd Hoffmann Reviewed-by: Jiewen Yao Signed-off-by: Rob Bradford Signed-off-by: Sebastien Boeuf --- OvmfPkg/Include/IndustryStandard/CloudHv.h | 5 +++ OvmfPkg/SmbiosPlatformDxe/CloudHv.c | 33 +++++++++++++++++++ OvmfPkg/SmbiosPlatformDxe/EntryPoint.c | 20 ++++++++--- OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h | 11 +++++++ .../SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 2 ++ 5 files changed, 66 insertions(+), 5 deletions(-) create mode 100644 OvmfPkg/SmbiosPlatformDxe/CloudHv.c diff --git a/OvmfPkg/Include/IndustryStandard/CloudHv.h b/OvmfPkg/Include/I= ndustryStandard/CloudHv.h index 1155335690..d31ecc9eec 100644 --- a/OvmfPkg/Include/IndustryStandard/CloudHv.h +++ b/OvmfPkg/Include/IndustryStandard/CloudHv.h @@ -33,4 +33,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..792e4ae981 --- /dev/null +++ b/OvmfPkg/SmbiosPlatformDxe/CloudHv.c @@ -0,0 +1,33 @@ +/** @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 Cloud Hypervisor SMBIOS data + + @return Address of extracted Cloud Hypervisor SMBIOS data + +**/ +UINT8 * +GetCloudHvSmbiosTables ( + VOID + ) +{ + SMBIOS_TABLE_3_0_ENTRY_POINT *CloudHvTables =3D (VOID *)CLOUDHV_SMBIOS_= ADDRESS; + + 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 f53af2b2e6..e55d135504 100644 --- a/OvmfPkg/SmbiosPlatformDxe/EntryPoint.c +++ b/OvmfPkg/SmbiosPlatformDxe/EntryPoint.c @@ -5,6 +5,7 @@ **/ =20 #include // FreePool() +#include // CLOUDHV_DEVICE_ID =20 #include "SmbiosPlatformDxe.h" =20 @@ -27,15 +28,24 @@ SmbiosTablePublishEntry ( { EFI_STATUS Status; UINT8 *SmbiosTables; + UINT16 HostBridgeDevId; =20 Status =3D EFI_NOT_FOUND; // - // Add QEMU SMBIOS data if found + // Add SMBIOS data if found // - SmbiosTables =3D GetQemuSmbiosTables (); - if (SmbiosTables !=3D NULL) { - Status =3D InstallAllStructures (SmbiosTables); - FreePool (SmbiosTables); + HostBridgeDevId =3D PcdGet16 (PcdOvmfHostBridgePciDevId); + if (HostBridgeDevId =3D=3D CLOUDHV_DEVICE_ID) { + SmbiosTables =3D GetCloudHvSmbiosTables (); + if (SmbiosTables !=3D NULL) { + Status =3D InstallAllStructures (SmbiosTables); + } + } else { + SmbiosTables =3D GetQemuSmbiosTables (); + if (SmbiosTables !=3D NULL) { + Status =3D InstallAllStructures (SmbiosTables); + FreePool (SmbiosTables); + } } =20 return Status; diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h b/OvmfPkg/Smbios= PlatformDxe/SmbiosPlatformDxe.h index b7bf004be9..709e096e7b 100644 --- a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h +++ b/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.h @@ -33,4 +33,15 @@ GetQemuSmbiosTables ( VOID ); =20 +/** + Locates and extracts Cloud Hypervisor SMBIOS data + + @return Address of extracted Cloud Hypervisor SMBIOS data + +**/ +UINT8 * +GetCloudHvSmbiosTables ( + VOID + ); + #endif diff --git a/OvmfPkg/SmbiosPlatformDxe/SmbiosPlatformDxe.inf b/OvmfPkg/Smbi= osPlatformDxe/SmbiosPlatformDxe.inf index e239a631f2..0066bbc922 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 @@ -42,6 +43,7 @@ UefiDriverEntryPoint =20 [Pcd] + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId gUefiOvmfPkgTokenSpaceGuid.PcdQemuSmbiosValidated =20 [Protocols] --=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 (#84641): https://edk2.groups.io/g/devel/message/84641 Mute This Topic: https://groups.io/mt/87637066/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-