From nobody Sun Apr 28 13:07:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1591256618; cv=none; d=zohomail.com; s=zohoarc; b=TjIPt6R75Qqy/CGaRkrmnc0CyddoF1ivhDffMq1e/IhnPa7VETruQM5xDY+Fr108bX70LP+DmAE6Y5MCTjVU9+Rqg/8kPIXpjb/cs3VbO+69WH39HDAjn3eIQOUvej5PBK6dvt0RnqitNgyCh4MXBVtQktYZ800GLxdFiG8Tceg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591256618; h=Content-Type:Content-Transfer-Encoding:Cc: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=X+PPbBFPv4fXz6zkyPFNlH4pBaNWZPVMMy0v0C/BIxQ=; b=Lbm0+i8jKXR93s0JCMSh9zTSYkvcOyVUVtpfnjbF7TEnhtsX04MxYBRabCXlZFigcyLjpsGXt/YVtcnHU6BPkKaexjA79XGorCLLRdVMa26NgiGUnKA8dvMBmO2Qbqpsj0vYy00RTloOIEzDmh3Btyx0qHBfJpr77rtDqQGZB+s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 159125661788756.692054120459034; Thu, 4 Jun 2020 00:43:37 -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-407-PXsGXoT7Plqbu4c5Q8r9tg-1; Thu, 04 Jun 2020 03:43:30 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 594CCEC1A3; Thu, 4 Jun 2020 07:43:25 +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 0D98160C47; Thu, 4 Jun 2020 07:43:25 +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 CED2C1809554; Thu, 4 Jun 2020 07:43:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0547h3t8007847 for ; Thu, 4 Jun 2020 03:43:03 -0400 Received: by smtp.corp.redhat.com (Postfix) id DFF22F1C98; Thu, 4 Jun 2020 07:43:02 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DB676F1C93 for ; Thu, 4 Jun 2020 07:42:58 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CC156833B47 for ; Thu, 4 Jun 2020 07:42:58 +0000 (UTC) Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-262-XwEIfa-tMu2ZbcqJp02evA-1; Thu, 04 Jun 2020 03:42:56 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0547gqU5114027 for ; Thu, 4 Jun 2020 07:42:55 GMT Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 31evap04f8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Thu, 04 Jun 2020 07:42:55 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0547c5Ha065911 for ; Thu, 4 Jun 2020 07:42:55 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3020.oracle.com with ESMTP id 31dju4k2c1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 04 Jun 2020 07:42:55 +0000 Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 0547gs20029385 for ; Thu, 4 Jun 2020 07:42:54 GMT Received: from maximegalon.us.oracle.com (/10.175.7.146) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 04 Jun 2020 00:42:53 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591256612; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=X+PPbBFPv4fXz6zkyPFNlH4pBaNWZPVMMy0v0C/BIxQ=; b=SpzV0nLvWRN6i3WIATgQTUst699AXLlobjXkWeNTL/ivxXjit5LuiDJLOcQ6bbBdkX2Aor C5VUfQqpFkygfMPODMJrT7SX8UJEt5wxwy4w1u1WWy7JsMAuWzZ0UxUYw2mbnJY59hzDAz VHM1sHDk7UiHMMIy7LVvAs+eKiLZUgs= X-MC-Unique: PXsGXoT7Plqbu4c5Q8r9tg-1 X-MC-Unique: XwEIfa-tMu2ZbcqJp02evA-1 From: Menno Lageman To: libvir-list@redhat.com Subject: [PATCH 1/2] conf: add address width attribute to iommu Date: Thu, 4 Jun 2020 09:42:42 +0200 Message-Id: <20200604074243.1908430-2-menno.lageman@oracle.com> In-Reply-To: <20200604074243.1908430-1-menno.lageman@oracle.com> References: <20200604074243.1908430-1-menno.lageman@oracle.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9641 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 mlxscore=0 adultscore=0 bulkscore=0 suspectscore=43 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006040052 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9641 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 adultscore=0 impostorscore=0 bulkscore=0 lowpriorityscore=0 malwarescore=0 priorityscore=1501 clxscore=1015 phishscore=0 mlxlogscore=999 mlxscore=0 suspectscore=43 cotscore=-2147483648 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006040053 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: Menno Lageman 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.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Add a new aw_bits attribute to the iommu device to control the address width of the intel-iommu Signed-off-by Menno Lageman Reviewed-by: Michal Privoznik --- docs/formatdomain.html.in | 9 +++++ docs/schemas/domaincommon.rng | 5 +++ src/conf/domain_conf.c | 21 +++++++++++ src/conf/domain_conf.h | 1 + .../qemuxml2argvdata/intel-iommu-aw-bits.xml | 35 +++++++++++++++++++ .../intel-iommu-aw-bits.x86_64-latest.xml | 1 + tests/qemuxml2xmltest.c | 1 + 7 files changed, 73 insertions(+) create mode 100644 tests/qemuxml2argvdata/intel-iommu-aw-bits.xml create mode 120000 tests/qemuxml2xmloutdata/intel-iommu-aw-bits.x86_64-lat= est.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 33cec1e6dd9f..64d4100dcd92 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -9326,6 +9326,15 @@ qemu-kvm -net nic,model=3D? /dev/null Since 3.5.0 (QEMU/KVM only)

