platform: generic: Introduce pmu_init() platform override

Add pmu_init() platform override, which will be used to register
PMU device and populate event mappings.

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
Reviewed-by: Atish Patra <atishp@rivosinc.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
Yu Chien Peter Lin 2023-11-30 20:42:04 +08:00 committed by Anup Patel
parent 51ec60c9ea
commit effd89aa05
2 changed files with 7 additions and 0 deletions

View file

@ -27,6 +27,7 @@ struct platform_override {
int (*fdt_fixup)(void *fdt, const struct fdt_match *match);
int (*extensions_init)(const struct fdt_match *match,
struct sbi_hart_features *hfeatures);
int (*pmu_init)(const struct fdt_match *match);
void (*fw_init)(void *fdt, const struct fdt_match *match);
int (*vendor_ext_provider)(long funcid,
const struct sbi_trap_regs *regs,

View file

@ -267,6 +267,12 @@ static int generic_pmu_init(void)
{
int rc;
if (generic_plat && generic_plat->pmu_init) {
rc = generic_plat->pmu_init(generic_plat_match);
if (rc)
return rc;
}
rc = fdt_pmu_setup(fdt_get_address());
if (rc && rc != SBI_ENOENT)
return rc;