Re: [PATCH v2 1/1] tests/virhostdevtest: remove virHostdevHostSupportsPassthroughKVM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/2/19 2:51 PM, Daniel Henrique Barboza wrote:
virhostdevtest is using pci mock to emulate all PCI attach/detach
operations. This means that that this test does not rely on KVM
support of the host anymore and the tests in this file shouldn't
be affected by it.

Suggested-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
Signed-off-by: Daniel Henrique Barboza <danielhb413@xxxxxxxxx>
---
  tests/virhostdevtest.c | 61 +++++++++---------------------------------
  1 file changed, 12 insertions(+), 49 deletions(-)

diff --git a/tests/virhostdevtest.c b/tests/virhostdevtest.c
index 4e067b10d1..20eaca82e0 100644
--- a/tests/virhostdevtest.c
+++ b/tests/virhostdevtest.c
@@ -126,37 +126,6 @@ myInit(void)
      return -1;
  }
-# if HAVE_LINUX_KVM_H
-#  include <linux/kvm.h>
-static bool
-virHostdevHostSupportsPassthroughKVM(void)
-{
-    int kvmfd = -1;
-    bool ret = false;
-
-    if ((kvmfd = open("/dev/kvm", O_RDONLY)) < 0)
-        goto cleanup;
-
-#  ifdef KVM_CAP_IOMMU
-    if ((ioctl(kvmfd, KVM_CHECK_EXTENSION, KVM_CAP_IOMMU)) <= 0)
-        goto cleanup;
-
-    ret = true;
-#  endif
-
- cleanup:
-    VIR_FORCE_CLOSE(kvmfd);
-
-    return ret;
-}
-# else
-static bool
-virHostdevHostSupportsPassthroughKVM(void)
-{
-    return false;
-}
-# endif
-
  static int
  testVirHostdevPreparePCIHostdevs_unmanaged(void)
  {
@@ -483,12 +452,10 @@ testVirHostdevRoundtripUnmanaged(const void *opaque ATTRIBUTE_UNUSED)
if (testVirHostdevDetachPCINodeDevice() < 0)
          goto out;
-    if (virHostdevHostSupportsPassthroughKVM()) {
-        if (testVirHostdevPreparePCIHostdevs_unmanaged() < 0)
-            goto out;
-        if (testVirHostdevReAttachPCIHostdevs_unmanaged() < 0)
-            goto out;
-    }
+    if (testVirHostdevPreparePCIHostdevs_unmanaged() < 0)
+        goto out;
+    if (testVirHostdevReAttachPCIHostdevs_unmanaged() < 0)
+        goto out;
      if (testVirHostdevReAttachPCINodeDevice() < 0)
          goto out;

Huh, these branches were never run because as of v4.12-rc1~68^2~65 kernel commit the KVM_CAP_IOMMU is dropped. And looks like RHEL-7.6 backported the patch too (don't have anything older to test this on).

This test could also use some cleanup. I'll post patches shortly.

ACK to this one though. Will push it once the release is done.

Michal

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux