aboutsummaryrefslogtreecommitdiff
path: root/hw/vfio/pci-quirks.c
diff options
context:
space:
mode:
authorAlex Williamson <alex.williamson@redhat.com>2015-09-23 13:04:49 -0600
committerAlex Williamson <alex.williamson@redhat.com>2015-09-23 13:04:49 -0600
commitff635e3775447b7e797f1bad8cf33403199faba1 (patch)
tree875770cc2293e4e12019607980bee09009163092 /hw/vfio/pci-quirks.c
parentc9c5000991148383d628aac59f1593937be572e4 (diff)
downloadqemu-ff635e3775447b7e797f1bad8cf33403199faba1.zip
qemu-ff635e3775447b7e797f1bad8cf33403199faba1.tar.gz
qemu-ff635e3775447b7e797f1bad8cf33403199faba1.tar.bz2
vfio/pci: Cache vendor and device ID
Simplify access to commonly referenced PCI vendor and device ID by caching it on the VFIOPCIDevice struct. Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'hw/vfio/pci-quirks.c')
-rw-r--r--hw/vfio/pci-quirks.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/hw/vfio/pci-quirks.c b/hw/vfio/pci-quirks.c
index 9b51a64..3717e01 100644
--- a/hw/vfio/pci-quirks.c
+++ b/hw/vfio/pci-quirks.c
@@ -19,12 +19,8 @@
/* Use uin32_t for vendor & device so PCI_ANY_ID expands and cannot match hw */
static bool vfio_pci_is(VFIOPCIDevice *vdev, uint32_t vendor, uint32_t device)
{
- PCIDevice *pdev = &vdev->pdev;
-
- return (vendor == PCI_ANY_ID ||
- vendor == pci_get_word(pdev->config + PCI_VENDOR_ID)) &&
- (device == PCI_ANY_ID ||
- device == pci_get_word(pdev->config + PCI_DEVICE_ID));
+ return (vendor == PCI_ANY_ID || vendor == vdev->vendor_id) &&
+ (device == PCI_ANY_ID || device == vdev->device_id);
}
static bool vfio_is_vga(VFIOPCIDevice *vdev)
@@ -1178,15 +1174,9 @@ out:
void vfio_setup_resetfn_quirk(VFIOPCIDevice *vdev)
{
- PCIDevice *pdev = &vdev->pdev;
- uint16_t vendor, device;
-
- vendor = pci_get_word(pdev->config + PCI_VENDOR_ID);
- device = pci_get_word(pdev->config + PCI_DEVICE_ID);
-
- switch (vendor) {
+ switch (vdev->vendor_id) {
case 0x1002:
- switch (device) {
+ switch (vdev->device_id) {
/* Bonaire */
case 0x6649: /* Bonaire [FirePro W5100] */
case 0x6650: