On Tue, 8 Jul 2025 22:52:11 +0800 Tomita Moeko <tomitamo...@gmail.com> wrote:
> Introduce x-pci-class-code option to allow users to override PCI class > code of a device, similar to the existing x-pci-vendor-id option. Only > the lower 24 bits of this option are used, though a uint32 is used here > for determining whether the value is valid and set by user. > > Additionally, to ensure VGA ranges are only exposed on VGA devices, > pci_register_vga() is now called in vfio_pci_config_setup(), after > the class code override is completed. > > This is mainly intended for IGD devices that expose themselves either > as VGA controller (primary display) or Display controller (non-primary > display). The UEFI GOP driver depends on the device reporting a VGA > controller class code (0x030000). > > Signed-off-by: Tomita Moeko <tomitamo...@gmail.com> > --- > v3: > * Save the vdev class code when it is unspecified. > * Call pci_register_vga() in vfio_pci_config_setup() to ensure VGA > regions are only get exposed when vdev is VGA. > * Check vdev class code in vfio_is_vga(). > Link: > https://lore.kernel.org/qemu-devel/20250528155548.29344-1-tomitamo...@gmail.com/ > > v2: > * Add vdev class code check in vfio_populate_vga(). > * Fix type in trace-events. > Link: > https://lore.kernel.org/all/20250524153102.19747-1-tomitamo...@gmail.com/ > > hw/vfio/pci.c | 29 +++++++++++++++++++++++++---- > hw/vfio/pci.h | 6 ++---- > hw/vfio/trace-events | 1 + > 3 files changed, 28 insertions(+), 8 deletions(-) Reviewed-by: Alex Williamson <alex.william...@redhat.com>