MsvmPkg: Add virtio-blk over PCI support (ported from EDK2 OvmfPkg)#90
Conversation
Port the virtio-blk-over-PCI driver stack from EDK2 OvmfPkg into MsvmPkg
for both X64 and AARCH64.
Modules added (drivers):
- MsvmPkg/VirtioBlkDxe (OvmfPkg/VirtioBlkDxe)
- MsvmPkg/Virtio10Dxe (OvmfPkg/Virtio10Dxe, modern 1.0 PCI transport)
- MsvmPkg/VirtioPciDeviceDxe (OvmfPkg/VirtioPciDeviceDxe, legacy transport)
Libraries added:
- MsvmPkg/Library/VirtioLib (OvmfPkg/Library/VirtioLib)
- MsvmPkg/Library/BasePciCapLib (OvmfPkg/Library/BasePciCapLib)
- MsvmPkg/Library/UefiPciCapPciIoLib (OvmfPkg/Library/UefiPciCapPciIoLib)
Headers added under MsvmPkg/Include:
IndustryStandard/{Virtio,Virtio095,Virtio10,VirtioBlk}.h,
Protocol/VirtioDevice.h, Library/{VirtioLib,PciCapLib,PciCapPciIoLib}.h
Wiring:
- MsvmPkg.dec: define gVirtioDeviceProtocolGuid (value preserved from OvmfPkg)
- MsvmPkgX64.dsc / MsvmPkgAARCH64.dsc: add VirtioLib/PciCapLib/PciCapPciIoLib
library classes and the three driver components
- MsvmPkgX64.fdf / MsvmPkgAARCH64.fdf: add the three drivers to the DXE FV
The only change to the upstream sources is retargeting each INF's [Packages]
from OvmfPkg/OvmfPkg.dec to MsvmPkg/MsvmPkg.dec; the .c/.h files are verbatim.
Source provenance:
Repository: https://github.com/tianocore/edk2
Tag: edk2-stable202511
Commit: 46548b1adac82211d8d11da12dd914f41e7aa775
chris-oo
left a comment
There was a problem hiding this comment.
This is fine with me, but I did have a question on how we want to handle this code in the future. Is this commit message equivalent or do others think we should have some kind of provenance in the repo for the drivers?
Additionally, I think with the way these drivers bind they will be no-ops if we don't expose any virtio devices, right? Or is there another way we can make sure that these drivers don't load when they're not expected to?
I'd also like Oliver/someone on sean's team to comment as well.
|
@maheeraeron we'll have to decide what to do about uncrustify for these foreign components |
|
[Copilot] Legacy transport ( If Hyper-V only ever exposes modern (1.0+) virtio devices, consider dropping |
|
[Copilot] On provenance (re: @chris-oo's question): the commit message is a reasonable minimum, but since this is an upstream subtree that will need future CVE/security-patch pickups from EDK2, I'd recommend recording the source coordinates in-repo — e.g. a short |
|
[Copilot] Minor / AARCH64: the legacy |
|
Should enumeration of these devices be restricted for CVM? |
Maybe initially. Do we have a UEFI PCI filtering story for CVM? Or do we just rely on the paravisor today? |
|
for vmbus, we rely on channel ID. For VPCI, we rely on device filtering for NVMe+AzHsm. We may need similar for PCIe and now virtio In reply to: 4994425978 |
|
|
||
| ## Refreshing from upstream | ||
|
|
||
| To pick up an upstream fix: |
|
[Copilot] Minor (VirtioPkg split): |
|
[Copilot] Component governance: since |
Port the virtio-blk-over-PCI driver stack from EDK2 OvmfPkg into a standalone VirtioPkg package for both X64 and AARCH64. Only the modern (virtio 1.0+) non-transitional transport is included.
Modules added (drivers):
Libraries added:
Headers added under VirtioPkg/Include:
IndustryStandard/{Virtio,Virtio095,Virtio10,VirtioBlk}.h,
Protocol/VirtioDevice.h, Library/{VirtioLib,PciCapLib,PciCapPciIoLib}.h
Wiring:
The only change to the upstream sources is retargeting each INF's [Packages] from OvmfPkg/OvmfPkg.dec to VirtioPkg/VirtioPkg.dec; the .c/.h files are verbatim. See VirtioPkg/README.md for the per-file upstream mapping.
Source provenance:
Repository: https://github.com/tianocore/edk2
Tag: edk2-stable202511
Commit: 46548b1adac82211d8d11da12dd914f41e7aa775