From: Shivaprasad G Bhat <sbhat(a)linux.vnet.ibm.com>
The pci-stub is obsolete for a while now. Upcoming test cases try
to test the VFIO hotplug/unplug cases.
Change the default test driver to vfio-pci instead of pci-stub,
and fail bind for pci-stub instead.
Signed-off-by: Shivaprasad G Bhat <sbhat(a)linux.vnet.ibm.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413(a)gmail.com>
---
tests/virhostdevtest.c | 4 ++--
tests/virpcimock.c | 4 ++--
tests/virpcitest.c | 12 ++++++------
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/tests/virhostdevtest.c b/tests/virhostdevtest.c
index 20eaca82e0..99ee2d44ec 100644
--- a/tests/virhostdevtest.c
+++ b/tests/virhostdevtest.c
@@ -93,7 +93,7 @@ myInit(void)
subsys.u.pci.addr.bus = 0;
subsys.u.pci.addr.slot = i + 1;
subsys.u.pci.addr.function = 0;
- subsys.u.pci.backend = VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM;
+ subsys.u.pci.backend = VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO;
hostdevs[i]->source.subsys = subsys;
}
@@ -101,7 +101,7 @@ myInit(void)
if (!(dev[i] = virPCIDeviceNew(0, 0, i + 1, 0)))
goto cleanup;
- virPCIDeviceSetStubDriver(dev[i], VIR_PCI_STUB_DRIVER_KVM);
+ virPCIDeviceSetStubDriver(dev[i], VIR_PCI_STUB_DRIVER_VFIO);
}
if (VIR_ALLOC(mgr) < 0)
diff --git a/tests/virpcimock.c b/tests/virpcimock.c
index 1b44ed0a44..deb802e860 100644
--- a/tests/virpcimock.c
+++ b/tests/virpcimock.c
@@ -978,8 +978,8 @@ init_env(void)
MAKE_PCI_DRIVER("iwlwifi", 0x8086, 0x0044);
MAKE_PCI_DRIVER("i915", 0x8086, 0x0046, 0x8086, 0x0047);
- MAKE_PCI_DRIVER("pci-stub", -1, -1);
- pci_driver_new("vfio-pci", PCI_ACTION_BIND, -1, -1);
+ pci_driver_new("pci-stub", PCI_ACTION_BIND, -1, -1);
+ MAKE_PCI_DRIVER("vfio-pci", -1, -1);
# define MAKE_PCI_DEVICE(Id, Vendor, Device, ...) \
do { \
diff --git a/tests/virpcitest.c b/tests/virpcitest.c
index 961a7eff1a..d120e7773a 100644
--- a/tests/virpcitest.c
+++ b/tests/virpcitest.c
@@ -106,12 +106,12 @@ testVirPCIDeviceDetach(const void *opaque ATTRIBUTE_UNUSED)
if (!(dev[i] = virPCIDeviceNew(0, 0, i + 1, 0)))
goto cleanup;
- virPCIDeviceSetStubDriver(dev[i], VIR_PCI_STUB_DRIVER_KVM);
+ virPCIDeviceSetStubDriver(dev[i], VIR_PCI_STUB_DRIVER_VFIO);
if (virPCIDeviceDetach(dev[i], activeDevs, inactiveDevs) < 0)
goto cleanup;
- if (testVirPCIDeviceCheckDriver(dev[i], "pci-stub") < 0)
+ if (testVirPCIDeviceCheckDriver(dev[i], "vfio-pci") < 0)
goto cleanup;
CHECK_LIST_COUNT(activeDevs, 0);
@@ -245,7 +245,7 @@ testVirPCIDeviceDetachSingle(const void *opaque)
if (!dev)
goto cleanup;
- virPCIDeviceSetStubDriver(dev, VIR_PCI_STUB_DRIVER_KVM);
+ virPCIDeviceSetStubDriver(dev, VIR_PCI_STUB_DRIVER_VFIO);
if (virPCIDeviceDetach(dev, NULL, NULL) < 0)
goto cleanup;
@@ -267,7 +267,7 @@ testVirPCIDeviceDetachFail(const void *opaque)
if (!dev)
goto cleanup;
- virPCIDeviceSetStubDriver(dev, VIR_PCI_STUB_DRIVER_VFIO);
+ virPCIDeviceSetStubDriver(dev, VIR_PCI_STUB_DRIVER_KVM);
if (virPCIDeviceDetach(dev, NULL, NULL) < 0) {
if (virTestGetVerbose() || virTestGetDebug())
@@ -278,7 +278,7 @@ testVirPCIDeviceDetachFail(const void *opaque)
virReportError(VIR_ERR_INTERNAL_ERROR,
"Attaching device %s to %s should have failed",
virPCIDeviceGetName(dev),
- virPCIStubDriverTypeToString(VIR_PCI_STUB_DRIVER_VFIO));
+ virPCIStubDriverTypeToString(VIR_PCI_STUB_DRIVER_KVM));
}
cleanup:
@@ -437,7 +437,7 @@ mymain(void)
/* Detach an unbound device */
DO_TEST_PCI_DRIVER(0, 0x0a, 2, 0, NULL);
DO_TEST_PCI(testVirPCIDeviceDetachSingle, 0, 0x0a, 2, 0);
- DO_TEST_PCI_DRIVER(0, 0x0a, 2, 0, "pci-stub");
+ DO_TEST_PCI_DRIVER(0, 0x0a, 2, 0, "vfio-pci");
/* Reattach an unknown unbound device */
DO_TEST_PCI_DRIVER(0, 0x0a, 3, 0, NULL);
--
2.21.0