From nobody Mon Feb 9 21:21:26 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1634735040; cv=none; d=zohomail.com; s=zohoarc; b=ACzGZQvPXlxXJWV72nh6NOFOYAVHHwfjZX4GiXbr0Bv5BcBT+La6JQTrAKBi9IEFBvpR0Lpcm5OUWFT6s2UK7cExnQa6lXOphIwcXGwNWt1WiqEZLNa3f/esjRDLStSaXNRcJaOYERpqV+c8mse9zVXeBdPpOrOuHPHNnWMLeII= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634735040; 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=Q9xjcGUieaE+hZVf5nAkG7ZxsEF2TEmZd5wHCoo8GYE=; b=TIrhxhoga5kMs3OmSQjIn7IJNHv7wbvV938gXu5igSlvkzlKqFJcGEkbymQGwgkhzPM9zoqyACQi7fhmhmGOy9Z3578Gqq+314qZgfI0p7Aw12JaU+CHEymNTPQCtLTGOP2LmRIYNeoAM18DZ1fRx9lozEVP8H21tMYDJOH1TBc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1634735040955888.3815649542659; Wed, 20 Oct 2021 06:04:00 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-553-svhGBF6YMY-0IWy3tl8DOw-1; Wed, 20 Oct 2021 09:03:56 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C28361054F9A; Wed, 20 Oct 2021 13:03:50 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A395060CC3; Wed, 20 Oct 2021 13:03:50 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 6D9E14EA43; Wed, 20 Oct 2021 13:03:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19KD3kmc029840 for ; Wed, 20 Oct 2021 09:03:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id DB8661981F; Wed, 20 Oct 2021 13:03:46 +0000 (UTC) Received: from kinshicho.usersys.redhat.com.homenet.telecomitalia.it (unknown [10.40.195.155]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 28CE91980E for ; Wed, 20 Oct 2021 13:03:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634735039; 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=Q9xjcGUieaE+hZVf5nAkG7ZxsEF2TEmZd5wHCoo8GYE=; b=YOgyKqnMdx3c4EshdxYCyrpBxMePdtZnMokVLRaZ4iZOVKznN8DvbUy2lI1vY5o6AWy1Eb xUwBpbGrWy9mIG3OAvl0hJH0ryt5ae/O+bOrD/YnxmsVZur3go3oONpP49IOVzvpN5tvTr RXyEPdbC2aZWOqH8iw48lUXkaradO1c= X-MC-Unique: svhGBF6YMY-0IWy3tl8DOw-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH v2 14/22] qemu: Validate capabilities for virtio-iommu Date: Wed, 20 Oct 2021 15:02:49 +0200 Message-Id: <20211020130257.534296-15-abologna@redhat.com> In-Reply-To: <20211020130257.534296-1-abologna@redhat.com> References: <20211020130257.534296-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1634735055728100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Andrea Bolognani --- 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 4f35e0eb49..7bee9fa9b0 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -4878,6 +4878,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 ff3832b642..ce57661d4c 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -3253,6 +3253,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.31.1