diff mbox series

[v23,12/20] qapi/s390x/cpu topology: query-cpu-polarization qmp command

Message ID 20230914120650.1318932-13-nsg@linux.ibm.com
State New
Headers show
Series s390x: CPU Topology | expand

Commit Message

Nina Schoetterl-Glausch Sept. 14, 2023, 12:06 p.m. UTC
From: Pierre Morel <pmorel@linux.ibm.com>

The query-cpu-polarization qmp command returns the current
CPU polarization of the machine.

Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
Co-developed-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
Signed-off-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
---
 qapi/machine-target.json | 29 +++++++++++++++++++++++++++++
 hw/s390x/cpu-topology.c  |  8 ++++++++
 2 files changed, 37 insertions(+)

Comments

Markus Armbruster Sept. 20, 2023, 11:51 a.m. UTC | #1
Nina Schoetterl-Glausch <nsg@linux.ibm.com> writes:

> From: Pierre Morel <pmorel@linux.ibm.com>
>
> The query-cpu-polarization qmp command returns the current
> CPU polarization of the machine.
>
> Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
> Reviewed-by: Thomas Huth <thuth@redhat.com>
> Reviewed-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
> Co-developed-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
> Signed-off-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
> ---
>  qapi/machine-target.json | 29 +++++++++++++++++++++++++++++
>  hw/s390x/cpu-topology.c  |  8 ++++++++
>  2 files changed, 37 insertions(+)
>
> diff --git a/qapi/machine-target.json b/qapi/machine-target.json
> index 276c3bf9d1..58ba28a868 100644
> --- a/qapi/machine-target.json
> +++ b/qapi/machine-target.json
> @@ -445,3 +445,32 @@
>    'features': [ 'unstable' ],
>    'if': { 'all': [ 'TARGET_S390X', 'CONFIG_KVM' ] }
>  }
> +
> +##
> +# @CpuPolarizationInfo:
> +#
> +# The result of a cpu polarization

CPU polarization

End the sentence with a period, please.

> +#
> +# @polarization: the CPU polarization
> +#
> +# Since: 8.2
> +##
> +{ 'struct': 'CpuPolarizationInfo',
> +  'data': { 'polarization': 'CpuS390Polarization' },
> +  'if': { 'all': [ 'TARGET_S390X', 'CONFIG_KVM' ] }
> +}
> +
> +##
> +# @query-s390x-cpu-polarization:
> +#
> +# Features:

Blank line, please.

> +# @unstable: This command may still be modified.

Make this

   # @unstable: This command is experimental.

> +#
> +# Returns: the machine polarization

The CPU polarization, I presume?

> +#
> +# Since: 8.2
> +##
> +{ 'command': 'query-s390x-cpu-polarization', 'returns': 'CpuPolarizationInfo',
> +  'features': [ 'unstable' ],
> +  'if': { 'all': [ 'TARGET_S390X', 'CONFIG_KVM' ] }
> +}

[...]
diff mbox series

Patch

diff --git a/qapi/machine-target.json b/qapi/machine-target.json
index 276c3bf9d1..58ba28a868 100644
--- a/qapi/machine-target.json
+++ b/qapi/machine-target.json
@@ -445,3 +445,32 @@ 
   'features': [ 'unstable' ],
   'if': { 'all': [ 'TARGET_S390X', 'CONFIG_KVM' ] }
 }
+
+##
+# @CpuPolarizationInfo:
+#
+# The result of a cpu polarization
+#
+# @polarization: the CPU polarization
+#
+# Since: 8.2
+##
+{ 'struct': 'CpuPolarizationInfo',
+  'data': { 'polarization': 'CpuS390Polarization' },
+  'if': { 'all': [ 'TARGET_S390X', 'CONFIG_KVM' ] }
+}
+
+##
+# @query-s390x-cpu-polarization:
+#
+# Features:
+# @unstable: This command may still be modified.
+#
+# Returns: the machine polarization
+#
+# Since: 8.2
+##
+{ 'command': 'query-s390x-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 18274db74c..1561a8ab44 100644
--- a/hw/s390x/cpu-topology.c
+++ b/hw/s390x/cpu-topology.c
@@ -459,3 +459,11 @@  void qmp_set_cpu_topology(uint16_t core,
                          has_drawer, drawer, has_entitlement, entitlement,
                          has_dedicated, dedicated, errp);
 }
+
+CpuPolarizationInfo *qmp_query_s390x_cpu_polarization(Error **errp)
+{
+    CpuPolarizationInfo *info = g_new0(CpuPolarizationInfo, 1);
+
+    info->polarization = s390_topology.polarization;
+    return info;
+}