From nobody Thu May 15 12:13:49 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; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 152060813164327.23563234264975; Fri, 9 Mar 2018 07:08:51 -0800 (PST) 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 9BBCE8A4D8; Fri, 9 Mar 2018 15:08:49 +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 660307DFCC; Fri, 9 Mar 2018 15:08:21 +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 271A8180BAD5; Fri, 9 Mar 2018 15:08:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w29F87hg023768 for ; Fri, 9 Mar 2018 10:08:07 -0500 Received: by smtp.corp.redhat.com (Postfix) id EDBE1215CDAE; Fri, 9 Mar 2018 15:08:06 +0000 (UTC) Received: from inaba.usersys.redhat.com (unknown [10.43.2.98]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 94804215CDAA for ; Fri, 9 Mar 2018 15:08:06 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Fri, 9 Mar 2018 16:07:52 +0100 Message-Id: <20180309150754.11341-7-abologna@redhat.com> In-Reply-To: <20180309150754.11341-1-abologna@redhat.com> References: <20180309150754.11341-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 6/8] qemu: Add capability for the 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Fri, 09 Mar 2018 15:08:50 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This is the first capability that depends on an object property, so we need to introduce a couple new functions at the same time. Signed-off-by: Andrea Bolognani --- src/qemu/qemu_capabilities.c | 38 +++++ src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_monitor.c | 13 ++ src/qemu/qemu_monitor.h | 3 + src/qemu/qemu_monitor_json.c | 10 ++ src/qemu/qemu_monitor_json.h | 5 + .../caps_2.12.0-gicv2.aarch64.replies | 24 ++- .../caps_2.12.0-gicv2.aarch64.xml | 2 +- .../caps_2.12.0-gicv3.aarch64.replies | 24 ++- .../caps_2.12.0-gicv3.aarch64.xml | 2 +- .../qemucapabilitiesdata/caps_2.12.0.ppc64.replies | 170 +++++++++++++++++= +++- tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml | 3 +- .../caps_2.12.0.x86_64.replies | 30 ++-- tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml | 2 +- 14 files changed, 289 insertions(+), 38 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 83ec8a67d5..0165de0407 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -460,6 +460,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, "machine.pseries.max-cpu-compat", "dump-completed", "qom-list-properties", + "machine.pseries.cap-htm", ); =20 =20 @@ -1950,6 +1951,21 @@ static struct virQEMUCapsObjectTypeProps virQEMUCaps= DeviceProps[] =3D { QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE }, }; =20 +/* Object properties. + * + * The following can be probed using the qom-list-properties QMP command + */ + +static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsSPAPRMachine[] = =3D { + { "cap-htm", QEMU_CAPS_MACHINE_PSERIES_CAP_HTM }, +}; + +static struct virQEMUCapsObjectTypeProps virQEMUCapsObjectProps[] =3D { + { "spapr-machine", virQEMUCapsObjectPropsSPAPRMachine, + ARRAY_CARDINALITY(virQEMUCapsObjectPropsSPAPRMachine), + -1 }, +}; + /* see documentation for virQEMUCapsQMPSchemaGetByPath for the query forma= t */ static struct virQEMUCapsStringFlags virQEMUCapsQMPSchemaQueries[] =3D { { "blockdev-add/arg-type/options/+gluster/debug-level", QEMU_CAPS_GLUS= TER_DEBUG_LEVEL}, @@ -2876,6 +2892,28 @@ virQEMUCapsProbeQMPObjects(virQEMUCapsPtr qemuCaps, virStringListFreeCount(values, nvalues); } =20 + /* If the qom-list-properties QMP command is available, then we + * can probe objects in addition to devices */ + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_QOM_LIST_PROPERTIES)) { + for (i =3D 0; i < ARRAY_CARDINALITY(virQEMUCapsObjectProps); i++) { + const char *type =3D virQEMUCapsObjectProps[i].type; + int cap =3D virQEMUCapsObjectProps[i].capsCondition; + + if (cap >=3D 0 && !virQEMUCapsGet(qemuCaps, cap)) + continue; + + if ((nvalues =3D qemuMonitorGetObjectProps(mon, + type, + &values)) < 0) + return -1; + virQEMUCapsProcessStringFlags(qemuCaps, + virQEMUCapsObjectProps[i].nprops, + virQEMUCapsObjectProps[i].props, + nvalues, values); + virStringListFreeCount(values, nvalues); + } + } + /* Prefer -chardev spicevmc (detected earlier) over -device spicevmc */ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_CHARDEV_SPICEVMC)) virQEMUCapsClear(qemuCaps, QEMU_CAPS_DEVICE_SPICEVMC); diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index ce07dfd6b1..62a1138130 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -445,6 +445,7 @@ typedef enum { QEMU_CAPS_MACHINE_PSERIES_MAX_CPU_COMPAT, /* -machine pseries,max-cpu-= compat=3D */ QEMU_CAPS_DUMP_COMPLETED, /* DUMP_COMPLETED event */ QEMU_CAPS_QOM_LIST_PROPERTIES, /* qom-list-properties QMP command */ + 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_monitor.c b/src/qemu/qemu_monitor.c index 8ec759fe3f..6e43d268e1 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -3954,6 +3954,19 @@ qemuMonitorGetDeviceProps(qemuMonitorPtr mon, } =20 =20 +int +qemuMonitorGetObjectProps(qemuMonitorPtr mon, + const char *type, + char ***props) +{ + VIR_DEBUG("type=3D%s props=3D%p", type, props); + + QEMU_CHECK_MONITOR_JSON(mon); + + return qemuMonitorJSONGetObjectProps(mon, type, props); +} + + char * qemuMonitorGetTargetArch(qemuMonitorPtr mon) { diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 26074ef7dd..e83e49cd51 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1097,6 +1097,9 @@ int qemuMonitorGetObjectTypes(qemuMonitorPtr mon, int qemuMonitorGetDeviceProps(qemuMonitorPtr mon, const char *type, char ***props); +int qemuMonitorGetObjectProps(qemuMonitorPtr mon, + const char *type, + char ***props); char *qemuMonitorGetTargetArch(qemuMonitorPtr mon); =20 int qemuMonitorNBDServerStart(qemuMonitorPtr mon, diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 141873a705..bb7e6e12e7 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -6139,6 +6139,16 @@ qemuMonitorJSONGetDeviceProps(qemuMonitorPtr mon, } =20 =20 +int +qemuMonitorJSONGetObjectProps(qemuMonitorPtr mon, + const char *type, + char ***props) +{ + return qemuMonitorJSONGetProps(mon, type, props, + "qom-list-properties"); +} + + char * qemuMonitorJSONGetTargetArch(qemuMonitorPtr mon) { diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 4a1da725d1..2ce208845a 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -445,6 +445,11 @@ int qemuMonitorJSONGetDeviceProps(qemuMonitorPtr mon, const char *type, char ***props) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); +int qemuMonitorJSONGetObjectProps(qemuMonitorPtr mon, + const char *type, + char ***props) + ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); + char *qemuMonitorJSONGetTargetArch(qemuMonitorPtr mon); =20 int qemuMonitorJSONNBDServerStart(qemuMonitorPtr mon, diff --git a/tests/qemucapabilitiesdata/caps_2.12.0-gicv2.aarch64.replies b= /tests/qemucapabilitiesdata/caps_2.12.0-gicv2.aarch64.replies index 9b1ed887e9..1a328d6bce 100644 --- a/tests/qemucapabilitiesdata/caps_2.12.0-gicv2.aarch64.replies +++ b/tests/qemucapabilitiesdata/caps_2.12.0-gicv2.aarch64.replies @@ -5208,6 +5208,14 @@ "id": "libvirt-35" } =20 +{ + "id": "libvirt-36", + "error": { + "class": "DeviceNotFound", + "desc": "Class 'spapr-machine' not found" + } +} + { "return": [ { @@ -5497,7 +5505,7 @@ "cpu-max": 1 } ], - "id": "libvirt-36" + "id": "libvirt-37" } =20 { @@ -5668,20 +5676,20 @@ "static": false } ], - "id": "libvirt-37" + "id": "libvirt-38" } =20 { "return": [ ], - "id": "libvirt-38" + "id": "libvirt-39" } =20 { "return": [ "emulator" ], - "id": "libvirt-39" + "id": "libvirt-40" } =20 { @@ -6838,7 +6846,7 @@ "option": "drive" } ], - "id": "libvirt-40" + "id": "libvirt-41" } =20 { @@ -6896,7 +6904,7 @@ "capability": "x-multifd" } ], - "id": "libvirt-41" + "id": "libvirt-42" } =20 { @@ -16953,7 +16961,7 @@ "meta-type": "object" } ], - "id": "libvirt-42" + "id": "libvirt-43" } =20 { @@ -16969,7 +16977,7 @@ "kernel": true } ], - "id": "libvirt-43" + "id": "libvirt-44" } =20 { diff --git a/tests/qemucapabilitiesdata/caps_2.12.0-gicv2.aarch64.xml b/tes= ts/qemucapabilitiesdata/caps_2.12.0-gicv2.aarch64.xml index 9c4e40973b..dab701b726 100644 --- a/tests/qemucapabilitiesdata/caps_2.12.0-gicv2.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_2.12.0-gicv2.aarch64.xml @@ -190,7 +190,7 @@ 2011050 0 - 315524 + 315645 (v2.11.0-2110-gf6d81cd) aarch64 diff --git a/tests/qemucapabilitiesdata/caps_2.12.0-gicv3.aarch64.replies b= /tests/qemucapabilitiesdata/caps_2.12.0-gicv3.aarch64.replies index 9a12b14569..6a4302f2e0 100644 --- a/tests/qemucapabilitiesdata/caps_2.12.0-gicv3.aarch64.replies +++ b/tests/qemucapabilitiesdata/caps_2.12.0-gicv3.aarch64.replies @@ -5208,6 +5208,14 @@ "id": "libvirt-35" } =20 +{ + "id": "libvirt-36", + "error": { + "class": "DeviceNotFound", + "desc": "Class 'spapr-machine' not found" + } +} + { "return": [ { @@ -5497,7 +5505,7 @@ "cpu-max": 1 } ], - "id": "libvirt-36" + "id": "libvirt-37" } =20 { @@ -5668,20 +5676,20 @@ "static": false } ], - "id": "libvirt-37" + "id": "libvirt-38" } =20 { "return": [ ], - "id": "libvirt-38" + "id": "libvirt-39" } =20 { "return": [ "emulator" ], - "id": "libvirt-39" + "id": "libvirt-40" } =20 { @@ -6838,7 +6846,7 @@ "option": "drive" } ], - "id": "libvirt-40" + "id": "libvirt-41" } =20 { @@ -6896,7 +6904,7 @@ "capability": "x-multifd" } ], - "id": "libvirt-41" + "id": "libvirt-42" } =20 { @@ -16953,7 +16961,7 @@ "meta-type": "object" } ], - "id": "libvirt-42" + "id": "libvirt-43" } =20 { @@ -16969,7 +16977,7 @@ "kernel": false } ], - "id": "libvirt-43" + "id": "libvirt-44" } =20 { diff --git a/tests/qemucapabilitiesdata/caps_2.12.0-gicv3.aarch64.xml b/tes= ts/qemucapabilitiesdata/caps_2.12.0-gicv3.aarch64.xml index 06e0068cbd..d14c7948b4 100644 --- a/tests/qemucapabilitiesdata/caps_2.12.0-gicv3.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_2.12.0-gicv3.aarch64.xml @@ -190,7 +190,7 @@ 2011050 0 - 315524 + 315645 (v2.11.0-2110-gf6d81cd) aarch64 diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.replies b/tests/q= emucapabilitiesdata/caps_2.12.0.ppc64.replies index 0ccf0ad403..e941e59995 100644 --- a/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.replies +++ b/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.replies @@ -5279,6 +5279,162 @@ "id": "libvirt-36" } =20 +{ + "return": [ + { + "name": "graphics", + "description": "Set on/off to enable/disable graphics emulation", + "type": "bool" + }, + { + "name": "phandle-start", + "description": "The first phandle ID we may generate dynamically", + "type": "int" + }, + { + "name": "dump-guest-core", + "description": "Include guest memory in a core dump", + "type": "bool" + }, + { + "name": "kernel-irqchip", + "description": "Configure KVM in-kernel irqchip", + "type": "on|off|split" + }, + { + "name": "accel", + "description": "Accelerator list", + "type": "string" + }, + { + "name": "append", + "description": "Linux kernel command line", + "type": "string" + }, + { + "name": "dumpdtb", + "description": "Dump current dtb to a file and quit", + "type": "string" + }, + { + "name": "igd-passthru", + "description": "Set on/off to enable/disable igd passthrou", + "type": "bool" + }, + { + "name": "dt-compatible", + "description": "Overrides the \"compatible\" property of the dt root= node", + "type": "string" + }, + { + "name": "kernel", + "description": "Linux kernel image file", + "type": "string" + }, + { + "name": "usb", + "description": "Set on/off to enable/disable usb", + "type": "bool" + }, + { + "name": "suppress-vmdesc", + "description": "Set on to disable self-describing migration", + "type": "bool" + }, + { + "name": "dtb", + "description": "Linux kernel device tree file", + "type": "string" + }, + { + "name": "firmware", + "description": "Firmware image", + "type": "string" + }, + { + "name": "mem-merge", + "description": "Enable/disable memory merge support", + "type": "bool" + }, + { + "name": "initrd", + "description": "Linux initial ramdisk file", + "type": "string" + }, + { + "name": "enforce-config-section", + "description": "Set on to enforce configuration section migration", + "type": "bool" + }, + { + "name": "kvm-shadow-mem", + "description": "KVM shadow MMU size", + "type": "int" + }, + { + "name": "cap-ibs", + "description": "Indirect Branch Speculation (broken, fixed-ibs, fixe= d-ccd)", + "type": "string" + }, + { + "name": "cap-cfpc", + "description": "Cache Flush on Privilege Change (broken, workaround,= fixed)", + "type": "string" + }, + { + "name": "cap-sbbc", + "description": "Speculation Barrier Bounds Checking (broken, workaro= und, fixed)", + "type": "string" + }, + { + "name": "cap-dfp", + "description": "Allow Decimal Floating Point (DFP)", + "type": "bool" + }, + { + "name": "cap-htm", + "description": "Allow Hardware Transactional Memory (HTM)", + "type": "bool" + }, + { + "name": "cap-vsx", + "description": "Allow Vector Scalar Extensions (VSX)", + "type": "bool" + }, + { + "name": "cap-ibs", + "description": "Indirect Branch Speculation (broken, fixed-ibs, fixe= d-ccd)", + "type": "string" + }, + { + "name": "cap-cfpc", + "description": "Cache Flush on Privilege Change (broken, workaround,= fixed)", + "type": "string" + }, + { + "name": "cap-sbbc", + "description": "Speculation Barrier Bounds Checking (broken, workaro= und, fixed)", + "type": "string" + }, + { + "name": "cap-dfp", + "description": "Allow Decimal Floating Point (DFP)", + "type": "bool" + }, + { + "name": "cap-htm", + "description": "Allow Hardware Transactional Memory (HTM)", + "type": "bool" + }, + { + "name": "cap-vsx", + "description": "Allow Vector Scalar Extensions (VSX)", + "type": "bool" + } + ], + "id": "libvirt-37" +} + { "return": [ { @@ -5414,7 +5570,7 @@ "cpu-max": 1 } ], - "id": "libvirt-37" + "id": "libvirt-38" } =20 { @@ -7610,20 +7766,20 @@ "static": false } ], - "id": "libvirt-38" + "id": "libvirt-39" } =20 { "return": [ ], - "id": "libvirt-39" + "id": "libvirt-40" } =20 { "return": [ "emulator" ], - "id": "libvirt-40" + "id": "libvirt-41" } =20 { @@ -8775,7 +8931,7 @@ "option": "drive" } ], - "id": "libvirt-41" + "id": "libvirt-42" } =20 { @@ -8833,7 +8989,7 @@ "capability": "x-multifd" } ], - "id": "libvirt-42" + "id": "libvirt-43" } =20 { @@ -18890,7 +19046,7 @@ "meta-type": "object" } ], - "id": "libvirt-43" + "id": "libvirt-44" } =20 { diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml b/tests/qemuc= apabilitiesdata/caps_2.12.0.ppc64.xml index a0df689c25..0a2b64e157 100644 --- a/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml @@ -186,9 +186,10 @@ + 2011050 0 - 393199 + 397043 (v2.11.0-2110-gf6d81cd) ppc64 diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.replies b/tests/= qemucapabilitiesdata/caps_2.12.0.x86_64.replies index c161dd006b..c06bafa4ba 100644 --- a/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.replies +++ b/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.replies @@ -4609,6 +4609,14 @@ "id": "libvirt-39" } =20 +{ + "id": "libvirt-40", + "error": { + "class": "DeviceNotFound", + "desc": "Class 'spapr-machine' not found" + } +} + { "return": [ { @@ -4815,7 +4823,7 @@ "cpu-max": 255 } ], - "id": "libvirt-40" + "id": "libvirt-41" } =20 { @@ -5329,7 +5337,7 @@ "migration-safe": true } ], - "id": "libvirt-41" + "id": "libvirt-42" } =20 { @@ -5337,7 +5345,7 @@ "tpm-crb", "tpm-tis" ], - "id": "libvirt-42" + "id": "libvirt-43" } =20 { @@ -5345,7 +5353,7 @@ "passthrough", "emulator" ], - "id": "libvirt-43" + "id": "libvirt-44" } =20 { @@ -6636,7 +6644,7 @@ "option": "drive" } ], - "id": "libvirt-44" + "id": "libvirt-45" } =20 { @@ -6694,7 +6702,7 @@ "capability": "x-multifd" } ], - "id": "libvirt-45" + "id": "libvirt-46" } =20 { @@ -16751,7 +16759,7 @@ "meta-type": "object" } ], - "id": "libvirt-46" + "id": "libvirt-47" } =20 { @@ -16939,7 +16947,7 @@ } } }, - "id": "libvirt-47" + "id": "libvirt-48" } =20 { @@ -17192,7 +17200,7 @@ } } }, - "id": "libvirt-48" + "id": "libvirt-49" } =20 { @@ -17380,7 +17388,7 @@ } } }, - "id": "libvirt-49" + "id": "libvirt-50" } =20 { @@ -17633,7 +17641,7 @@ } } }, - "id": "libvirt-50" + "id": "libvirt-51" } =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 fbdde1733f..dd910853f4 100644 --- a/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml @@ -231,7 +231,7 @@ 2011050 0 - 364740 + 364861 (v2.11.0-2110-gf6d81cdec8-dirty) x86_64 --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list