From nobody Mon Feb 2 07:31:18 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=1769421416; cv=none; d=zohomail.com; s=zohoarc; b=gK1U6IBubmSB9Of/xuZV1DnOEs43auoP7UwVlfusX4LV6eHE+jsfHa0rnQwhnLofygbVKY6t2U4ymo79kcGUV1dsEHYARAb9Z0WhG46dXDbWKV/dNqQQwCVrAbDEAmRsyrV1Dn4rRDQ5juLu0UTCjgNSsi2BWIOydn39d7S6iRo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769421416; 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=NFDrv24+mPp4c1fJcENqQ6AwG8JVjFnIphASS6Be28E=; b=YDeNswl6YJZSDRmjjbiXKv/NtEYLaVvaw2s7u+Dz+ofJpLdIek5iFOHLoyZYiz9KHQn9hpjjCyg56UiZNpYG1IFxWsd1ZNz1dgpVroymN9xxiDHZg3WcY4hEzbNZvcfv/en6b2seaoGOUoicsT84SMcyyHCslH9yuhz9hD9CNhA= 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 1769421416768589.638030288318; Mon, 26 Jan 2026 01:56:56 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 28EA4418A7; Mon, 26 Jan 2026 04:56:56 -0500 (EST) Received: from [172.19.199.3] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 32ADA43F6A; Mon, 26 Jan 2026 04:50:49 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id AC67F419E0; Mon, 26 Jan 2026 04:50:45 -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 7800E419A2 for ; Mon, 26 Jan 2026 04:50:33 -0500 (EST) 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-111-GfT5486SOWe43gYThTWDsQ-1; Mon, 26 Jan 2026 04:50:30 -0500 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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 05CE71944EBB for ; Mon, 26 Jan 2026 09:50:30 +0000 (UTC) Received: from moe (unknown [10.43.3.236]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 627241956053 for ; Mon, 26 Jan 2026 09:50:29 +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=1769421033; 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=NFDrv24+mPp4c1fJcENqQ6AwG8JVjFnIphASS6Be28E=; b=BH9p+9+kNlhwtxZTydxueS5pajN2xktjJPMETmQ+h12YjvzX33ttbzYH8rhfsPsFD/k8qT FSB7FvYS8bsFYNt92lC7Rb/Uvns1cHqlzjwveCpHafUzG3zRU/oseOl+qCOqqbjMPcBqGd QOdO+RD5jZ25MpEEt3FsgNIaTj7ugiw= X-MC-Unique: GfT5486SOWe43gYThTWDsQ-1 X-Mimecast-MFC-AGG-ID: GfT5486SOWe43gYThTWDsQ_1769421030 To: devel@lists.libvirt.org Subject: [PATCH v2 6/7] qemu_validate: Check whether granule of virtio-iommu is supported Date: Mon, 26 Jan 2026 10:50:20 +0100 Message-ID: In-Reply-To: References: 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: XcLa_IeVgErzEdeNBqstAR7kF3UpPgcvPC7xw4lBtSQ_1769421030 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: AYJ5ZAUX2T5HGCY54IVST4ZIBE5XCYZT X-Message-ID-Hash: AYJ5ZAUX2T5HGCY54IVST4ZIBE5XCYZT X-MailFrom: mprivozn@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: Michal Privoznik via Devel Reply-To: Michal Privoznik X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1769421418031154100 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Michal Privoznik Just like with other features, check whether QEMU supports them based on capabilities. Now, instead of inventing a new QEMU capability, an existing one can be used: QEMU_CAPS_VIRTIO_IOMMU_AW_BITS. This is because the aw-bits and granule attributes were introduced into QEMU in close succession (v9.0.0-rc0~9^2~7 v9.0.0-rc0~9^2~11), neither can be disabled at compile time and backporting just one without the other makes almost no sense. Signed-off-by: Michal Privoznik --- src/qemu/qemu_validate.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 8f85334cf9..6b44d8d785 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -5685,15 +5685,27 @@ qemuValidateDomainDeviceDefIOMMU(const virDomainIOM= MUDef *iommu, return -1; } =20 - /* QEMU supports only 4KiB, 8KiB, 16KiB and 64KiB granule size */ - if (iommu->granule > 0 && - !(iommu->granule =3D=3D 4 || - iommu->granule =3D=3D 8 || - iommu->granule =3D=3D 16 || - iommu->granule =3D=3D 64)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("iommu: unsupported granule size. Supported value= s are 4, 8, 16 and 64 KiB")); - return -1; + if (iommu->granule > 0) { + /* QEMU supports only 4KiB, 8KiB, 16KiB and 64KiB granule size */ + if (!(iommu->granule =3D=3D 4 || + iommu->granule =3D=3D 8 || + iommu->granule =3D=3D 16 || + iommu->granule =3D=3D 64)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("iommu: unsupported granule size. Supported v= alues are 4, 8, 16 and 64 KiB")); + return -1; + } + + /* While the QEMU_CAPS_VIRTIO_IOMMU_AW_BITS tracks .aw-bits attrib= ute of + * virtio-iommu it is also a good indicator of .granule attribute = as both + * attributes were introduced in neighboring commits, in the same = release, + * neither can be disabled at compile time and backporting one wit= hout the + * other makes no sense. */ + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_IOMMU_AW_BITS)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("iommu: page granule is not supported with th= is QEMU binary")); + return -1; + } } =20 return 0; --=20 2.52.0