From nobody Sat Apr 27 23:20:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1495098812077644.7909327044968; Thu, 18 May 2017 02:13:32 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 36A5980C01; Thu, 18 May 2017 09:13:29 +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 123D9627DD; Thu, 18 May 2017 09:13:29 +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 AE2C24BB7F; Thu, 18 May 2017 09:13:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v4I9Bsrv021332 for ; Thu, 18 May 2017 05:11:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3440B5C891; Thu, 18 May 2017 09:11:54 +0000 (UTC) Received: from icr.brq.redhat.com (dhcp129-58.brq.redhat.com [10.34.129.58]) by smtp.corp.redhat.com (Postfix) with ESMTP id 848815C88F; Thu, 18 May 2017 09:11:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 36A5980C01 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 36A5980C01 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Thu, 18 May 2017 11:09:31 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: rkrcmar@redhat.com Subject: [libvirt] [PATCH 1/2] conf: add eim attribute to 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 18 May 2017 09:13:30 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add an attribute to control extended interrupt mode. https://bugzilla.redhat.com/show_bug.cgi?id=3D1451282 Reviewed-by: Andrea Bolognani --- docs/formatdomain.html.in | 10 +++++++ docs/schemas/domaincommon.rng | 5 ++++ src/conf/domain_conf.c | 20 ++++++++++++++ src/conf/domain_conf.h | 1 + .../qemuxml2argv-intel-iommu-eim.xml | 31 ++++++++++++++++++= ++++ .../qemuxml2xmlout-intel-iommu-eim.xml | 1 + tests/qemuxml2xmltest.c | 1 + 7 files changed, 69 insertions(+) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-eim.xml create mode 120000 tests/qemuxml2xmloutdata/qemuxml2xmlout-intel-iommu-eim= .xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 3135db4..b5026b1 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -7436,6 +7436,16 @@ qemu-kvm -net nic,model=3D? /dev/null Since 3.4.0 (QEMU/KVM only)

+
eim
+
+

+ The eim attribute with possible values + on and off can be used to + turn on extended interrupt mode. In combination with intremap + and split I/O APIC, this allows for more vCPUs to be used. + Since 3.4.0 (QEMU/KVM only) +

