Re: [PATCH v8 20/22] tools/perf: Add RISC-V CounterIDMask event field

From: Ian Rogers

Date: Wed Jul 01 2026 - 13:49:30 EST


On Wed, Jul 1, 2026 at 1:48 AM Atish Patra <atish.patra@xxxxxxxxx> wrote:
>
> From: Atish Patra <atishp@xxxxxxxxxxxx>
>
> 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@xxxxxxxxxxxx>

Reviewed-by: Ian Rogers <irogers@xxxxxxxxxx>

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
>