[PATCH 2/5] lib: sbi_pmu: Remove redundant check for fw events

Anup Patel anup at brainfault.org
Sun Dec 1 20:28:38 PST 2024


On Wed, Nov 20, 2024 at 1:04 AM Atish Patra <atishp at rivosinc.com> wrote:
>
> The pmu_validate_event already has the same check for fw events.
> The validate function is called prior to the current function
> to find a counter for firmware. That's why, the redudant
> check can be removed from the find counter function.
>
> Signed-off-by: Atish Patra <atishp at rivosinc.com>

Applied this patch to the riscv/opensbi repo.

Thanks,
Anup

> ---
>  lib/sbi/sbi_pmu.c | 5 -----
>  1 file changed, 5 deletions(-)
>
> diff --git a/lib/sbi/sbi_pmu.c b/lib/sbi/sbi_pmu.c
> index 14d6a0da984c..1ed578bac23e 100644
> --- a/lib/sbi/sbi_pmu.c
> +++ b/lib/sbi/sbi_pmu.c
> @@ -796,11 +796,6 @@ static int pmu_ctr_find_fw(struct sbi_pmu_hart_state *phs,
>  {
>         int i, cidx;
>
> -       if ((event_code >= SBI_PMU_FW_MAX &&
> -           event_code <= SBI_PMU_FW_RESERVED_MAX) ||
> -           event_code > SBI_PMU_FW_PLATFORM)
> -               return SBI_EINVAL;
> -
>         for_each_set_bit(i, &cmask, BITS_PER_LONG) {
>                 cidx = i + cbase;
>                 if (cidx < num_hw_ctrs || total_ctrs <= cidx)
>
> --
> 2.34.1
>
>
> --
> opensbi mailing list
> opensbi at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi



More information about the opensbi mailing list