+
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index f88e84a..144c281 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -3959,6 +3959,11 @@ + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 9eba70a..2264d96 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -14184,6 +14184,14 @@ virDomainIOMMUDefParseXML(xmlNodePtr node, } iommu->caching_mode =3D val; } + VIR_FREE(tmp); + if ((tmp =3D virXPathString("string(./driver/@eim)", ctxt))) { + if ((val =3D virTristateSwitchTypeFromString(tmp)) < 0) { + virReportError(VIR_ERR_XML_ERROR, _("unknown eim value: %s"), = tmp); + goto cleanup; + } + iommu->eim =3D val; + } =20 ret =3D iommu; iommu =3D NULL; @@ -19856,6 +19864,14 @@ virDomainIOMMUDefCheckABIStability(virDomainIOMMUD= efPtr src, virTristateSwitchTypeToString(src->caching_mode)); return false; } + if (src->eim !=3D dst->eim) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target domain IOMMU device eim value '%s' " + "does not match source '%s'"), + virTristateSwitchTypeToString(dst->eim), + virTristateSwitchTypeToString(src->eim)); + return false; + } return true; } =20 @@ -24199,6 +24215,10 @@ virDomainIOMMUDefFormat(virBufferPtr buf, virBufferAsprintf(&childBuf, " caching_mode=3D'%s'", virTristateSwitchTypeToString(iommu->caching= _mode)); } + if (iommu->eim !=3D VIR_TRISTATE_SWITCH_ABSENT) { + virBufferAsprintf(&childBuf, " eim=3D'%s'", + virTristateSwitchTypeToString(iommu->eim)); + } virBufferAddLit(&childBuf, "/>\n"); } =20 diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 34a3596..83e0672 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2211,6 +2211,7 @@ struct _virDomainIOMMUDef { virDomainIOMMUModel model; virTristateSwitch intremap; virTristateSwitch caching_mode; + virTristateSwitch eim; }; /* * Guest VM main configuration diff --git a/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-eim.xml b/test= s/qemuxml2argvdata/qemuxml2argv-intel-iommu-eim.xml new file mode 100644 index 0000000..8642ed3 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-eim.xml @@ -0,0 +1,31 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 288 + + hvm + + + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + +
+ + + + + + + + + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-intel-iommu-eim.xml b/= tests/qemuxml2xmloutdata/qemuxml2xmlout-intel-iommu-eim.xml new file mode 120000 index 0000000..9fbec36 --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-intel-iommu-eim.xml @@ -0,0 +1 @@ +../qemuxml2argvdata/qemuxml2argv-intel-iommu-eim.xml \ No newline at end of file diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index fed74d0..fff13e2 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -1127,6 +1127,7 @@ mymain(void) QEMU_CAPS_MACHINE_IOMMU); DO_TEST("intel-iommu-ioapic", NONE); DO_TEST("intel-iommu-caching-mode", NONE); + DO_TEST("intel-iommu-eim", NONE); =20 DO_TEST("cpu-check-none", NONE); DO_TEST("cpu-check-partial", NONE); --=20 2.10.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat Apr 27 23:20:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1495098803107968.5967523035401; Thu, 18 May 2017 02:13:23 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 450BC8047E; Thu, 18 May 2017 09:13:20 +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 B5F9A17597; Thu, 18 May 2017 09:13:18 +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 0AB16180BAF2; Thu, 18 May 2017 09:13:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v4I9Bv03021343 for ; Thu, 18 May 2017 05:11:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8E9424D73E; Thu, 18 May 2017 09:11:57 +0000 (UTC) Received: from icr.brq.redhat.com (dhcp129-58.brq.redhat.com [10.34.129.58]) by smtp.corp.redhat.com (Postfix) with ESMTP id 87C8B5C88F; Thu, 18 May 2017 09:11:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 450BC8047E Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 450BC8047E From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Thu, 18 May 2017 11:09:32 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: rkrcmar@redhat.com Subject: [libvirt] [PATCH 2/2] qemu: format eim on intel-iommu command line 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 18 May 2017 09:13:22 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This option turns on extended interrupt mode, which allows more than 255 vCPUs. https://bugzilla.redhat.com/show_bug.cgi?id=3D1451282 Reviewed-by: Andrea Bolognani --- src/qemu/qemu_capabilities.c | 2 ++ src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_command.c | 11 +++++++++++ src/qemu/qemu_domain.c | 20 ++++++++++++++++= ++++ tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml | 1 + .../qemuxml2argv-intel-iommu-eim.args | 19 ++++++++++++++++= +++ tests/qemuxml2argvtest.c | 7 +++++++ 8 files changed, 62 insertions(+) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-eim.args diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 546dfd7..7ea8505 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -371,6 +371,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, "kernel-irqchip.split", "intel-iommu.intremap", "intel-iommu.caching-mode", + "intel-iommu.eim", ); =20 =20 @@ -1728,6 +1729,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsObjec= tPropsUSBNECXHCI[] =3D { static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsIntelIOMMU[] = =3D { { "intremap", QEMU_CAPS_INTEL_IOMMU_INTREMAP }, { "caching-mode", QEMU_CAPS_INTEL_IOMMU_CACHING_MODE }, + { "eim", QEMU_CAPS_INTEL_IOMMU_EIM }, }; =20 /* see documentation for virQEMUCapsQMPSchemaGetByPath for the query forma= t */ diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index aa99fda..eba9814 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -409,6 +409,7 @@ typedef enum { QEMU_CAPS_MACHINE_KERNEL_IRQCHIP_SPLIT, /* -machine kernel_irqchip=3Ds= plit */ QEMU_CAPS_INTEL_IOMMU_INTREMAP, /* intel-iommu.intremap */ QEMU_CAPS_INTEL_IOMMU_CACHING_MODE, /* intel-iommu.caching-mode */ + QEMU_CAPS_INTEL_IOMMU_EIM, /* intel-iommu.eim */ =20 QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 4c1a266..f190d51 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6701,6 +6701,13 @@ qemuBuildIOMMUCommandLine(virCommandPtr cmd, "with this QEMU binary")); return -1; } + if (iommu->eim !=3D VIR_TRISTATE_SWITCH_ABSENT && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_INTEL_IOMMU_EIM)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("iommu: eim is not supported " + "with this QEMU binary")); + return -1; + } break; case VIR_DOMAIN_IOMMU_MODEL_LAST: break; @@ -6734,6 +6741,10 @@ qemuBuildIOMMUCommandLine(virCommandPtr cmd, virBufferAsprintf(&opts, ",caching-mode=3D%s", virTristateSwitchTypeToString(iommu->caching= _mode)); } + if (iommu->eim !=3D VIR_TRISTATE_SWITCH_ABSENT) { + virBufferAsprintf(&opts, ",eim=3D%s", + virTristateSwitchTypeToString(iommu->eim)); + } case VIR_DOMAIN_IOMMU_MODEL_LAST: break; } diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 7c54f69..cd1825e 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2663,6 +2663,9 @@ qemuDomainRecheckInternalPaths(virDomainDefPtr def, } =20 =20 +#define QEMU_MAX_VCPUS_WITHOUT_EIM 255 + + static int qemuDomainDefVcpusPostParse(virDomainDefPtr def) { @@ -3071,6 +3074,23 @@ qemuDomainDefValidate(const virDomainDef *def, } } =20 + if (ARCH_IS_X86(def->os.arch) && + virDomainDefGetVcpusMax(def) > QEMU_MAX_VCPUS_WITHOUT_EIM) { + if (!qemuDomainIsQ35(def)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("more than %d vCPUs are only supported on " + "q35-based machine types"), + QEMU_MAX_VCPUS_WITHOUT_EIM); + goto cleanup; + } + if (!def->iommu || def->iommu->eim !=3D VIR_TRISTATE_SWITCH_ON) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("more than %d vCPUs require extended interrup= t " + "mode enabled on the iommu device"), + QEMU_MAX_VCPUS_WITHOUT_EIM); + } + } + if (qemuDomainDefValidateVideo(def) < 0) goto cleanup; =20 diff --git a/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_2.8.0.x86_64.xml index e515678..01edbc8 100644 --- a/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml @@ -206,6 +206,7 @@ + 2008000 0 (v2.8.0) diff --git a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_2.9.0.x86_64.xml index 19fe4b7..95b04dd 100644 --- a/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml @@ -214,6 +214,7 @@ + 2009000 0 (v2.9.0) diff --git a/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-eim.args b/tes= ts/qemuxml2argvdata/qemuxml2argv-intel-iommu-eim.args new file mode 100644 index 0000000..ebf7c49 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-eim.args @@ -0,0 +1,19 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-x86_64 \ +-name QEMUGuest1 \ +-S \ +-machine q35,accel=3Dkvm,kernel_irqchip=3Dsplit \ +-m 214 \ +-smp 288,sockets=3D288,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-nographic \ +-nodefaults \ +-monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \ +-no-acpi \ +-boot c \ +-device intel-iommu,intremap=3Don,eim=3Don diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 4269598..b360185 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2529,6 +2529,13 @@ mymain(void) QEMU_CAPS_DEVICE_INTEL_IOMMU, QEMU_CAPS_INTEL_IOMMU_INTREMAP, QEMU_CAPS_INTEL_IOMMU_CACHING_MODE); + DO_TEST("intel-iommu-eim", + QEMU_CAPS_MACHINE_OPT, + QEMU_CAPS_MACHINE_KERNEL_IRQCHIP, + QEMU_CAPS_MACHINE_KERNEL_IRQCHIP_SPLIT, + QEMU_CAPS_INTEL_IOMMU_INTREMAP, + QEMU_CAPS_INTEL_IOMMU_EIM, + QEMU_CAPS_DEVICE_INTEL_IOMMU); =20 DO_TEST("cpu-hotplug-startup", QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS); =20 --=20 2.10.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list