From nobody Mon May 6 16:33:05 2024 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+84686+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+84686+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1639383428; cv=none; d=zohomail.com; s=zohoarc; b=mZCFLVpVTto6Mb0DnLXsgWTtIrnWjxpygGniXdtD6EQX+rAx/jJDEHos6e4t9XTeJrA3qzah5HTY3ZOchkwqqaMcgEr4yh9noNJo78KEPkFBLs7KNgVuYeCUoRaYDYhZSMYDFK/0EEk+iwc/1pnJxlf+fVZrQe4FxcX7lzULmTM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639383428; 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=Grl+AGS/NrDflIwuOE5LB3VhO6pMtBRW40RI2/dabuM=; b=GtjXIqyklrsxwGn0LhqoP9SdaqtpfBRAnPxhZsNjEqBRaE7NVfTuN+mvVba/faGWwd7GmOVEq1H1RnTkkL9md9N+r/rsch+H8E7fPwTPnDSHxjA39TdM1QlsxAvhTMfnSPyN1S1bxxsaSDyLqpDL7LUOZsmWvK7AABaa3e91ii0= 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+84686+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 1639383428852697.0978989793347; Mon, 13 Dec 2021 00:17:08 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id CcmIYY1788612xYUSKeAglgM; Mon, 13 Dec 2021 00:17:08 -0800 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.web08.8615.1639383426743596562 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-188-W5N5BIkSMOaY7GvFbsvVgQ-1; Mon, 13 Dec 2021 03:17:00 -0500 X-MC-Unique: W5N5BIkSMOaY7GvFbsvVgQ-1 X-Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CD1AB104ECE6; Mon, 13 Dec 2021 08:16:59 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.14]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 919A85F70B; Mon, 13 Dec 2021 08:16:59 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 2BBA91800609; 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 1/5] OvmfPkg/Microvm/fdt: add device tree support Date: Mon, 13 Dec 2021 09:16:54 +0100 Message-Id: <20211213081658.3535809-2-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.16 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: 9X1mtSN4fRzSzJhqTCXe7VNgx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1639383428; bh=JoolJfeGcPevRH6u8VQjaUuY0WCUkm8/wFNySUntgAg=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=LEPUY9LCTgzr9cQ5l8B8N7XcEwbC1oY9IngKTjXx3G2CglGITdnUBcZw7ycgO3bs1+T 0QjbnLBN3xPTSktS8l6fAlRbqk7YfCjBIigcNyXD8hqHYDN1sAL/lGPh3rQBKxUN6mgGZ DluyS9qBX4RI+MxG683DZAY9zBkfC3lnbG0= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1639383429299100013 Content-Type: text/plain; charset="utf-8" Add fdt parser from EmbeddedPkg (FdtLib and FdtClientDxe) to MicrovmX64. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3689 Signed-off-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daude --- OvmfPkg/Microvm/MicrovmX64.dsc | 6 ++++++ OvmfPkg/Microvm/MicrovmX64.fdf | 2 ++ 2 files changed, 8 insertions(+) diff --git a/OvmfPkg/Microvm/MicrovmX64.dsc b/OvmfPkg/Microvm/MicrovmX64.dsc index 5f4d9226791b..edddf6c29b32 100644 --- a/OvmfPkg/Microvm/MicrovmX64.dsc +++ b/OvmfPkg/Microvm/MicrovmX64.dsc @@ -232,6 +232,7 @@ [LibraryClasses.common] VmgExitLib|OvmfPkg/Library/VmgExitLib/VmgExitLib.inf SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPort= Lib16550.inf PlatformHookLib|MdeModulePkg/Library/BasePlatformHookLibNull/BasePlatfor= mHookLibNull.inf + FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf =20 [LibraryClasses.common.SEC] QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgSecLib.inf @@ -739,6 +740,11 @@ [Components] # MdeModulePkg/Universal/SerialDxe/SerialDxe.inf =20 + # + # device tree + # + EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.inf + # # SMBIOS Support # diff --git a/OvmfPkg/Microvm/MicrovmX64.fdf b/OvmfPkg/Microvm/MicrovmX64.fdf index 4570bc866c9b..905d23b843d3 100644 --- a/OvmfPkg/Microvm/MicrovmX64.fdf +++ b/OvmfPkg/Microvm/MicrovmX64.fdf @@ -276,6 +276,8 @@ [FV.DXEFV] INF MdeModulePkg/Universal/Disk/UdfDxe/UdfDxe.inf INF OvmfPkg/VirtioFsDxe/VirtioFsDxe.inf =20 +INF EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.inf + !if $(TOOL_CHAIN_TAG) !=3D "XCODE5" INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf INF ShellPkg/DynamicCommand/HttpDynamicCommand/HttpDynamicCommand.inf --=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 (#84686): https://edk2.groups.io/g/devel/message/84686 Mute This Topic: https://groups.io/mt/87693653/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- From nobody Mon May 6 16:33:05 2024 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+84687+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+84687+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1639383428; cv=none; d=zohomail.com; s=zohoarc; b=jskFScpUl8ckcO/euQJolMDktsXfXhYXZFlv+kEcOr1n6s8KW0cEGyyt/dwYN55isw84O2Zu3NonEVuuG/RSHlwbU0nZT6ElzLtPb6OcQ1/NZ1jz9kvNHsm09gtpb/AokUQhbqWv3ehQq9NqRiyS1Jx6PlxDryb3VUPziq9mNA0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639383428; 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=CFTjT4OE0uudMU/f8T6vrXA5Sg1WuPg8Pd6TlRY2j74=; b=VbBfyuESR3XJ7DviZeTYisu2TqrPssE+3W7juhnc2LTcW/fVTsS+Z8vORuYRODxSvEnDFCViNcjccbDd5d/NPySfyi79OTCpoeIMH4CO9WfD0ygdx/xjJyQO6oKt0uXEm+RKOTjELBlTDxZrkOgag7nxn7SBvKiHewiNbwc3hjA= 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+84687+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 1639383428680819.8025685853685; Mon, 13 Dec 2021 00:17:08 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id IWquYY1788612xvYPt9kNiOv; Mon, 13 Dec 2021 00:17:08 -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.web12.8797.1639383427460590947 for ; Mon, 13 Dec 2021 00:17:07 -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-555-qiVn6N_sMzO4Iqw7goHQcw-1; Mon, 13 Dec 2021 03:17:02 -0500 X-MC-Unique: qiVn6N_sMzO4Iqw7goHQcw-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 81E7F8042EA; 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 4654145D86; Mon, 13 Dec 2021 08:17:01 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 3187F180061A; 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 2/5] OvmfPkg/Microvm/fdt: load fdt from fw_cfg Date: Mon, 13 Dec 2021 09:16:55 +0100 Message-Id: <20211213081658.3535809-3-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.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: igNaORdf0FVELTTZ10iIhJVRx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1639383428; bh=kji7QtXrsV5zd7tV5I15NoBn3luvRNp81Y1UkoxDCjU=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=MN8UkGFwJIdH85pyhhobaEyS3gy9Jen/Fc9myC9B3RNkHF8fs1xzQ9vGA95mHZm+ZF+ Lvq7e/FgZHf82JZaKNO2dMAP27VEYXfJsyiWWG7jDqncyFyXtZjuFnoRTgm1eFqnkubI0 Brk73sswUCfpTWFfeWZqEyEElKmdRd8e+ZU= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1639383429266100012 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 Reviewed-by: Philippe Mathieu-Daude --- OvmfPkg/PlatformPei/PlatformPei.inf | 1 + OvmfPkg/PlatformPei/Platform.c | 45 +++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/OvmfPkg/PlatformPei/PlatformPei.inf b/OvmfPkg/PlatformPei/Plat= formPei.inf index 1c56ba275835..8ef404168c45 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 906f64615de7..c9ec1d7e99fb 100644 --- a/OvmfPkg/PlatformPei/Platform.c +++ b/OvmfPkg/PlatformPei/Platform.c @@ -321,6 +321,50 @@ 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 +412,7 @@ MiscInitialization ( break; case 0xffff: /* microvm */ DEBUG ((DEBUG_INFO, "%a: microvm\n", __FUNCTION__)); + MicrovmInitialization (); PcdStatus =3D PcdSet16S ( PcdOvmfHostBridgePciDevId, MICROVM_PSEUDO_DEVICE_ID --=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 (#84687): https://edk2.groups.io/g/devel/message/84687 Mute This Topic: https://groups.io/mt/87693654/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- From nobody Mon May 6 16:33:05 2024 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- From nobody Mon May 6 16:33:05 2024 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+84688+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+84688+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1639383429; cv=none; d=zohomail.com; s=zohoarc; b=amYAY841zet9Gjk0bD4rxoCmT+cjPNIz2P4lymy7u7pW1gATnbzAa1No5+kjLXzCjYEl66Vmseq0Bz3YgYmwoqPP7t/sw/zMPc7sJe1ZxpdMb5dFDyNd2vmjmAHRY1rIhW+URkvTm5idI/CaPM8RoLBsGxIaPKPBWpPXjkbXS9k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639383429; 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=pM5MiSSFyH9xn+Yceue/bqemWd5qGFukqCUrC1T+ZYw=; b=P8bAyIipdq3DJrxPoX3eNFr9bATNN9QrDFciGBaLOemUmqWCvzGu/g3ktCT68Q/3NjSFB6+4kouyxypU6wrAg44yM3wD8dkkLm6jP0+6AL9nfpitrVxncufnRgJiYPksjx/rKGq5jPCqijwFEH9ld1BAuMYsoD6SNVS2aPjHcgE= 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+84688+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 16393834295681022.9913443750562; Mon, 13 Dec 2021 00:17:09 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id qJmRYY1788612xBOyuyJ9KtG; Mon, 13 Dec 2021 00:17:09 -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.8616.1639383428603944783 for ; Mon, 13 Dec 2021 00:17:08 -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-459-hsojy99lMjO6zd8qA90uUA-1; Mon, 13 Dec 2021 03:17:04 -0500 X-MC-Unique: hsojy99lMjO6zd8qA90uUA-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 59574101F005; Mon, 13 Dec 2021 08:17:03 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.14]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1F87B418E; Mon, 13 Dec 2021 08:17:03 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 442E6180062F; 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 4/5] OvmfPkg/Microvm/virtio: add virtio-mmio support Date: Mon, 13 Dec 2021 09:16:57 +0100 Message-Id: <20211213081658.3535809-5-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.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: zBOMWxOZCuN9QzzXnveYoaKUx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1639383429; bh=RtJL23b1vbrXYK7rlvBN122ZUEKrYF05ieDZTGJElhM=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=onRm9pEWzeDHar28+vSi0w88akQLO+jp9AmMAyWrWjsyP///gCi47JZEq9job6MYyYu Wl7GR5LRrRZppdhYOGuZ8mos5ptSMM0LMDGT0y5Ph3SLlW1FT4gyb4qYlA3mggQwIfE1M dnzuXnMYNhIi67KjVNvO9T4IlVIL8Cpt5io= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1639383431395100019 Content-Type: text/plain; charset="utf-8" Add virtio-mmio support (VirtioMmioDeviceLib and VirtioFdtDxe). With this patch added and a new enough qemu version (6.2+) edk2 will detect virtio-mmio devices, so it is possible to boot from storage (virtio-blk, virtio-scsi) or network (virtio-net). https://bugzilla.tianocore.org/show_bug.cgi?id=3D3689 Signed-off-by: Gerd Hoffmann Reviewed-by: Philippe Mathieu-Daude --- OvmfPkg/Microvm/MicrovmX64.dsc | 2 ++ OvmfPkg/Microvm/MicrovmX64.fdf | 1 + 2 files changed, 3 insertions(+) diff --git a/OvmfPkg/Microvm/MicrovmX64.dsc b/OvmfPkg/Microvm/MicrovmX64.dsc index edddf6c29b32..a78c8f3dd89f 100644 --- a/OvmfPkg/Microvm/MicrovmX64.dsc +++ b/OvmfPkg/Microvm/MicrovmX64.dsc @@ -233,6 +233,7 @@ [LibraryClasses.common] SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPort= Lib16550.inf PlatformHookLib|MdeModulePkg/Library/BasePlatformHookLibNull/BasePlatfor= mHookLibNull.inf FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf + VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice= Lib.inf =20 [LibraryClasses.common.SEC] QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgSecLib.inf @@ -744,6 +745,7 @@ [Components] # device tree # EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.inf + OvmfPkg/Fdt/VirtioFdtDxe/VirtioFdtDxe.inf =20 # # SMBIOS Support diff --git a/OvmfPkg/Microvm/MicrovmX64.fdf b/OvmfPkg/Microvm/MicrovmX64.fdf index 905d23b843d3..6999ac1a87b9 100644 --- a/OvmfPkg/Microvm/MicrovmX64.fdf +++ b/OvmfPkg/Microvm/MicrovmX64.fdf @@ -277,6 +277,7 @@ [FV.DXEFV] INF OvmfPkg/VirtioFsDxe/VirtioFsDxe.inf =20 INF EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.inf +INF OvmfPkg/Fdt/VirtioFdtDxe/VirtioFdtDxe.inf =20 !if $(TOOL_CHAIN_TAG) !=3D "XCODE5" INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf --=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 (#84688): https://edk2.groups.io/g/devel/message/84688 Mute This Topic: https://groups.io/mt/87693655/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- From nobody Mon May 6 16:33:05 2024 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+84689+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+84689+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1639383430; cv=none; d=zohomail.com; s=zohoarc; b=RQTUoJMiTvL5nYylTq1Gk8xwswnzk6GPKAR97u15jhfQ78MV3p9OOfvXfiADojFMiaIr8Ci7ESnT2CgdaHqEuItSLYnos9OYahaeDiUzOZCyi3QCGIHOq2VBzJLPnZiwOhrER8SdtZFhlQikbGPfAxoLKq6K3W/sg85Ua8bsf9U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639383430; 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=YZc2f+XQO3oAVdgUeYcNMriCjcRpYEbwngePBpb1ZNo=; b=Fm09qMHq2QC/RGTwv/am1Em0Z4SXkxkh9gNmDU4IEJloUzst7tcuCyRNmAuUGpMx5SANFBPjwinK6jefzTGlriQGKcrZnn5jn0AUMppj78kH8GWtq2+iEQ0AO4Eha03NpPWRuWZKpRpqrEO6nZWI5rDpIj/G6UUWr+TfQR2Jggo= 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+84689+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 1639383430144583.8066119532607; Mon, 13 Dec 2021 00:17:10 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id R4VlYY1788612xHTGip4ydSp; Mon, 13 Dec 2021 00:17:09 -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.web11.8581.1639383429118848886 for ; Mon, 13 Dec 2021 00:17:09 -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-561-C08cWIkgOp-bd1FQvIQXCA-1; Mon, 13 Dec 2021 03:17:04 -0500 X-MC-Unique: C08cWIkgOp-bd1FQvIQXCA-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 5FEE08042EA; Mon, 13 Dec 2021 08:17:03 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.192.14]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2153B5D6D7; Mon, 13 Dec 2021 08:17:03 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 486701800631; 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 , Jiewen Yao Subject: [edk2-devel] [PATCH v3 5/5] OvmfPkg/Microvm: add README Date: Mon, 13 Dec 2021 09:16:58 +0100 Message-Id: <20211213081658.3535809-6-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: RMrCq0JEbj1Gg1TXHEbyWCkQx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1639383429; bh=vg0nCOQ95Lm1fWar27K+bDrMChbokAzadeVkU9m3JtY=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=k2gWV3eMhPrvAaXuZ1Mz3BtxjJA61b7/eMzuKo8JUFTU/KWYiqJ18XyFGeJoBuo5BGL 1uUX7y5HwTsViTDSiio836LMPOTC6mAlse6sScQSPdMaBlxB7Nx0x0SxhrjURry4T9YZV V2GY42vfWSIhjFaRhp2yE77LhbpRHzEhyhM= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1639383431496100023 Content-Type: text/plain; charset="utf-8" Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3599 Signed-off-by: Gerd Hoffmann Acked-by: Jiewen Yao Reviewed-by: Philippe Mathieu-Daude --- OvmfPkg/Microvm/README | 50 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 OvmfPkg/Microvm/README diff --git a/OvmfPkg/Microvm/README b/OvmfPkg/Microvm/README new file mode 100644 index 000000000000..540d39f2ec21 --- /dev/null +++ b/OvmfPkg/Microvm/README @@ -0,0 +1,50 @@ + +This is an *experimental* port of OVMF for the QEMU microvm +machine type. + +microvm background info +----------------------- + +microvm is designed for modern, virtio-based workloads. Most legacy +lpc/isa devices like pit and pic can be turned off. virtio-mmio +(i.e. '-device virtio-{blk,net,scsi,...}-device') is used for +storage/network/etc. + +Optional pcie support is available and any pcie device supported by +QEMU can be plugged in (including virtio-pci if you prefer that over +virtio-mmio). + +https://qemu.readthedocs.io/en/latest/system/i386/microvm.html +https://www.kraxel.org/blog/2020/10/qemu-microvm-acpi/ + +design issues +------------- + +Not fully clear yet how to do hardware detection best. Right now +using device tree to find virtio-mmio devices and pcie host bridge, +can reuse existing ArmVirtPkg code that way. Needs patched QEMU. + +features +-------- + [working] serial console + [working] direct kernel boot + [working] virtio-mmio support + [in progress] pcie support + +known limitations +----------------- + * rtc=3Don is required for now. + * can't use separate code/vars (actually an microvm limitation, + there is no pflash support). + * transitional virtio-pci devices do not work. microvm doesn't + support ioports on pcie, and ovmf doesn't initialize pcie devices + with ioports if there is no address space for them (even though + pcie devices are required to be functional without ioports). + +usage +----- +qemu-system-x86_64 \ + -nographic \ + -machine microvm,acpi=3Don,pit=3Doff,pic=3Doff,rtc=3Don \ + -bios /path/to/MICROVM.fd \ + [ ... more args here ... ] --=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 (#84689): https://edk2.groups.io/g/devel/message/84689 Mute This Topic: https://groups.io/mt/87693656/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-