From nobody Mon Feb 9 11:46:41 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+84685+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+84685+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1639383427; cv=none; d=zohomail.com; s=zohoarc; b=naNrZxOLxoeOGoP7fh4NoH4c/Tjp5M3CNO9OIWPPkHCM0qWkXJXR+Z3ZPtSKjDTcHfjhweAHG0+IPccSVSelHDOgBpz8WZceO3MP+LeeReREA6LGnRiwrS4OhLinSwpsjm3VaMubg+kqRpgK4f6+tKfq1M/Q/6OK3/O1nXhafps= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639383427; 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=laVr3E63oBie1SnM4Jlh1Cm3pIDoB9zUHILR9OrSDh4=; b=e4zfg7q/QRdgdXbVrq5t4fKDHcsZF/9PNOg11Ft5CjFjhWKHCq962tSksocePmFn8s+HZB829TOW1HrAscN4XPvvSTPOg3dq7Vp/YW130UtRVSWWDI1Atgv8F+eTuv0rMCcJDgNY7iSiQHBqDnPU8mYAnAIEHUJ1jc6CvVANr+s= 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+84685+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 1639383427592609.0136974493812; Mon, 13 Dec 2021 00:17:07 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id LfyuYY1788612xtRg4yq4GCG; Mon, 13 Dec 2021 00:17:07 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web08.8614.1639383426719847747 for ; Mon, 13 Dec 2021 00:17:06 -0800 X-Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-463-XDRyt-ieM0CvQwsGIG7wmQ-1; Mon, 13 Dec 2021 03:17:02 -0500 X-MC-Unique: XDRyt-ieM0CvQwsGIG7wmQ-1 X-Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 883DD104ECFC; Mon, 13 Dec 2021 08:17:01 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.14]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 48EC55BE02; Mon, 13 Dec 2021 08:17:01 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 3DD0A180062C; Mon, 13 Dec 2021 09:16:58 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Jordan Justen , Jiewen Yao , Pawel Polawski , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Ard Biesheuvel Subject: [edk2-devel] [PATCH v3 3/5] OvmfPkg/Microvm/fdt: add empty fdt Date: Mon, 13 Dec 2021 09:16:56 +0100 Message-Id: <20211213081658.3535809-4-kraxel@redhat.com> In-Reply-To: <20211213081658.3535809-1-kraxel@redhat.com> References: <20211213081658.3535809-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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: clx7kUe7wWVeL0n2ISvXtjFzx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1639383427; bh=mXszOjtx8klPjFXkgIt8k6UTeSrzz3GnTRhBP96hoGk=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=sD2jfBpCOy14e/7P/s8f6QI7SuFGiqxsc1W5ne2Bal/dtmhiRMoGHlfIUJtz8Zrb2Lf HWfSvtFZcoh22RSrW1/d6cCA2nw2uppPo6v200MG1FhytRTCkDmZg13AYCWN7lL1KL5P0 n5DYGaGuPZAK4x8CUPERtOKp4TqHa+nH0n8= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1639383429148100007 Content-Type: text/plain; charset="utf-8" FdtClient is unhappy without a device tree, so add an empty fdt which we can use in case etc/fdt is not present in fw_cfg. On ARM machines a device tree is mandatory for hardware detection, thats why FdtClient fails hard. On microvm the device tree is only used to detect virtio-mmio devices (this patch series) and the pcie host (future series). So edk2 can continue with limited functionality in case no device tree is present: no storage, no network, but serial console and direct kernel boot works. qemu release 6.2 & newer will provide a device tree for microvm. https://bugzilla.tianocore.org/show_bug.cgi?id=3D3689 Signed-off-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daude --- OvmfPkg/PlatformPei/Platform.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/OvmfPkg/PlatformPei/Platform.c b/OvmfPkg/PlatformPei/Platform.c index c9ec1d7e99fb..d0323c645162 100644 --- a/OvmfPkg/PlatformPei/Platform.c +++ b/OvmfPkg/PlatformPei/Platform.c @@ -16,6 +16,7 @@ // // The Library classes this module consumes // +#include #include #include #include @@ -321,6 +322,18 @@ PciExBarInitialization ( ); } =20 +static const UINT8 EmptyFdt[] =3D { + 0xd0, 0x0d, 0xfe, 0xed, 0x00, 0x00, 0x00, 0x48, + 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x48, + 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x11, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x09, +}; + VOID MicrovmInitialization ( VOID @@ -335,8 +348,9 @@ MicrovmInitialization ( =20 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; + DEBUG ((DEBUG_INFO, "%a: no etc/fdt found in fw_cfg, using dummy\n", _= _FUNCTION__)); + FdtItem =3D 0; + FdtSize =3D sizeof (EmptyFdt); } =20 FdtPages =3D EFI_SIZE_TO_PAGES (FdtSize); @@ -346,8 +360,12 @@ MicrovmInitialization ( return; } =20 - QemuFwCfgSelectItem (FdtItem); - QemuFwCfgReadBytes (FdtSize, NewBase); + if (FdtItem) { + QemuFwCfgSelectItem (FdtItem); + QemuFwCfgReadBytes (FdtSize, NewBase); + } else { + CopyMem (NewBase, EmptyFdt, FdtSize); + } =20 FdtHobData =3D BuildGuidHob (&gFdtHobGuid, sizeof (*FdtHobData)); if (FdtHobData =3D=3D NULL) { --=20 2.33.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 (#84685): https://edk2.groups.io/g/devel/message/84685 Mute This Topic: https://groups.io/mt/87693652/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-