[PATCH v8 20/22] tools/perf: Add RISC-V CounterIDMask event field
Ian Rogers
irogers at google.com
Wed Jul 1 10:44:52 PDT 2026
On Wed, Jul 1, 2026 at 1:48 AM Atish Patra <atish.patra at linux.dev> wrote:
>
> From: Atish Patra <atishp at rivosinc.com>
>
> Counter delegation lets supervisor mode choose the hpmcounter for an event,
> but the hardware may only allow a given event on a subset of counters. Add
> a RISC-V specific "CounterIDMask" json event field, handled like the other
> arch-specific entries in event_fields[], that carries the allowed-counter
> bitmask through to the driver's existing counterid_mask (config2:0-31)
> format.
>
> The value is the bitmask directly so no counter-list to bitmask
> conversion is needed, and because the field is RISC-V specific it is a
> no-op for every other architecture's events (unlike the shared "Counter"
> field).
>
> Signed-off-by: Atish Patra <atishp at rivosinc.com>
Reviewed-by: Ian Rogers <irogers at google.com>
Thanks,
Ian
> ---
> tools/perf/pmu-events/jevents.py | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/tools/perf/pmu-events/jevents.py b/tools/perf/pmu-events/jevents.py
> index 0cf9d26315b3..516fb73886ed 100755
> --- a/tools/perf/pmu-events/jevents.py
> +++ b/tools/perf/pmu-events/jevents.py
> @@ -396,6 +396,7 @@ class JsonEvent:
> ('EnAllSlices', 'enallslices='),
> ('SliceId', 'sliceid='),
> ('ThreadMask', 'threadmask='),
> + ('CounterIDMask', 'counterid_mask='),
> ]
> for key, value in event_fields:
> if key in jd and not is_zero(jd[key]):
>
> --
> 2.53.0-Meta
>
More information about the linux-arm-kernel
mailing list