An X64 UefiPayload chainloaded inside a virtual machine that exposes a
virtio-blk root disk, QEMU for example, does not discover its boot
device: the X64 payload carries neither the virtio-pci transport nor
the virtio class drivers, while the AArch64 build already gets both
through the OvmfPkg AARCH64 component set.

Add a VIRTIO_ENABLE build define (default FALSE) that pulls the OvmfPkg
virtio-pci transport (Virtio10Dxe, VirtioPciDeviceDxe) and the virtio
blk/scsi/net class drivers into the X64 payload's DSC and FDF, together
with their PciCapLib / VirtioLib dependencies. That brings X64 to
parity behind an opt-in switch and matches the existing
{ATA,SD,NVME}_ENABLE convention.

Cc: Benjamin Doron <[email protected]>
Cc: Gua Guo <[email protected]>
Cc: Guo Dong <[email protected]>
Cc: James Lu <[email protected]>
Cc: Sean Rhodes <[email protected]>
Cc: Shuo Liu <[email protected]>
Assisted-by: claude-opus-5
Signed-off-by: Alexander Graf <[email protected]>
---
 UefiPayloadPkg/UefiPayloadPkg.dsc | 22 ++++++++++++++++++++++
 UefiPayloadPkg/UefiPayloadPkg.fdf | 13 +++++++++++++
 2 files changed, 35 insertions(+)

diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc 
b/UefiPayloadPkg/UefiPayloadPkg.dsc
index bff20fd4d5..495bb85868 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.dsc
+++ b/UefiPayloadPkg/UefiPayloadPkg.dsc
@@ -45,6 +45,7 @@
   DEFINE USE_CBMEM_FOR_CONSOLE        = FALSE

   DEFINE BOOTSPLASH_IMAGE             = FALSE

   DEFINE NVME_ENABLE                  = TRUE

+  DEFINE VIRTIO_ENABLE                = FALSE

   DEFINE LOCKBOX_SUPPORT              = FALSE

   DEFINE LOAD_OPTION_ROMS             = FALSE

 

@@ -436,6 +437,16 @@
   
CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf

   CpuPageTableLib|UefiCpuPkg/Library/CpuPageTableLib/CpuPageTableLib.inf

 

+!if $(VIRTIO_ENABLE) == TRUE

+  #

+  # Virtio driver dependencies

+  #

+  PciCapLib|OvmfPkg/Library/BasePciCapLib/BasePciCapLib.inf

+  PciCapPciIoLib|OvmfPkg/Library/UefiPciCapPciIoLib/UefiPciCapPciIoLib.inf

+  
OrderedCollectionLib|MdePkg/Library/BaseOrderedCollectionRedBlackTreeLib/BaseOrderedCollectionRedBlackTreeLib.inf

+  VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf

+!endif

+

 [LibraryClasses.AARCH64]

   ArmHvcLib|ArmPkg/Library/ArmHvcLib/ArmHvcLib.inf

   ArmLib|MdePkg/Library/ArmLib/ArmBaseLib.inf

@@ -1240,6 +1251,17 @@
   !error "Invalid TIMER_SUPPORT"

 !endif

 

+!if $(VIRTIO_ENABLE) == TRUE

+  #

+  # Virtio bus and class drivers

+  #

+  OvmfPkg/Virtio10Dxe/Virtio10.inf

+  OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf

+  OvmfPkg/VirtioBlkDxe/VirtioBlk.inf

+  OvmfPkg/VirtioScsiDxe/VirtioScsi.inf

+  OvmfPkg/VirtioNetDxe/VirtioNet.inf

+!endif

+

 [Components.AARCH64]

   ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf

   ArmPkg/Drivers/CpuDxe/CpuDxe.inf

diff --git a/UefiPayloadPkg/UefiPayloadPkg.fdf 
b/UefiPayloadPkg/UefiPayloadPkg.fdf
index 28afae75dd..054227e3ea 100644
--- a/UefiPayloadPkg/UefiPayloadPkg.fdf
+++ b/UefiPayloadPkg/UefiPayloadPkg.fdf
@@ -170,6 +170,19 @@ INF 
MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntime
   !elseif $(TIMER_SUPPORT) == "LAPIC"

     INF OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf

   !endif

+  !if $(VIRTIO_ENABLE) == TRUE

+    #

+    # Virtio: modern + legacy PCI transport, blk / scsi / net class

+    # drivers.  Enables boot from a virtio-blk root disk on X64

+    # payloads chainloaded inside a virtual machine (e.g. QEMU) that

+    # exposes a virtio-pci endpoint.

+    #

+    INF OvmfPkg/Virtio10Dxe/Virtio10.inf

+    INF OvmfPkg/VirtioPciDeviceDxe/VirtioPciDeviceDxe.inf

+    INF OvmfPkg/VirtioBlkDxe/VirtioBlk.inf

+    INF OvmfPkg/VirtioScsiDxe/VirtioScsi.inf

+    INF OvmfPkg/VirtioNetDxe/VirtioNet.inf

+  !endif

 !elseif "AARCH64" IN "$(ARCH)"

   INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf

   INF ArmPkg/Drivers/ArmGicDxe/ArmGicDxe.inf

-- 
2.47.3



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#122094): https://edk2.groups.io/g/devel/message/122094
Mute This Topic: https://groups.io/mt/120797266/21656
Group Owner: [email protected]
Unsubscribe: https://edk2.groups.io/g/devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to