From 59962b69b595e32902b1fd0cb44519324aaf0a3e Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Mon, 24 Apr 2023 12:12:57 +0200 Subject: [PATCH] qemu: Deny all but VFIO PCI backends in hostdev prepare phase 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 Reviewed-by: Martin Kletzander --- src/qemu/qemu_domain.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 58cd3dd710..8dc9305b2a 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -11331,7 +11331,14 @@ qemuDomainPrepareHostdevPCI(virDomainHostdevDef *hostdev, return false; case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN: + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("QEMU does not support device assignment mode '%1$s'"), + virDomainHostdevSubsysPCIBackendTypeToString(*backend)); + return false; + + default: case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST: + virReportEnumRangeError(virDomainHostdevSubsysPCIBackendType, *backend); break; }