yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-hw-vfio-pci-use-name-field-in-format-strings.patch

5d360b
From 38023d511ff6770e4ff1d2a4e3fdcc3820a45b3f Mon Sep 17 00:00:00 2001
5d360b
From: Alex Williamson <alex.williamson@redhat.com>
5d360b
Date: Fri, 29 Sep 2017 21:45:08 +0200
5d360b
Subject: [PATCH 08/27] hw/vfio/pci: use name field in format strings
5d360b
5d360b
RH-Author: Alex Williamson <alex.williamson@redhat.com>
5d360b
Message-id: <20170929214508.16765.18033.stgit@gimli.home>
5d360b
Patchwork-id: 76766
5d360b
O-Subject: [RHEL-7.5 qemu-kvm PATCH 08/16] hw/vfio/pci: use name field in format strings
5d360b
Bugzilla: 1494181
5d360b
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
5d360b
RH-Acked-by: Auger Eric <eric.auger@redhat.com>
5d360b
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
5d360b
5d360b
From: Eric Auger <eric.auger@linaro.org>
5d360b
5d360b
Upstream: df92ee444884ba66b5cc95e3ff3d5579f89ed4aa
5d360b
5d360b
Signed-off-by: Eric Auger <eric.auger@linaro.org>
5d360b
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
5d360b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
5d360b
---
5d360b
 hw/misc/vfio.c | 193 ++++++++++++++++++++-------------------------------------
5d360b
 1 file changed, 68 insertions(+), 125 deletions(-)
5d360b
5d360b
diff --git a/hw/misc/vfio.c b/hw/misc/vfio.c
5d360b
index 92414b9..0d88313 100644
5d360b
--- a/hw/misc/vfio.c
5d360b
+++ b/hw/misc/vfio.c
5d360b
@@ -375,8 +375,7 @@ static void vfio_intx_interrupt(void *opaque)
5d360b
         return;
5d360b
     }
5d360b
 
5d360b
-    DPRINTF("%s(%04x:%02x:%02x.%x) Pin %c\n", __func__, vdev->host.domain,
5d360b
-            vdev->host.bus, vdev->host.slot, vdev->host.function,
5d360b
+    DPRINTF("%s(%s) Pin %c\n", __func__, vdev->vbasedev.name,
5d360b
             'A' + vdev->intx.pin);
5d360b
 
5d360b
     vdev->intx.pending = true;
5d360b
@@ -396,8 +395,7 @@ static void vfio_eoi(VFIODevice *vbasedev)
5d360b
         return;
5d360b
     }
5d360b
 
5d360b
-    DPRINTF("%s(%04x:%02x:%02x.%x) EOI\n", __func__, vdev->host.domain,
5d360b
-            vdev->host.bus, vdev->host.slot, vdev->host.function);
5d360b
+    DPRINTF("%s(%s) EOI\n", __func__, vbasedev->name);
5d360b
 
5d360b
     vdev->intx.pending = false;
5d360b
     qemu_set_irq(vdev->pdev.irq[vdev->intx.pin], 0);
5d360b
@@ -466,9 +464,7 @@ static void vfio_enable_intx_kvm(VFIOPCIDevice *vdev)
5d360b
 
5d360b
     vdev->intx.kvm_accel = true;
5d360b
 
5d360b
-    DPRINTF("%s(%04x:%02x:%02x.%x) KVM INTx accel enabled\n",
5d360b
-            __func__, vdev->host.domain, vdev->host.bus,
5d360b
-            vdev->host.slot, vdev->host.function);
5d360b
+    DPRINTF("%s(%s) KVM INTx accel enabled\n", __func__, vdev->vbasedev.name);
5d360b
 
5d360b
     return;
5d360b
 
5d360b
@@ -520,9 +516,7 @@ static void vfio_disable_intx_kvm(VFIOPCIDevice *vdev)
5d360b
     /* If we've missed an event, let it re-fire through QEMU */
5d360b
     vfio_unmask_single_irqindex(&vdev->vbasedev, VFIO_PCI_INTX_IRQ_INDEX);
5d360b
 
5d360b
-    DPRINTF("%s(%04x:%02x:%02x.%x) KVM INTx accel disabled\n",
5d360b
-            __func__, vdev->host.domain, vdev->host.bus,
5d360b
-            vdev->host.slot, vdev->host.function);
5d360b
+    DPRINTF("%s(%s) KVM INTx accel disabled\n", __func__, vdev->vbasedev.name);
5d360b
 #endif
5d360b
 }
5d360b
 
5d360b
@@ -541,9 +535,8 @@ static void vfio_update_irq(PCIDevice *pdev)
5d360b
         return; /* Nothing changed */
5d360b
     }
5d360b
 