+
aw_bits
+
+

+ The aw_bits attribute can be used to set + the address width to allow mapping larger iova addresses + in the guest. + Since 2.12.2 (QEMU/KVM only) +

+
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 6727cd743b7e..91addcbcee52 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -4749,6 +4749,11 @@ + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 1cdc7971fca6..9bae30152c0f 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -16814,6 +16814,15 @@ virDomainIOMMUDefParseXML(xmlNodePtr node, } iommu->eim =3D val; } + + VIR_FREE(tmp); + if ((tmp =3D virXMLPropString(driver, "aw_bits"))) { + if (virStrToLong_ui(tmp, NULL, 10, &iommu->aw_bits) < 0) { + virReportError(VIR_ERR_XML_ERROR, _("unknown aw_bits value= : %s"), tmp); + return NULL; + } + } + } =20 return g_steal_pointer(&iommu); @@ -23891,6 +23900,14 @@ virDomainIOMMUDefCheckABIStability(virDomainIOMMUD= efPtr src, virTristateSwitchTypeToString(src->iotlb)); return false; } + if (src->aw_bits !=3D dst->aw_bits) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target domain IOMMU device aw_bits value '%d' " + "does not match source '%d'"), + dst->aw_bits, src->aw_bits); + return false; + } + return true; } =20 @@ -28886,6 +28903,10 @@ virDomainIOMMUDefFormat(virBufferPtr buf, virBufferAsprintf(&driverAttrBuf, " iotlb=3D'%s'", virTristateSwitchTypeToString(iommu->iotlb)); } + if (iommu->aw_bits > 0) { + virBufferAsprintf(&driverAttrBuf, " aw_bits=3D'%d'", + iommu->aw_bits); + } =20 virXMLFormatElement(&childBuf, "driver", &driverAttrBuf, NULL); =20 diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index e152c599cac3..53c941364122 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2454,6 +2454,7 @@ struct _virDomainIOMMUDef { virTristateSwitch caching_mode; virTristateSwitch eim; virTristateSwitch iotlb; + unsigned int aw_bits; }; =20 typedef enum { diff --git a/tests/qemuxml2argvdata/intel-iommu-aw-bits.xml b/tests/qemuxml= 2argvdata/intel-iommu-aw-bits.xml new file mode 100644 index 000000000000..23e3ef581677 --- /dev/null +++ b/tests/qemuxml2argvdata/intel-iommu-aw-bits.xml @@ -0,0 +1,35 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + + + + qemu64 + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + + +
+ + + + + + + + + diff --git a/tests/qemuxml2xmloutdata/intel-iommu-aw-bits.x86_64-latest.xml= b/tests/qemuxml2xmloutdata/intel-iommu-aw-bits.x86_64-latest.xml new file mode 120000 index 000000000000..dbd1dfd97a66 --- /dev/null +++ b/tests/qemuxml2xmloutdata/intel-iommu-aw-bits.x86_64-latest.xml @@ -0,0 +1 @@ +../qemuxml2argvdata/intel-iommu-aw-bits.xml \ No newline at end of file diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index dcc7b29ded3e..81d5669293b1 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -1336,6 +1336,7 @@ mymain(void) DO_TEST_CAPS_LATEST("intel-iommu-caching-mode"); DO_TEST_CAPS_LATEST("intel-iommu-eim"); DO_TEST_CAPS_LATEST("intel-iommu-device-iotlb"); + DO_TEST_CAPS_LATEST("intel-iommu-aw-bits"); DO_TEST_CAPS_ARCH_LATEST("iommu-smmuv3", "aarch64"); =20 DO_TEST("cpu-check-none", NONE); --=20 2.26.2 From nobody Sun Apr 28 13:07:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1591256605; cv=none; d=zohomail.com; s=zohoarc; b=AEXnFnMOPJk030ouAcvWSDDl/Zf8rxK3vj/t2Hki7+KEudsa1d709OuR7U4btIWQ4zbjhoUIwSswKmtbiZUfspqw2urRuswAAvWnOWCk3ZAwSRIZ71QN6zjwKxrU6qaYlnO+SeB6uvZqRVoLNWtqx4PqzkwRk9dgvm1AQXKBgWw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591256605; h=Content-Type:Content-Transfer-Encoding:Cc: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=S/bR2ZKSu/BuTz0scwPlhk6MHWltORiBHRwVj+v/BiM=; b=Jd/k1NeauEdzZAmQKnURSCG1uCJjJL4HT00HU5oHclD7zvAENFO79I9LsOnZ/AZQoJNGAme396UnD7TzwTXs+Tsa2MhAZacIe7U8aLB0kT0hWdUVEcoBLzR62ZkH7ALTeCjLtg8v8ENWrRcvlqhpr0QxmhQdplXKpqNw/gmYZgk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1591256605942928.0949611873535; Thu, 4 Jun 2020 00:43:25 -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-40-s-DQxcvMMUinzvrjsjLlVA-1; Thu, 04 Jun 2020 03:43:22 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E81A7835B46; Thu, 4 Jun 2020 07:43:16 +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 B62665C28E; Thu, 4 Jun 2020 07:43:16 +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 16EDDADA8D; Thu, 4 Jun 2020 07:43:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0547h6Bo007863 for ; Thu, 4 Jun 2020 03:43:06 -0400 Received: by smtp.corp.redhat.com (Postfix) id ABC5410C6ED7; Thu, 4 Jun 2020 07:43:06 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A6C0E10C6EC1 for ; Thu, 4 Jun 2020 07:43:02 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 888B7811E7A for ; Thu, 4 Jun 2020 07:43:02 +0000 (UTC) Received: from userp2130.oracle.com (userp2130.oracle.com [156.151.31.86]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-61-7D0y5-BVMwSNDmF8BweGBg-1; Thu, 04 Jun 2020 03:43:00 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0547g06E086523 for ; Thu, 4 Jun 2020 07:42:59 GMT Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 31bewr55ch-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Thu, 04 Jun 2020 07:42:58 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0547c9S3066430 for ; Thu, 4 Jun 2020 07:42:58 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3020.oracle.com with ESMTP id 31dju4k2f1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Thu, 04 Jun 2020 07:42:58 +0000 Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 0547gvLx019332 for ; Thu, 4 Jun 2020 07:42:57 GMT Received: from maximegalon.us.oracle.com (/10.175.7.146) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 04 Jun 2020 00:42:56 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591256604; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=S/bR2ZKSu/BuTz0scwPlhk6MHWltORiBHRwVj+v/BiM=; b=CwaBVZysuHbV28NN7KE8shHTiuV/lkNh5EjwzuVF6809/8bTyrWghwAk7qsC9FJaS3Pzmq UhqqYA0gXcS3l/K3NeXIlRY+Mk31KTtZKBFNOQQ/fGq599P+T2C03ywhgBr6GuDmAJrgJG RKhCQZ684t4Et+G3VP+a8hysElJhcI8= X-MC-Unique: s-DQxcvMMUinzvrjsjLlVA-1 X-MC-Unique: 7D0y5-BVMwSNDmF8BweGBg-1 From: Menno Lageman To: libvir-list@redhat.com Subject: [PATCH 2/2] qemu: format address wdith on intel-iommu command line Date: Thu, 4 Jun 2020 09:42:43 +0200 Message-Id: <20200604074243.1908430-3-menno.lageman@oracle.com> In-Reply-To: <20200604074243.1908430-1-menno.lageman@oracle.com> References: <20200604074243.1908430-1-menno.lageman@oracle.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9641 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 mlxscore=0 adultscore=0 bulkscore=0 suspectscore=1 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006040052 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9641 signatures=668686 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 bulkscore=0 phishscore=0 suspectscore=1 impostorscore=0 cotscore=-2147483648 lowpriorityscore=0 mlxscore=0 adultscore=0 spamscore=0 mlxlogscore=999 malwarescore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006040053 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: Menno Lageman 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.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Format the address width attribute. Depending on the version of QEMU it is named 'aw-bits' or 'x-aw-bits'. Signed-off-by: Menno Lageman Reviewed-by: Michal Privoznik --- src/qemu/qemu_capabilities.c | 6 ++++ src/qemu/qemu_capabilities.h | 4 +++ src/qemu/qemu_command.c | 6 ++++ src/qemu/qemu_validate.c | 9 ++++- .../caps_2.12.0.x86_64.xml | 1 + .../caps_3.0.0.x86_64.xml | 1 + .../caps_3.1.0.x86_64.xml | 1 + .../caps_4.0.0.x86_64.xml | 1 + .../caps_4.1.0.x86_64.xml | 1 + .../caps_4.2.0.x86_64.xml | 1 + .../caps_5.0.0.x86_64.xml | 1 + .../caps_5.1.0.x86_64.xml | 1 + .../intel-iommu-aw-bits.x86_64-latest.args | 33 +++++++++++++++++++ tests/qemuxml2argvtest.c | 1 + 14 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/intel-iommu-aw-bits.x86_64-lates= t.args diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index f12769635a86..fa305bf67f33 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -582,6 +582,10 @@ VIR_ENUM_IMPL(virQEMUCaps, "tcg", "virtio-blk-pci.scsi.default.disabled", "pvscsi", + + /* 370 */ + "intel-iommu.x-aw-bits", + "intel-iommu.aw-bits", ); =20 =20 @@ -1469,6 +1473,8 @@ static struct virQEMUCapsDevicePropsFlags virQEMUCaps= DevicePropsIntelIOMMU[] =3D { { "caching-mode", QEMU_CAPS_INTEL_IOMMU_CACHING_MODE, NULL }, { "eim", QEMU_CAPS_INTEL_IOMMU_EIM, NULL }, { "device-iotlb", QEMU_CAPS_INTEL_IOMMU_DEVICE_IOTLB, NULL }, + { "x-aw-bits", QEMU_CAPS_INTEL_IOMMU_X_AW_BITS, NULL }, + { "aw-bits", QEMU_CAPS_INTEL_IOMMU_AW_BITS, NULL }, }; =20 static struct virQEMUCapsDevicePropsFlags virQEMUCapsObjectPropsVirtualCSS= Bridge[] =3D { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 076ecad0f73b..c14561a4e70c 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -564,6 +564,10 @@ typedef enum { /* virQEMUCapsFlags grouping marker for= syntax-check */ QEMU_CAPS_VIRTIO_BLK_SCSI_DEFAULT_DISABLED, /* virtio-blk-pci.scsi dis= abled by default */ QEMU_CAPS_SCSI_PVSCSI, /* -device pvscsi */ =20 + /* 370 */ + QEMU_CAPS_INTEL_IOMMU_X_AW_BITS, /* intel-iommu.x-aw-bits */ + QEMU_CAPS_INTEL_IOMMU_AW_BITS, /* intel-iommu.aw-bits */ + QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; =20 diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 419eca5675cc..adcb48a66f18 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6157,6 +6157,12 @@ qemuBuildIOMMUCommandLine(virCommandPtr cmd, virBufferAsprintf(&opts, ",device-iotlb=3D%s", virTristateSwitchTypeToString(iommu->iotlb)); } + if (iommu->aw_bits > 0) { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_INTEL_IOMMU_AW_BITS)) + virBufferAsprintf(&opts, ",aw-bits=3D%d", iommu->aw_bits); + else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_INTEL_IOMMU_X_AW_B= ITS)) + virBufferAsprintf(&opts, ",x-aw-bits=3D%d", iommu->aw_bits= ); + } =20 virCommandAddArg(cmd, "-device"); virCommandAddArgBuffer(cmd, &opts); diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 584d1375b857..c7bcb77013b5 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -3858,7 +3858,14 @@ qemuValidateDomainDeviceDefIOMMU(const virDomainIOMM= UDef *iommu, "with this QEMU binary")); return -1; } - + if (iommu->aw_bits > 0 && + !(virQEMUCapsGet(qemuCaps, QEMU_CAPS_INTEL_IOMMU_X_AW_BITS) || + virQEMUCapsGet(qemuCaps, QEMU_CAPS_INTEL_IOMMU_AW_BITS))) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("iommu: aw_bits is not supported " + "with this QEMU binary")); + return -1; + } return 0; } =20 diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml b/tests/qemu= capabilitiesdata/caps_2.12.0.x86_64.xml index 319dd6f2c3a5..9b632f025956 100644 --- a/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml @@ -200,6 +200,7 @@ + 2011090 0 43100289 diff --git a/tests/qemucapabilitiesdata/caps_3.0.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_3.0.0.x86_64.xml index 40cff641a89a..babbb5c0eec5 100644 --- a/tests/qemucapabilitiesdata/caps_3.0.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_3.0.0.x86_64.xml @@ -206,6 +206,7 @@ + 3000000 0 43100239 diff --git a/tests/qemucapabilitiesdata/caps_3.1.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_3.1.0.x86_64.xml index 3dbda4b3f30c..73f8927a1e9d 100644 --- a/tests/qemucapabilitiesdata/caps_3.1.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_3.1.0.x86_64.xml @@ -209,6 +209,7 @@ + 3000092 0 43100240 diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_4.0.0.x86_64.xml index bf7735caf340..bae15e771da9 100644 --- a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml @@ -214,6 +214,7 @@ + 4000000 0 43100240 diff --git a/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_4.1.0.x86_64.xml index 8ce0f80e8a2c..e17ae7ffb04c 100644 --- a/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml @@ -220,6 +220,7 @@ + 4001000 0 43100241 diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_4.2.0.x86_64.xml index 50ed35f092b3..e0685887e10a 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml @@ -228,6 +228,7 @@ + 4002000 0 43100242 diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_5.0.0.x86_64.xml index ba39fef7135d..538c8a8c8bcd 100644 --- a/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml @@ -234,6 +234,7 @@ + 5000000 0 43100241 diff --git a/tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_5.1.0.x86_64.xml index c2bc121f737c..2380618fed6f 100644 --- a/tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml @@ -234,6 +234,7 @@ + 5000050 0 43100242 diff --git a/tests/qemuxml2argvdata/intel-iommu-aw-bits.x86_64-latest.args = b/tests/qemuxml2argvdata/intel-iommu-aw-bits.x86_64-latest.args new file mode 100644 index 000000000000..0ce0952b5152 --- /dev/null +++ b/tests/qemuxml2argvdata/intel-iommu-aw-bits.x86_64-latest.args @@ -0,0 +1,33 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-QEMUGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-x86_64 \ +-name guest=3DQEMUGuest1,debug-threads=3Don \ +-S \ +-object secret,id=3DmasterKey0,format=3Draw,\ +file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ +-machine q35,accel=3Dkvm,usb=3Doff,dump-guest-core=3Doff,kernel_irqchip=3D= split \ +-cpu qemu64 \ +-m 214 \ +-overcommit mem-lock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-boot strict=3Don \ +-device intel-iommu,intremap=3Don,aw-bits=3D48 \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\ +resourcecontrol=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 3103cac884d7..c5eda14b3bf9 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -3122,6 +3122,7 @@ mymain(void) DO_TEST_CAPS_LATEST("intel-iommu-caching-mode"); DO_TEST_CAPS_LATEST("intel-iommu-eim"); DO_TEST_CAPS_LATEST("intel-iommu-device-iotlb"); + DO_TEST_CAPS_LATEST("intel-iommu-aw-bits"); DO_TEST_CAPS_LATEST_PARSE_ERROR("intel-iommu-wrong-machine"); DO_TEST_CAPS_ARCH_LATEST("iommu-smmuv3", "aarch64"); =20 --=20 2.26.2