From nobody Mon Feb 9 00:07:03 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1682332924; cv=none; d=zohomail.com; s=zohoarc; b=C/pr90Mtj7vfMgrywsCjKJBeJElEjvjDH+7qpDRxZxTOtKQONkfXhuVf3bpEnbWwXzrl2X/grB0HnhdC/rBMNcTHjXqIiHP0mmfn09LKwqfLpbOA4evH10TaiJx1zf+36hTmTU+D+OCiL1Oczy7F5xhOOncfSOzQVdGPgH8IDmU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682332924; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=jJG54Qqm7K9Wb4PNH08mdFkwhA3Vbewjr/zEfHSW45Y=; b=VemZwL2GaA/6rIMEINchkFcs95nebHx94JP8efTzwJjdDllQAwmfSHzy430hbS95FQu5CYVGBHdbR9JaWLT3Xt3ZQw9jvaOWMpxFHJmWLMaH8maSXFlhvcaaP6FjaAlD67A6VczKGCIOYcJxCfzqCL3RmpPMWSu9stJK+qbD7PY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1682332924308946.8062073198797; Mon, 24 Apr 2023 03:42:04 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-61-LqDScMRjPrerVARqbxBDYg-1; Mon, 24 Apr 2023 06:41:59 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8B23E858289; Mon, 24 Apr 2023 10:41:56 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 761EA2166B2C; Mon, 24 Apr 2023 10:41:56 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 40806194658D; Mon, 24 Apr 2023 10:41:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 710D71946589 for ; Mon, 24 Apr 2023 10:41:53 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 528D2112131B; Mon, 24 Apr 2023 10:41:53 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id EDC1A1121319 for ; Mon, 24 Apr 2023 10:41:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682332923; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=jJG54Qqm7K9Wb4PNH08mdFkwhA3Vbewjr/zEfHSW45Y=; b=hwdjIH5nuwrKlqLHnJYlKcMEIpguEv3YOH0eZlvIZdiIX3abw4OXjOoEcZLDvYrj+K1uQR X69DJ/TNdHH2YNW8H4GCojUnJSdrDpajwhQgioCQKzjckCwfZ7kXmEYzwjiqNT7bFP8ii+ 0Ym9AhZgLfEkvwJvWRte/GBI1tFKsw4= X-MC-Unique: LqDScMRjPrerVARqbxBDYg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v2 6/9] qemu_hotplug: Drop PCI backend check in qemuDomainAttachHostPCIDevice() Date: Mon, 24 Apr 2023 12:41:45 +0200 Message-Id: <873e0fab88609575f068dd97bbda4f4a3aaa1211.1682332714.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1682332925610100007 Content-Type: text/plain; charset="utf-8"; x-default="true" There is no way the qemuDomainAttachHostPCIDevice() function can be called over a hostdev with other PCI backend than VFIO. And 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 Reviewed-by: Martin Kletzander --- 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 =3D false; bool teardowndevice =3D false; bool teardownmemlock =3D false; - int backend; g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); unsigned int flags =3D 0; =20 @@ -1478,32 +1477,6 @@ qemuDomainAttachHostPCIDevice(virQEMUDriver *driver, &hostdev, 1, priv->qemuCaps, flags) <= 0) return -1; =20 - /* this could have been changed by qemuDomainPrepareHostdevPCI() */ - backend =3D 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(backen= d)); - goto error; - break; - } - if (qemuDomainAdjustMaxMemLockHostdev(vm, hostdev) < 0) goto error; teardownmemlock =3D true; @@ -1517,8 +1490,7 @@ qemuDomainAttachHostPCIDevice(virQEMUDriver *driver, =20 if (qemuSecuritySetHostdevLabel(driver, vm, hostdev) < 0) goto error; - if (backend !=3D VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO) - teardownlabel =3D true; + teardownlabel =3D true; =20 qemuAssignDeviceHostdevAlias(vm->def, &info->alias, -1); =20 --=20 2.39.2