From nobody Mon Feb 9 17:57:54 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=1634735103; cv=none; d=zohomail.com; s=zohoarc; b=Eh5pBOHSdVyUhasp0t9uucrRh6vf3HfYUVn8kpjkpdGQf4Dc8nZbTxF2gjOvZfK2g2fOKUj7/0RPsOlRHBfveUtxQBdn4+BW/tHRi6ceSSQr05xi+LVPehE6xyRxylWyLQ/D4mwCaukNvfi7Tef/D6x0zX/rU17MDrDWu9vE6eE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634735103; 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=3HBfIrCYRu8bDXyN07uOd4YSjAWrFyLWI3c3gp2JzTk=; b=njICE5EWBSe/lIPz340GLL+XZ5RGkrZ1k5g5cRALWFa27vc1TB4KEuL1tLoY7n855YFJasuKLxiYatrBGrJBxi3+2KUCz0VyOyz8NeZocC2Z2viF0fzBkgahh7KFRRHNsMvgQQ+hDPLF06WcBvAX48r9qlGTiLeL5bTrZUhyJrg= 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 1634735103579803.737292562145; Wed, 20 Oct 2021 06:05:03 -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-39-cq9W3fVGMK-bJRjMc0uH7g-1; Wed, 20 Oct 2021 09:04:05 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 02BC1879515; Wed, 20 Oct 2021 13:03:59 +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 DAFC969FA0; Wed, 20 Oct 2021 13:03:58 +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 A79914EA30; Wed, 20 Oct 2021 13:03:58 +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 19KD3oEK029915 for ; Wed, 20 Oct 2021 09:03:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id 92EE369FA0; Wed, 20 Oct 2021 13:03:50 +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 D082519EF9 for ; Wed, 20 Oct 2021 13:03:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634735102; 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=3HBfIrCYRu8bDXyN07uOd4YSjAWrFyLWI3c3gp2JzTk=; b=bpxOSZnvQv3sedH+xn8zgfZPRucl5Q0c9ACB9mE+ET5NKhAzE7IxNINzeNBqYTCCkUkx3v mfUYWqpPAdTZC45n1BFqLTOsYutk+6uKbnkFe/2FoEoWjPmCnjKLVPDG7O5uNqllqqFVCx S2aHNihOw+bw+0Y2C3DR4iRCnZrpvNQ= X-MC-Unique: cq9W3fVGMK-bJRjMc0uH7g-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH v2 17/22] qemu: Assign PCI address to virtio-iommu Date: Wed, 20 Oct 2021 15:02:52 +0200 Message-Id: <20211020130257.534296-18-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.11 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: 1634735108158100001 Content-Type: text/plain; charset="utf-8" The device is configured to be an integrated endpoint, as is necessary for it to function correctly. Signed-off-by: Andrea Bolognani --- 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 e23de3bb83..767e2c28f8 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -1004,7 +1004,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 @@