From nobody Sun Feb 8 16:50:42 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1648836535; cv=none; d=zohomail.com; s=zohoarc; b=BCb+bIao6VoHl/CMhZMshnefkZwUX00fRYJxI5csvz1WIJM/6mXbwfBMi8kQlsQJy9zwxCbBNvDytKme6dj3C7BKQbs2Ye1J/WHZCzEJGMOYsQJ28D69QgDMhoWzkI4DcgtM3xM9qsFYhQaIPmZD38EhXglHh+2JEpG1PtVd8O8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1648836535; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/mCqYkDCE0/Xrvt7E7BXTC2bGH0QSCUtyEZseLY/01U=; b=VQBLLu1c9/e0RE1BNv58Cen/smVT+JByBGTtHDSgIPV5yFZlmsWfkoeusu5jZA2xul16yxcG1RhoK2RtiLbPvrPZraWra4/rhR9rNTvaKHG1k5TUPYplfeOXuup3KaycqU3POD7zfqMYpWR/WGI2Sx93adItNxCjJgZaLcGg4/A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1648836535153974.0285675270625; Fri, 1 Apr 2022 11:08:55 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-547-hs42DnQyNwy3EbzM58pVrw-1; Fri, 01 Apr 2022 14:08:50 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CA92D804191; Fri, 1 Apr 2022 18:08:46 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id B2B01111CD33; Fri, 1 Apr 2022 18:08:46 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 7EAA61947BBF; Fri, 1 Apr 2022 18:08:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 73D3C1947BBE for ; Fri, 1 Apr 2022 18:08:45 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 5DC08111D7B4; Fri, 1 Apr 2022 18:08:45 +0000 (UTC) Received: from harajuku.usersys.redhat.com.homenet.telecomitalia.it (unknown [10.40.193.23]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D7A20111D641 for ; Fri, 1 Apr 2022 18:08:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1648836534; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=/mCqYkDCE0/Xrvt7E7BXTC2bGH0QSCUtyEZseLY/01U=; b=JLgiZKD5YGHdGOuL8S/F76kM/f1Kg3X3voGDOyO7RPnLB/Y1Lw1bpb5WiMv2uSrGrh2mOD z9zbA4ZZ3sxWuQySrVrpANrdR2Q+TXioE8HzRtN7bHpIxiOmVFsNpD29ky8Hh7csxwfJkG zVEsW6RaN2xnShRCWq2AooZIUfmG67o= X-MC-Unique: hs42DnQyNwy3EbzM58pVrw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH v4 08/16] qemu: Validate capabilities for virtio-iommu Date: Fri, 1 Apr 2022 20:08:27 +0200 Message-Id: <20220401180835.200444-9-abologna@redhat.com> In-Reply-To: <20220401180835.200444-1-abologna@redhat.com> References: <20220401180835.200444-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1648836540162100003 Signed-off-by: Andrea Bolognani Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_validate.c | 8 ++++++++ .../qemuxml2argvdata/virtio-iommu-x86_64.x86_64-6.1.0.err | 1 + tests/qemuxml2argvtest.c | 1 + 3 files changed, 10 insertions(+) create mode 100644 tests/qemuxml2argvdata/virtio-iommu-x86_64.x86_64-6.1.0= .err diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index eb3200712c..f67c802cbf 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -4874,6 +4874,14 @@ qemuValidateDomainDeviceDefIOMMU(const virDomainIOMM= UDef *iommu, virDomainIOMMUModelTypeToString(iommu->model)); return -1; } + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_IOMMU_PCI) || + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_IOMMU_BOOT_BYPASS))= { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("IOMMU device: '%s' is not supported with " + "this QEMU binary"), + virDomainIOMMUModelTypeToString(iommu->model)); + return -1; + } break; =20 case VIR_DOMAIN_IOMMU_MODEL_LAST: diff --git a/tests/qemuxml2argvdata/virtio-iommu-x86_64.x86_64-6.1.0.err b/= tests/qemuxml2argvdata/virtio-iommu-x86_64.x86_64-6.1.0.err new file mode 100644 index 0000000000..e76e1540bc --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-iommu-x86_64.x86_64-6.1.0.err @@ -0,0 +1 @@ +unsupported configuration: IOMMU device: 'virtio' is not supported with th= is QEMU binary diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index f4c5c5bb31..bc01d60e12 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -3248,6 +3248,7 @@ mymain(void) DO_TEST_CAPS_LATEST_PARSE_ERROR("intel-iommu-wrong-machine"); DO_TEST_CAPS_ARCH_LATEST("iommu-smmuv3", "aarch64"); DO_TEST_CAPS_LATEST("virtio-iommu-x86_64"); + DO_TEST_CAPS_VER_PARSE_ERROR("virtio-iommu-x86_64", "6.1.0"); DO_TEST_CAPS_ARCH_LATEST("virtio-iommu-aarch64", "aarch64"); DO_TEST_CAPS_LATEST_PARSE_ERROR("virtio-iommu-wrong-machine"); =20 --=20 2.35.1