* [PATCH 0/5] [RfC] OvmfPkg/Microvm: second batch of microvm patches @ 2021-10-14 15:30 Gerd Hoffmann 2021-10-14 15:30 ` [PATCH 1/5] OvmfPkg/Microvm/fdt: add device tree support Gerd Hoffmann ` (4 more replies) 0 siblings, 5 replies; 12+ messages in thread From: Gerd Hoffmann @ 2021-10-14 15:30 UTC (permalink / raw) To: devel; +Cc: Ard Biesheuvel, Jordan Justen, Jiewen Yao, Gerd Hoffmann Adds support for virtio-mmio devices to microvm. Needs patched qemu, so posting this only for review. Actual merge should wait until the host side changes are accepted to qemu. While being at it also add the README, the patch somehow disappeared from the first batch. Gerd Hoffmann (5): OvmfPkg/Microvm/fdt: add device tree support OvmfPkg/Microvm/fdt: load fdt from fw_cfg OvmfPkg/Microvm/fdt: add empty fdt OvmfPkg/Microvm/virtio: add virtio-mmio support OvmfPkg/Microvm: add README OvmfPkg/Microvm/MicrovmX64.dsc | 8 ++++ OvmfPkg/Microvm/MicrovmX64.fdf | 3 ++ OvmfPkg/PlatformPei/PlatformPei.inf | 1 + OvmfPkg/PlatformPei/Platform.c | 58 +++++++++++++++++++++++++++++ OvmfPkg/Microvm/README | 50 +++++++++++++++++++++++++ 5 files changed, 120 insertions(+) create mode 100644 OvmfPkg/Microvm/README -- 2.31.1 ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 1/5] OvmfPkg/Microvm/fdt: add device tree support 2021-10-14 15:30 [PATCH 0/5] [RfC] OvmfPkg/Microvm: second batch of microvm patches Gerd Hoffmann @ 2021-10-14 15:30 ` Gerd Hoffmann 2021-10-14 15:30 ` [PATCH 2/5] OvmfPkg/Microvm/fdt: load fdt from fw_cfg Gerd Hoffmann ` (3 subsequent siblings) 4 siblings, 0 replies; 12+ messages in thread From: Gerd Hoffmann @ 2021-10-14 15:30 UTC (permalink / raw) To: devel; +Cc: Ard Biesheuvel, Jordan Justen, Jiewen Yao, Gerd Hoffmann Add fdt parser from EmbeddedPkg (FdtLib and FdtClientDxe) to MicrovmX64. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3689 Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> --- 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/BaseSerialPortLib16550.inf PlatformHookLib|MdeModulePkg/Library/BasePlatformHookLibNull/BasePlatformHookLibNull.inf + FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf [LibraryClasses.common.SEC] QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgSecLib.inf @@ -738,6 +739,11 @@ [Components] # MdeModulePkg/Universal/SerialDxe/SerialDxe.inf + # + # 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 +INF EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.inf + !if $(TOOL_CHAIN_TAG) != "XCODE5" INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf INF ShellPkg/DynamicCommand/HttpDynamicCommand/HttpDynamicCommand.inf -- 2.31.1 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 2/5] OvmfPkg/Microvm/fdt: load fdt from fw_cfg 2021-10-14 15:30 [PATCH 0/5] [RfC] OvmfPkg/Microvm: second batch of microvm patches Gerd Hoffmann 2021-10-14 15:30 ` [PATCH 1/5] OvmfPkg/Microvm/fdt: add device tree support Gerd Hoffmann @ 2021-10-14 15:30 ` Gerd Hoffmann 2021-10-14 15:30 ` [PATCH 3/5] OvmfPkg/Microvm/fdt: add empty fdt Gerd Hoffmann ` (2 subsequent siblings) 4 siblings, 0 replies; 12+ messages in thread From: Gerd Hoffmann @ 2021-10-14 15:30 UTC (permalink / raw) To: devel; +Cc: Ard Biesheuvel, Jordan Justen, Jiewen Yao, Gerd Hoffmann 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=3689 Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> --- 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/PlatformPei.inf index 67eb7aa7166b..56876184b17a 100644 --- a/OvmfPkg/PlatformPei/PlatformPei.inf +++ b/OvmfPkg/PlatformPei/PlatformPei.inf @@ -44,6 +44,7 @@ [Packages] [Guids] gEfiMemoryTypeInformationGuid + gFdtHobGuid [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 ( ); } +VOID +MicrovmInitialization ( + VOID + ) +{ + FIRMWARE_CONFIG_ITEM FdtItem; + UINTN FdtSize; + UINTN FdtPages; + EFI_STATUS Status; + UINT64 *FdtHobData; + VOID *NewBase; + + Status = QemuFwCfgFindFile ("etc/fdt", &FdtItem, &FdtSize); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_INFO, "%a: no etc/fdt found in fw_cfg\n", __FUNCTION__)); + return; + } + + FdtPages = EFI_SIZE_TO_PAGES (FdtSize); + NewBase = AllocatePages (FdtPages); + if (NewBase == NULL) { + DEBUG ((DEBUG_INFO, "%a: AllocatePages failed\n", __FUNCTION__)); + return; + } + + QemuFwCfgSelectItem (FdtItem); + QemuFwCfgReadBytes (FdtSize, NewBase); + + FdtHobData = BuildGuidHob (&gFdtHobGuid, sizeof (*FdtHobData)); + if (FdtHobData == 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 = (UINTN)NewBase; +} + VOID MiscInitialization ( VOID @@ -368,6 +407,7 @@ MiscInitialization ( break; case 0xffff: /* microvm */ DEBUG ((DEBUG_INFO, "%a: microvm\n", __FUNCTION__)); + MicrovmInitialization(); PcdStatus = PcdSet16S (PcdOvmfHostBridgePciDevId, MICROVM_PSEUDO_DEVICE_ID); ASSERT_RETURN_ERROR (PcdStatus); -- 2.31.1 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 3/5] OvmfPkg/Microvm/fdt: add empty fdt 2021-10-14 15:30 [PATCH 0/5] [RfC] OvmfPkg/Microvm: second batch of microvm patches Gerd Hoffmann 2021-10-14 15:30 ` [PATCH 1/5] OvmfPkg/Microvm/fdt: add device tree support Gerd Hoffmann 2021-10-14 15:30 ` [PATCH 2/5] OvmfPkg/Microvm/fdt: load fdt from fw_cfg Gerd Hoffmann @ 2021-10-14 15:30 ` Gerd Hoffmann 2021-10-15 3:54 ` Yao, Jiewen 2021-10-14 15:30 ` [PATCH 4/5] OvmfPkg/Microvm/virtio: add virtio-mmio support Gerd Hoffmann 2021-10-14 15:30 ` [PATCH 5/5] OvmfPkg/Microvm: add README Gerd Hoffmann 4 siblings, 1 reply; 12+ messages in thread From: Gerd Hoffmann @ 2021-10-14 15:30 UTC (permalink / raw) To: devel; +Cc: Ard Biesheuvel, Jordan Justen, Jiewen Yao, Gerd Hoffmann 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. https://bugzilla.tianocore.org/show_bug.cgi?id=3689 Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> --- 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 <Library/BaseMemoryLib.h> #include <Library/BaseLib.h> #include <Library/DebugLib.h> #include <Library/HobLib.h> @@ -321,6 +322,18 @@ PciExBarInitialization ( ); } +static const UINT8 EmptyFdt[] = { + 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 ( Status = 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 = 0; + FdtSize = sizeof(EmptyFdt); } FdtPages = EFI_SIZE_TO_PAGES (FdtSize); @@ -346,8 +360,12 @@ MicrovmInitialization ( return; } - QemuFwCfgSelectItem (FdtItem); - QemuFwCfgReadBytes (FdtSize, NewBase); + if (FdtItem) { + QemuFwCfgSelectItem (FdtItem); + QemuFwCfgReadBytes (FdtSize, NewBase); + } else { + CopyMem(NewBase, EmptyFdt, FdtSize); + } FdtHobData = BuildGuidHob (&gFdtHobGuid, sizeof (*FdtHobData)); if (FdtHobData == NULL) { -- 2.31.1 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 3/5] OvmfPkg/Microvm/fdt: add empty fdt 2021-10-14 15:30 ` [PATCH 3/5] OvmfPkg/Microvm/fdt: add empty fdt Gerd Hoffmann @ 2021-10-15 3:54 ` Yao, Jiewen 2021-10-15 4:53 ` [edk2-devel] " Gerd Hoffmann 0 siblings, 1 reply; 12+ messages in thread From: Yao, Jiewen @ 2021-10-15 3:54 UTC (permalink / raw) To: Gerd Hoffmann, devel@edk2.groups.io; +Cc: Ard Biesheuvel, Justen, Jordan L Hi I am not sure where the problem is. "FdtClient is unhappy without a device tree, so add an empty fdt" Do we have option 2 to fix the issue? If no device tree, why we need FdtClient? Why we need make it happy? Thank you Yao Jiewen > -----Original Message----- > From: Gerd Hoffmann <kraxel@redhat.com> > Sent: Thursday, October 14, 2021 11:30 PM > To: devel@edk2.groups.io > Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>; Justen, Jordan L > <jordan.l.justen@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>; Gerd > Hoffmann <kraxel@redhat.com> > Subject: [PATCH 3/5] OvmfPkg/Microvm/fdt: add empty fdt > > 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. > > https://bugzilla.tianocore.org/show_bug.cgi?id=3689 > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> > --- > 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 <Library/BaseMemoryLib.h> > #include <Library/BaseLib.h> > #include <Library/DebugLib.h> > #include <Library/HobLib.h> > @@ -321,6 +322,18 @@ PciExBarInitialization ( > ); > } > > +static const UINT8 EmptyFdt[] = { > + 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 ( > > Status = 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 = 0; > + FdtSize = sizeof(EmptyFdt); > } > > FdtPages = EFI_SIZE_TO_PAGES (FdtSize); > @@ -346,8 +360,12 @@ MicrovmInitialization ( > return; > } > > - QemuFwCfgSelectItem (FdtItem); > - QemuFwCfgReadBytes (FdtSize, NewBase); > + if (FdtItem) { > + QemuFwCfgSelectItem (FdtItem); > + QemuFwCfgReadBytes (FdtSize, NewBase); > + } else { > + CopyMem(NewBase, EmptyFdt, FdtSize); > + } > > FdtHobData = BuildGuidHob (&gFdtHobGuid, sizeof (*FdtHobData)); > if (FdtHobData == NULL) { > -- > 2.31.1 ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [edk2-devel] [PATCH 3/5] OvmfPkg/Microvm/fdt: add empty fdt 2021-10-15 3:54 ` Yao, Jiewen @ 2021-10-15 4:53 ` Gerd Hoffmann 2021-10-15 16:10 ` Yao, Jiewen 0 siblings, 1 reply; 12+ messages in thread From: Gerd Hoffmann @ 2021-10-15 4:53 UTC (permalink / raw) To: devel, jiewen.yao; +Cc: Ard Biesheuvel, Justen, Jordan L On Fri, Oct 15, 2021 at 03:54:19AM +0000, Yao, Jiewen wrote: > Hi > I am not sure where the problem is. "FdtClient is unhappy without a device tree, so add an empty fdt" FdtClient throws an assert() in case no device tree is present. > Do we have option 2 to fix the issue? > If no device tree, why we need FdtClient? Why we need make it happy? Well, if all goes as planned the microvm in qemu 6.2+ will provide the fdt but older qemu versions don't. So I want use the fdt if present to detect virtio-mmio devices. On older qemu versions without fdt I do *not* want abort the boot though, the firmware still works with reduced functionality (no storage/network, but direct kernel boot works). The microvm situation is a bit special here. On arm systems the fdt is rather essential for hardware bringup, which is probably the reason for the assert(). For microvm this is not the case though. take care, Gerd ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [edk2-devel] [PATCH 3/5] OvmfPkg/Microvm/fdt: add empty fdt 2021-10-15 4:53 ` [edk2-devel] " Gerd Hoffmann @ 2021-10-15 16:10 ` Yao, Jiewen 0 siblings, 0 replies; 12+ messages in thread From: Yao, Jiewen @ 2021-10-15 16:10 UTC (permalink / raw) To: devel@edk2.groups.io, kraxel@redhat.com; +Cc: Ard Biesheuvel, Justen, Jordan L OK. I recommend to add those background info in comments. Thank you Yao Jiewen > -----Original Message----- > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Gerd > Hoffmann > Sent: Friday, October 15, 2021 12:53 PM > To: devel@edk2.groups.io; Yao, Jiewen <jiewen.yao@intel.com> > Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>; Justen, Jordan L > <jordan.l.justen@intel.com> > Subject: Re: [edk2-devel] [PATCH 3/5] OvmfPkg/Microvm/fdt: add empty fdt > > On Fri, Oct 15, 2021 at 03:54:19AM +0000, Yao, Jiewen wrote: > > Hi > > I am not sure where the problem is. "FdtClient is unhappy without a device tree, > so add an empty fdt" > > FdtClient throws an assert() in case no device tree is present. > > > Do we have option 2 to fix the issue? > > If no device tree, why we need FdtClient? Why we need make it happy? > > Well, if all goes as planned the microvm in qemu 6.2+ will provide the > fdt but older qemu versions don't. So I want use the fdt if present to > detect virtio-mmio devices. On older qemu versions without fdt I do > *not* want abort the boot though, the firmware still works with reduced > functionality (no storage/network, but direct kernel boot works). > > The microvm situation is a bit special here. On arm systems the fdt is > rather essential for hardware bringup, which is probably the reason for > the assert(). For microvm this is not the case though. > > take care, > Gerd > > > > > ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 4/5] OvmfPkg/Microvm/virtio: add virtio-mmio support 2021-10-14 15:30 [PATCH 0/5] [RfC] OvmfPkg/Microvm: second batch of microvm patches Gerd Hoffmann ` (2 preceding siblings ...) 2021-10-14 15:30 ` [PATCH 3/5] OvmfPkg/Microvm/fdt: add empty fdt Gerd Hoffmann @ 2021-10-14 15:30 ` Gerd Hoffmann 2021-10-15 3:57 ` [edk2-devel] " Yao, Jiewen 2021-10-14 15:30 ` [PATCH 5/5] OvmfPkg/Microvm: add README Gerd Hoffmann 4 siblings, 1 reply; 12+ messages in thread From: Gerd Hoffmann @ 2021-10-14 15:30 UTC (permalink / raw) To: devel; +Cc: Ard Biesheuvel, Jordan Justen, Jiewen Yao, Gerd Hoffmann Add virtio-mmio support (VirtioMmioDeviceLib and VirtioFdtDxe). https://bugzilla.tianocore.org/show_bug.cgi?id=3689 Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> --- 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/BaseSerialPortLib16550.inf PlatformHookLib|MdeModulePkg/Library/BasePlatformHookLibNull/BasePlatformHookLibNull.inf FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf + VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceLib.inf [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 # # 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 INF EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.inf +INF OvmfPkg/Fdt/VirtioFdtDxe/VirtioFdtDxe.inf !if $(TOOL_CHAIN_TAG) != "XCODE5" INF ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf -- 2.31.1 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [edk2-devel] [PATCH 4/5] OvmfPkg/Microvm/virtio: add virtio-mmio support 2021-10-14 15:30 ` [PATCH 4/5] OvmfPkg/Microvm/virtio: add virtio-mmio support Gerd Hoffmann @ 2021-10-15 3:57 ` Yao, Jiewen 2021-10-15 4:57 ` Gerd Hoffmann 0 siblings, 1 reply; 12+ messages in thread From: Yao, Jiewen @ 2021-10-15 3:57 UTC (permalink / raw) To: devel@edk2.groups.io, kraxel@redhat.com; +Cc: Ard Biesheuvel, Justen, Jordan L Would you please help me understand what the relationship is between VirtioMmio and VirtioFdt ? The Bugzilla just states "add support for virtio-mmio devices". How VirtioFdt comes into this case? Thank you Yao Jiewen > -----Original Message----- > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Gerd > Hoffmann > Sent: Thursday, October 14, 2021 11:30 PM > To: devel@edk2.groups.io > Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>; Justen, Jordan L > <jordan.l.justen@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>; Gerd > Hoffmann <kraxel@redhat.com> > Subject: [edk2-devel] [PATCH 4/5] OvmfPkg/Microvm/virtio: add virtio-mmio > support > > Add virtio-mmio support (VirtioMmioDeviceLib and VirtioFdtDxe). > > https://bugzilla.tianocore.org/show_bug.cgi?id=3689 > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> > --- > 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/BaseSerialPortLib > 16550.inf > > PlatformHookLib|MdeModulePkg/Library/BasePlatformHookLibNull/BasePlatfo > rmHookLibNull.inf > FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf > + > VirtioMmioDeviceLib|OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice > Lib.inf > > [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 > > # > # 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 > > INF EmbeddedPkg/Drivers/FdtClientDxe/FdtClientDxe.inf > +INF OvmfPkg/Fdt/VirtioFdtDxe/VirtioFdtDxe.inf > > !if $(TOOL_CHAIN_TAG) != "XCODE5" > INF > ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf > -- > 2.31.1 > > > > > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [edk2-devel] [PATCH 4/5] OvmfPkg/Microvm/virtio: add virtio-mmio support 2021-10-15 3:57 ` [edk2-devel] " Yao, Jiewen @ 2021-10-15 4:57 ` Gerd Hoffmann 2021-10-15 16:08 ` Yao, Jiewen 0 siblings, 1 reply; 12+ messages in thread From: Gerd Hoffmann @ 2021-10-15 4:57 UTC (permalink / raw) To: Yao, Jiewen; +Cc: devel@edk2.groups.io, Ard Biesheuvel, Justen, Jordan L On Fri, Oct 15, 2021 at 03:57:28AM +0000, Yao, Jiewen wrote: > Would you please help me understand what the relationship is between VirtioMmio and VirtioFdt ? > > The Bugzilla just states "add support for virtio-mmio devices". How VirtioFdt comes into this case? The plan is to use an fdt to allow ovmf find the virtio-mmio devices. The qemu patch for that is here: https://gitlab.com/kraxel/qemu/-/commit/81b52c9fbef8f5f52c3c88dc3b80cf4093c96df6 take care, Gerd ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [edk2-devel] [PATCH 4/5] OvmfPkg/Microvm/virtio: add virtio-mmio support 2021-10-15 4:57 ` Gerd Hoffmann @ 2021-10-15 16:08 ` Yao, Jiewen 0 siblings, 0 replies; 12+ messages in thread From: Yao, Jiewen @ 2021-10-15 16:08 UTC (permalink / raw) To: devel@edk2.groups.io, kraxel@redhat.com; +Cc: Ard Biesheuvel, Justen, Jordan L OK. I recommend to add those info in Bugzilla and the description as well. > -----Original Message----- > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Gerd > Hoffmann > Sent: Friday, October 15, 2021 12:57 PM > To: Yao, Jiewen <jiewen.yao@intel.com> > Cc: devel@edk2.groups.io; Ard Biesheuvel <ardb+tianocore@kernel.org>; Justen, > Jordan L <jordan.l.justen@intel.com> > Subject: Re: [edk2-devel] [PATCH 4/5] OvmfPkg/Microvm/virtio: add virtio- > mmio support > > On Fri, Oct 15, 2021 at 03:57:28AM +0000, Yao, Jiewen wrote: > > Would you please help me understand what the relationship is between > VirtioMmio and VirtioFdt ? > > > > The Bugzilla just states "add support for virtio-mmio devices". How VirtioFdt > comes into this case? > > The plan is to use an fdt to allow ovmf find the virtio-mmio devices. > > The qemu patch for that is here: > https://gitlab.com/kraxel/qemu/- > /commit/81b52c9fbef8f5f52c3c88dc3b80cf4093c96df6 > > take care, > Gerd > > > > > ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 5/5] OvmfPkg/Microvm: add README 2021-10-14 15:30 [PATCH 0/5] [RfC] OvmfPkg/Microvm: second batch of microvm patches Gerd Hoffmann ` (3 preceding siblings ...) 2021-10-14 15:30 ` [PATCH 4/5] OvmfPkg/Microvm/virtio: add virtio-mmio support Gerd Hoffmann @ 2021-10-14 15:30 ` Gerd Hoffmann 4 siblings, 0 replies; 12+ messages in thread From: Gerd Hoffmann @ 2021-10-14 15:30 UTC (permalink / raw) To: devel; +Cc: Ard Biesheuvel, Jordan Justen, Jiewen Yao, Gerd Hoffmann, Jiewen Yao Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3599 Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Jiewen Yao <Jiewen.yao@intel.com> --- 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=on 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=on,pit=off,pic=off,rtc=on \ + -bios /path/to/MICROVM.fd \ + [ ... more args here ... ] -- 2.31.1 ^ permalink raw reply related [flat|nested] 12+ messages in thread
end of thread, other threads:[~2021-10-15 16:14 UTC | newest] Thread overview: 12+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2021-10-14 15:30 [PATCH 0/5] [RfC] OvmfPkg/Microvm: second batch of microvm patches Gerd Hoffmann 2021-10-14 15:30 ` [PATCH 1/5] OvmfPkg/Microvm/fdt: add device tree support Gerd Hoffmann 2021-10-14 15:30 ` [PATCH 2/5] OvmfPkg/Microvm/fdt: load fdt from fw_cfg Gerd Hoffmann 2021-10-14 15:30 ` [PATCH 3/5] OvmfPkg/Microvm/fdt: add empty fdt Gerd Hoffmann 2021-10-15 3:54 ` Yao, Jiewen 2021-10-15 4:53 ` [edk2-devel] " Gerd Hoffmann 2021-10-15 16:10 ` Yao, Jiewen 2021-10-14 15:30 ` [PATCH 4/5] OvmfPkg/Microvm/virtio: add virtio-mmio support Gerd Hoffmann 2021-10-15 3:57 ` [edk2-devel] " Yao, Jiewen 2021-10-15 4:57 ` Gerd Hoffmann 2021-10-15 16:08 ` Yao, Jiewen 2021-10-14 15:30 ` [PATCH 5/5] OvmfPkg/Microvm: add README Gerd Hoffmann
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox