From nobody Sun Feb 8 18:48:37 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1648836540; cv=none; d=zohomail.com; s=zohoarc; b=CYDsrheDB3hssOZNUrGbDYqlGka4V/ZLS+8lRlGqmaIoxZwH0WNQSOM+RwwOKlNhSlT3vVvdL+ur/MAkbx33OBSSeLIZipSrJLA0Vp37o6aZMW52tNb1HFnMQbTd1YM+uXCbaogqeL6abKPTkQQMjBSOgqRbMfscyjSvnUmCIVg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1648836540; 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=y0fxTQAd886tLb/0SYGWOnd85FjwyXsly2e9s4RFvZ8=; b=EOh08DKQgkiRN1eEmyHgFy2H3befXpWvXTGOwLyqDFq6BRItk9Dj1Qh3RVBe/Uk/odeUYTwWph27TbPpKq91YjMSdZz0EF7UbZhNmKNJk4SIjUG1EAMlIwIIkhKChep2C+LGT+NIHSxhaAZFxEI0/UYHdxMfCiKOb91OtDnXEbI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1648836540465863.6956956760317; Fri, 1 Apr 2022 11:09:00 -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-668-H36HpJpaOPiPZNArLbt7lA-1; Fri, 01 Apr 2022 14:08:53 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E830886B8B3; Fri, 1 Apr 2022 18:08:49 +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 D39C8145B965; Fri, 1 Apr 2022 18:08:49 +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 839221940341; Fri, 1 Apr 2022 18:08:49 +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 DFC621947BBE for ; Fri, 1 Apr 2022 18:08:47 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id D25E4111D7B6; Fri, 1 Apr 2022 18:08:47 +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 5999E111D7B4 for ; Fri, 1 Apr 2022 18:08:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1648836539; 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=y0fxTQAd886tLb/0SYGWOnd85FjwyXsly2e9s4RFvZ8=; b=ZrpzndxF/V/gPhsFb+hM4GJKyIKfxGIE03wQY2JVaRUUzN8ICGiNPnkG3zlnYfmf3zOEhB hViPfSfC9Nl5OF9jRmzjTZNze7syXfWiuXm6KdV46VX1Cg9LpsHsSINA21H+pU36KVKE+H 3HuztZq+PISngtEZkn3nrvpJN6ZMRvQ= X-MC-Unique: H36HpJpaOPiPZNArLbt7lA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH v4 11/16] qemu: Assign PCI address to virtio-iommu Date: Fri, 1 Apr 2022 20:08:30 +0200 Message-Id: <20220401180835.200444-12-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.85 on 10.11.54.7 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: 1648836542250100008 The device is configured to be an integrated endpoint, as is necessary for it to function correctly. Signed-off-by: Andrea Bolognani Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_domain_address.c | 6 +++++- .../virtio-iommu-aarch64.aarch64-latest.xml | 4 +++- .../virtio-iommu-x86_64.x86_64-latest.xml | 4 +++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 205610c53e..753733d1b9 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -1005,7 +1005,7 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDev= iceDef *dev, case VIR_DOMAIN_DEVICE_IOMMU: switch ((virDomainIOMMUModel) dev->data.iommu->model) { case VIR_DOMAIN_IOMMU_MODEL_VIRTIO: - return 0; + return virtioFlags | VIR_PCI_CONNECT_INTEGRATED; =20 case VIR_DOMAIN_IOMMU_MODEL_INTEL: case VIR_DOMAIN_IOMMU_MODEL_SMMUV3: @@ -2386,6 +2386,10 @@ qemuDomainAssignDevicePCISlots(virDomainDef *def, =20 switch ((virDomainIOMMUModel) iommu->model) { case VIR_DOMAIN_IOMMU_MODEL_VIRTIO: + if (virDeviceInfoPCIAddressIsWanted(&iommu->info) && + qemuDomainPCIAddressReserveNextAddr(addrs, &iommu->info) <= 0) { + return -1; + } break; =20 case VIR_DOMAIN_IOMMU_MODEL_INTEL: diff --git a/tests/qemuxml2xmloutdata/virtio-iommu-aarch64.aarch64-latest.x= ml b/tests/qemuxml2xmloutdata/virtio-iommu-aarch64.aarch64-latest.xml index 336f99d539..c6560e9a91 100644 --- a/tests/qemuxml2xmloutdata/virtio-iommu-aarch64.aarch64-latest.xml +++ b/tests/qemuxml2xmloutdata/virtio-iommu-aarch64.aarch64-latest.xml @@ -27,6 +27,8 @@