5d360b
-    DPRINTF("%s(%04x:%02x:%02x.%x) IRQ moved %d -> %d\n", __func__,
5d360b
-            vdev->host.domain, vdev->host.bus, vdev->host.slot,
5d360b
-            vdev->host.function, vdev->intx.route.irq, route.irq);
5d360b
+    DPRINTF("%s(%s) IRQ moved %d -> %d\n", __func__,
5d360b
+            vdev->vbasedev.name, vdev->intx.route.irq, route.irq);
5d360b
 
5d360b
     vfio_disable_intx_kvm(vdev);
5d360b
 
5d360b
@@ -618,8 +611,7 @@ static int vfio_enable_intx(VFIOPCIDevice *vdev)
5d360b
 
5d360b
     vdev->interrupt = VFIO_INT_INTx;
5d360b
 
5d360b
-    DPRINTF("%s(%04x:%02x:%02x.%x)\n", __func__, vdev->host.domain,
5d360b
-            vdev->host.bus, vdev->host.slot, vdev->host.function);
5d360b
+    DPRINTF("%s(%s)\n", __func__, vdev->vbasedev.name);
5d360b
 
5d360b
     return 0;
5d360b
 }
5d360b
@@ -641,8 +633,7 @@ static void vfio_disable_intx(VFIOPCIDevice *vdev)
5d360b
 
5d360b
     vdev->interrupt = VFIO_INT_NONE;
5d360b
 
5d360b
-    DPRINTF("%s(%04x:%02x:%02x.%x)\n", __func__, vdev->host.domain,
5d360b
-            vdev->host.bus, vdev->host.slot, vdev->host.function);
5d360b
+    DPRINTF("%s(%s)\n", __func__, vdev->vbasedev.name);
5d360b
 }
5d360b
 
