From nobody Sun Apr 28 22:14:59 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+83263+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+83263+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1635952006; cv=none; d=zohomail.com; s=zohoarc; b=PlolcLcOL77G/VHaX34RFkZB/FlWCZ94QruBT7zIwvgz0QGEBVYVf+h5QYq4DK4x6rKkPhHHPLK/P0MHe6PQvtTL/4ibtUS99BViSGiivCksBerXkzNcrTuEPgLsJh7NXqlIlvGSOkOOD7zVJZP2wffrsWm0JU2Wl2hax2zdNf4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1635952006; 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=aeHu+rU6/1XEkc2Fr0W8TpyrxmSQKBLeLUc0+CKHKPc=; b=L6ZqPG05iX8Yj0qESieH3F3IIC5dK+7Eq+KIlcidVDB/5PKU8Wi3nCi8MmFep8kr1cxa+gu3n+ztQ7zswkJW9FSsKxLiKCnPSeVHPjrgqUPhJ43b2vwxRM5rGM6+qns03zS1QAhKnjB2ZZAs0XmyfuC1YyEf4ujQz/TImE90p5Q= 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+83263+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 1635952006223310.5291113030156; Wed, 3 Nov 2021 08:06:46 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id JKg3YY1788612x6GQbW9wBZs; Wed, 03 Nov 2021 08:06:45 -0700 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.web09.8945.1635952005189977298 for ; Wed, 03 Nov 2021 08:06:45 -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-193-uEEkbSQkNIC6rqe7GLe_yQ-1; Wed, 03 Nov 2021 11:06:40 -0400 X-MC-Unique: uEEkbSQkNIC6rqe7GLe_yQ-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 04E82A40C1; Wed, 3 Nov 2021 15:06:39 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.194.99]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5A87567848; Wed, 3 Nov 2021 15:06:29 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 8AC2718221B3; 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 1/5] OvmfPkg/Microvm/fdt: add device tree support Date: Wed, 3 Nov 2021 16:06:23 +0100 Message-Id: <20211103150627.3133189-2-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.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: aPF27C6wv23oK0bJhPDyam4ix1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1635952005; bh=YpzhUAYjhXg27QqLd6J9ms+ukCdQ2nthvUlPonn057k=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=NjpZWxIYdPdxwukCqnldTv++LY93m1ydgo3FropgAuCTgkz5plDwDoFi3nOGWfbZXoz 2apdWL19g6iq9IU4uMcrb+7ThnjwUyIyK/NS93X6J+H3RsXYRVALSKptiWIfOfDwB5ExM A3LuokJcSmgcM8UVCcX6xx/ks4DlumJjNlk= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1635952007203100001 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 --- 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 617f92539518..27d2024266c2 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 @@ -738,6 +739,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 6314014f3de7..cc8892a459ee 100644 --- a/OvmfPkg/Microvm/MicrovmX64.fdf +++ b/OvmfPkg/Microvm/MicrovmX64.fdf @@ -277,6 +277,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.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 (#83263): https://edk2.groups.io/g/devel/message/83263 Mute This Topic: https://groups.io/mt/86793343/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 Sun Apr 28 22:14:59 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+83266+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+83266+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1635952019; cv=none; d=zohomail.com; s=zohoarc; b=BpSYPpnA9goQmfYTqlnkpjn3hLQuJUhWILJymBbU/JlXLyRYPEV7pHrk/6THC8ezRKgfkI8dAeHaBYoBC9k5ngs7tAX1G3aC6FgPU0dL4MOF1Ye2pdZ59zej/Uqg1KDRDoL/nvdYoeEBDt/P13oaVzy0wInVXTcOQQ4lMA2+jlo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1635952019; 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=CCrcMBHsYtiarpejruCevIIArD/97X1SXVLj6YaAvC4=; b=Uf8lgFtoPSO9Um9OCRyM4aT4OvG5uXJVrL9c0UGx7PvNNFxwurXIsXG/h3fhr7HP37Zv2GJxxis018zWUHYauosDu9TyqI2Dv/e4O/NP46F9KX5etBBBfqeGhE2vkRxV24NQXgK3gt4+YxRvMIiw26AeMatpHakh00z4/gagxb0= 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+83266+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 1635952019704521.27192601996; Wed, 3 Nov 2021 08:06:59 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 7R5FYY1788612xiTeE9mwbfo; Wed, 03 Nov 2021 08:06:59 -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.8950.1635952018762532281 for ; Wed, 03 Nov 2021 08:06:59 -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-583-1BD5JGUcOGGcx6dOzuvXZg-1; Wed, 03 Nov 2021 11:06:48 -0400 X-MC-Unique: 1BD5JGUcOGGcx6dOzuvXZg-1 X-Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 67C9F10247A7; Wed, 3 Nov 2021 15:06:47 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.194.99]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0834219723; Wed, 3 Nov 2021 15:06:41 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 8D46018221B4; 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 2/5] OvmfPkg/Microvm/fdt: load fdt from fw_cfg Date: Wed, 3 Nov 2021 16:06:24 +0100 Message-Id: <20211103150627.3133189-3-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.84 on 10.5.11.23 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: U0A3az8AMR7w4NZoGK5BeJj4x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1635952019; bh=mVsbuyi6dYvQJdj3qC8rknjL/5eONWU3XttWKLyhLyo=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=GSawtTOLBmMYx4nqPZ5Ro3ctPe/0tCmOZvHS16NvTZcWmiBvefuXXZQXUaXJEqabClc 56rlMWxE6fs0VsdrQcQLWObvgMGqt/Cc4pg4R1+/8lAr1wop9PWrWZMmdF/Kai/pXGCSp Tq7yeW7k4HYA4Wn+xP9sKq5E+AA6mxPZ4L0= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1635952020659100003 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 (#83266): https://edk2.groups.io/g/devel/message/83266 Mute This Topic: https://groups.io/mt/86793348/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 Sun Apr 28 22:14:59 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+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- From nobody Sun Apr 28 22:14:59 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+83265+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+83265+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1635952016; cv=none; d=zohomail.com; s=zohoarc; b=b4Q1vC2WLDHHcoq9YsB+tZqBQCxX+XdSNIOQWJ9v/FFiC/cl+1KBM5VQFTkNqJW5tCSWKw+nlye42pek33jSVxvMrnOXsr1Ap5WO0qyFNMP6yDunIwwH9aJUKis1eWXkcUAJo0nqsr4a47+dZatzKPkdmIlf6N9wPMQ5Yc0DqOI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1635952016; 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=tYHm5wAD8zYO1LkLT2zDJ4gGd0HH4vRPUOjskwGUwW8=; b=hcsNplwNy8C2n6vQDBtNmnDB51qbsbFT21k1TEDIVWaRDe6SHKLu07TK8F0QdxmECsGib5YbxfEpjembfJJJg4OuOJk8fbw/1x3kDvzjCzIIl7zXkBJbpzI48z9Wc02ujcOPWm2E+Jy7n3gLNlfRh5WxVxOiyIunxCwot7+5BwQ= 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+83265+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 1635952016623697.2916613962877; Wed, 3 Nov 2021 08:06:56 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id GJjRYY1788612xGR3dHEepWn; Wed, 03 Nov 2021 08:06:56 -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.web10.9161.1635952015695075688 for ; Wed, 03 Nov 2021 08:06:55 -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-336-rBxQLTdTOFi-jxnB2zMCcA-1; Wed, 03 Nov 2021 11:06:51 -0400 X-MC-Unique: rBxQLTdTOFi-jxnB2zMCcA-1 X-Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B34D1100B780; Wed, 3 Nov 2021 15:06:50 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.194.99]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7187719723; Wed, 3 Nov 2021 15:06:49 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 92EE318221B7; 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 4/5] OvmfPkg/Microvm/virtio: add virtio-mmio support Date: Wed, 3 Nov 2021 16:06:26 +0100 Message-Id: <20211103150627.3133189-5-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.84 on 10.5.11.23 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: lUQB5bgGtgYb5ylwRX9vZ839x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1635952016; bh=NnnoNqMO2SKjQDLV77jmZ8iu1ilXRgxi7r+y2GurvoQ=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=ja8ODPwIsvXQjOl+WI9Uv7XrggQ4jQo/JoqpAWCQF/fwQAyJ0tb4bl74NBLhsj/4Gm+ fV/HXi+54AhcPv132mXXdV5WuQ5RjBvCod0SijErXyJ/VbHSUiPQZLA7J6zEykEKn2RP2 TO7JwiakApcIXCahQ8dQHicps8vg6pGLs48= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1635952018249100001 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 --- 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 27d2024266c2..85afdca9beba 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 @@ -743,6 +744,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 cc8892a459ee..0bf20a702764 100644 --- a/OvmfPkg/Microvm/MicrovmX64.fdf +++ b/OvmfPkg/Microvm/MicrovmX64.fdf @@ -278,6 +278,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.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 (#83265): https://edk2.groups.io/g/devel/message/83265 Mute This Topic: https://groups.io/mt/86793347/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 Sun Apr 28 22:14:59 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+83268+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+83268+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1635952037; cv=none; d=zohomail.com; s=zohoarc; b=SWzFGBwx24YkyG6ie1w0MeiJy027k9upgeqeQqfmVGNqtKLDAN2TK0Oom95ZIR9kPoI47amga6l4LbNezS8bOqH7g7juDPrs5aNRPR7YLYFeaTzR47Hetjsjm5hoZaY6H02yxAlXlEdR3rvUxmtyPBoiiorH0mcf9/nqj82OZWM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1635952037; 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=4xWYQYeyt7fI6cNp50o8bSM8cDnYOHmDeUFLGQBC/dI=; b=Rln3RQ6QsXYgJTsfEOEwQkh/cvADoufEWV/uAaMxOZKu6GVE0oMWfdkzxzDyRvlPtV4Ax8vTd5+/ugjH42l/fBAv+kQaZt+QQsTYs3r81ARBM1wP1Aa68VY2Ze4x8A4ke45BCQisPLFrdKZqnnTwJpZJDn99b8Zbri2rOVd36Oo= 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+83268+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 1635952037527687.3677832521465; Wed, 3 Nov 2021 08:07:17 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id ix9kYY1788612xnuburNAvle; Wed, 03 Nov 2021 08:07:17 -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.web08.8928.1635952036466691253 for ; Wed, 03 Nov 2021 08:07:16 -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-530-xShWh2yOMCKoZ6jqRW2RXQ-1; Wed, 03 Nov 2021 11:07:10 -0400 X-MC-Unique: xShWh2yOMCKoZ6jqRW2RXQ-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 737FB18414A0; Wed, 3 Nov 2021 15:07:09 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.194.99]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9B37757CAB; Wed, 3 Nov 2021 15:06:51 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 957C418221BA; 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 , Jiewen Yao Subject: [edk2-devel] [PATCH v2 5/5] OvmfPkg/Microvm: add README Date: Wed, 3 Nov 2021 16:06:27 +0100 Message-Id: <20211103150627.3133189-6-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.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: kHkAPK2nJxO9ifc5N250KUaVx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1635952037; bh=xGmkv5MjRZ5eZV5C/G0xgk2zDenrAyI1Eqot2Ksdla0=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=clvR+zf6BdNUs8kvxjDje9umiWbt1zlcdGffN6hlkrRDsA+NzinAy0HQt3bqm+tnx53 cxci481NRAc1tjfcOF0+I+Meb5bv9cb/HZN3Mn2jnHf2tXsjf1fBgMzbItfix/eiyVGDB q3NFJYnLyppzR/uAUlNH1uCBe6LSKN+wIew= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1635952039507100002 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 --- 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..82e2bfe03d37 --- /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.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 (#83268): https://edk2.groups.io/g/devel/message/83268 Mute This Topic: https://groups.io/mt/86793355/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-