From nobody Tue Feb 10 16:18: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+83264+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+83264+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1635952013; cv=none; d=zohomail.com; s=zohoarc; b=i5zK4dkbE7o9KzmYqOGY64my17fyKzteOvY1Q8qSWkTJLtpq1olGhysgRMG2YN6wyjsEWTswdQElRTqbYRVv6da/26H5UwfHAGL4IBrGPOujoUjjZkkE5agw6htXvDDFWpH+QfLZiCb/9WoxpoSunzBiR8wZwW9stsSA2DY02os= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1635952013; 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=6ryG2rP+ywAdyun+pBcGwGGdMwzDgY7fGU+TnUI8cWM=; b=C8Wa5q1A1y5g0IEpHoC6KbOhvy/6AVbWLVevSYDq7Z23AEJXHP5wluZi71GNQfwFh0+tiw5LnnLE5viW3HLnhWq4GjAa3fxt/KA8imiJk0nQy3Vz5Swy+0u5JAO3AKv+ArfqhWKHAEvem65CHY86W7VXcHZ/MsgBiUQ5FuI0Npo= 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+83264+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 1635952013053573.8433872481046; Wed, 3 Nov 2021 08:06:53 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id okFFYY1788612xioMciJGfl4; Wed, 03 Nov 2021 08:06:52 -0700 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.groups.io with SMTP id smtpd.web09.8949.1635952011883380218 for ; Wed, 03 Nov 2021 08:06:52 -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-399-35b0Hbv4N9elT5tdyQ_J4Q-1; Wed, 03 Nov 2021 11:06:49 -0400 X-MC-Unique: 35b0Hbv4N9elT5tdyQ_J4Q-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 9CD7D18414A2; Wed, 3 Nov 2021 15:06:48 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.194.99]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2B37A5F4ED; Wed, 3 Nov 2021 15:06:44 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 9009F18221B5; Wed, 3 Nov 2021 16:06:27 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Jiewen Yao , Gerd Hoffmann , Jordan Justen , Ard Biesheuvel Subject: [edk2-devel] [PATCH v2 3/5] OvmfPkg/Microvm/fdt: add empty fdt Date: Wed, 3 Nov 2021 16:06:25 +0100 Message-Id: <20211103150627.3133189-4-kraxel@redhat.com> In-Reply-To: <20211103150627.3133189-1-kraxel@redhat.com> References: <20211103150627.3133189-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: uSVLj8LDU9AxQzipI5kzH9JTx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1635952012; bh=u4BpbBCIPzpDVUm/dnBmbV06YqEIinnW5bQLh4x+MQ8=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=C1cuR4iAs54zEi1nHWDoe1G7HT/UdCU8X+A4xa1lUmZdb/MvuX5WOiMvxTEWvLycGBs PX/IJsEXEGZI5ibX/qrN4oq+CkAOBdW2C39MOQrypX1RWzYyxav0UAVMvuuZhImCQs7Az urEl1C2JBzCUtrDKrbtUL9JfGj7cGUkVpIU= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1635952015050100001 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 3c0cdba67c83..5071389c1fb4 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.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 (#83264): https://edk2.groups.io/g/devel/message/83264 Mute This Topic: https://groups.io/mt/86793345/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-