5d360b
 /*
5d360b
@@ -669,9 +660,8 @@ static void vfio_msi_interrupt(void *opaque)
5d360b
         abort();
5d360b
     }
5d360b
 
5d360b
-    DPRINTF("%s(%04x:%02x:%02x.%x) vector %d 0x%"PRIx64"/0x%x\n", __func__,
5d360b
-            vdev->host.domain, vdev->host.bus, vdev->host.slot,
5d360b
-            vdev->host.function, nr, msg.address, msg.data);
5d360b
+    DPRINTF("%s(%s) vector %d 0x%"PRIx64"/0x%x\n", __func__,
5d360b
+            vdev->vbasedev.name, nr, msg.address, msg.data);
5d360b
 #endif
5d360b
 
5d360b
     if (vdev->interrupt == VFIO_INT_MSIX) {
5d360b
@@ -778,9 +768,7 @@ static int vfio_msix_vector_do_use(PCIDevice *pdev, unsigned int nr,
5d360b
     VFIOMSIVector *vector;
5d360b
     int ret;
5d360b
 
5d360b
-    DPRINTF("%s(%04x:%02x:%02x.%x) vector %d used\n", __func__,
5d360b
-            vdev->host.domain, vdev->host.bus, vdev->host.slot,
5d360b
-            vdev->host.function, nr);
5d360b
+    DPRINTF("%s(%s) vector %d used\n", __func__, vdev->vbasedev.name, nr);
5d360b
 
5d360b
     vector = &vdev->msi_vectors[nr];
5d360b
 
5d360b
@@ -866,9 +854,7 @@ static void vfio_msix_vector_release(PCIDevice *pdev, unsigned int nr)
5d360b
     VFIOPCIDevice *vdev = DO_UPCAST(VFIOPCIDevice, pdev, pdev);
5d360b
     VFIOMSIVector *vector = &vdev->msi_vectors[nr];
5d360b
 
5d360b
-    DPRINTF("%s(%04x:%02x:%02x.%x) vector %d released\n", __func__,
5d360b
-            vdev->host.domain, vdev->host.bus, vdev->host.slot,
5d360b
-            vdev->host.function, nr);
5d360b
+    DPRINTF("%s(%s) vector %d released\n", __func__, vdev->vbasedev.name, nr);
5d360b
 
5d360b
     /*
5d360b
      * There are still old guests that mask and unmask vectors on every
5d360b
@@ -931,8 +917,7 @@ static void vfio_enable_msix(VFIOPCIDevice *vdev)
5d360b
         error_report("vfio: msix_set_vector_notifiers failed");
5d360b
     }
5d360b
 
5d360b
-    DPRINTF("%s(%04x:%02x:%02x.%x)\n", __func__, vdev->host.domain,
5d360b
-            vdev->host.bus, vdev->host.slot, vdev->host.function);
5d360b
+    DPRINTF("%s(%s)\n", __func__, vdev->vbasedev.name);
5d360b
 }
5d360b
 
5d360b
 static void vfio_enable_msi(VFIOPCIDevice *vdev)
5d360b
@@ -1008,9 +993,8 @@ retry:
5d360b
         return;
5d360b
     }
5d360b
 
5d360b
-    DPRINTF("%s(%04x:%02x:%02x.%x) Enabled %d MSI vectors\n", __func__,
5d360b
-            vdev->host.domain, vdev->host.bus, vdev->host.slot,
5d360b
-            vdev->host.function, vdev->nr_vectors);
5d360b
+    DPRINTF("%s(%s) Enabled %d MSI vectors\n", __func__,
5d360b
+            vdev->vbasedev.name, vdev->nr_vectors);
5d360b
 }
5d360b
 
5d360b
 static void vfio_disable_msi_common(VFIOPCIDevice *vdev)
5d360b
@@ -1060,8 +1044,7 @@ static void vfio_disable_msix(VFIOPCIDevice *vdev)
5d360b
 
5d360b
     vfio_disable_msi_common(vdev);
5d360b
 
5d360b
-    DPRINTF("%s(%04x:%02x:%02x.%x)\n", __func__, vdev->host.domain,
5d360b
-            vdev->host.bus, vdev->host.slot, vdev->host.function);
5d360b
+    DPRINTF("%s(%s)\n", __func__, vdev->vbasedev.name);
5d360b
 }
5d360b
 
5d360b
 static void vfio_disable_msi(VFIOPCIDevice *vdev)
5d360b
@@ -1069,8 +1052,7 @@ static void vfio_disable_msi(VFIOPCIDevice *vdev)
5d360b
     vfio_disable_irqindex(&vdev->vbasedev, VFIO_PCI_MSI_IRQ_INDEX);
5d360b
     vfio_disable_msi_common(vdev);
5d360b
 
5d360b
-    DPRINTF("%s(%04x:%02x:%02x.%x)\n", __func__, vdev->host.domain,
5d360b
-            vdev->host.bus, vdev->host.slot, vdev->host.function);
5d360b
+    DPRINTF("%s(%s)\n", __func__, vdev->vbasedev.name);
5d360b
 }
5d360b
 
5d360b
 static void vfio_update_msi(VFIOPCIDevice *vdev)
5d360b
@@ -1206,8 +1188,7 @@ static void vfio_pci_load_rom(VFIOPCIDevice *vdev)
5d360b
         return;
5d360b
     }
5d360b
 
5d360b
-    DPRINTF("Device %04x:%02x:%02x.%x ROM:\n", vdev->host.domain,
5d360b
-            vdev->host.bus, vdev->host.slot, vdev->host.function);
5d360b
+    DPRINTF("Device %s ROM:\n", vdev->vbasedev.name);
5d360b
     DPRINTF("  size: 0x%lx, offset: 0x%lx, flags: 0x%lx\n",
5d360b
             (unsigned long)reg_info.size, (unsigned long)reg_info.offset,
5d360b
             (unsigned long)reg_info.flags);
5d360b
@@ -1218,9 +1199,7 @@ static void vfio_pci_load_rom(VFIOPCIDevice *vdev)
5d360b
     if (!vdev->rom_size) {
5d360b
         vdev->rom_read_failed = true;
5d360b
         error_report("vfio-pci: Cannot read device rom at "
5d360b
-                    "%04x:%02x:%02x.%x\n",
5d360b
-                    vdev->host.domain, vdev->host.bus, vdev->host.slot,
5d360b
-                    vdev->host.function);
5d360b
+                    "%s\n", vdev->vbasedev.name);
5d360b
         error_printf("Device option ROM contents are probably invalid "
5d360b
                     "(check dmesg).\nSkip option ROM probe with rombar=0, "
5d360b
                     "or load from file with romfile=\n");
5d360b
@@ -1261,9 +1240,8 @@ static uint64_t vfio_rom_read(void *opaque, hwaddr addr, unsigned size)
5d360b
     memcpy(&val, vdev->rom + addr,
5d360b
            (addr < vdev->rom_size) ? MIN(size, vdev->rom_size - addr) : 0);
5d360b
 
5d360b
-    DPRINTF("%s(%04x:%02x:%02x.%x, 0x%"HWADDR_PRIx", 0x%x) = 0x%"PRIx64"\n",
5d360b
-            __func__, vdev->host.domain, vdev->host.bus, vdev->host.slot,
5d360b
-            vdev->host.function, addr, size, val);
5d360b
+    DPRINTF("%s(%s, 0x%"HWADDR_PRIx", 0x%x) = 0x%"PRIx64"\n",
5d360b
+            __func__, vdev->vbasedev.name, addr, size, val);
5d360b
 
5d360b
     return val;
5d360b
 }
5d360b
@@ -1360,8 +1338,7 @@ static void vfio_pci_size_rom(VFIOPCIDevice *vdev)
5d360b
         }
5d360b
     }
5d360b
 
5d360b
-    DPRINTF("%04x:%02x:%02x.%x ROM size 0x%x\n", vdev->host.domain,
5d360b
-            vdev->host.bus, vdev->host.slot, vdev->host.function, size);
5d360b
+    DPRINTF("%s ROM size 0x%x\n", vdev->vbasedev.name, size);
5d360b
 
5d360b
     snprintf(name, sizeof(name), "vfio[%04x:%02x:%02x.%x].rom",
5d360b
              vdev->host.domain, vdev->host.bus, vdev->host.slot,
5d360b
@@ -1496,10 +1473,9 @@ static uint64_t vfio_generic_window_quirk_read(void *opaque,
5d360b
         data = vfio_pci_read_config(&vdev->pdev,
5d360b
                                     quirk->data.address_val + offset, size);
5d360b
 
5d360b
-        DPRINTF("%s read(%04x:%02x:%02x.%x:BAR%d+0x%"HWADDR_PRIx", %d) = 0x%"
5d360b
-                PRIx64"\n", memory_region_name(&quirk->mem), vdev->host.domain,
5d360b
-                vdev->host.bus, vdev->host.slot, vdev->host.function,
5d360b
-                quirk->data.bar, addr, size, data);
5d360b
+        DPRINTF("%s read(%s:BAR%d+0x%"HWADDR_PRIx", %d) = 0x%"
5d360b
+                PRIx64"\n", memory_region_name(&quirk->mem),
5d360b
+                vdev->vbasedev.name, quirk->data.bar, addr, size, data);
5d360b
     } else {
5d360b
         data = vfio_region_read(&vdev->bars[quirk->data.bar].region,
5d360b
                                 addr + quirk->data.base_offset, size);
5d360b
@@ -1545,10 +1521,9 @@ static void vfio_generic_window_quirk_write(void *opaque, hwaddr addr,
5d360b
 
5d360b
         vfio_pci_write_config(&vdev->pdev,
5d360b
                               quirk->data.address_val + offset, data, size);
5d360b
-        DPRINTF("%s write(%04x:%02x:%02x.%x:BAR%d+0x%"HWADDR_PRIx", 0x%"
5d360b
+        DPRINTF("%s write(%s:BAR%d+0x%"HWADDR_PRIx", 0x%"
5d360b
                 PRIx64", %d)\n", memory_region_name(&quirk->mem),
5d360b
-                vdev->host.domain, vdev->host.bus, vdev->host.slot,
5d360b
-                vdev->host.function, quirk->data.bar, addr, data, size);
5d360b
+                vdev->vbasedev.name, quirk->data.bar, addr, data, size);
5d360b
         return;
5d360b
     }
5d360b
 
5d360b
@@ -1581,10 +1556,9 @@ static uint64_t vfio_generic_quirk_read(void *opaque,
5d360b
 
5d360b
         data = vfio_pci_read_config(&vdev->pdev, addr - offset, size);
5d360b
 
5d360b
-        DPRINTF("%s read(%04x:%02x:%02x.%x:BAR%d+0x%"HWADDR_PRIx", %d) = 0x%"
5d360b
-                PRIx64"\n", memory_region_name(&quirk->mem), vdev->host.domain,
5d360b
-                vdev->host.bus, vdev->host.slot, vdev->host.function,
5d360b
-                quirk->data.bar, addr + base, size, data);
5d360b
+        DPRINTF("%s read(%s:BAR%d+0x%"HWADDR_PRIx", %d) = 0x%"
5d360b
+                PRIx64"\n", memory_region_name(&quirk->mem),
5d360b
+                vdev->vbasedev.name, quirk->data.bar, addr + base, size, data);
5d360b
     } else {
5d360b
         data = vfio_region_read(&vdev->bars[quirk->data.bar].region,
5d360b
                                 addr + base, size);
5d360b
@@ -1611,10 +1585,9 @@ static void vfio_generic_quirk_write(void *opaque, hwaddr addr,
5d360b
 
5d360b
         vfio_pci_write_config(&vdev->pdev, addr - offset, data, size);
5d360b
 
5d360b
-        DPRINTF("%s write(%04x:%02x:%02x.%x:BAR%d+0x%"HWADDR_PRIx", 0x%"
5d360b
+        DPRINTF("%s write(%s:BAR%d+0x%"HWADDR_PRIx", 0x%"
5d360b
                 PRIx64", %d)\n", memory_region_name(&quirk->mem),
5d360b
-                vdev->host.domain, vdev->host.bus, vdev->host.slot,
5d360b
-                vdev->host.function, quirk->data.bar, addr + base, data, size);
5d360b
+                vdev->vbasedev.name, quirk->data.bar, addr + base, data, size);
5d360b
     } else {
5d360b
         vfio_region_write(&vdev->bars[quirk->data.bar].region,
5d360b
                           addr + base, data, size);
5d360b
@@ -1685,9 +1658,8 @@ static void vfio_vga_probe_ati_3c3_quirk(VFIOPCIDevice *vdev)
5d360b
     QLIST_INSERT_HEAD(&vdev->vga.region[QEMU_PCI_VGA_IO_HI].quirks,
5d360b
                       quirk, next);
5d360b
 
5d360b
-    DPRINTF("Enabled ATI/AMD quirk 0x3c3 BAR4for device %04x:%02x:%02x.%x\n",
5d360b
-            vdev->host.domain, vdev->host.bus, vdev->host.slot,
5d360b
-            vdev->host.function);
5d360b
+    DPRINTF("Enabled ATI/AMD quirk 0x3c3 BAR4for device %s\n",
5d360b
+            vdev->vbasedev.name);
5d360b
 }
5d360b
 
5d360b
 /*
5d360b
@@ -1728,9 +1700,8 @@ static void vfio_probe_ati_bar4_window_quirk(VFIOPCIDevice *vdev, int nr)
5d360b
 
5d360b
     QLIST_INSERT_HEAD(&vdev->bars[nr].quirks, quirk, next);
5d360b
 
5d360b
-    DPRINTF("Enabled ATI/AMD BAR4 window quirk for device %04x:%02x:%02x.%x\n",
5d360b
-            vdev->host.domain, vdev->host.bus, vdev->host.slot,
5d360b
-            vdev->host.function);
5d360b
+    DPRINTF("Enabled ATI/AMD BAR4 window quirk for device %s\n",
5d360b
+            vdev->vbasedev.name);
5d360b
 }
5d360b
 
5d360b
 /*
5d360b
@@ -1763,9 +1734,8 @@ static void vfio_probe_ati_bar2_4000_quirk(VFIOPCIDevice *vdev, int nr)
5d360b
 
5d360b
     QLIST_INSERT_HEAD(&vdev->bars[nr].quirks, quirk, next);
5d360b
 
5d360b
-    DPRINTF("Enabled ATI/AMD BAR2 0x4000 quirk for device %04x:%02x:%02x.%x\n",
5d360b
-            vdev->host.domain, vdev->host.bus, vdev->host.slot,
5d360b
-            vdev->host.function);
5d360b
+    DPRINTF("Enabled ATI/AMD BAR2 0x4000 quirk for device %s\n",
5d360b
+            vdev->vbasedev.name);
5d360b
 }
5d360b
 
5d360b
 /*
5d360b
@@ -1898,9 +1868,8 @@ static void vfio_vga_probe_nvidia_3d0_quirk(VFIOPCIDevice *vdev)
5d360b
     QLIST_INSERT_HEAD(&vdev->vga.region[QEMU_PCI_VGA_IO_HI].quirks,
5d360b
                       quirk, next);
5d360b
 
5d360b
-    DPRINTF("Enabled NVIDIA VGA 0x3d0 quirk for device %04x:%02x:%02x.%x\n",
5d360b
-            vdev->host.domain, vdev->host.bus, vdev->host.slot,
5d360b
-            vdev->host.function);
5d360b
+    DPRINTF("Enabled NVIDIA VGA 0x3d0 quirk for device %s\n",
5d360b
+            vdev->vbasedev.name);
5d360b
 }
5d360b
 
5d360b
 /*
5d360b
@@ -1989,9 +1958,8 @@ static void vfio_probe_nvidia_bar5_window_quirk(VFIOPCIDevice *vdev, int nr)
5d360b
 
5d360b
     QLIST_INSERT_HEAD(&vdev->bars[nr].quirks, quirk, next);
5d360b
 
5d360b
-    DPRINTF("Enabled NVIDIA BAR5 window quirk for device %04x:%02x:%02x.%x\n",
5d360b
-            vdev->host.domain, vdev->host.bus, vdev->host.slot,
5d360b
-            vdev->host.function);
5d360b
+    DPRINTF("Enabled NVIDIA BAR5 window quirk for device %s\n",
5d360b
+            vdev->vbasedev.name);
5d360b
 }
5d360b
 
5d360b
 /*
5d360b
@@ -2029,9 +1997,8 @@ static void vfio_probe_nvidia_bar0_88000_quirk(VFIOPCIDevice *vdev, int nr)
5d360b
 
5d360b
     QLIST_INSERT_HEAD(&vdev->bars[nr].quirks, quirk, next);
5d360b
 
5d360b
-    DPRINTF("Enabled NVIDIA BAR0 0x88000 quirk for device %04x:%02x:%02x.%x\n",
5d360b
-            vdev->host.domain, vdev->host.bus, vdev->host.slot,
5d360b
-            vdev->host.function);
5d360b
+    DPRINTF("Enabled NVIDIA BAR0 0x88000 quirk for device %s\n",
5d360b
+            vdev->vbasedev.name);
5d360b
 }
5d360b
 
5d360b
 /*
5d360b
@@ -2068,9 +2035,8 @@ static void vfio_probe_nvidia_bar0_1800_quirk(VFIOPCIDevice *vdev, int nr)
5d360b
 
5d360b
     QLIST_INSERT_HEAD(&vdev->bars[nr].quirks, quirk, next);
5d360b
 
5d360b
-    DPRINTF("Enabled NVIDIA BAR0 0x1800 quirk for device %04x:%02x:%02x.%x\n",
5d360b
-            vdev->host.domain, vdev->host.bus, vdev->host.slot,
5d360b
-            vdev->host.function);
5d360b
+    DPRINTF("Enabled NVIDIA BAR0 0x1800 quirk for device %s\n",
5d360b
+            vdev->vbasedev.name);
5d360b
 }
5d360b
 
5d360b
 /*
5d360b
@@ -2156,9 +2122,8 @@ static uint32_t vfio_pci_read_config(PCIDevice *pdev, uint32_t addr, int len)
5d360b
 
5d360b
     val = (emu_val & emu_bits) | (phys_val & ~emu_bits);
5d360b
 
5d360b
-    DPRINTF("%s(%04x:%02x:%02x.%x, @0x%x, len=0x%x) %x\n", __func__,
5d360b
-            vdev->host.domain, vdev->host.bus, vdev->host.slot,
5d360b
-            vdev->host.function, addr, len, val);
5d360b
+    DPRINTF("%s(%s, @0x%x, len=0x%x) %x\n", __func__,
5d360b
+            vdev->vbasedev.name, addr, len, val);
5d360b
 
5d360b
     return val;
5d360b
 }
5d360b
@@ -2169,9 +2134,8 @@ static void vfio_pci_write_config(PCIDevice *pdev, uint32_t addr,
5d360b
     VFIOPCIDevice *vdev = DO_UPCAST(VFIOPCIDevice, pdev, pdev);
5d360b
     uint32_t val_le = cpu_to_le32(val);
5d360b
 
5d360b
-    DPRINTF("%s(%04x:%02x:%02x.%x, @0x%x, 0x%x, len=0x%x)\n", __func__,
5d360b
-            vdev->host.domain, vdev->host.bus, vdev->host.slot,
5d360b
-            vdev->host.function, addr, val, len);
5d360b
+    DPRINTF("%s(%s, @0x%x, 0x%x, len=0x%x)\n", __func__,
5d360b
+            vdev->vbasedev.name, addr, val, len);
5d360b
 
5d360b
     /* Write everything to VFIO, let it filter out what we can't write */
