Currently, an error is logged for this case, but a device not supporting VGA is not an error, so this particular -EINVAL is intended and correct for devices without VGA regions.
Two fixes:
make the ioctl wrappers return the actual errno errors, instead of the ioctl return values.
vfio_pci driver returns num_regions of at least VFIO_PCI_NUM_REGIONS from VFIO_DEVICE_GET_INFO ioctl.
However, if the device does not support VGA, the VFIO_DEVICE_GET_REGION_INFO ioctl returns -EINVAL for VFIO_PCI_VGA_REGION_INDEX.
Currently, an error is logged for this case, but a device not supporting VGA is not an error, so this particular -EINVAL is intended and correct for devices without VGA regions.
Two fixes: