From nobody Tue Mar 24 01:17:01 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1773938565; cv=none; d=zohomail.com; s=zohoarc; b=BonK31x+3UbqMEV0GykM4KiwKOBq+AhIfRgczvl+538Sux//KhPHynHVlez0t4e6KhYEw3rxBZSVGLyxrnbpTFVTW4W+QpE9bsjFy/IvIe+1beIqe6LtwsDsJZEEU4YP2PkaMCaw7BlFU4Juy+6GItBZrFZHIC+O0muJu2+ezxA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773938565; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=JOHgJ96UnXbFuVIFE3+N+e/GhunOWRsNjHnIwPr1r2o=; b=EFDZS7dqAjXKw71O3gqWvVEW+iqWnjSW4z4D4fcQ4vnEQuvlW+bIAcz1TfPOIbDtUXi8Yeg+Xqdc5T2JoC7nuOMZeJS2TVLLRMNKV08IiVAWH6llNONCU3DFhVu7WVMny03QurNaFF3R83Xdwx7LHH/LPAhBCibGrnpjmBEUGTA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1773938565071970.8482891281; Thu, 19 Mar 2026 09:42:45 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 3616441B05; Thu, 19 Mar 2026 12:42:44 -0400 (EDT) Received: from [172.19.199.12] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 93A9341CBC; Thu, 19 Mar 2026 12:38:33 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 596DF3F840; Thu, 19 Mar 2026 12:38:26 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 8F6B541B09 for ; Thu, 19 Mar 2026 12:37:08 -0400 (EDT) Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-245-Wji47gkKOS-HGKws7Nm85w-1; Thu, 19 Mar 2026 12:37:06 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1A1BE1800577 for ; Thu, 19 Mar 2026 16:37:06 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.44.33.53]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 6453B30002E0 for ; Thu, 19 Mar 2026 16:37:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HELO_MISC_IP,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1773938228; h=from:from: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; bh=JOHgJ96UnXbFuVIFE3+N+e/GhunOWRsNjHnIwPr1r2o=; b=RV/p7skTiOtFv9TieHxC3LH0ENCEqJ4J1b3wV6F2THuLihTWVC0YzgehVw29fnpWPFpEYB 1UG4lImLeBiufDXfSlR17Ne7Dg9ufJ7wX3SKWuGE+Z6zvcyGIaPXYgDR+NbAgsT35iqXyx 5kTS2fqosvzTLXFbhtr9434tJ+MFwdk= X-MC-Unique: Wji47gkKOS-HGKws7Nm85w-1 X-Mimecast-MFC-AGG-ID: Wji47gkKOS-HGKws7Nm85w_1773938226 To: devel@lists.libvirt.org Subject: [libvirt PATCH 06/11] src: Use virHostdevIsPCIDeviceWith* to check for IOMMUFD Date: Thu, 19 Mar 2026 17:36:52 +0100 Message-ID: <2bcae3bdc2c6a8e758bb6e523223b0382f279ed0.1773938045.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: nlEelnbu6WbbKwEv4H0kUSz6culOB08Re4kV5nIwpGw_1773938226 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 6VFHNBDU3W5E6R7XXAPKYVXF6S6JWJCV X-Message-ID-Hash: 6VFHNBDU3W5E6R7XXAPKYVXF6S6JWJCV X-MailFrom: phrdina@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Pavel Hrdina via Devel Reply-To: Pavel Hrdina X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1773938566683158500 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Pavel Hrdina Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/qemu/qemu_cgroup.c | 2 +- src/qemu/qemu_command.c | 2 +- src/qemu/qemu_namespace.c | 2 +- src/qemu/qemu_validate.c | 2 +- src/security/security_apparmor.c | 2 +- src/security/security_dac.c | 4 ++-- src/security/security_selinux.c | 4 ++-- src/security/virt-aa-helper.c | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c index 6148990f19..0e1815f571 100644 --- a/src/qemu/qemu_cgroup.c +++ b/src/qemu/qemu_cgroup.c @@ -479,7 +479,7 @@ qemuSetupHostdevCgroup(virDomainObj *vm, g_autofree char *path =3D NULL; int perms; =20 - if (dev->source.subsys.u.pci.driver.iommufd =3D=3D VIR_TRISTATE_BOOL_Y= ES) + if (virHostdevIsPCIDeviceWithIOMMUFD(dev)) return 0; =20 if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_DEVICE= S)) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index d0df7b7826..7286fd8b83 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -5266,7 +5266,7 @@ qemuBuildHostdevCommandLine(virCommand *cmd, if (qemuCommandAddExtDevice(cmd, hostdev->info, def, qemuCaps)= < 0) return -1; =20 - if (subsys->u.pci.driver.iommufd =3D=3D VIR_TRISTATE_BOOL_YES)= { + if (virHostdevIsPCIDeviceWithIOMMUFD(hostdev)) { qemuDomainHostdevPrivate *hostdevPriv =3D QEMU_DOMAIN_HOST= DEV_PRIVATE(hostdev); =20 qemuFDPassDirectTransferCommand(hostdevPriv->vfioDeviceFd,= cmd); diff --git a/src/qemu/qemu_namespace.c b/src/qemu/qemu_namespace.c index fb0734193d..4a063064f1 100644 --- a/src/qemu/qemu_namespace.c +++ b/src/qemu/qemu_namespace.c @@ -345,7 +345,7 @@ qemuDomainSetupHostdev(virDomainObj *vm, { g_autofree char *path =3D NULL; =20 - if (hostdev->source.subsys.u.pci.driver.iommufd =3D=3D VIR_TRISTATE_BO= OL_YES) + if (virHostdevIsPCIDeviceWithIOMMUFD(hostdev)) return 0; =20 if (qemuDomainGetHostdevPath(hostdev, &path, NULL) < 0) diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index f8a15374c9..b3db2c71d8 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -2791,7 +2791,7 @@ qemuValidateDomainDeviceDefHostdev(const virDomainHos= tdevDef *hostdev, return -1; } =20 - if (hostdev->source.subsys.u.pci.driver.iommufd =3D=3D VIR= _TRISTATE_BOOL_YES) { + if (virHostdevIsPCIDeviceWithIOMMUFD(hostdev)) { if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_IOMMUFD= )) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("IOMMUFD is not supported by this= version of qemu")); diff --git a/src/security/security_apparmor.c b/src/security/security_appar= mor.c index 40f13ec1a5..e53486ee0c 100644 --- a/src/security/security_apparmor.c +++ b/src/security/security_apparmor.c @@ -847,7 +847,7 @@ AppArmorSetSecurityHostdevLabel(virSecurityManager *mgr, return -1; =20 if (pcisrc->driver.name =3D=3D VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_= VFIO) { - if (dev->source.subsys.u.pci.driver.iommufd !=3D VIR_TRISTATE_= BOOL_YES) { + if (virHostdevIsPCIDeviceWithoutIOMMUFD(dev)) { g_autofree char *vfioGroupDev =3D virPCIDeviceGetIOMMUGrou= pDev(pci); =20 if (!vfioGroupDev) diff --git a/src/security/security_dac.c b/src/security/security_dac.c index 5aa13741e6..05ab7ec2f9 100644 --- a/src/security/security_dac.c +++ b/src/security/security_dac.c @@ -1283,7 +1283,7 @@ virSecurityDACSetHostdevLabel(virSecurityManager *mgr, return -1; =20 if (pcisrc->driver.name =3D=3D VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_= VFIO) { - if (dev->source.subsys.u.pci.driver.iommufd !=3D VIR_TRISTATE_= BOOL_YES) { + if (virHostdevIsPCIDeviceWithoutIOMMUFD(dev)) { g_autofree char *vfioGroupDev =3D virPCIDeviceGetIOMMUGrou= pDev(pci); =20 if (!vfioGroupDev) @@ -1454,7 +1454,7 @@ virSecurityDACRestoreHostdevLabel(virSecurityManager = *mgr, return -1; =20 if (pcisrc->driver.name =3D=3D VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_= VFIO) { - if (dev->source.subsys.u.pci.driver.iommufd !=3D VIR_TRISTATE_= BOOL_YES) { + if (virHostdevIsPCIDeviceWithoutIOMMUFD(dev)) { g_autofree char *vfioGroupDev =3D virPCIDeviceGetIOMMUGrou= pDev(pci); =20 if (!vfioGroupDev) diff --git a/src/security/security_selinux.c b/src/security/security_selinu= x.c index 89546e3316..0824217f24 100644 --- a/src/security/security_selinux.c +++ b/src/security/security_selinux.c @@ -2255,7 +2255,7 @@ virSecuritySELinuxSetHostdevSubsysLabel(virSecurityMa= nager *mgr, return -1; =20 if (pcisrc->driver.name =3D=3D VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_= VFIO) { - if (dev->source.subsys.u.pci.driver.iommufd !=3D VIR_TRISTATE_= BOOL_YES) { + if (virHostdevIsPCIDeviceWithoutIOMMUFD(dev)) { g_autofree char *vfioGroupDev =3D virPCIDeviceGetIOMMUGrou= pDev(pci); =20 if (!vfioGroupDev) @@ -2499,7 +2499,7 @@ virSecuritySELinuxRestoreHostdevSubsysLabel(virSecuri= tyManager *mgr, return -1; =20 if (pcisrc->driver.name =3D=3D VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_= VFIO) { - if (dev->source.subsys.u.pci.driver.iommufd !=3D VIR_TRISTATE_= BOOL_YES) { + if (virHostdevIsPCIDeviceWithoutIOMMUFD(dev)) { g_autofree char *vfioGroupDev =3D virPCIDeviceGetIOMMUGrou= pDev(pci); =20 if (!vfioGroupDev) diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c index e932e79dab..14b202bf7b 100644 --- a/src/security/virt-aa-helper.c +++ b/src/security/virt-aa-helper.c @@ -1133,7 +1133,7 @@ get_files(vahControl * ctl) =20 if ((driverName =3D=3D VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO= || driverName =3D=3D VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_DEFAU= LT) && - dev->source.subsys.u.pci.driver.iommufd !=3D VIR_TRISTATE_= BOOL_YES) { + virHostdevIsPCIDeviceWithoutIOMMUFD(dev)) { needsVfio =3D true; } =20 --=20 2.53.0