[RFC PATCH 07/13] target/arm: Remove kvm test in arm_set_pmu

Richard Henderson posted 13 patches 1 month, 3 weeks ago
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, Cornelia Huck <cohuck@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Peter Maydell <peter.maydell@linaro.org>
[RFC PATCH 07/13] target/arm: Remove kvm test in arm_set_pmu
Posted by Richard Henderson 1 month, 3 weeks ago
In kvm_arm_get_host_cpu_features, we only set ARM_FEATURE_PMU if
kvm_arm_pmu_supported.  In arm_cpu_post_init we only register the
"pmu" property if ARM_FEATURE_PMU.  Therefore, if kvm is enabled,
we can only arrive in arm_set_pmu if kvm_arm_pmu_supported.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/arm/cpu.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index 7542444b18..16ce5f300d 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -1218,10 +1218,6 @@ static void arm_set_pmu(Object *obj, bool value, Error **errp)
     ARMCPU *cpu = ARM_CPU(obj);
 
     if (value) {
-        if (kvm_enabled() && !kvm_arm_pmu_supported()) {
-            error_setg(errp, "'pmu' feature not supported by KVM on this host");
-            return;
-        }
         set_feature(&cpu->env, ARM_FEATURE_PMU);
     } else {
         unset_feature(&cpu->env, ARM_FEATURE_PMU);
-- 
2.43.0
Re: [RFC PATCH 07/13] target/arm: Remove kvm test in arm_set_pmu
Posted by Peter Maydell 1 month, 2 weeks ago
On Mon, 16 Feb 2026 at 03:45, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> In kvm_arm_get_host_cpu_features, we only set ARM_FEATURE_PMU if
> kvm_arm_pmu_supported.  In arm_cpu_post_init we only register the
> "pmu" property if ARM_FEATURE_PMU.  Therefore, if kvm is enabled,
> we can only arrive in arm_set_pmu if kvm_arm_pmu_supported.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>  target/arm/cpu.c | 4 ----
>  1 file changed, 4 deletions(-)
>
> diff --git a/target/arm/cpu.c b/target/arm/cpu.c
> index 7542444b18..16ce5f300d 100644
> --- a/target/arm/cpu.c
> +++ b/target/arm/cpu.c
> @@ -1218,10 +1218,6 @@ static void arm_set_pmu(Object *obj, bool value, Error **errp)
>      ARMCPU *cpu = ARM_CPU(obj);
>
>      if (value) {
> -        if (kvm_enabled() && !kvm_arm_pmu_supported()) {
> -            error_setg(errp, "'pmu' feature not supported by KVM on this host");
> -            return;
> -        }
>          set_feature(&cpu->env, ARM_FEATURE_PMU);
>      } else {
>          unset_feature(&cpu->env, ARM_FEATURE_PMU);
> --
> 2.43.0
>

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM