[libvirt] [PATCH 01/12] qemu: Drop KVM assignment

Ján Tomko jtomko at redhat.com
Wed Aug 21 12:17:53 UTC 2019


On Tue, Aug 20, 2019 at 04:30:21PM +0200, Michal Privoznik wrote:
>KVM style of PCI devices assignment was dropped in kernel in
>favor of vfio pci (see kernel commit v4.12-rc1~68^2~65). Since
>vfio is around for quite some time now and is far superior
>discourage people in using KVM style.
>
>Ideally, I'd make QEMU_CAPS_VFIO_PCI implicitly assumed but turns
>out qemu-3.0.0 doesn't support vfio-pci device for RISC-V.
>
>Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
>---
> src/qemu/qemu_capabilities.c |  6 -----
> src/qemu/qemu_command.c      | 26 ++-------------------
> src/qemu/qemu_command.h      |  1 -
> src/qemu/qemu_driver.c       | 14 ++++--------
> src/qemu/qemu_hostdev.c      | 44 +++---------------------------------
> src/qemu/qemu_hostdev.h      |  1 -
> src/qemu/qemu_hotplug.c      | 20 ++--------------
> tests/domaincapstest.c       |  3 +--
> 8 files changed, 12 insertions(+), 103 deletions(-)
>
>diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h
>index 7e2dc5a60a..e3983bedb2 100644
>--- a/src/qemu/qemu_command.h
>+++ b/src/qemu/qemu_command.h
>@@ -148,7 +148,6 @@ char *qemuBuildMemoryDeviceStr(virDomainMemoryDefPtr mem,
> char *qemuBuildPCIHostdevDevStr(const virDomainDef *def,
>                                 virDomainHostdevDefPtr dev,
>                                 unsigned int bootIndex,
>-                                const char *configfd,
>                                 virQEMUCapsPtr qemuCaps);
>
> char *qemuBuildRNGDevStr(const virDomainDef *def,
>diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
>index 11f97dbc65..eb373c14d7 100644
>--- a/src/qemu/qemu_driver.c
>+++ b/src/qemu/qemu_driver.c
>@@ -13517,7 +13517,6 @@ qemuNodeDeviceDetachFlags(virNodeDevicePtr dev,
>     int ret = -1;
>     virNodeDeviceDefPtr def = NULL;
>     char *xml = NULL;
>-    bool legacy = qemuHostdevHostSupportsPassthroughLegacy();
>     bool vfio = qemuHostdevHostSupportsPassthroughVFIO();
>     virHostdevManagerPtr hostdev_mgr = driver->hostdevMgr;
>
>@@ -13544,8 +13543,6 @@ qemuNodeDeviceDetachFlags(virNodeDevicePtr dev,
>     if (!driverName) {
>         if (vfio) {
>             driverName = "vfio";
>-        } else if (legacy) {
>-            driverName = "kvm";
>         } else {
>             virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
>                            _("neither VFIO nor KVM device assignment is "

This whole condition can be just:
if (!driverName)
  driverName = "vfio";

now that we would not be able to pick a different one.

>@@ -13563,13 +13560,10 @@ qemuNodeDeviceDetachFlags(virNodeDevicePtr dev,
>         }
>         virPCIDeviceSetStubDriver(pci, VIR_PCI_STUB_DRIVER_VFIO);
>     } else if (STREQ(driverName, "kvm")) {
>-        if (!legacy) {
>-            virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
>-                           _("KVM device assignment is currently not "
>-                             "supported on this system"));
>-            goto cleanup;
>-        }
>-        virPCIDeviceSetStubDriver(pci, VIR_PCI_STUB_DRIVER_KVM);
>+        virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
>+                       _("KVM device assignment is currently not "
>+                         "supported on this system"));

s/currently not/no longer/
d/on this system/



>+        goto cleanup;
>     } else {
>         virReportError(VIR_ERR_INVALID_ARG,
>                        _("unknown driver name '%s'"), driverName);

Reviewed-by: Ján Tomko <jtomko at redhat.com>

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190821/ecd26341/attachment-0001.sig>


More information about the libvir-list mailing list