[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v20 12/21] qapi/s390x/cpu topology: query-cpu-polarization qmp co
From: |
Pierre Morel |
Subject: |
[PATCH v20 12/21] qapi/s390x/cpu topology: query-cpu-polarization qmp command |
Date: |
Tue, 25 Apr 2023 18:14:47 +0200 |
The query-cpu-polarization qmp command returns the current
CPU polarization of the machine.
Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
---
qapi/machine-target.json | 30 ++++++++++++++++++++++++++++++
hw/s390x/cpu-topology.c | 14 ++++++++++++++
2 files changed, 44 insertions(+)
diff --git a/qapi/machine-target.json b/qapi/machine-target.json
index ffde2e9cbd..8eb05755cd 100644
--- a/qapi/machine-target.json
+++ b/qapi/machine-target.json
@@ -4,6 +4,7 @@
# This work is licensed under the terms of the GNU GPL, version 2 or later.
# See the COPYING file in the top-level directory.
+{ 'include': 'common.json' }
{ 'include': 'machine-common.json' }
##
@@ -424,3 +425,32 @@
'features': [ 'unstable' ],
'if': { 'all': [ 'TARGET_S390X', 'CONFIG_KVM' ] }
}
+
+##
+# @CpuPolarizationInfo:
+#
+# The result of a cpu polarization
+#
+# @polarization: the CPU polarization
+#
+# Since: 2.8
+##
+{ 'struct': 'CpuPolarizationInfo',
+ 'data': { 'polarization': 'CpuS390Polarization' },
+ 'if': { 'all': [ 'TARGET_S390X', 'CONFIG_KVM' ] }
+}
+
+##
+# @query-cpu-polarization:
+#
+# Features:
+# @unstable: This command may still be modified.
+#
+# Returns: the machine polarization
+#
+# Since: 8.1
+##
+{ 'command': 'query-cpu-polarization', 'returns': 'CpuPolarizationInfo',
+ 'features': [ 'unstable' ],
+ 'if': { 'all': [ 'TARGET_S390X', 'CONFIG_KVM' ] }
+}
diff --git a/hw/s390x/cpu-topology.c b/hw/s390x/cpu-topology.c
index e8b140d623..d440e8a3c6 100644
--- a/hw/s390x/cpu-topology.c
+++ b/hw/s390x/cpu-topology.c
@@ -18,6 +18,7 @@
#include "hw/s390x/cpu-topology.h"
#include "qapi/qapi-commands-machine-target.h"
#include "qapi/qapi-events-machine-target.h"
+#include "qapi/type-helpers.h"
/*
* s390_topology is used to keep the topology information.
@@ -468,3 +469,16 @@ void qmp_set_cpu_topology(uint16_t core,
has_drawer, drawer, has_entitlement, entitlement,
has_dedicated, dedicated, errp);
}
+
+CpuPolarizationInfo *qmp_query_cpu_polarization(Error **errp)
+{
+ CpuPolarizationInfo *info = g_new0(CpuPolarizationInfo, 1);
+
+ if (s390_topology.vertical_polarization) {
+ info->polarization = S390_CPU_POLARIZATION_VERTICAL;
+ } else {
+ info->polarization = S390_CPU_POLARIZATION_HORIZONTAL;
+ }
+
+ return info;
+}
--
2.31.1
- [PATCH v20 00/21] s390x: CPU Topology, Pierre Morel, 2023/04/25
- [PATCH v20 07/21] target/s390x/cpu topology: activate CPU topology, Pierre Morel, 2023/04/25
- [PATCH v20 02/21] s390x/cpu topology: add topology entries on CPU hotplug, Pierre Morel, 2023/04/25
- [PATCH v20 06/21] s390x/cpu topology: interception of PTF instruction, Pierre Morel, 2023/04/25
- [PATCH v20 01/21] s390x/cpu topology: add s390 specifics to CPU topology, Pierre Morel, 2023/04/25
- [PATCH v20 12/21] qapi/s390x/cpu topology: query-cpu-polarization qmp command,
Pierre Morel <=
- [PATCH v20 20/21] tests/avocado: s390x cpu topology bad move, Pierre Morel, 2023/04/25
- [PATCH v20 03/21] target/s390x/cpu topology: handle STSI(15) and build the SYSIB, Pierre Morel, 2023/04/25
- [PATCH v20 05/21] s390x/cpu topology: resetting the Topology-Change-Report, Pierre Morel, 2023/04/25
- [PATCH v20 09/21] machine: adding s390 topology to query-cpu-fast, Pierre Morel, 2023/04/25
- [PATCH v20 21/21] tests/avocado: s390x cpu topology query-cpu-polarization, Pierre Morel, 2023/04/25
- [PATCH v20 13/21] docs/s390x/cpu topology: document s390x cpu topology, Pierre Morel, 2023/04/25
- [PATCH v20 19/21] tests/avocado: s390x cpu topology dedicated errors, Pierre Morel, 2023/04/25
- [PATCH v20 17/21] tests/avocado: s390x cpu topology test dedicated CPU, Pierre Morel, 2023/04/25