[PATCH v3 4/4] lib: sbi: Fix fw_event_map initialization

Anup Patel anup at brainfault.org
Sat Jul 30 03:25:48 PDT 2022


On Thu, Jul 21, 2022 at 3:20 AM Atish Patra <atishp at rivosinc.com> wrote:
>
> fw_event_map represents array of firmware events. It should initialized
> for maximum number of firmware events not counters.
>
> Reviewed-by: Andrew Jones <ajones at ventanamicro.com>
> Signed-off-by: Atish Patra <atishp at rivosinc.com>

Looks good to me.

Reviewed-by: Anup Patel <anup at brainfault.org>

Applied this patch to the riscv/opensbi repo.

Thanks,
Anup

> ---
>  lib/sbi/sbi_pmu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/sbi/sbi_pmu.c b/lib/sbi/sbi_pmu.c
> index ae3c00374058..b4342971bcf1 100644
> --- a/lib/sbi/sbi_pmu.c
> +++ b/lib/sbi/sbi_pmu.c
> @@ -764,7 +764,7 @@ static void pmu_reset_event_map(u32 hartid)
>         /* Initialize the counter to event mapping table */
>         for (j = 3; j < total_ctrs; j++)
>                 active_events[hartid][j] = SBI_PMU_EVENT_IDX_INVALID;
> -       for (j = 0; j < SBI_PMU_FW_CTR_MAX; j++)
> +       for (j = 0; j < SBI_PMU_FW_EVENT_MAX; j++)
>                 sbi_memset(&fw_event_map[hartid][j], 0,
>                            sizeof(struct sbi_pmu_fw_event));
>  }
> --
> 2.25.1
>



More information about the opensbi mailing list