From nobody Tue Mar 24 01:03: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=1773938427; cv=none; d=zohomail.com; s=zohoarc; b=CQe9gQD0dM/u2GyFaf8eLBMMbQrpkBsTROw+eXOhs2E8LIVumFfcZij6gj3c9m5J1zYQczczGR7KE/CuaFm5Hn2e5fibfAdn2LlVjbtBEx7Yy5RQgJgJvKsiO8T8qCTAPY/RlD1haTw8ur0/iePkkgOrqkZTZLcGuhz1onmKnlY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773938427; 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=g9hyZfQMtAoa3+O244UGs9wvQ2kRintsYQ5F9tiCHpU=; b=FMsxYyDMOrPR59JQIMNlC9QUfdnAe/8MeFyJAxWN6/VcmnUe5cwuPzHV6Y2fygtYCz0HjAU3yxudee5ZrQy8FEujVu5ovCd2iN1+2dNVa4ftdiMKEmDpgZE+G4whmAkygGP2XI1gh0x8lXbxRvpUJ/BQuG5WNp5SoV2Kk85j0Ow= 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 1773938427320421.30574685140004; Thu, 19 Mar 2026 09:40:27 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id AA4D241B4F; Thu, 19 Mar 2026 12:40:26 -0400 (EDT) Received: from [172.19.199.12] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 8B8A241BD1; Thu, 19 Mar 2026 12:37:12 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 8F669418A5; Thu, 19 Mar 2026 12:37:05 -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 12C0F3F363 for ; Thu, 19 Mar 2026 12:37:05 -0400 (EDT) Received: from mx-prod-mc-01.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-460-YuTRoCrWNseBxMo_5bMUEw-1; Thu, 19 Mar 2026 12:37:03 -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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9C09C19560B5 for ; Thu, 19 Mar 2026 16:37:02 +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 E90E530001A1 for ; Thu, 19 Mar 2026 16:37:01 +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=1773938224; 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=g9hyZfQMtAoa3+O244UGs9wvQ2kRintsYQ5F9tiCHpU=; b=LcSaxQHHO+sR7dK8U98rJBUz4uc9rl/mfF2Ezo8x7Fw3c5h5LCZtPNnsA+0Mbqys3qAijK sREwOcr+GJzIarcQaKZd4SFQ8qa8Npv4U5H3R34va96Kr9ldF3ovJvud2olzFsgyD8tX+9 OalLNMu3wCnNzypzP6ekgi4ZlPzCchY= X-MC-Unique: YuTRoCrWNseBxMo_5bMUEw-1 X-Mimecast-MFC-AGG-ID: YuTRoCrWNseBxMo_5bMUEw_1773938222 To: devel@lists.libvirt.org Subject: [libvirt PATCH 03/11] hypervisor: Fix virHostdevNeedsVFIO detection Date: Thu, 19 Mar 2026 17:36:49 +0100 Message-ID: <38e2ff795150d2d5e21fbb79b94fbddec77aa00b.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: DM9Dmlo3blp-cGfmUXBhOHMkwgkmEZCXo5U4OgsTEk8_1773938222 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: ZC6HNHYOHZV3BUQPTC74Z6L3PHO75C6J X-Message-ID-Hash: ZC6HNHYOHZV3BUQPTC74Z6L3PHO75C6J 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: 1773938428209154100 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Pavel Hrdina Function virHostdevNeedsVFIO is used only in QEMU to figure out if the host device needs access to /dev/vfio/vfio, for PCI host devices that is true only if libvirt is not using IOMMUFD. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/conf/domain_conf.c | 13 +++++++++++++ src/conf/domain_conf.h | 3 +++ src/hypervisor/virhostdev.c | 2 +- src/libvirt_private.syms | 1 + 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 01e2bd631a..2d6ae64210 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -33079,6 +33079,19 @@ virHostdevIsPCIDeviceWithIOMMUFD(const virDomainHo= stdevDef *hostdev) } =20 =20 +/** + * virHostdevIsPCIDeviceWithIOMMUFD: + * @hostdev: host device to check + * + * Returns true if @hostdev is a PCI device with IOMMUFD disabled, false o= therwise. + */ +bool +virHostdevIsPCIDeviceWithoutIOMMUFD(const virDomainHostdevDef *hostdev) +{ + return virHostdevIsPCIDeviceImpl(hostdev, VIR_TRISTATE_BOOL_NO); +} + + static void virDomainObjGetMessagesIOErrorsSrc(virStorageSource *src, const char *diskdst, diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index e63230beec..018daef4c7 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -4735,6 +4735,9 @@ virHostdevIsPCIDevice(const virDomainHostdevDef *host= dev) bool virHostdevIsPCIDeviceWithIOMMUFD(const virDomainHostdevDef *hostdev) ATTRIBUTE_NONNULL(1); +bool +virHostdevIsPCIDeviceWithoutIOMMUFD(const virDomainHostdevDef *hostdev) + ATTRIBUTE_NONNULL(1); =20 void virDomainObjGetMessagesIOErrorsChain(virStorageSource *src, diff --git a/src/hypervisor/virhostdev.c b/src/hypervisor/virhostdev.c index 19907c76ba..0d5e582c08 100644 --- a/src/hypervisor/virhostdev.c +++ b/src/hypervisor/virhostdev.c @@ -2536,7 +2536,7 @@ virHostdevUpdateActiveNVMeDevices(virHostdevManager *= hostdev_mgr, bool virHostdevNeedsVFIO(const virDomainHostdevDef *hostdev) { - return virHostdevIsPCIDevice(hostdev) || + return virHostdevIsPCIDeviceWithoutIOMMUFD(hostdev) || virHostdevIsMdevDevice(hostdev); } =20 diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index cd028c488a..8dbbd7f64d 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -817,6 +817,7 @@ virDomainQemuMonitorEventStateRegisterID; virHostdevIsMdevDevice; virHostdevIsPCIDevice; virHostdevIsPCIDeviceWithIOMMUFD; +virHostdevIsPCIDeviceWithoutIOMMUFD; virHostdevIsSCSIDevice; =20 =20 --=20 2.53.0