diff mbox series

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

Message ID 20230630091752.67190-13-pmorel@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series s390x: CPU Topology | expand

Commit Message

Pierre Morel June 30, 2023, 9:17 a.m. UTC
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 | 29 +++++++++++++++++++++++++++++
 hw/s390x/cpu-topology.c  |  8 ++++++++
 2 files changed, 37 insertions(+)

Comments

Thomas Huth July 5, 2023, 7:58 a.m. UTC | #1
On 30/06/2023 11.17, Pierre Morel wrote:
> 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 | 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 1362e43983..1e4b8976aa 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.1
> +##
> +{ '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',

Since this is very specific to s390x, I wonder whether we want to have a 
"s390x" in the command name? 'query-s390x-cpu-polarization'? ... or is this 
getting too long already?

Anyway,
Reviewed-by: Thomas Huth <thuth@redhat.com>
Pierre Morel July 12, 2023, 4:12 p.m. UTC | #2
On 7/5/23 09:58, Thomas Huth wrote:
> On 30/06/2023 11.17, Pierre Morel wrote:
>> 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 | 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 1362e43983..1e4b8976aa 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.1
>> +##
>> +{ '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',
>
> Since this is very specific to s390x, I wonder whether we want to have 
> a "s390x" in the command name? 'query-s390x-cpu-polarization'? ... or 
> is this getting too long already?
>
> Anyway,
> Reviewed-by: Thomas Huth <thuth@redhat.com>
>
I do not know.I prefer short commands but the interface will mostly be 
used by a program, so...

I let it like that unless there is more pressure to change it.

Thanks,

Pierre
Nina Schoetterl-Glausch July 26, 2023, 11:54 a.m. UTC | #3
On Fri, 2023-06-30 at 11:17 +0200, Pierre Morel wrote:
> 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: Nina Schoetterl-Glausch <nsg@linux.ibm.com>

[...]
diff mbox series

Patch

diff --git a/qapi/machine-target.json b/qapi/machine-target.json
index 1362e43983..1e4b8976aa 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.1
+##
+{ '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 69f31db4af..4f08bdeb2f 100644
--- a/hw/s390x/cpu-topology.c
+++ b/hw/s390x/cpu-topology.c
@@ -465,3 +465,11 @@  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);
+
+    info->polarization = s390_topology.polarization;
+    return info;
+}