• Rob Herring (Arm)'s avatar
    perf: arm_pmu: Remove event index to counter remapping · bf5ffc8c
    Rob Herring (Arm) authored
    Xscale and Armv6 PMUs defined the cycle counter at 0 and event counters
    starting at 1 and had 1:1 event index to counter numbering. On Armv7 and
    later, this changed the cycle counter to 31 and event counters start at
    0. The drivers for Armv7 and PMUv3 kept the old event index numbering
    and introduced an event index to counter conversion. The conversion uses
    masking to convert from event index to a counter number. This operation
    relies on having at most 32 counters so that the cycle counter index 0
    can be transformed to counter number 31.
    
    Armv9.4 adds support for an additional fixed function counter
    (instructions) which increases possible counters to more than 32, and
    the conversion won't work anymore as a simple subtract and mask. The
    primary reason for the translation (other than history) seems to be to
    have a contiguous mask of counters 0-N. Keeping that would result in
    more complicated index to counter conversions. Instead, store a mask of
    available counters rather than just number of events. That provides more
    information in addition to the number of events.
    
    No (intended) functional changes.
    Acked-by: default avatarMark Rutland <mark.rutland@arm.com>
    Signed-off-by: default avatarRob Herring (Arm) <robh@kernel.org>
    Tested-by: default avatarJames Clark <james.clark@linaro.org>
    Link: https://lore.kernel.org/r/20240731-arm-pmu-3-9-icntr-v3-1-280a8d7ff465@kernel.orgSigned-off-by: default avatarWill Deacon <will@kernel.org>
    bf5ffc8c
arm_xscale_pmu.c 18.9 KB