diff mbox series

[18/21] target/arm/kvm: Init cap_has_inject_serror_esr in kvm_arch_init

Message ID 20231123044219.896776-19-richard.henderson@linaro.org
State New
Headers show
Series target/arm: kvm cleanups | expand

Commit Message

Richard Henderson Nov. 23, 2023, 4:42 a.m. UTC
There is no need to do this in kvm_arch_init_vcpu per vcpu.
Inline kvm_arm_init_serror_injection rather than keep separate.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/arm/kvm_arm.h |  8 --------
 target/arm/kvm.c     | 13 ++++---------
 2 files changed, 4 insertions(+), 17 deletions(-)

Comments

Philippe Mathieu-Daudé Nov. 24, 2023, 11:49 a.m. UTC | #1
On 23/11/23 05:42, Richard Henderson wrote:
> There is no need to do this in kvm_arch_init_vcpu per vcpu.
> Inline kvm_arm_init_serror_injection rather than keep separate.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   target/arm/kvm_arm.h |  8 --------
>   target/arm/kvm.c     | 13 ++++---------
>   2 files changed, 4 insertions(+), 17 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Philippe Mathieu-Daudé Nov. 24, 2023, 11:54 a.m. UTC | #2
On 23/11/23 05:42, Richard Henderson wrote:
> There is no need to do this in kvm_arch_init_vcpu per vcpu.
> Inline kvm_arm_init_serror_injection rather than keep separate.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   target/arm/kvm_arm.h |  8 --------
>   target/arm/kvm.c     | 13 ++++---------
>   2 files changed, 4 insertions(+), 17 deletions(-)


> @@ -562,6 +556,10 @@ int kvm_arch_init(MachineState *ms, KVMState *s)
>   
>       cap_has_mp_state = kvm_check_extension(s, KVM_CAP_MP_STATE);
>   
> +    /* Check whether user space can specify guest syndrome value */
> +    cap_has_inject_serror_esr =
> +        kvm_check_extension(s, KVM_CAP_ARM_INJECT_SERROR_ESR);
> +
>       if (ms->smp.cpus > 256 &&
>           !kvm_check_extension(s, KVM_CAP_ARM_IRQ_LINE_LAYOUT_2)) {
>           error_report("Using more than 256 vcpus requires a host kernel "
> @@ -1948,9 +1946,6 @@ int kvm_arch_init_vcpu(CPUState *cs)
>       }
>       cpu->mp_affinity = mpidr & ARM64_AFFINITY_MASK;
>   
> -    /* Check whether user space can specify guest syndrome value */
> -    kvm_arm_init_serror_injection(cs);
> -
>       return kvm_arm_init_cpreg_list(cpu);
>   }


Just checking, in a heterogeneous setup we still want to keep
these 2 calls per-vCPU, right?

     if (kvm_check_extension(cs->kvm_state, KVM_CAP_ARM_PSCI_0_2)) {
         cpu->psci_version = QEMU_PSCI_VERSION_0_2;
         cpu->kvm_init_features[0] |= 1 << KVM_ARM_VCPU_PSCI_0_2;
     }

     if (!kvm_check_extension(cs->kvm_state, KVM_CAP_ARM_PMU_V3)) {
         cpu->has_pmu = false;
     }
