diff --git a/tests/qemuxml2argvdata/hostdev-vfio-multidomain.args b/tests/qemuxml2argvdata/hostdev-vfio-multidomain.args
index d098bff356..959d2a8888 100644
--- a/tests/qemuxml2argvdata/hostdev-vfio-multidomain.args
+++ b/tests/qemuxml2argvdata/hostdev-vfio-multidomain.args
@@ -27,5 +27,5 @@ server,nowait \
-usb \
-drive file=/dev/HostVG/QEMUGuest2,format=raw,if=none,id=drive-ide0-0-0 \
-device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \
--device vfio-pci,host=55aa:20:0f.3,id=hostdev0,bus=pci.0,addr=0x3 \
+-device vfio-pci,host=0021:de:1f.1,id=hostdev0,bus=pci.0,addr=0x3 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4
diff --git a/tests/qemuxml2argvdata/hostdev-vfio-multidomain.xml b/tests/qemuxml2argvdata/hostdev-vfio-multidomain.xml
index 832458125b..7c34b65c7f 100644
--- a/tests/qemuxml2argvdata/hostdev-vfio-multidomain.xml
+++ b/tests/qemuxml2argvdata/hostdev-vfio-multidomain.xml
@@ -25,7 +25,7 @@
-
+
diff --git a/tests/qemuxml2argvdata/hostdev-vfio.args b/tests/qemuxml2argvdata/hostdev-vfio.args
index 79654f44bb..f2025afcd4 100644
--- a/tests/qemuxml2argvdata/hostdev-vfio.args
+++ b/tests/qemuxml2argvdata/hostdev-vfio.args
@@ -27,5 +27,5 @@ server,nowait \
-usb \
-drive file=/dev/HostVG/QEMUGuest2,format=raw,if=none,id=drive-ide0-0-0 \
-device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \
--device vfio-pci,host=0000:06:12.5,id=hostdev0,bus=pci.0,addr=0x3 \
+-device vfio-pci,host=0000:06:12.1,id=hostdev0,bus=pci.0,addr=0x3 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4
diff --git a/tests/qemuxml2argvdata/hostdev-vfio.xml b/tests/qemuxml2argvdata/hostdev-vfio.xml
index 4d96b9f732..b2e6c62e7e 100644
--- a/tests/qemuxml2argvdata/hostdev-vfio.xml
+++ b/tests/qemuxml2argvdata/hostdev-vfio.xml
@@ -27,7 +27,7 @@
-
+
diff --git a/tests/qemuxml2argvdata/net-hostdev-fail.xml b/tests/qemuxml2argvdata/net-hostdev-fail.xml
index c815d68bd9..50b102c658 100644
--- a/tests/qemuxml2argvdata/net-hostdev-fail.xml
+++ b/tests/qemuxml2argvdata/net-hostdev-fail.xml
@@ -25,7 +25,7 @@
-
+
diff --git a/tests/qemuxml2argvdata/net-hostdev-vfio.args b/tests/qemuxml2argvdata/net-hostdev-vfio.args
index aa9e91db82..b0178a81bb 100644
--- a/tests/qemuxml2argvdata/net-hostdev-vfio.args
+++ b/tests/qemuxml2argvdata/net-hostdev-vfio.args
@@ -27,5 +27,5 @@ server,nowait \
-usb \
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
-device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 \
--device vfio-pci,host=0000:03:07.1,id=hostdev0,bus=pci.0,addr=0x3 \
+-device vfio-pci,host=0000:06:12.1,id=hostdev0,bus=pci.0,addr=0x3 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4
diff --git a/tests/qemuxml2argvdata/net-hostdev-vfio.xml b/tests/qemuxml2argvdata/net-hostdev-vfio.xml
index 24034cad8b..aff681c0fb 100644
--- a/tests/qemuxml2argvdata/net-hostdev-vfio.xml
+++ b/tests/qemuxml2argvdata/net-hostdev-vfio.xml
@@ -26,7 +26,7 @@
-
+
diff --git a/tests/qemuxml2xmloutdata/hostdev-vfio.xml b/tests/qemuxml2xmloutdata/hostdev-vfio.xml
index 77bd62a129..15a845f4d1 100644
--- a/tests/qemuxml2xmloutdata/hostdev-vfio.xml
+++ b/tests/qemuxml2xmloutdata/hostdev-vfio.xml
@@ -32,7 +32,7 @@
-
+
diff --git a/tests/qemuxml2xmloutdata/net-hostdev-vfio.xml b/tests/qemuxml2xmloutdata/net-hostdev-vfio.xml
index 0523cd8d3b..3f057a8249 100644
--- a/tests/qemuxml2xmloutdata/net-hostdev-vfio.xml
+++ b/tests/qemuxml2xmloutdata/net-hostdev-vfio.xml
@@ -31,7 +31,7 @@
-
+
diff --git a/tests/virpcimock.c b/tests/virpcimock.c
index 9f6ca24737..47d151e0bc 100644
--- a/tests/virpcimock.c
+++ b/tests/virpcimock.c
@@ -124,6 +124,7 @@ struct pciDevice {
int device;
int klass;
int iommuGroup;
+ const char *physfn;
struct pciDriver *driver; /* Driver attached. NULL if attached to no driver */
};
@@ -545,6 +546,15 @@ pci_device_new_from_stub(const struct pciDevice *data)
make_symlink(devsympath, devid, tmp);
+ if (dev->physfn) {
+ if (snprintf(tmp, sizeof(tmp),
+ "%s%s/devices/%s", fakerootdir,
+ SYSFS_PCI_PREFIX, dev->physfn) < 0) {
+ ABORT("@tmp overflow");
+ }
+ make_symlink(devpath, "physfn", tmp);
+ }
+
if (pci_device_autobind(dev) < 0)
ABORT("Unable to bind: %s", devid);
@@ -1020,6 +1030,15 @@ init_env(void)
MAKE_PCI_DEVICE("0000:0a:01.0", 0x8086, 0x0047, 8);
MAKE_PCI_DEVICE("0000:0a:02.0", 0x8286, 0x0048, 8);
MAKE_PCI_DEVICE("0000:0a:03.0", 0x8386, 0x0048, 8);
+ MAKE_PCI_DEVICE("0000:06:12.0", 0x8086, 0x0047, 9);
+ MAKE_PCI_DEVICE("0000:06:12.1", 0x8086, 0x0047, 10,
+ .physfn = "0000:06:12.0"); /* Virtual Function */
+ MAKE_PCI_DEVICE("0000:06:12.2", 0x8086, 0x0047, 11,
+ .physfn = "0000:06:12.0"); /* Virtual Function */
+ MAKE_PCI_DEVICE("0021:de:1f.0", 0x8086, 0x0047, 12);
+ MAKE_PCI_DEVICE("0021:de:1f.1", 0x8086, 0x0047, 13,
+ .physfn = "0021:de:1f.0"); /* Virtual Function */
+
}
diff --git a/tests/virpcitestdata/0000-06-12.0.config b/tests/virpcitestdata/0000-06-12.0.config
new file mode 100644
index 0000000000..beee765340
Binary files /dev/null and b/tests/virpcitestdata/0000-06-12.0.config differ
diff --git a/tests/virpcitestdata/0000-06-12.1.config b/tests/virpcitestdata/0000-06-12.1.config
new file mode 100644
index 0000000000..beee765340
Binary files /dev/null and b/tests/virpcitestdata/0000-06-12.1.config differ
diff --git a/tests/virpcitestdata/0000-06-12.2.config b/tests/virpcitestdata/0000-06-12.2.config
new file mode 100644
index 0000000000..beee765340
Binary files /dev/null and b/tests/virpcitestdata/0000-06-12.2.config differ