Re: [PATCH v2 6/9] qemu_hotplug: Drop PCI backend check in qemuDomainAttachHostPCIDevice()

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

 



On Mon, Apr 24, 2023 at 12:41:45PM +0200, Michal Privoznik wrote:
There is no way the qemuDomainAttachHostPCIDevice() function can
be called over a hostdev with other PCI backend than VFIO. And

"with PCI backend other than VFIO"

even if it were, then the check is written so poorly that it lets
some types through (e.g. KVM) only to let
qemuBuildPCIHostdevDevProps() called afterwards fail properly.

Drop this check and rely on qemuDomainPrepareHostdevPCI() (and
worst case scenario even qemuBuildPCIHostdevDevProps()) to report
the proper error.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
src/qemu/qemu_hotplug.c | 30 +-----------------------------
1 file changed, 1 insertion(+), 29 deletions(-)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index fab8935346..566aa1f7df 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1466,7 +1466,6 @@ qemuDomainAttachHostPCIDevice(virQEMUDriver *driver,
    bool teardownlabel = false;
    bool teardowndevice = false;
    bool teardownmemlock = false;
-    int backend;
    g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
    unsigned int flags = 0;

@@ -1478,32 +1477,6 @@ qemuDomainAttachHostPCIDevice(virQEMUDriver *driver,
                                     &hostdev, 1, priv->qemuCaps, flags) < 0)
        return -1;

-    /* this could have been changed by qemuDomainPrepareHostdevPCI() */
-    backend = hostdev->source.subsys.u.pci.backend;
-
-    switch (backend) {
-    case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO:
-        if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE_VFIO_PCI)) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                           _("VFIO PCI device assignment is not "
-                             "supported by this version of qemu"));
-            goto error;
-        }
-        break;
-
-    case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT:
-    case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM:
-        break;
-
-    case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN:
-    case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST:
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("QEMU does not support device assignment mode '%1$s'"),
-                       virDomainHostdevSubsysPCIBackendTypeToString(backend));

This is a better error message for example for the previous patch except
the fact that for _TYPE_LAST this reports "... assignment mode
'<null>'", but that's probably a non-issue (famous last words?).

Reviewed-by: Martin Kletzander <mkletzan@xxxxxxxxxx>

Attachment: signature.asc
Description: PGP signature


[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