5d360b
     if (pwrite(vdev->vbasedev.fd, &val_le, len, vdev->config_offset + addr)
5d360b
@@ -2421,8 +2385,7 @@ static int vfio_setup_msi(VFIOPCIDevice *vdev, int pos)
5d360b
     msi_maskbit = !!(ctrl & PCI_MSI_FLAGS_MASKBIT);
5d360b
     entries = 1 << ((ctrl & PCI_MSI_FLAGS_QMASK) >> 1);
5d360b
 
5d360b
-    DPRINTF("%04x:%02x:%02x.%x PCI MSI CAP @0x%x\n", vdev->host.domain,
5d360b
-            vdev->host.bus, vdev->host.slot, vdev->host.function, pos);
5d360b
+    DPRINTF("%s PCI MSI CAP @0x%x\n", vdev->vbasedev.name, pos);
5d360b
 
5d360b
     ret = msi_init(&vdev->pdev, pos, entries, msi_64bit, msi_maskbit);
5d360b
     if (ret < 0) {
5d360b
@@ -2483,10 +2446,8 @@ static int vfio_early_setup_msix(VFIOPCIDevice *vdev)
5d360b
     vdev->msix->pba_offset = pba & ~PCI_MSIX_FLAGS_BIRMASK;
5d360b
     vdev->msix->entries = (ctrl & PCI_MSIX_FLAGS_QSIZE) + 1;
5d360b
 
5d360b
-    DPRINTF("%04x:%02x:%02x.%x "
5d360b
-            "PCI MSI-X CAP @0x%x, BAR %d, offset 0x%x, entries %d\n",
5d360b
-            vdev->host.domain, vdev->host.bus, vdev->host.slot,
5d360b
-            vdev->host.function, pos, vdev->msix->table_bar,
5d360b
+    DPRINTF("%s PCI MSI-X CAP @0x%x, BAR %d, offset 0x%x, entries %d\n",
5d360b
+            vdev->vbasedev.name, pos, vdev->msix->table_bar,
5d360b
             vdev->msix->table_offset, vdev->msix->entries);
5d360b
 
5d360b
     /*
5d360b
@@ -2895,9 +2856,7 @@ static void vfio_check_pcie_flr(VFIOPCIDevice *vdev, uint8_t pos)
5d360b
     uint32_t cap = pci_get_long(vdev->pdev.config + pos + PCI_EXP_DEVCAP);
5d360b
 
5d360b
     if (cap & PCI_EXP_DEVCAP_FLR) {
5d360b
-        DPRINTF("%04x:%02x:%02x.%x Supports FLR via PCIe cap\n",
5d360b
-                vdev->host.domain, vdev->host.bus, vdev->host.slot,
5d360b
-                vdev->host.function);
5d360b
+        DPRINTF("%s Supports FLR via PCIe cap\n", vdev->vbasedev.name);
5d360b
         vdev->has_flr = true;
5d360b
     }
5d360b
 }
5d360b
@@ -2907,9 +2866,7 @@ static void vfio_check_pm_reset(VFIOPCIDevice *vdev, uint8_t pos)
5d360b
     uint16_t csr = pci_get_word(vdev->pdev.config + pos + PCI_PM_CTRL);
5d360b
 
5d360b
     if (!(csr & PCI_PM_CTRL_NO_SOFT_RESET)) {
5d360b
-        DPRINTF("%04x:%02x:%02x.%x Supports PM reset\n",
5d360b
-                vdev->host.domain, vdev->host.bus, vdev->host.slot,
5d360b
-                vdev->host.function);
5d360b
+        DPRINTF("%s Supports PM reset\n", vdev->vbasedev.name);
5d360b
         vdev->has_pm_reset = true;
5d360b
     }
5d360b
 }
5d360b
@@ -2919,9 +2876,7 @@ static void vfio_check_af_flr(VFIOPCIDevice *vdev, uint8_t pos)
5d360b
     uint8_t cap = pci_get_byte(vdev->pdev.config + pos + PCI_AF_CAP);
5d360b
 
5d360b
     if ((cap & PCI_AF_CAP_TP) && (cap & PCI_AF_CAP_FLR)) {
5d360b
-        DPRINTF("%04x:%02x:%02x.%x Supports FLR via AF cap\n",
5d360b
-                vdev->host.domain, vdev->host.bus, vdev->host.slot,
5d360b
-                vdev->host.function);
5d360b
+        DPRINTF("%s Supports FLR via AF cap\n", vdev->vbasedev.name);
5d360b
         vdev->has_flr = true;
5d360b
     }
5d360b
 }
5d360b
@@ -3072,8 +3027,7 @@ static int vfio_pci_hot_reset(VFIOPCIDevice *vdev, bool single)
5d360b
     int ret, i, count;
5d360b
     bool multi = false;
5d360b
 
5d360b
-    DPRINTF("%s(%04x:%02x:%02x.%x) %s\n", __func__, vdev->host.domain,
5d360b
-            vdev->host.bus, vdev->host.slot, vdev->host.function,
5d360b
+    DPRINTF("%s(%s) %s\n", __func__, vdev->vbasedev.name,
5d360b
             single ? "one" : "multi");
5d360b
 
5d360b
     vfio_pci_pre_reset(vdev);
5d360b
@@ -3105,9 +3059,7 @@ static int vfio_pci_hot_reset(VFIOPCIDevice *vdev, bool single)
5d360b
         goto out_single;
5d360b
     }
5d360b
 
5d360b
-    DPRINTF("%04x:%02x:%02x.%x: hot reset dependent devices:\n",
5d360b
-            vdev->host.domain, vdev->host.bus, vdev->host.slot,
5d360b
-            vdev->host.function);
5d360b
+    DPRINTF("%s: hot reset dependent devices:\n", vdev->vbasedev.name);
5d360b
 
5d360b
     /* Verify that we have all the groups required */
5d360b
     for (i = 0; i < info->count; i++) {
5d360b
@@ -3135,10 +3087,9 @@ static int vfio_pci_hot_reset(VFIOPCIDevice *vdev, bool single)
5d360b
 
5d360b
         if (!group) {
5d360b
             if (!vdev->has_pm_reset) {
5d360b
-                error_report("vfio: Cannot reset device %04x:%02x:%02x.%x, "
5d360b
+                error_report("vfio: Cannot reset device %s, "
5d360b
                              "depends on group %d which is not owned.",
5d360b
-                             vdev->host.domain, vdev->host.bus, vdev->host.slot,
5d360b
-                             vdev->host.function, devices[i].group_id);
5d360b
+                             vdev->vbasedev.name, devices[i].group_id);
5d360b
             }
5d360b
             ret = -EPERM;
5d360b
             goto out;
5d360b
@@ -3153,8 +3104,7 @@ static int vfio_pci_hot_reset(VFIOPCIDevice *vdev, bool single)
5d360b
             if (vfio_pci_host_match(&host, &tmp->host)) {
5d360b
                 if (single) {
5d360b
                     DPRINTF("vfio: found another in-use device "
5d360b
-                            "%04x:%02x:%02x.%x\n", host.domain, host.bus,
5d360b
-                            host.slot, host.function);
5d360b
+                            "%s\n", tmp->vbasedev.name);
5d360b
                     ret = -EINVAL;
5d360b
                     goto out_single;
5d360b
                 }
5d360b
@@ -3201,9 +3151,7 @@ static int vfio_pci_hot_reset(VFIOPCIDevice *vdev, bool single)
5d360b
     ret = ioctl(vdev->vbasedev.fd, VFIO_DEVICE_PCI_HOT_RESET, reset);
5d360b
     g_free(reset);
5d360b
 
5d360b
-    DPRINTF("%04x:%02x:%02x.%x hot reset: %s\n", vdev->host.domain,
5d360b
-            vdev->host.bus, vdev->host.slot, vdev->host.function,
5d360b
-            ret ? "%m" : "Success");
5d360b
+    DPRINTF("%s hot reset: %s\n", vdev->vbasedev.name, ret ? "%m" : "Success");
5d360b
 
5d360b
 out:
5d360b
     /* Re-enable INTx on affected devices */
5d360b
@@ -3691,10 +3639,9 @@ static int vfio_get_device(VFIOGroup *group, const char *name,
5d360b
     } else if (irq_info.count == 1) {
5d360b
         vdev->pci_aer = true;
5d360b
     } else {
5d360b
-        error_report("vfio: %04x:%02x:%02x.%x "
5d360b
+        error_report("vfio: %s "
5d360b
                      "Could not enable error recovery for the device",
5d360b
-                     vdev->host.domain, vdev->host.bus, vdev->host.slot,
5d360b
-                     vdev->host.function);
5d360b
+                     vdev->vbasedev.name);
5d360b
     }
5d360b
 
5d360b
 error:
5d360b
@@ -3971,8 +3918,7 @@ static int vfio_initfn(PCIDevice *pdev)
5d360b
         return -errno;
5d360b
     }
5d360b
 
5d360b
-    DPRINTF("%s(%04x:%02x:%02x.%x) group %d\n", __func__, vdev->host.domain,
5d360b
-            vdev->host.bus, vdev->host.slot, vdev->host.function, groupid);
5d360b
+    DPRINTF("%s(%s) group %d\n", __func__, vdev->vbasedev.name, groupid);
5d360b
 
5d360b
     group = vfio_get_group(groupid);
5d360b
     if (!group) {
5d360b
@@ -4111,16 +4057,14 @@ static void vfio_pci_reset(DeviceState *dev)
5d360b
     PCIDevice *pdev = DO_UPCAST(PCIDevice, qdev, dev);
5d360b
     VFIOPCIDevice *vdev = DO_UPCAST(VFIOPCIDevice, pdev, pdev);
5d360b
 
5d360b
-    DPRINTF("%s(%04x:%02x:%02x.%x)\n", __func__, vdev->host.domain,
5d360b
-            vdev->host.bus, vdev->host.slot, vdev->host.function);
5d360b
+    DPRINTF("%s(%s)\n", __func__, vdev->vbasedev.name);
5d360b
 
5d360b
     vfio_pci_pre_reset(vdev);
5d360b
 
5d360b
     if (vdev->vbasedev.reset_works &&
5d360b
         (vdev->has_flr || !vdev->has_pm_reset) &&
5d360b
         !ioctl(vdev->vbasedev.fd, VFIO_DEVICE_RESET)) {
5d360b
-        DPRINTF("%04x:%02x:%02x.%x FLR/VFIO_DEVICE_RESET\n", vdev->host.domain,
5d360b
-            vdev->host.bus, vdev->host.slot, vdev->host.function);
5d360b
+        DPRINTF("%s FLR/VFIO_DEVICE_RESET\n", vdev->vbasedev.name);
5d360b
         goto post_reset;
5d360b
     }
5d360b
 
5d360b
@@ -4132,8 +4076,7 @@ static void vfio_pci_reset(DeviceState *dev)
5d360b
     /* If nothing else works and the device supports PM reset, use it */
5d360b
     if (vdev->vbasedev.reset_works && vdev->has_pm_reset &&
5d360b
         !ioctl(vdev->vbasedev.fd, VFIO_DEVICE_RESET)) {
5d360b
-        DPRINTF("%04x:%02x:%02x.%x PCI PM Reset\n", vdev->host.domain,
5d360b
-            vdev->host.bus, vdev->host.slot, vdev->host.function);
5d360b
+        DPRINTF("%s PCI PM Reset\n", vdev->vbasedev.name);
5d360b
         goto post_reset;
5d360b
     }
5d360b
 
5d360b
-- 
5d360b
1.8.3.1
5d360b