Re: [PATCH] arm64/boot: Don't set PMUv3p9 FGT2 bits without PMUv3

From: Will Deacon

Date: Fri Oct 02 2026 - 09:30:21 EST


On Wed, Sep 30, 2026 at 01:12:12PM +0100, Fuad Tabba wrote:
> On a CPU with FGT2 and an IMPLEMENTATION DEFINED PMU (PMUVer 0b1111),
> __init_el2_fgt2 sets the PMUv3p9 bits in HDFGRTR2_EL2 and HDFGWTR2_EL2,
> which are RES0 there. The macro only checks that PMUVer is at least
> PMUv3p9, and 0b1111 passes.
>
> Exclude 0b1111 before the compare, as __init_el2_debug does.
>
> Fixes: 858c7bfcb35e1 ("arm64/boot: Enable EL2 requirements for FEAT_PMUv3p9")
> Signed-off-by: Fuad Tabba <fuad.tabba@xxxxxxxxx>
> ---
> arch/arm64/include/asm/el2_setup.h | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm64/include/asm/el2_setup.h b/arch/arm64/include/asm/el2_setup.h
> index 87560d8b254e6..1da277baacf78 100644
> --- a/arch/arm64/include/asm/el2_setup.h
> +++ b/arch/arm64/include/asm/el2_setup.h
> @@ -421,8 +421,9 @@
> mov x2, xzr
> mrs x1, id_aa64dfr0_el1
> ubfx x1, x1, #ID_AA64DFR0_EL1_PMUVer_SHIFT, #4
> - cmp x1, #ID_AA64DFR0_EL1_PMUVer_V3P9
> - b.lt .Lskip_pmuv3p9_\@
> + cmp x1, #ID_AA64DFR0_EL1_PMUVer_IMP_DEF
> + ccmp x1, #ID_AA64DFR0_EL1_PMUVer_V3P9, #8, ne
> + b.lt .Lskip_pmuv3p9_\@ // Skip if < PMUv3p9 or IMP_DEF

Are you sure #8 is the correct immediate for the ccmp? My reading of the
pseudocode is that it should be #9, but this instruction has always confused
me and I hate the fact that it doesn't take another condition code mnemonic
instead of a raw immediate value.

Will