Resizable BAR (ReBAR) support on VFIO

Goal

Support ReBAR on passed through hardware for VFIO

Technical details

New video cards support Resizable BAR (allows to make BARs bigger than 256M) and benefit from it.

Using VFIO currently doesn't allow the VMs to boot when ReBAR is enabled in UEFI.

Additional information

Currently vfio_add_ext_cap() doesn't pass ReBAR support option to VFIO.

There was a report that removing the line you see below makes it boot, but the system is not stable. Needs investigation.

https://github.com/qemu/qemu/blob/2255564fd21059960966b47212def9069cb56077/hw/vfio/pci.c#L2089

        case 0: /* kernel masked capability */
        case PCI_EXT_CAP_ID_SRIOV: /* Read-only VF BARs confuse OVMF */
        case PCI_EXT_CAP_ID_ARI: /* XXX Needs next function virtualization */
        case PCI_EXT_CAP_ID_REBAR: /* Can't expose read-only */
            trace_vfio_add_ext_cap_dropped(vdev->vbasedev.name, cap_id, next);

Discussion link

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information