From nobody Tue Mar 3 04:54:09 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=1771245865; cv=none; d=zohomail.com; s=zohoarc; b=lsJ+R49FLHkc3kwnPt2sYfEeVSJpttRytmHffhTLzb0RyDO7v20KfpsgOFq0zC+0e/WnwyW4IDzvJ9+2IdDbsox8BVXXHWuDqAXXKRo/U7FHjAmGx4uSQhYIBUd6OWD3hh9YPdR9Dbf+itvaaMhlTQHuteOxF5aYXNsPwW4Tjrg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771245865; 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=Jg2D7kk7gnEBxo9i27PG0tl7sGB00MWhlippWNBHf18=; b=SgUlJPex2pdVb3+lBB4oq81Jay+w6/DbV748TkRxg6r7KNzkfxiOODfamLLPsG9dQFvBd8HrtRB2Anf4YvFImp0OYB04t15efovlIgk4IgOgrhGQf+HtSHfiB3W776+4GczYxEH2By2XC/UuYB8ehVSRQV6pEN+Di9AgC0hWgCs= 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 1771245865275620.1640221234682; Mon, 16 Feb 2026 04:44:25 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 81AC03FD29; Mon, 16 Feb 2026 07:44:24 -0500 (EST) Received: from [172.19.199.9] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 5474141CB8; Mon, 16 Feb 2026 07:34:21 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 2ED7B3F881; Mon, 16 Feb 2026 07:34:13 -0500 (EST) 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 2E757419D8 for ; Mon, 16 Feb 2026 07:28:41 -0500 (EST) 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-353-qvmUjYr1MMCO7PRA5754eA-1; Mon, 16 Feb 2026 07:28:39 -0500 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 975B418002C2 for ; Mon, 16 Feb 2026 12:28:38 +0000 (UTC) Received: from antique-laptop.rosnicka.net (unknown [10.45.242.10]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id EB17130001A5 for ; Mon, 16 Feb 2026 12:28:37 +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=-5.0 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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=1771244920; 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=Jg2D7kk7gnEBxo9i27PG0tl7sGB00MWhlippWNBHf18=; b=IQRhjay4KKJ4axzKy/Cjoda//QtYOTLSf4FzKbTHVTN7ch6Z9yiO/vr2wNsN5IVymN2uQB 9lifW0agof6Oo28BsQVy+0/TbyMAhaK66HsyfPQd/HG0zUKP3gMKl80eMxA7TgoM1lmAok BHrDL/wfgTqvCwoixDGsxJNXOsKBTXM= X-MC-Unique: qvmUjYr1MMCO7PRA5754eA-1 X-Mimecast-MFC-AGG-ID: qvmUjYr1MMCO7PRA5754eA_1771244918 To: devel@lists.libvirt.org Subject: [libvirt PATCH 18/24] qemu_command: Don't use host property if IOMMUFD is used Date: Mon, 16 Feb 2026 13:28:10 +0100 Message-ID: <0c44d86aa292856a361e4b0ee010062ee744f318.1771244723.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: Lgx45mkDXj0PBS7KQKF-qnCBIiWXqk-PqeWM4fxoDx0_1771244918 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: YMMSONODMXZ2ST42RSSHPYMPJFN7NEI6 X-Message-ID-Hash: YMMSONODMXZ2ST42RSSHPYMPJFN7NEI6 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: 1771245865808158500 Content-Type: text/plain; charset="utf-8"; x-default="true" They should not be used at the same time. Fixes: f6230804727df834da27370e835204672218ab23 Signed-off-by: Pavel Hrdina --- src/qemu/qemu_command.c | 24 +++++++++---------- .../iommufd-q35.x86_64-latest.args | 2 +- ...fd-virt-pci-bus-single.aarch64-latest.args | 2 +- .../iommufd-virt.aarch64-latest.args | 4 ++-- .../iommufd.x86_64-latest.args | 2 +- 5 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 91eb3cb27d..724f0cd8eb 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4762,10 +4762,11 @@ qemuBuildPCIHostdevDevProps(const virDomainDef *def, g_autoptr(virJSONValue) props =3D NULL; virDomainHostdevSubsysPCI *pcisrc =3D &dev->source.subsys.u.pci; virDomainNetTeamingInfo *teaming; - g_autofree char *host =3D virPCIDeviceAddressAsString(&pcisrc->addr); + g_autofree char *host =3D NULL; const char *failover_pair_id =3D NULL; const char *driver =3D NULL; const char *iommufdId =3D NULL; + const char *fdstr =3D NULL; /* 'ramfb' property must be omitted unless it's to be enabled */ bool ramfb =3D pcisrc->ramfb =3D=3D VIR_TRISTATE_SWITCH_ON; =20 @@ -4799,31 +4800,28 @@ qemuBuildPCIHostdevDevProps(const virDomainDef *def, teaming->persistent) failover_pair_id =3D teaming->persistent; =20 - if (pcisrc->driver.iommufd =3D=3D VIR_TRISTATE_BOOL_YES) + if (virHostdevIsPCIDeviceWithIOMMUFD(dev)) { + qemuDomainHostdevPrivate *hostdevPriv =3D QEMU_DOMAIN_HOSTDEV_PRIV= ATE(dev); + + fdstr =3D qemuFDPassDirectGetPath(hostdevPriv->vfioDeviceFd); iommufdId =3D "iommufd0"; + } else { + host =3D virPCIDeviceAddressAsString(&pcisrc->addr); + } =20 if (virJSONValueObjectAdd(&props, "s:driver", driver, - "s:host", host, + "S:host", host, "s:id", dev->info->alias, "p:bootindex", dev->info->effectiveBootIndex, "S:failover_pair_id", failover_pair_id, "S:display", qemuOnOffAuto(pcisrc->display), "B:ramfb", ramfb, "S:iommufd", iommufdId, + "S:fd", fdstr, NULL) < 0) return NULL; =20 - if (pcisrc->driver.name =3D=3D VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO= && - pcisrc->driver.iommufd =3D=3D VIR_TRISTATE_BOOL_YES) { - qemuDomainHostdevPrivate *hostdevPriv =3D QEMU_DOMAIN_HOSTDEV_PRIV= ATE(dev); - - if (virJSONValueObjectAdd(&props, - "S:fd", qemuFDPassDirectGetPath(hostdevP= riv->vfioDeviceFd), - NULL) < 0) - return NULL; - } - if (qemuBuildDeviceAddressProps(props, def, dev->info) < 0) return NULL; =20 diff --git a/tests/qemuxmlconfdata/iommufd-q35.x86_64-latest.args b/tests/q= emuxmlconfdata/iommufd-q35.x86_64-latest.args index d5fe704021..f886c488e1 100644 --- a/tests/qemuxmlconfdata/iommufd-q35.x86_64-latest.args +++ b/tests/qemuxmlconfdata/iommufd-q35.x86_64-latest.args @@ -36,6 +36,6 @@ XDG_CONFIG_HOME=3D/var/lib/libvirt/qemu/domain--1-q35-tes= t/.config \ -global ICH9-LPC.noreboot=3Doff \ -watchdog-action reset \ -object '{"qom-type":"iommufd","id":"iommufd0","fd":"0"}' \ --device '{"driver":"vfio-pci","host":"0000:06:12.5","id":"hostdev0","iommu= fd":"iommufd0","fd":"0","bus":"pcie.0","addr":"0x3"}' \ +-device '{"driver":"vfio-pci","id":"hostdev0","iommufd":"iommufd0","fd":"0= ","bus":"pcie.0","addr":"0x3"}' \ -sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=3Ddeny \ -msg timestamp=3Don diff --git a/tests/qemuxmlconfdata/iommufd-virt-pci-bus-single.aarch64-late= st.args b/tests/qemuxmlconfdata/iommufd-virt-pci-bus-single.aarch64-latest.= args index 303cfa922b..543e976c58 100644 --- a/tests/qemuxmlconfdata/iommufd-virt-pci-bus-single.aarch64-latest.args +++ b/tests/qemuxmlconfdata/iommufd-virt-pci-bus-single.aarch64-latest.args @@ -27,6 +27,6 @@ XDG_CONFIG_HOME=3D/var/lib/libvirt/qemu/domain--1-foo/.co= nfig \ -boot strict=3Don \ -audiodev '{"id":"audio1","driver":"none"}' \ -object '{"qom-type":"iommufd","id":"iommufd0","fd":"0"}' \ --device '{"driver":"vfio-pci","host":"0000:06:12.5","id":"hostdev0","iommu= fd":"iommufd0","fd":"0","bus":"pcie.0","addr":"0x1"}' \ +-device '{"driver":"vfio-pci","id":"hostdev0","iommufd":"iommufd0","fd":"0= ","bus":"pcie.0","addr":"0x1"}' \ -sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=3Ddeny \ -msg timestamp=3Don diff --git a/tests/qemuxmlconfdata/iommufd-virt.aarch64-latest.args b/tests= /qemuxmlconfdata/iommufd-virt.aarch64-latest.args index 6a62b08e8a..e1a4c4bb9a 100644 --- a/tests/qemuxmlconfdata/iommufd-virt.aarch64-latest.args +++ b/tests/qemuxmlconfdata/iommufd-virt.aarch64-latest.args @@ -30,7 +30,7 @@ XDG_CONFIG_HOME=3D/var/lib/libvirt/qemu/domain--1-foo/.co= nfig \ -device '{"driver":"pcie-root-port","port":10,"chassis":3,"id":"pci.3","bu= s":"pcie.0","addr":"0x1.0x2"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ -object '{"qom-type":"iommufd","id":"iommufd0","fd":"0"}' \ --device '{"driver":"vfio-pci","host":"0000:06:12.5","id":"hostdev0","iommu= fd":"iommufd0","fd":"0","bus":"pci.1","addr":"0x0"}' \ --device '{"driver":"vfio-pci","host":"0000:07:12.5","id":"hostdev1","iommu= fd":"iommufd0","fd":"0","bus":"pci.2","addr":"0x0"}' \ +-device '{"driver":"vfio-pci","id":"hostdev0","iommufd":"iommufd0","fd":"0= ","bus":"pci.1","addr":"0x0"}' \ +-device '{"driver":"vfio-pci","id":"hostdev1","iommufd":"iommufd0","fd":"0= ","bus":"pci.2","addr":"0x0"}' \ -sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=3Ddeny \ -msg timestamp=3Don diff --git a/tests/qemuxmlconfdata/iommufd.x86_64-latest.args b/tests/qemux= mlconfdata/iommufd.x86_64-latest.args index 15dabe197c..b9aefda39d 100644 --- a/tests/qemuxmlconfdata/iommufd.x86_64-latest.args +++ b/tests/qemuxmlconfdata/iommufd.x86_64-latest.args @@ -29,7 +29,7 @@ XDG_CONFIG_HOME=3D/var/lib/libvirt/qemu/domain--1-foo/.co= nfig \ -device '{"driver":"piix3-usb-uhci","id":"usb","bus":"pci.0","addr":"0x1.0= x2"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ -object '{"qom-type":"iommufd","id":"iommufd0","fd":"0"}' \ --device '{"driver":"vfio-pci","host":"0000:06:12.5","id":"hostdev0","iommu= fd":"iommufd0","fd":"0","bus":"pci.0","addr":"0x3"}' \ +-device '{"driver":"vfio-pci","id":"hostdev0","iommufd":"iommufd0","fd":"0= ","bus":"pci.0","addr":"0x3"}' \ -device '{"driver":"virtio-balloon-pci","id":"balloon0","bus":"pci.0","add= r":"0x2"}' \ -sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=3Ddeny \ -msg timestamp=3Don --=20 2.53.0