From nobody Thu May 15 02:31:35 2025 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.zohomail.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 151672257106918.202759414100797; Tue, 23 Jan 2018 07:49:31 -0800 (PST) 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 mx1.redhat.com (Postfix) with ESMTPS id A7C5D40255; Tue, 23 Jan 2018 15:49:29 +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 BE89517517; Tue, 23 Jan 2018 15:49:26 +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 7053B18033E1; Tue, 23 Jan 2018 15:49:17 +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 w0NFk5t3023568 for ; Tue, 23 Jan 2018 10:46:05 -0500 Received: by smtp.corp.redhat.com (Postfix) id 327C017B86; Tue, 23 Jan 2018 15:46:05 +0000 (UTC) Received: from inaba.usersys.redhat.com (unknown [10.43.2.98]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AB31B6560B for ; Tue, 23 Jan 2018 15:46:00 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 23 Jan 2018 16:45:04 +0100 Message-Id: <20180123154504.9541-6-abologna@redhat.com> In-Reply-To: <20180123154504.9541-1-abologna@redhat.com> References: <20180123154504.9541-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [RFC PATCH 5/5] conf: Add HTM pSeries feature 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 23 Jan 2018 15:49:30 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Introduce a way to enable and disable the availability of HTM (Hardware Transactional Memory) for pSeries guests. Signed-off-by: Andrea Bolognani --- The availability of the corresponding QEMU toggle is currently crudely inferred from the version number, but there's ongoing discussion on how to introspect it properly through QMP, hence the RFC status of this patch. docs/formatdomain.html.in | 7 ++++ docs/schemas/domaincommon.rng | 5 +++ src/conf/domain_conf.c | 44 +++++++++++++++++++= ++++ src/conf/domain_conf.h | 1 + src/qemu/qemu_capabilities.c | 9 +++++ src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_command.c | 13 +++++++ tests/qemuxml2argvdata/pseries-features-htm.args | 19 ++++++++++ tests/qemuxml2argvdata/pseries-features-htm.xml | 30 ++++++++++++++++ tests/qemuxml2argvtest.c | 3 ++ tests/qemuxml2xmloutdata/pseries-features-htm.xml | 1 + tests/qemuxml2xmltest.c | 3 ++ 12 files changed, 136 insertions(+) create mode 100644 tests/qemuxml2argvdata/pseries-features-htm.args create mode 100644 tests/qemuxml2argvdata/pseries-features-htm.xml create mode 120000 tests/qemuxml2xmloutdata/pseries-features-htm.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 1e2fccaeb..22b0739ac 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -1770,6 +1770,7 @@ </kvm> <pseries> <hpt resizing=3D'required'/> + <htm state=3D'off'/> </pseries> <pvspinlock state=3D'on'/> <gic version=3D'2'/> @@ -1921,6 +1922,12 @@ resizing: enabled, disabled, required 4.1.0 (QEMU 2.10) + + htm + Configure HTM (Hardware Transactional Memory) + state: on, off + 4.1.0 (QEMU 2.12) +
pmu
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index fead6e7cc..b49318aa3 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -5538,6 +5538,11 @@ + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 763228ca7..34ef08e21 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -176,6 +176,7 @@ VIR_ENUM_IMPL(virDomainKVM, VIR_DOMAIN_KVM_LAST, VIR_ENUM_IMPL(virDomainPSeries, VIR_DOMAIN_PSERIES_LAST, "hpt", + "htm", ); =20 VIR_ENUM_IMPL(virDomainCapsFeature, VIR_DOMAIN_CAPS_FEATURE_LAST, @@ -19175,6 +19176,28 @@ virDomainDefParseXML(xmlDocPtr xml, VIR_FREE(tmp); break; =20 + case VIR_DOMAIN_PSERIES_HTM: + if (!(tmp =3D virXMLPropString(nodes[i], "state"))) { + virReportError(VIR_ERR_XML_ERROR, + _("Missing 'state' attribute for " + "'%s' pSeries feature"), + nodes[i]->name); + goto error; + } + + if ((value =3D virTristateSwitchTypeFromString(tmp)) < 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Invalid value '%s' for 'state' " + "attribute of '%s' pSeries feature"), + nodes[i]->name, tmp); + goto error; + } + + def->pseries_features[feature] =3D value; + + VIR_FREE(tmp); + break; + case VIR_DOMAIN_PSERIES_LAST: break; } @@ -21225,6 +21248,18 @@ virDomainDefFeaturesCheckABIStability(virDomainDef= Ptr src, } break; =20 + case VIR_DOMAIN_PSERIES_HTM: + if (src->pseries_features[i] !=3D dst->pseries_features[i]= ) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("State of '%s' pSeries feature differ= s: " + "source: '%s', destination: '%s'"), + virDomainPSeriesTypeToString(i), + virTristateSwitchTypeToString(src->pser= ies_features[i]), + virTristateSwitchTypeToString(dst->pser= ies_features[i])); + return false; + } + break; + case VIR_DOMAIN_PSERIES_LAST: break; } @@ -26618,6 +26653,15 @@ virDomainDefFormatInternal(virDomainDefPtr def, virDomainHPTResizingTypeToString= (def->pseries_hpt_resizing)); break; =20 + case VIR_DOMAIN_PSERIES_HTM: + if (def->pseries_features[j] =3D=3D VIR_TRISTATE_S= WITCH_ABSENT) + break; + + virBufferAsprintf(buf, "<%s state=3D'%s'/>\n", + virDomainPSeriesTypeToString(j), + virTristateSwitchTypeToString(de= f->pseries_features[j])); + break; + case VIR_DOMAIN_PSERIES_LAST: break; } diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 91db2220a..3c1a61c8e 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1768,6 +1768,7 @@ typedef enum { =20 typedef enum { VIR_DOMAIN_PSERIES_HPT =3D 0, + VIR_DOMAIN_PSERIES_HTM, =20 VIR_DOMAIN_PSERIES_LAST } virDomainPSeries; diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 5e03447ba..5897b6c66 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -458,6 +458,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, /* 280 */ "pl011", "machine.pseries.max-cpu-compat", + "machine.pseries.cap-htm", ); =20 =20 @@ -4894,6 +4895,14 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps, virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_PSERIES_MAX_CPU_COMPAT); } =20 + /* No way to query cap-htm availability... Yet. See + * http://lists.nongnu.org/archive/html/qemu-devel/2018-01/msg04674.ht= ml + * for an attempt at making this introspectable through QMP */ + if (qemuCaps->version >=3D 2012000 && + ARCH_IS_PPC64(qemuCaps->arch)) { + virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_PSERIES_CAP_HTM); + } + if (virQEMUCapsProbeQMPCommands(qemuCaps, mon) < 0) goto cleanup; =20 diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 3dfc77f87..5401a3118 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -443,6 +443,7 @@ typedef enum { /* 280 */ QEMU_CAPS_DEVICE_PL011, /* -device pl011 (not user-instantiable) */ QEMU_CAPS_MACHINE_PSERIES_MAX_CPU_COMPAT, /* -machine pseries,max-cpu-= compat=3D */ + QEMU_CAPS_MACHINE_PSERIES_CAP_HTM, /* -machine pseries,cap-htm=3D */ =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 26122b048..bb8567629 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7366,6 +7366,8 @@ virDomainPSeriesToQEMUCaps(int feature) switch ((virDomainPSeries) feature) { case VIR_DOMAIN_PSERIES_HPT: return QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT; + case VIR_DOMAIN_PSERIES_HTM: + return QEMU_CAPS_MACHINE_PSERIES_CAP_HTM; case VIR_DOMAIN_PSERIES_LAST: break; } @@ -7379,6 +7381,8 @@ virDomainPSeriesToMachineOption(int feature) switch ((virDomainPSeries) feature) { case VIR_DOMAIN_PSERIES_HPT: return "resize-hpt"; + case VIR_DOMAIN_PSERIES_HTM: + return "cap-htm"; case VIR_DOMAIN_PSERIES_LAST: break; } @@ -7659,6 +7663,15 @@ qemuBuildMachineCommandLine(virCommandPtr cmd, goto cleanup; break; =20 + case VIR_DOMAIN_PSERIES_HTM: + if (def->pseries_features[i] =3D=3D VIR_TRISTATE_SWITC= H_ABSENT) + break; + + value =3D virTristateSwitchTypeToString(def->pseries_f= eatures[i]); + if (qemuBuildMachineCommandLinePSeriesFeature(&buf, i,= value, qemuCaps) < 0) + goto cleanup; + break; + case VIR_DOMAIN_PSERIES_LAST: goto cleanup; } diff --git a/tests/qemuxml2argvdata/pseries-features-htm.args b/tests/qemux= ml2argvdata/pseries-features-htm.args new file mode 100644 index 000000000..64fd28ed2 --- /dev/null +++ b/tests/qemuxml2argvdata/pseries-features-htm.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-ppc64 \ +-name guest \ +-S \ +-machine pseries,accel=3Dtcg,cap-htm=3Don \ +-m 512 \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \ +-nographic \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-guest/monitor.s= ock,\ +server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dreadline \ +-boot c diff --git a/tests/qemuxml2argvdata/pseries-features-htm.xml b/tests/qemuxm= l2argvdata/pseries-features-htm.xml new file mode 100644 index 000000000..9e92aa91e --- /dev/null +++ b/tests/qemuxml2argvdata/pseries-features-htm.xml @@ -0,0 +1,30 @@ + + guest + 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 + 524288 + 524288 + 1 + + hvm + + + + + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-ppc64 + + + + + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index cc9280db0..03d159e69 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1899,6 +1899,9 @@ mymain(void) DO_TEST_PARSE_ERROR("pseries-features-invalid-machine", QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT); + DO_TEST("pseries-features-htm", + QEMU_CAPS_MACHINE_OPT, + QEMU_CAPS_MACHINE_PSERIES_CAP_HTM); =20 DO_TEST("pseries-serial-native", QEMU_CAPS_NODEFCONFIG, diff --git a/tests/qemuxml2xmloutdata/pseries-features-htm.xml b/tests/qemu= xml2xmloutdata/pseries-features-htm.xml new file mode 120000 index 000000000..42cf0f7d7 --- /dev/null +++ b/tests/qemuxml2xmloutdata/pseries-features-htm.xml @@ -0,0 +1 @@ +../qemuxml2argvdata/pseries-features-htm.xml \ No newline at end of file diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index ba4e853f9..e97f17740 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -766,6 +766,9 @@ mymain(void) DO_TEST("pseries-features-hpt", QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT); + DO_TEST("pseries-features-htm", + QEMU_CAPS_MACHINE_OPT, + QEMU_CAPS_MACHINE_PSERIES_CAP_HTM); =20 DO_TEST("pseries-serial-native", QEMU_CAPS_NODEFCONFIG, --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list