[virtio] Ignore capabilities that describe inaccessible PCI BARs

In some configurations, newer versions of QEMU will end up placing the
modern interface's BAR4 above 4GB, rendering it inaccessible in a
32-bit build of iPXE.  We will currently detect the existence of the
modern interface and attempt to use it, but fail at the point of
attempting to map the PCI BARs.

Fix by ignoring any virtio capabilities that describe an inaccessible
PCI BAR, and thereby allowing iPXE to fall back to using the legacy
interface if the modern interface's BAR cannot be used.

Reported-by: Jan ONDREJ (SAL) <ondrejj@salstar.sk>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2026-06-16 13:04:01 +01:00
parent 22564dd26b
commit fe070bf2de
+7
View File
@@ -409,6 +409,13 @@ static int virtio_pci_cap ( struct virtio_device *virtio,
if ( reg > PCI_BASE_ADDRESS_5 )
continue;
/* Check BAR accessibility */
if ( ! pci_bar_start ( pci, reg ) ) {
DBGC ( virtio, "VIRTIO %s capability type %d BAR%d is "
"not usable\n", virtio->name, type, cap->bar );
continue;
}
/* Success */
cap->pos = pos;
return 0;