diff mbox series

[v21,09/20] machine: adding s390 topology to query-cpu-fast

Message ID 20230630091752.67190-10-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
S390x provides two more topology attributes, entitlement and dedication.

Let's add these CPU attributes to the QAPI command query-cpu-fast.

Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
---
 qapi/machine.json  | 9 ++++++++-
 target/s390x/cpu.c | 4 ++++
 2 files changed, 12 insertions(+), 1 deletion(-)

Comments

Thomas Huth July 4, 2023, 12:55 p.m. UTC | #1
On 30/06/2023 11.17, Pierre Morel wrote:
> S390x provides two more topology attributes, entitlement and dedication.
> 
> Let's add these CPU attributes to the QAPI command query-cpu-fast.
> 
> Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
> ---
>   qapi/machine.json  | 9 ++++++++-
>   target/s390x/cpu.c | 4 ++++
>   2 files changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/qapi/machine.json b/qapi/machine.json
> index 08245beea1..a1920cb78d 100644
> --- a/qapi/machine.json
> +++ b/qapi/machine.json
> @@ -56,10 +56,17 @@
>   # Additional information about a virtual S390 CPU
>   #
>   # @cpu-state: the virtual CPU's state
> +# @dedicated: the virtual CPU's dedication (since 8.1)
> +# @entitlement: the virtual CPU's entitlement (since 8.1)
>   #
>   # Since: 2.12
>   ##
> -{ 'struct': 'CpuInfoS390', 'data': { 'cpu-state': 'CpuS390State' } }
> +{ 'struct': 'CpuInfoS390',
> +  'data': { 'cpu-state': 'CpuS390State',
> +            'dedicated': 'bool',
> +            'entitlement': 'CpuS390Entitlement'

Would it make sense to make them optional and only report those if the 
topology feature is enabled?

  Thomas


> +  }
> +}
>   
>   ##
>   # @CpuInfoFast:
> diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
> index 74405beb51..01938635eb 100644
> --- a/target/s390x/cpu.c
> +++ b/target/s390x/cpu.c
> @@ -146,6 +146,10 @@ static void s390_query_cpu_fast(CPUState *cpu, CpuInfoFast *value)
>       S390CPU *s390_cpu = S390_CPU(cpu);
>   
>       value->u.s390x.cpu_state = s390_cpu->env.cpu_state;
> +#if !defined(CONFIG_USER_ONLY)
> +    value->u.s390x.dedicated = s390_cpu->env.dedicated;
> +    value->u.s390x.entitlement = s390_cpu->env.entitlement;
> +#endif
>   }
>   
>   /* S390CPUClass::reset() */
Pierre Morel July 12, 2023, 3:44 p.m. UTC | #2
On 7/4/23 14:55, Thomas Huth wrote:
> On 30/06/2023 11.17, Pierre Morel wrote:
>> S390x provides two more topology attributes, entitlement and dedication.
>>
>> Let's add these CPU attributes to the QAPI command query-cpu-fast.
>>
>> Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
>> ---
>>   qapi/machine.json  | 9 ++++++++-
>>   target/s390x/cpu.c | 4 ++++
>>   2 files changed, 12 insertions(+), 1 deletion(-)
>>
>> diff --git a/qapi/machine.json b/qapi/machine.json
>> index 08245beea1..a1920cb78d 100644
>> --- a/qapi/machine.json
>> +++ b/qapi/machine.json
>> @@ -56,10 +56,17 @@
>>   # Additional information about a virtual S390 CPU
>>   #
>>   # @cpu-state: the virtual CPU's state
>> +# @dedicated: the virtual CPU's dedication (since 8.1)
>> +# @entitlement: the virtual CPU's entitlement (since 8.1)
>>   #
>>   # Since: 2.12
>>   ##
>> -{ 'struct': 'CpuInfoS390', 'data': { 'cpu-state': 'CpuS390State' } }
>> +{ 'struct': 'CpuInfoS390',
>> +  'data': { 'cpu-state': 'CpuS390State',
>> +            'dedicated': 'bool',
>> +            'entitlement': 'CpuS390Entitlement'
>
> Would it make sense to make them optional and only report those if the 
> topology feature is enabled?
>
>  Thomas
>
I think you are right, I make them optional, it has no sense if the 
architecture does support topology.

Thanks,

Pierre


>
>> +  }
>> +}
>>     ##
>>   # @CpuInfoFast:
>> diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
>> index 74405beb51..01938635eb 100644
>> --- a/target/s390x/cpu.c
>> +++ b/target/s390x/cpu.c
>> @@ -146,6 +146,10 @@ static void s390_query_cpu_fast(CPUState *cpu, 
>> CpuInfoFast *value)
>>       S390CPU *s390_cpu = S390_CPU(cpu);
>>         value->u.s390x.cpu_state = s390_cpu->env.cpu_state;
>> +#if !defined(CONFIG_USER_ONLY)
>> +    value->u.s390x.dedicated = s390_cpu->env.dedicated;
>> +    value->u.s390x.entitlement = s390_cpu->env.entitlement;
>> +#endif
>>   }
>>     /* S390CPUClass::reset() */
>
diff mbox series

Patch

diff --git a/qapi/machine.json b/qapi/machine.json
index 08245beea1..a1920cb78d 100644
--- a/qapi/machine.json
+++ b/qapi/machine.json
@@ -56,10 +56,17 @@ 
 # Additional information about a virtual S390 CPU
 #
 # @cpu-state: the virtual CPU's state
+# @dedicated: the virtual CPU's dedication (since 8.1)
+# @entitlement: the virtual CPU's entitlement (since 8.1)
 #
 # Since: 2.12
 ##
-{ 'struct': 'CpuInfoS390', 'data': { 'cpu-state': 'CpuS390State' } }
+{ 'struct': 'CpuInfoS390',
+  'data': { 'cpu-state': 'CpuS390State',
+            'dedicated': 'bool',
+            'entitlement': 'CpuS390Entitlement'
+  }
+}
 
 ##
 # @CpuInfoFast:
diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
index 74405beb51..01938635eb 100644
--- a/target/s390x/cpu.c
+++ b/target/s390x/cpu.c
@@ -146,6 +146,10 @@  static void s390_query_cpu_fast(CPUState *cpu, CpuInfoFast *value)
     S390CPU *s390_cpu = S390_CPU(cpu);
 
     value->u.s390x.cpu_state = s390_cpu->env.cpu_state;
+#if !defined(CONFIG_USER_ONLY)
+    value->u.s390x.dedicated = s390_cpu->env.dedicated;
+    value->u.s390x.entitlement = s390_cpu->env.entitlement;
+#endif
 }
 
 /* S390CPUClass::reset() */