From nobody Wed Apr 1 22:15:21 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=1774956765; cv=none; d=zohomail.com; s=zohoarc; b=MuVq3SPZdiBpYUYanwtD+OrcCowj7PBM3zgMjCIp2oStB1n1IZZA+Ywq9KSmkJmb/BXGxyC7WHwmmeJ7TQ1OgqfuDmKieZNsoX/t62Uvh0hjCw8Xa44rrjhHiNA0tOTyLiyVmttMfy0lxSvKo0nqBuNTY7j0nr+pN/KCsGZxqss= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1774956765; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Subject:Subject:To:To:Message-Id:Cc; bh=ZSW72mJlN0hPrkCs09Z/O2YHKcoOsLqvHNAU1lFwuMU=; b=geKfyGqVfOQMscOYriHH+6Ak9icWLN7j4sg2PfHN2Ec3ud/vaVS/JF7Vmc1khvo7KbhFVHlJP8CLdSNgxmSwvL/yJdhh6glBsb7+6GhZixeWVpSEFNWVXjDEt6MZiVWwm8R5wbaSDCdpG2+wWeVgLFX0YWryk/+rVhztWyuotac= 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 1774956765383740.7582493755556; Tue, 31 Mar 2026 04:32:45 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 230D23F313; Tue, 31 Mar 2026 07:32:44 -0400 (EDT) Received: from [172.19.199.12] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id D8EBC3FEF0; Tue, 31 Mar 2026 07:32:15 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 0C2E53F30F; Tue, 31 Mar 2026 07:32:12 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 40C673F2F8 for ; Tue, 31 Mar 2026 07:32:10 -0400 (EDT) Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-74-X44Q_Ev8Nh6rs-EhHD4GVw-1; Tue, 31 Mar 2026 07:32:08 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9BE1819560AA for ; Tue, 31 Mar 2026 11:32:07 +0000 (UTC) Received: from antique-laptop.lan.rosnicka.net (unknown [10.44.22.37]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id ADE331954102 for ; Tue, 31 Mar 2026 11:32:06 +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=1.6 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HELO_MISC_IP,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_SBL_CSS,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1774956729; 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; bh=ZSW72mJlN0hPrkCs09Z/O2YHKcoOsLqvHNAU1lFwuMU=; b=ApLpyt9e55Y9ilxP4Opk9ewZSMsE2PpP5woeawlIlAGwGGLqFiqTSh5pLRydon45zoZvBI KOXsNYpVC9J6huObCsdA620DTdwYPgLORZCOjxbAsA1hvgICIZgEG8rKtrxXZpAHtA9qYq n3PPN3MDsi+P2/3G/XpFZSqXQP7uz84= X-MC-Unique: X44Q_Ev8Nh6rs-EhHD4GVw-1 X-Mimecast-MFC-AGG-ID: X44Q_Ev8Nh6rs-EhHD4GVw_1774956727 To: devel@lists.libvirt.org Subject: [libvirt PATCH] qemu_hotplug: Set correct iommufdState on error path Date: Tue, 31 Mar 2026 13:32:04 +0200 Message-ID: <25f57f6473a8038856545cdc939f9aa881a96ecd.1774956560.git.phrdina@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 0TNhKNJWu2vZrstEV8pxPUhgO4TuEp8RixLyoazXYC8_1774956727 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 64Z6SFQ6Q76P5K7DKEJUBLZ7XBC32AGE X-Message-ID-Hash: 64Z6SFQ6Q76P5K7DKEJUBLZ7XBC32AGE 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: 1774956769074154100 Content-Type: text/plain; charset="utf-8"; x-default="true" If hotplugging host device that needs to add iommufd object fails we need to remove the iommufd object as well. We also need to update the iommufdState otherwise hotplugging any host device with iommufd will fail for the same VM. Fixes: 5d16bef1a69500791be454239e3b9ac68ec53ace Signed-off-by: Pavel Hrdina Reviewed-by: J=C3=A1n Tomko Reviewed-by: Peter Krempa --- src/qemu/qemu_hotplug.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index c86ebc59d0..9439948089 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1679,8 +1679,10 @@ qemuDomainAttachHostPCIDevice(virQEMUDriver *driver, if (virHostdevIsPCIDeviceWithIOMMUFD(hostdev)) { qemuDomainObjEnterMonitor(vm); =20 - if (removeiommufd) + if (removeiommufd) { + priv->iommufdState =3D false; ignore_value(qemuMonitorDelObject(priv->mon, "iommufd0", false= )); + } =20 qemuFDPassDirectTransferMonitorRollback(hostdevPriv->vfioDeviceFd,= priv->mon); qemuFDPassDirectTransferMonitorRollback(priv->iommufd, priv->mon); --=20 2.53.0