int gen;
if (!vfio_pci_is(vdev, PCI_VENDOR_ID_INTEL, PCI_ANY_ID) ||
- !vfio_is_vga(vdev) || nr != 0) {
+ !vfio_is_base_display(vdev) || nr != 0) {
return;
}
Error *err = NULL;
if (!vfio_pci_is(vdev, PCI_VENDOR_ID_INTEL, PCI_ANY_ID) ||
- !vfio_is_vga(vdev)) {
+ !vfio_is_base_display(vdev)) {
return true;
}
/*
* For backward compatibility, enable legacy mode when
* - Device geneation is 6 to 9 (including both)
- * - IGD claims VGA cycles on host
+ * - IGD exposes itself as VGA controller and claims VGA cycles on host
* - Machine type is i440fx (pc_piix)
* - IGD device is at guest BDF 00:02.0
* - Not manually disabled by x-igd-legacy-mode=off
*/
if ((vdev->igd_legacy_mode != ON_OFF_AUTO_OFF) &&
+ vfio_is_vga(vdev) &&
(gen >= 6 && gen <= 9) &&
!(gmch & IGD_GMCH_VGA_DISABLE) &&
!strcmp(MACHINE_GET_CLASS(qdev_get_machine())->family, "pc_piix") &&
return (vdev->class_code >> 8) == PCI_CLASS_DISPLAY_VGA;
}
+static inline bool vfio_is_base_display(VFIOPCIDevice *vdev)
+{
+ return (vdev->class_code >> 16) == PCI_BASE_CLASS_DISPLAY;
+}
+
/* MSI/MSI-X/INTx */
void vfio_pci_vector_init(VFIOPCIDevice *vdev, int nr);
void vfio_pci_add_kvm_msi_virq(VFIOPCIDevice *vdev, VFIOMSIVector *vector,