Re: [PATCH v2 5/9] qemu: Deny all but VFIO PCI backends in hostdev prepare phase

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

 



On Mon, Apr 24, 2023 at 12:41:44PM +0200, Michal Privoznik wrote:
We used to support KVM and VFIO style of PCI assignment. The
former was dropped in v5.7.0-rc1~103 and thus we only support
VFIO. All other backends lead to an error (see
qemuBuildPCIHostdevDevProps(), or qemuBuildPCIHostdevDevStr() as
it used to be called in the era of aforementioned commit).

Might as well report the error in prepare phase and save hassle
of proceeding with device preparation (e.g. in case of hotplug
overriding the device's driver, setting seclabels, etc.).

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
src/qemu/qemu_domain.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 58cd3dd710..72f36c807b 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -11326,12 +11326,11 @@ qemuDomainPrepareHostdevPCI(virDomainHostdevDef *hostdev,
        break;

    case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM:
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                       _("host doesn't support legacy PCI passthrough"));
-        return false;
-
    case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN:
    case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST:
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("invalid PCI passthrough type '%1$s'"),
+                       virDomainHostdevSubsysPCIBackendTypeToString(*backend));

This is a bit misleading as it is not "invalid", it's just unsupported,
and on top of that you're changing it to internal error and I think it
should still be CONFIG_UNSUPPORTED, at least for KVM and XEN.  _LAST
(and possibly default:) is still an internal error of course.

        break;
    }

--
2.39.2

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