[PATCH 1/2] KVM: arm64: PMU: Introduce pmu_v3_is_supported() helper

Oliver Upton oliver.upton at linux.dev
Sat Jun 10 18:10:48 PDT 2023


On Fri, Jun 09, 2023 at 11:15:19PM -0700, Reiji Watanabe wrote:
> Introduce pmu_v3_is_supported() helper to check if the given
> PMUVer supports PMUv3, and use it instead of open coding it.
> 
> Signed-off-by: Reiji Watanabe <reijiw at google.com>
> ---
>  arch/arm64/kvm/pmu-emul.c | 3 +--
>  arch/arm64/kvm/sys_regs.c | 2 +-
>  include/kvm/arm_pmu.h     | 8 ++++++++
>  3 files changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm64/kvm/pmu-emul.c b/arch/arm64/kvm/pmu-emul.c
> index 491ca7eb2a4c..5d2903f52a5f 100644
> --- a/arch/arm64/kvm/pmu-emul.c
> +++ b/arch/arm64/kvm/pmu-emul.c
> @@ -672,8 +672,7 @@ void kvm_host_pmu_init(struct arm_pmu *pmu)
>  {
>  	struct arm_pmu_entry *entry;
>  
> -	if (pmu->pmuver == ID_AA64DFR0_EL1_PMUVer_NI ||
> -	    pmu->pmuver == ID_AA64DFR0_EL1_PMUVer_IMP_DEF)
> +	if (!pmu_v3_is_supported(pmu->pmuver))
>  		return;

Why not use pmuv3_implemented()?

--
Thanks,
Oliver



More information about the linux-arm-kernel mailing list