diff mbox series

[PATCH-for-9.0,03/16] target/arm/kvm: Have kvm_arm_add_vcpu_properties take a ARMCPU argument

Message ID 20231123183518.64569-4-philmd@linaro.org
State New
Headers show
Series target/arm/kvm: Unify kvm_arm_FOO() API | expand

Commit Message

Philippe Mathieu-Daudé Nov. 23, 2023, 6:35 p.m. UTC
Unify the "kvm_arm.h" API: All functions related to ARM vCPUs
take a ARMCPU* argument. Use the CPU() QOM cast macro When
calling the generic vCPU API from "sysemu/kvm.h".

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 target/arm/kvm_arm.h | 4 ++--
 target/arm/cpu.c     | 2 +-
 target/arm/kvm.c     | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

Comments

Gavin Shan Nov. 27, 2023, 4:05 a.m. UTC | #1
Hi Phil,

On 11/24/23 05:35, Philippe Mathieu-Daudé wrote:
> Unify the "kvm_arm.h" API: All functions related to ARM vCPUs
> take a ARMCPU* argument. Use the CPU() QOM cast macro When
> calling the generic vCPU API from "sysemu/kvm.h".
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   target/arm/kvm_arm.h | 4 ++--
>   target/arm/cpu.c     | 2 +-
>   target/arm/kvm.c     | 4 ++--
>   3 files changed, 5 insertions(+), 5 deletions(-)
> 

With the following comments resolved:

Reviewed-by: Gavin Shan <gshan@redhat.com>

> diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h
> index 50967f4ae9..6fb8a5f67e 100644
> --- a/target/arm/kvm_arm.h
> +++ b/target/arm/kvm_arm.h
> @@ -153,7 +153,7 @@ void kvm_arm_set_cpu_features_from_host(ARMCPU *cpu);
>    * Add all KVM specific CPU properties to the CPU object. These
>    * are the CPU properties with "kvm-" prefixed names.
>    */
> -void kvm_arm_add_vcpu_properties(Object *obj);
> +void kvm_arm_add_vcpu_properties(ARMCPU *cpu);
>   

The function's description needs to be modified since @obj has been
renamed to @cpu?

   /**
    * kvm_arm_add_vcpu_properties:
    * @obj: The CPU object to add the properties to
    *
    */

