From nobody Mon Feb 9 23:00:29 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=1633712074; cv=none; d=zohomail.com; s=zohoarc; b=V7goBV69Bncc7oRDJPe9Agm+dRlwTqrGfh1G37fXinN9gBjlPq9CNiTI9QyMuYIjCOwr8mAIxKgWNHI4MaSPMVgDO4rs1OnNDkseRlKJ15gGTzffjzjZjQPUCIermFuTjJ8jMW9eXwqXAZHpmvvNPinMNQzvGcGtLuD1N7dQ4FQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633712074; 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=xIugwWZ95jiL6TRGVE30+xOZFcSwiMROYe1pHSZ5918=; b=aQUE4WuiNE6BvwyWAEmvYheqZHO3L+UmAPF708SpFf8Uq1JlcCJCdgDVRbdyZORkaLHNYpEvp1cWDfHkYzyIYGUIMOfDXWeDn7a+MD4OkXn7qjOg9ngqIpkaowyB2wpuftbmLdotH1AA+CiSSDtull/RSVmJinPuzRwJsGiahow= 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 163371207445187.02020979481188; Fri, 8 Oct 2021 09:54:34 -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-154-z-ynokJYMnC0BfhIps8sGQ-1; Fri, 08 Oct 2021 12:54:32 -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 2C74284A5F2; Fri, 8 Oct 2021 16:54:27 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0CCE65F4E3; Fri, 8 Oct 2021 16:54:27 +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 C5FF5180598A; Fri, 8 Oct 2021 16:54:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 198GsPXF014008 for ; Fri, 8 Oct 2021 12:54:25 -0400 Received: by smtp.corp.redhat.com (Postfix) id 83E255F4F7; Fri, 8 Oct 2021 16:54:25 +0000 (UTC) Received: from harajuku.usersys.redhat.com (unknown [10.40.195.77]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D9F9F5F505 for ; Fri, 8 Oct 2021 16:53:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633712073; 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=xIugwWZ95jiL6TRGVE30+xOZFcSwiMROYe1pHSZ5918=; b=XWmcjPPRztMh9I0vongioRxupISENMB9wGFZ4A3ENTCqJeAOc0WVA0bJtWzBrJ0jHbXMR6 CfgAJseMA9h2wxHjKZfoaKZ3jNSZMyJf1RxQfb/AtVmVvm/2YKlcwnaWpjI7VnPY3bCgB/ WIkLPeSFr0x0If+2dPcfPo1dGYz84/U= X-MC-Unique: z-ynokJYMnC0BfhIps8sGQ-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH 15/21] conf: Add virDomainDeviceInfo to virDomainIOMMUDef Date: Fri, 8 Oct 2021 18:51:50 +0200 Message-Id: <20211008165156.405216-16-abologna@redhat.com> In-Reply-To: <20211008165156.405216-1-abologna@redhat.com> References: <20211008165156.405216-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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: 1633712076053100001 Content-Type: text/plain; charset="utf-8" This is needed so that IOMMU devices can have addresses. Existing IOMMU devices (intel-iommu and SMMUv3) are system devices and as such don't have an address associated to them, but virtio-iommu is a PCI device and needs one. Signed-off-by: Andrea Bolognani --- docs/schemas/domaincommon.rng | 63 +++++++++++++++++++---------------- src/conf/domain_conf.c | 37 +++++++++++++------- src/conf/domain_conf.h | 1 + 3 files changed, 60 insertions(+), 41 deletions(-) diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 2f30b15c48..6dffe3afae 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -5418,35 +5418,40 @@ virtio - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + =20 diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index a2d155069f..3b23c32a96 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2542,6 +2542,7 @@ virDomainIOMMUDefFree(virDomainIOMMUDef *iommu) if (!iommu) return; =20 + virDomainDeviceInfoClear(&iommu->info); g_free(iommu); } =20 @@ -4230,13 +4231,14 @@ virDomainDeviceGetInfo(virDomainDeviceDef *device) return &device->data.panic->info; case VIR_DOMAIN_DEVICE_MEMORY: return &device->data.memory->info; + case VIR_DOMAIN_DEVICE_IOMMU: + return &device->data.iommu->info; case VIR_DOMAIN_DEVICE_VSOCK: return &device->data.vsock->info; =20 /* The following devices do not contain virDomainDeviceInfo */ case VIR_DOMAIN_DEVICE_LEASE: case VIR_DOMAIN_DEVICE_GRAPHICS: - case VIR_DOMAIN_DEVICE_IOMMU: case VIR_DOMAIN_DEVICE_AUDIO: case VIR_DOMAIN_DEVICE_LAST: case VIR_DOMAIN_DEVICE_NONE: @@ -4532,6 +4534,13 @@ virDomainDeviceInfoIterateFlags(virDomainDef *def, return rc; } =20 + device.type =3D VIR_DOMAIN_DEVICE_IOMMU; + if (def->iommu) { + device.data.iommu =3D def->iommu; + if ((rc =3D cb(def, &device, &def->iommu->info, opaque)) !=3D 0) + return rc; + } + device.type =3D VIR_DOMAIN_DEVICE_VSOCK; if (def->vsock) { device.data.vsock =3D def->vsock; @@ -4559,12 +4568,6 @@ virDomainDeviceInfoIterateFlags(virDomainDef *def, if ((rc =3D cb(def, &device, NULL, opaque)) !=3D 0) return rc; } - device.type =3D VIR_DOMAIN_DEVICE_IOMMU; - if (def->iommu) { - device.data.iommu =3D def->iommu; - if ((rc =3D cb(def, &device, NULL, opaque)) !=3D 0) - return rc; - } } =20 /* Coverity is not very happy with this - all dead_error_condition */ @@ -14933,8 +14936,10 @@ virDomainMemoryDefParseXML(virDomainXMLOption *xml= opt, =20 =20 static virDomainIOMMUDef * -virDomainIOMMUDefParseXML(xmlNodePtr node, - xmlXPathContextPtr ctxt) +virDomainIOMMUDefParseXML(virDomainXMLOption *xmlopt, + xmlNodePtr node, + xmlXPathContextPtr ctxt, + unsigned int flags) { VIR_XPATH_NODE_AUTORESTORE(ctxt) xmlNodePtr driver; @@ -14970,6 +14975,10 @@ virDomainIOMMUDefParseXML(xmlNodePtr node, return NULL; } =20 + if (virDomainDeviceInfoParseXML(xmlopt, node, ctxt, + &iommu->info, flags) < 0) + return NULL; + return g_steal_pointer(&iommu); } =20 @@ -15167,7 +15176,8 @@ virDomainDeviceDefParse(const char *xmlStr, return NULL; break; case VIR_DOMAIN_DEVICE_IOMMU: - if (!(dev->data.iommu =3D virDomainIOMMUDefParseXML(node, ctxt))) + if (!(dev->data.iommu =3D virDomainIOMMUDefParseXML(xmlopt, node, + ctxt, flags))) return NULL; break; case VIR_DOMAIN_DEVICE_VSOCK: @@ -20285,7 +20295,8 @@ virDomainDefParseXML(xmlXPathContextPtr ctxt, } =20 if (n > 0) { - if (!(def->iommu =3D virDomainIOMMUDefParseXML(nodes[0], ctxt))) + if (!(def->iommu =3D virDomainIOMMUDefParseXML(xmlopt, nodes[0], + ctxt, flags))) return NULL; } VIR_FREE(nodes); @@ -22107,7 +22118,7 @@ virDomainIOMMUDefCheckABIStability(virDomainIOMMUDe= f *src, return false; } =20 - return true; + return virDomainDeviceInfoCheckABIStability(&src->info, &dst->info); } =20 =20 @@ -27494,6 +27505,8 @@ virDomainIOMMUDefFormat(virBuffer *buf, =20 virXMLFormatElement(&childBuf, "driver", &driverAttrBuf, NULL); =20 + virDomainDeviceInfoFormat(&childBuf, &iommu->info, 0); + virBufferAsprintf(&attrBuf, " model=3D'%s'", virDomainIOMMUModelTypeToString(iommu->model)); =20 diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 21e069f42e..1961a686e6 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2708,6 +2708,7 @@ struct _virDomainIOMMUDef { virTristateSwitch eim; virTristateSwitch iotlb; unsigned int aw_bits; + virDomainDeviceInfo info; }; =20 typedef enum { --=20 2.31.1