From nobody Mon Feb 9 21:21:10 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=1634735117; cv=none; d=zohomail.com; s=zohoarc; b=IWGY3uokZxnt5BOXwCJ2LFHHtp5pxqGkVn9VfFb5DkkmwwYHO4JmWoqGx8KxW9Fo9UjVV81QRVakjrFA6CpN6NU9AwZSv5R5MK+OLjVXj46XMbVZeHWUBRg623GMnrDdENrAhchG1qTdxUnKMaY0JAJ3E/HmW6HXLAQqhaoJCZg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634735117; 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=yKnF83t12Z6WPz5IM0V+j/PZuYjppsM3Axodj1Y1ZQ0=; b=E3tN4/3xFooZyVRLTh0Y0Pvd9ZODjOAVBz5I3gRryv2op36SMv+uZfPCoDhiMB9ttB2Pd77+mLZ9zDpLsWyWON0uEwvojr2dsIJ7dFzqd+lT3Axhns5bqiCHxfkixwyqtoLAB4/rlHxxvnh6Jm1YSMpIvE+Orf5aD/uJQgI4KqY= 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 1634735117850589.3941061995841; Wed, 20 Oct 2021 06:05:17 -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-287-0ci9kI8mPyak7gI_zU_t1Q-1; Wed, 20 Oct 2021 09:03:53 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 95CC0CC629; Wed, 20 Oct 2021 13:03:47 +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 6EB595F4E1; Wed, 20 Oct 2021 13:03:47 +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 34F4A4EA41; Wed, 20 Oct 2021 13:03:47 +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 19KD3jjT029825 for ; Wed, 20 Oct 2021 09:03:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id A20851981F; Wed, 20 Oct 2021 13:03:45 +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 E549A1980E for ; Wed, 20 Oct 2021 13:03:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634735116; 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=yKnF83t12Z6WPz5IM0V+j/PZuYjppsM3Axodj1Y1ZQ0=; b=Y5yZe7jbXZ3yeuacldIfaSIriIS5bDgX3jQm9LXPJSfRscV/qfjq6IxXKWIBsFUA86SwPW nsJmFwwMdcw7Iz2pIs/9uZJyxi8Z4XQLr6kRZ/64M6eVP7e0PYlM98IGZ/26qE8eRQ5NaZ BDHaVc4XK0KjiPMcKUpsr9cIPHVZizc= X-MC-Unique: 0ci9kI8mPyak7gI_zU_t1Q-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH v2 13/22] qemu: Validate machine type used with virtio-iommu Date: Wed, 20 Oct 2021 15:02:48 +0200 Message-Id: <20211020130257.534296-14-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.15 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: 1634735120833100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Andrea Bolognani --- src/qemu/qemu_validate.c | 8 ++++++++ ...irtio-iommu-wrong-machine.x86_64-latest.err | 1 + .../virtio-iommu-wrong-machine.xml | 18 ++++++++++++++++++ tests/qemuxml2argvtest.c | 1 + 4 files changed, 28 insertions(+) create mode 100644 tests/qemuxml2argvdata/virtio-iommu-wrong-machine.x86_6= 4-latest.err create mode 100644 tests/qemuxml2argvdata/virtio-iommu-wrong-machine.xml diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index bd4c7b2cd7..4f35e0eb49 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -4870,6 +4870,14 @@ qemuValidateDomainDeviceDefIOMMU(const virDomainIOMM= UDef *iommu, break; =20 case VIR_DOMAIN_IOMMU_MODEL_VIRTIO: + if (!qemuDomainIsARMVirt(def) && + !qemuDomainIsQ35(def)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("IOMMU device: '%s' is only supported with " + "Q35 and ARM Virt machines"), + virDomainIOMMUModelTypeToString(iommu->model)); + return -1; + } break; =20 case VIR_DOMAIN_IOMMU_MODEL_LAST: diff --git a/tests/qemuxml2argvdata/virtio-iommu-wrong-machine.x86_64-lates= t.err b/tests/qemuxml2argvdata/virtio-iommu-wrong-machine.x86_64-latest.err new file mode 100644 index 0000000000..8d1cd19170 --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-iommu-wrong-machine.x86_64-latest.err @@ -0,0 +1 @@ +unsupported configuration: IOMMU device: 'virtio' is only supported with Q= 35 and ARM Virt machines diff --git a/tests/qemuxml2argvdata/virtio-iommu-wrong-machine.xml b/tests/= qemuxml2argvdata/virtio-iommu-wrong-machine.xml new file mode 100644 index 0000000000..ad2a516b3a --- /dev/null +++ b/tests/qemuxml2argvdata/virtio-iommu-wrong-machine.xml @@ -0,0 +1,18 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 1 + + hvm + + + + + + /usr/bin/qemu-system-x86_64 + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 60d44eea01..ff3832b642 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -3254,6 +3254,7 @@ mymain(void) DO_TEST_CAPS_ARCH_LATEST("iommu-smmuv3", "aarch64"); DO_TEST_CAPS_LATEST("virtio-iommu-x86_64"); DO_TEST_CAPS_ARCH_LATEST("virtio-iommu-aarch64", "aarch64"); + DO_TEST_CAPS_LATEST_PARSE_ERROR("virtio-iommu-wrong-machine"); =20 DO_TEST("cpu-hotplug-startup", QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS); DO_TEST_PARSE_ERROR("cpu-hotplug-granularity", --=20 2.31.1