>   /**
>    * kvm_arm_steal_time_finalize:
> @@ -243,7 +243,7 @@ static inline void kvm_arm_set_cpu_features_from_host(ARMCPU *cpu)
>       g_assert_not_reached();
>   }
>   
> -static inline void kvm_arm_add_vcpu_properties(Object *obj)
> +static inline void kvm_arm_add_vcpu_properties(ARMCPU *cpu)
>   {
>       g_assert_not_reached();
>   }
> diff --git a/target/arm/cpu.c b/target/arm/cpu.c
> index 25e9d2ae7b..97081e0c70 100644
> --- a/target/arm/cpu.c
> +++ b/target/arm/cpu.c
> @@ -1686,7 +1686,7 @@ void arm_cpu_post_init(Object *obj)
>       }
>   
>       if (kvm_enabled()) {
> -        kvm_arm_add_vcpu_properties(obj);
> +        kvm_arm_add_vcpu_properties(cpu);
>       }
>   
>   #ifndef CONFIG_USER_ONLY
> diff --git a/target/arm/kvm.c b/target/arm/kvm.c
> index 6e3fea1879..03195f5627 100644
> --- a/target/arm/kvm.c
> +++ b/target/arm/kvm.c
> @@ -495,10 +495,10 @@ static void kvm_steal_time_set(Object *obj, bool value, Error **errp)
>   }
>   
>   /* KVM VCPU properties should be prefixed with "kvm-". */
> -void kvm_arm_add_vcpu_properties(Object *obj)
> +void kvm_arm_add_vcpu_properties(ARMCPU *cpu)
>   {
> -    ARMCPU *cpu = ARM_CPU(obj);
>       CPUARMState *env = &cpu->env;
> +    Object *obj = OBJECT(cpu);
>   
>       if (arm_feature(env, ARM_FEATURE_GENERIC_TIMER)) {
>           cpu->kvm_adjvtime = true;

Thanks,
Gavin
Philippe Mathieu-Daudé Nov. 28, 2023, 6:52 a.m. UTC | #2
On 27/11/23 05:05, Gavin Shan wrote:
> Hi Phil,
> 
> On 11/24/23 05:35, Philippe Mathieu-Daudé wrote:
>> Unify the "kvm_arm.h" API: All functions related to ARM vCPUs
>> take a ARMCPU* argument. Use the CPU() QOM cast macro When
>> calling the generic vCPU API from "sysemu/kvm.h".
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> ---
>>   target/arm/kvm_arm.h | 4 ++--
>>   target/arm/cpu.c     | 2 +-
>>   target/arm/kvm.c     | 4 ++--
>>   3 files changed, 5 insertions(+), 5 deletions(-)
>>
> 
> With the following comments resolved:
> 
> Reviewed-by: Gavin Shan <gshan@redhat.com>
> 
>> diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h
>> index 50967f4ae9..6fb8a5f67e 100644
>> --- a/target/arm/kvm_arm.h
>> +++ b/target/arm/kvm_arm.h
>> @@ -153,7 +153,7 @@ void kvm_arm_set_cpu_features_from_host(ARMCPU *cpu);
>>    * Add all KVM specific CPU properties to the CPU object. These
>>    * are the CPU properties with "kvm-" prefixed names.
>>    */
>> -void kvm_arm_add_vcpu_properties(Object *obj);
>> +void kvm_arm_add_vcpu_properties(ARMCPU *cpu);
> 
> The function's description needs to be modified since @obj has been
> renamed to @cpu?
> 
>    /**
>     * kvm_arm_add_vcpu_properties:
>     * @obj: The CPU object to add the properties to
>     *
>     */

Oops thanks!
diff mbox series

Patch

diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h
index 50967f4ae9..6fb8a5f67e 100644
--- a/target/arm/kvm_arm.h
+++ b/target/arm/kvm_arm.h
@@ -153,7 +153,7 @@  void kvm_arm_set_cpu_features_from_host(ARMCPU *cpu);
  * Add all KVM specific CPU properties to the CPU object. These
  * are the CPU properties with "kvm-" prefixed names.
  */
-void kvm_arm_add_vcpu_properties(Object *obj);
+void kvm_arm_add_vcpu_properties(ARMCPU *cpu);
 
 /**
  * kvm_arm_steal_time_finalize:
@@ -243,7 +243,7 @@  static inline void kvm_arm_set_cpu_features_from_host(ARMCPU *cpu)
     g_assert_not_reached();
 }
 
-static inline void kvm_arm_add_vcpu_properties(Object *obj)
+static inline void kvm_arm_add_vcpu_properties(ARMCPU *cpu)
 {
     g_assert_not_reached();
 }
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index 25e9d2ae7b..97081e0c70 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -1686,7 +1686,7 @@  void arm_cpu_post_init(Object *obj)
     }
 
     if (kvm_enabled()) {
-        kvm_arm_add_vcpu_properties(obj);
+        kvm_arm_add_vcpu_properties(cpu);
     }
 
 #ifndef CONFIG_USER_ONLY
diff --git a/target/arm/kvm.c b/target/arm/kvm.c
index 6e3fea1879..03195f5627 100644
--- a/target/arm/kvm.c
+++ b/target/arm/kvm.c
@@ -495,10 +495,10 @@  static void kvm_steal_time_set(Object *obj, bool value, Error **errp)
 }
 
 /* KVM VCPU properties should be prefixed with "kvm-". */
-void kvm_arm_add_vcpu_properties(Object *obj)
+void kvm_arm_add_vcpu_properties(ARMCPU *cpu)
 {
-    ARMCPU *cpu = ARM_CPU(obj);
     CPUARMState *env = &cpu->env;
+    Object *obj = OBJECT(cpu);
 
     if (arm_feature(env, ARM_FEATURE_GENERIC_TIMER)) {
         cpu->kvm_adjvtime = true;