Gavin Shan Nov. 27, 2023, 12:21 a.m. UTC | #3
On 11/23/23 15:42, Richard Henderson wrote:
> There is no need to do this in kvm_arch_init_vcpu per vcpu.
> Inline kvm_arm_init_serror_injection rather than keep separate.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   target/arm/kvm_arm.h |  8 --------
>   target/arm/kvm.c     | 13 ++++---------
>   2 files changed, 4 insertions(+), 17 deletions(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>
Richard Henderson Dec. 11, 2023, 5:09 p.m. UTC | #4
On 11/24/23 03:54, Philippe Mathieu-Daudé wrote:
> On 23/11/23 05:42, Richard Henderson wrote:
>> There is no need to do this in kvm_arch_init_vcpu per vcpu.
>> Inline kvm_arm_init_serror_injection rather than keep separate.
>>
>> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
>> ---
>>   target/arm/kvm_arm.h |  8 --------
>>   target/arm/kvm.c     | 13 ++++---------
>>   2 files changed, 4 insertions(+), 17 deletions(-)
> 
> 
>> @@ -562,6 +556,10 @@ int kvm_arch_init(MachineState *ms, KVMState *s)
>>       cap_has_mp_state = kvm_check_extension(s, KVM_CAP_MP_STATE);
>> +    /* Check whether user space can specify guest syndrome value */
>> +    cap_has_inject_serror_esr =
>> +        kvm_check_extension(s, KVM_CAP_ARM_INJECT_SERROR_ESR);
>> +
>>       if (ms->smp.cpus > 256 &&
>>           !kvm_check_extension(s, KVM_CAP_ARM_IRQ_LINE_LAYOUT_2)) {
>>           error_report("Using more than 256 vcpus requires a host kernel "
>> @@ -1948,9 +1946,6 @@ int kvm_arch_init_vcpu(CPUState *cs)
>>       }
>>       cpu->mp_affinity = mpidr & ARM64_AFFINITY_MASK;
>> -    /* Check whether user space can specify guest syndrome value */
>> -    kvm_arm_init_serror_injection(cs);
>> -
>>       return kvm_arm_init_cpreg_list(cpu);
>>   }
> 
> 
> Just checking, in a heterogeneous setup we still want to keep
> these 2 calls per-vCPU, right?

There is no hetrogeneous kvm -- every vcpu must match the host cpu.


r~


>      if (kvm_check_extension(cs->kvm_state, KVM_CAP_ARM_PSCI_0_2)) {
>          cpu->psci_version = QEMU_PSCI_VERSION_0_2;
>          cpu->kvm_init_features[0] |= 1 << KVM_ARM_VCPU_PSCI_0_2;
>      }
> 
>      if (!kvm_check_extension(cs->kvm_state, KVM_CAP_ARM_PMU_V3)) {
>          cpu->has_pmu = false;
>      }
Philippe Mathieu-Daudé Dec. 11, 2023, 6:43 p.m. UTC | #5
On 11/12/23 18:09, Richard Henderson wrote:
> On 11/24/23 03:54, Philippe Mathieu-Daudé wrote:
>> On 23/11/23 05:42, Richard Henderson wrote:
>>> There is no need to do this in kvm_arch_init_vcpu per vcpu.
>>> Inline kvm_arm_init_serror_injection rather than keep separate.
>>>
>>> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
>>> ---
>>>   target/arm/kvm_arm.h |  8 --------
>>>   target/arm/kvm.c     | 13 ++++---------
>>>   2 files changed, 4 insertions(+), 17 deletions(-)
>>
>>
>>> @@ -562,6 +556,10 @@ int kvm_arch_init(MachineState *ms, KVMState *s)
>>>       cap_has_mp_state = kvm_check_extension(s, KVM_CAP_MP_STATE);
>>> +    /* Check whether user space can specify guest syndrome value */
>>> +    cap_has_inject_serror_esr =
>>> +        kvm_check_extension(s, KVM_CAP_ARM_INJECT_SERROR_ESR);
>>> +
>>>       if (ms->smp.cpus > 256 &&
>>>           !kvm_check_extension(s, KVM_CAP_ARM_IRQ_LINE_LAYOUT_2)) {
>>>           error_report("Using more than 256 vcpus requires a host 
>>> kernel "
>>> @@ -1948,9 +1946,6 @@ int kvm_arch_init_vcpu(CPUState *cs)
>>>       }
>>>       cpu->mp_affinity = mpidr & ARM64_AFFINITY_MASK;
>>> -    /* Check whether user space can specify guest syndrome value */
>>> -    kvm_arm_init_serror_injection(cs);
>>> -
>>>       return kvm_arm_init_cpreg_list(cpu);
>>>   }
>>
>>
>> Just checking, in a heterogeneous setup we still want to keep
>> these 2 calls per-vCPU, right?
> 
> There is no hetrogeneous kvm -- every vcpu must match the host cpu.

So big.LITTLE will never be a KVM thing?
Richard Henderson Dec. 11, 2023, 6:58 p.m. UTC | #6
On 12/11/23 10:43, Philippe Mathieu-Daudé wrote:
> On 11/12/23 18:09, Richard Henderson wrote:
>> On 11/24/23 03:54, Philippe Mathieu-Daudé wrote:
>>> On 23/11/23 05:42, Richard Henderson wrote:
>>>> There is no need to do this in kvm_arch_init_vcpu per vcpu.
>>>> Inline kvm_arm_init_serror_injection rather than keep separate.
>>>>
>>>> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
>>>> ---
>>>>   target/arm/kvm_arm.h |  8 --------
>>>>   target/arm/kvm.c     | 13 ++++---------
>>>>   2 files changed, 4 insertions(+), 17 deletions(-)
>>>
>>>
>>>> @@ -562,6 +556,10 @@ int kvm_arch_init(MachineState *ms, KVMState *s)
>>>>       cap_has_mp_state = kvm_check_extension(s, KVM_CAP_MP_STATE);
>>>> +    /* Check whether user space can specify guest syndrome value */
>>>> +    cap_has_inject_serror_esr =
>>>> +        kvm_check_extension(s, KVM_CAP_ARM_INJECT_SERROR_ESR);
>>>> +
>>>>       if (ms->smp.cpus > 256 &&
>>>>           !kvm_check_extension(s, KVM_CAP_ARM_IRQ_LINE_LAYOUT_2)) {
>>>>           error_report("Using more than 256 vcpus requires a host kernel "
>>>> @@ -1948,9 +1946,6 @@ int kvm_arch_init_vcpu(CPUState *cs)
>>>>       }
>>>>       cpu->mp_affinity = mpidr & ARM64_AFFINITY_MASK;
>>>> -    /* Check whether user space can specify guest syndrome value */
>>>> -    kvm_arm_init_serror_injection(cs);
>>>> -
>>>>       return kvm_arm_init_cpreg_list(cpu);
>>>>   }
>>>
>>>
>>> Just checking, in a heterogeneous setup we still want to keep
>>> these 2 calls per-vCPU, right?
>>
>> There is no hetrogeneous kvm -- every vcpu must match the host cpu.
> 
> So big.LITTLE will never be a KVM thing?

Not as far as I'm aware.  There are even issues *running* on big.LITTLE hosts -- you must 
use taskset to limit qemu to one cpu type, either big or little.


r~
diff mbox series

Patch

diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h
index 350ba6cb96..1ec2476de7 100644
--- a/target/arm/kvm_arm.h
+++ b/target/arm/kvm_arm.h
@@ -98,14 +98,6 @@  void kvm_arm_cpu_post_load(ARMCPU *cpu);
  */
 void kvm_arm_reset_vcpu(ARMCPU *cpu);
 
-/**
- * kvm_arm_init_serror_injection:
- * @cs: CPUState
- *
- * Check whether KVM can set guest SError syndrome.
- */
-void kvm_arm_init_serror_injection(CPUState *cs);
-
 /**
  * kvm_get_vcpu_events:
  * @cpu: ARMCPU
diff --git a/target/arm/kvm.c b/target/arm/kvm.c
index bc4ba7628b..3250919273 100644
--- a/target/arm/kvm.c
+++ b/target/arm/kvm.c
@@ -96,12 +96,6 @@  static int kvm_arm_vcpu_finalize(CPUState *cs, int feature)
     return kvm_vcpu_ioctl(cs, KVM_ARM_VCPU_FINALIZE, &feature);
 }
 
-void kvm_arm_init_serror_injection(CPUState *cs)
-{
-    cap_has_inject_serror_esr = kvm_check_extension(cs->kvm_state,
-                                    KVM_CAP_ARM_INJECT_SERROR_ESR);
-}
-
 bool kvm_arm_create_scratch_host_vcpu(const uint32_t *cpus_to_try,
                                       int *fdarray,
                                       struct kvm_vcpu_init *init)
@@ -562,6 +556,10 @@  int kvm_arch_init(MachineState *ms, KVMState *s)
 
     cap_has_mp_state = kvm_check_extension(s, KVM_CAP_MP_STATE);
 
+    /* Check whether user space can specify guest syndrome value */
+    cap_has_inject_serror_esr =
+        kvm_check_extension(s, KVM_CAP_ARM_INJECT_SERROR_ESR);
+
     if (ms->smp.cpus > 256 &&
         !kvm_check_extension(s, KVM_CAP_ARM_IRQ_LINE_LAYOUT_2)) {
         error_report("Using more than 256 vcpus requires a host kernel "
@@ -1948,9 +1946,6 @@  int kvm_arch_init_vcpu(CPUState *cs)
     }
     cpu->mp_affinity = mpidr & ARM64_AFFINITY_MASK;
 
-    /* Check whether user space can specify guest syndrome value */
-    kvm_arm_init_serror_injection(cs);
-
     return kvm_arm_init_cpreg_list(cpu);
 }