From nobody Mon Feb 9 20:59:19 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+82036+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+82036+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1634225450; cv=none; d=zohomail.com; s=zohoarc; b=JdU81u++y3AbBbcz2VNAtjU3NZ26YkFFm7C1hgkJxvOzuN9qEWO0lPokAaaVj7DLWTB+3t7KST2MQ4D+C8A927hIzlQHJqCebJAIKuxTXW4ApjRiUZcqnHeaFWXgZDvtlS2Jl27fRtrpaKufxBuA8pSVX/h5usAKrqa7DmKb6t8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634225450; 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=UWrluPx0LQgXUec53qU7AOHEwOjCPaqqZfE7BAeartQ=; b=VgdkCw6FABHtCylpe0YXSGQn0unBcGpYzUkNZRHVMny0i7Z22bZ8Jh+bHl+TL9W8sHNwPF6YE1spP+Pwbn0UiiBtVUh27B6CAHaM8SISkbEKGzYh5JW0dUkKnBN8n1czOVZLk7+CFPYjdSOa5C9IwhzKmEH4hbFb4dTlQl2C9X4= 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+82036+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 1634225450052988.6650715185967; Thu, 14 Oct 2021 08:30:50 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id ThZWYY1788612xVTFrL0jlKo; Thu, 14 Oct 2021 08:30:49 -0700 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web11.11251.1634225448528116551 for ; Thu, 14 Oct 2021 08:30:48 -0700 X-Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-166-a32II4ajNSukUwoaqojOnA-1; Thu, 14 Oct 2021 11:30:44 -0400 X-MC-Unique: a32II4ajNSukUwoaqojOnA-1 X-Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0B315100C610; Thu, 14 Oct 2021 15:30:43 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.23]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C2C3869CBF; Thu, 14 Oct 2021 15:30:42 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id C632F18009F7; Thu, 14 Oct 2021 17:30:24 +0200 (CEST) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Jordan Justen , Jiewen Yao , Gerd Hoffmann Subject: [edk2-devel] [PATCH 2/5] OvmfPkg/Microvm/fdt: load fdt from fw_cfg Date: Thu, 14 Oct 2021 17:30:21 +0200 Message-Id: <20211014153024.2318942-3-kraxel@redhat.com> In-Reply-To: <20211014153024.2318942-1-kraxel@redhat.com> References: <20211014153024.2318942-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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,kraxel@redhat.com X-Gm-Message-State: 43jrgCtERcgRiAGQd4epqNjtx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1634225449; bh=4iHyW5ZdoqH6UB6GtvXdKwsvi1/twSShFMFwUWdnMFQ=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=TVsZ672xwL/SbWQuOzvhiOpCJ7BAWAoBkB40fBUV8qs5UQagqkOQ9HNikOI8t2Bstk1 LvSWPaRbE+xqFjnRJhf+fCRHinHNd0adcvm7+dKL+V2oJILLMXudvmvbgOyEjbWuiyAPX EIOPH/XWy6gEz5GfgrfL9rExbvO3yDb18r4= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1634225451122100002 Content-Type: text/plain; charset="utf-8" Needed for hardware detection: virtio-mmio devices for now, later also pcie root bridge. Depends on patched qemu which actually provides an fdt: https://gitlab.com/kraxel/qemu/-/commits/sirius/microvm-device-tree https://bugzilla.tianocore.org/show_bug.cgi?id=3D3689 Signed-off-by: Gerd Hoffmann --- OvmfPkg/PlatformPei/PlatformPei.inf | 1 + OvmfPkg/PlatformPei/Platform.c | 40 +++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/OvmfPkg/PlatformPei/PlatformPei.inf b/OvmfPkg/PlatformPei/Plat= formPei.inf index 67eb7aa7166b..56876184b17a 100644 --- a/OvmfPkg/PlatformPei/PlatformPei.inf +++ b/OvmfPkg/PlatformPei/PlatformPei.inf @@ -44,6 +44,7 @@ [Packages] =20 [Guids] gEfiMemoryTypeInformationGuid + gFdtHobGuid =20 [LibraryClasses] BaseLib diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c index df2d9ad015aa..3c0cdba67c83 100644 --- a/OvmfPkg/PlatformPei/Platform.c +++ b/OvmfPkg/PlatformPei/Platform.c @@ -321,6 +321,45 @@ PciExBarInitialization ( ); } =20 +VOID +MicrovmInitialization ( + VOID + ) +{ + FIRMWARE_CONFIG_ITEM FdtItem; + UINTN FdtSize; + UINTN FdtPages; + EFI_STATUS Status; + UINT64 *FdtHobData; + VOID *NewBase; + + Status =3D QemuFwCfgFindFile ("etc/fdt", &FdtItem, &FdtSize); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_INFO, "%a: no etc/fdt found in fw_cfg\n", __FUNCTION__= )); + return; + } + + FdtPages =3D EFI_SIZE_TO_PAGES (FdtSize); + NewBase =3D AllocatePages (FdtPages); + if (NewBase =3D=3D NULL) { + DEBUG ((DEBUG_INFO, "%a: AllocatePages failed\n", __FUNCTION__)); + return; + } + + QemuFwCfgSelectItem (FdtItem); + QemuFwCfgReadBytes (FdtSize, NewBase); + + FdtHobData =3D BuildGuidHob (&gFdtHobGuid, sizeof (*FdtHobData)); + if (FdtHobData =3D=3D NULL) { + DEBUG ((DEBUG_INFO, "%a: BuildGuidHob failed\n", __FUNCTION__)); + return; + } + + DEBUG ((DEBUG_INFO, "%a: fdt at 0x%x (size %d)\n", __FUNCTION__, + NewBase, FdtSize)); + *FdtHobData =3D (UINTN)NewBase; +} + VOID MiscInitialization ( VOID @@ -368,6 +407,7 @@ MiscInitialization ( break; case 0xffff: /* microvm */ DEBUG ((DEBUG_INFO, "%a: microvm\n", __FUNCTION__)); + MicrovmInitialization(); PcdStatus =3D PcdSet16S (PcdOvmfHostBridgePciDevId, MICROVM_PSEUDO_DEVICE_ID); ASSERT_RETURN_ERROR (PcdStatus); --=20 2.31.1 -=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 (#82036): https://edk2.groups.io/g/devel/message/82036 Mute This Topic: https://groups.io/mt/86316749/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-