Skip to content

Commit

Permalink
vfio/pci: Fix VGA quirks
Browse files Browse the repository at this point in the history
Commit 2d82f8a ("vfio/pci: Convert all MemoryRegion to dynamic
alloc and consistent functions") converted VFIOPCIDevice.vga to be
dynamically allocted, negating the need for VFIOPCIDevice.has_vga.
Unfortunately not all of the has_vga users were converted, nor was
the field removed from the structure.  Correct these oversights.

Reported-by: Peter Maloney <[email protected]>
Tested-by: Peter Maloney <[email protected]>
Fixes: 2d82f8a ("vfio/pci: Convert all MemoryRegion to dynamic alloc and consistent functions")
Fixes: https://bugs.launchpad.net/qemu/+bug/1591628
Cc: [email protected]
Signed-off-by: Alex Williamson <[email protected]>
  • Loading branch information
awilliam committed Jun 30, 2016
1 parent 8a0b4de commit 4d3fc4f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
8 changes: 4 additions & 4 deletions hw/vfio/pci-quirks.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ static void vfio_probe_ati_bar4_quirk(VFIOPCIDevice *vdev, int nr)

/* This windows doesn't seem to be used except by legacy VGA code */
if (!vfio_pci_is(vdev, PCI_VENDOR_ID_ATI, PCI_ANY_ID) ||
!vdev->has_vga || nr != 4) {
!vdev->vga || nr != 4) {
return;
}

Expand Down Expand Up @@ -366,7 +366,7 @@ static void vfio_probe_ati_bar2_quirk(VFIOPCIDevice *vdev, int nr)

/* Only enable on newer devices where BAR2 is 64bit */
if (!vfio_pci_is(vdev, PCI_VENDOR_ID_ATI, PCI_ANY_ID) ||
!vdev->has_vga || nr != 2 || !vdev->bars[2].mem64) {
!vdev->vga || nr != 2 || !vdev->bars[2].mem64) {
return;
}

Expand Down Expand Up @@ -660,7 +660,7 @@ static void vfio_probe_nvidia_bar5_quirk(VFIOPCIDevice *vdev, int nr)
VFIOConfigWindowQuirk *window;

if (!vfio_pci_is(vdev, PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID) ||
!vdev->has_vga || nr != 5) {
!vdev->vga || nr != 5) {
return;
}

Expand Down Expand Up @@ -776,7 +776,7 @@ static void vfio_probe_nvidia_bar0_quirk(VFIOPCIDevice *vdev, int nr)
QLIST_INSERT_HEAD(&vdev->bars[nr].quirks, quirk, next);

/* The 0x1800 offset mirror only seems to get used by legacy VGA */
if (vdev->has_vga) {
if (vdev->vga) {
quirk = g_malloc0(sizeof(*quirk));
mirror = quirk->data = g_malloc0(sizeof(*mirror));
mirror->mem = quirk->mem = g_new0(MemoryRegion, 1);
Expand Down
1 change: 0 additions & 1 deletion hw/vfio/pci.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ typedef struct VFIOPCIDevice {
int32_t bootindex;
uint32_t igd_gms;
uint8_t pm_cap;
bool has_vga;
bool pci_aer;
bool req_enabled;
bool has_flr;
Expand Down

0 comments on commit 4d3fc4f

Please sign in to comment.