From nobody Sun Feb 8 18:48:46 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=1648836538; cv=none; d=zohomail.com; s=zohoarc; b=i1mlwG56itEKizjhY2vTyiI4eiNMmldygYTMr/sVGnHn3rYKMAHlsmIsd9ZOAt2bK64h95QXRFo0VkcBdW987sayBZS6Ey5P8uW1XcblVPeX1U2lCsRWFeCiDtgJ7t9OhSPbeEEel4qr4ByqcfBFfmbgyWesbLAqivH3+E0wjhk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1648836538; 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=i/zF9yWA2MffBf38Um7+f0P92vjm0wY+u37Dtfoq2TM=; b=DuhKAyGhDJ9WwL1OuEcrba0S9A9Xs4+16HSpafg4GV2fxuc4w+LBqYe+D39oTBv0fArOwQ72RRe98Evi6FgLv3GCvm5AgOqJq5gZ5AGjoknQ4IVB8oz6Z+5oa5moFUEg6iL+TJJ5b2dvftuCAynlgXDQk6Y3h115x0aFr2MzOiE= 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 16488365384911020.9469540213256; Fri, 1 Apr 2022 11:08:58 -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-607-80_vYu_7PIeeitEYmCst8w-1; Fri, 01 Apr 2022 14:08:55 -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 3DF27100BABF; Fri, 1 Apr 2022 18:08:53 +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 2351E111D7B4; Fri, 1 Apr 2022 18:08:53 +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 C6E7A194035D; Fri, 1 Apr 2022 18:08:52 +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 6C88A1940340 for ; Fri, 1 Apr 2022 18:08:50 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 5E479111D7BB; Fri, 1 Apr 2022 18:08:50 +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 D8658111D7B5 for ; Fri, 1 Apr 2022 18:08:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1648836537; 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=i/zF9yWA2MffBf38Um7+f0P92vjm0wY+u37Dtfoq2TM=; b=d5LtEsaazt/MaDghxKYNXE2aYPJHQmuBUjDGizWl1UGpsIxqqwlL2ohefGDfdqVws/Sv31 fEf05fTWazw289hWBGZf6qdRPt3DAJ6c3jBi0bCEsVddVCI77+awh7OOMxSUfIsTCyP48K SQUin6oHZZU7sKr6HDuRxJV2i77Pdh4= X-MC-Unique: 80_vYu_7PIeeitEYmCst8w-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH v4 14/16] qemu: Generate command line for virtio-iommu Date: Fri, 1 Apr 2022 20:08:33 +0200 Message-Id: <20220401180835.200444-15-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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1648836540194100004 Content-Type: text/plain; charset="utf-8"; x-default="true" https://bugzilla.redhat.com/show_bug.cgi?id=3D1653327 Signed-off-by: Andrea Bolognani Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_command.c | 12 ++++++++++++ .../virtio-iommu-aarch64.aarch64-latest.args | 1 + .../virtio-iommu-x86_64.x86_64-latest.args | 1 + 3 files changed, 14 insertions(+) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index a6d4bb1cb1..ea8a18a05b 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6452,6 +6452,18 @@ qemuBuildIOMMUCommandLine(virCommand *cmd, return 0; =20 case VIR_DOMAIN_IOMMU_MODEL_VIRTIO: + if (virJSONValueObjectAdd(&props, + "s:driver", "virtio-iommu", + NULL) < 0) { + return -1; + } + + if (qemuBuildDeviceAddressProps(props, def, &iommu->info) < 0) + return -1; + + if (qemuBuildDeviceCommandlineFromJSON(cmd, props, def, qemuCaps) = < 0) + return -1; + return 0; =20 case VIR_DOMAIN_IOMMU_MODEL_SMMUV3: diff --git a/tests/qemuxml2argvdata/virtio-iommu-aarch64.aarch64-latest.arg= s b/tests/qemuxml2argvdata/virtio-iommu-aarch64.aarch64-latest.args index 917451d6f2..a9e45ab87f 100644 --- a/tests/qemuxml2argvdata/virtio-iommu-aarch64.aarch64-latest.args +++ b/tests/qemuxml2argvdata/virtio-iommu-aarch64.aarch64-latest.args @@ -30,6 +30,7 @@ XDG_CONFIG_HOME=3D/tmp/lib/domain--1-guest/.config \ -rtc base=3Dutc \ -no-shutdown \ -boot strict=3Don \ +-device '{"driver":"virtio-iommu","bus":"pcie.0","addr":"0x1"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ -sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=3Ddeny \ -msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/virtio-iommu-x86_64.x86_64-latest.args = b/tests/qemuxml2argvdata/virtio-iommu-x86_64.x86_64-latest.args index be06ea9957..7e0aa7192d 100644 --- a/tests/qemuxml2argvdata/virtio-iommu-x86_64.x86_64-latest.args +++ b/tests/qemuxml2argvdata/virtio-iommu-x86_64.x86_64-latest.args @@ -26,6 +26,7 @@ XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ -rtc base=3Dutc \ -no-shutdown \ -boot strict=3Don \ +-device '{"driver":"virtio-iommu","bus":"pcie.0","addr":"0x1"}' \ -audiodev '{"id":"audio1","driver":"none"}' \ -sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=3Ddeny \ -msg timestamp=3Don --=20 2.35.1