[PATCH] lib/sbi_pmu: Don't fallback to fixed counters when sscofpmf && !smcntrpmf

Michael Ellerman mpe at kernel.org
Sun May 17 18:13:44 PDT 2026


On 11/5/2026 17:52, Anup Patel wrote:
> On Tue, Mar 24, 2026 at 5:59 PM Michael Ellerman <mpe at kernel.org> wrote:
>>
>> Currently when searching for a hardware counter for an event, if no
>> programmable counter is available, the code falls back to using a fixed
>> counter (mcycle/minstret) if one matches the event.
>>
>> However the fallback is incorrect when sscofpmf is present but
>> smcntrpmf is not. That's because with sscofpmf, programmable counters
>> support mode filtering, but the fixed counters do not (without
>> smcntrpmf). Even if the caller didn't configure mode filtering, by
>> default programmable counters don't count M mode when sscofpmf is
>> present, whereas mcycle/minstret do.
>>
>> Fix the logic to not fallback to a fixed counter if sscofpmf is present
>> but smcntrpmf is not.
>>
>> Signed-off-by: Michael Ellerman <mpe at kernel.org>
> 
> Fixes tag is missing but I will add this at the time of merging.

Thanks.

cheers



More information about the opensbi mailing list