forked from Mirrors/opensbi
platform: andes: Add Andes custom PMU support
Before the ratification of Sscofpmf, the Andes PMU extension was designed to support the sampling and filtering with hardware performance counters (zihpm), it works with the current SBI PMU extension and Linux SBI PMU driver. We implement 1) the PMU device callbacks that update the corresponding bits on custom CSRs, 2) extentions_init() to detect the hardware support of Andes PMU and initialize the per-hart PMU related CSR, and 3) pmu_init() to register PMU device and populate event mappings. Also define a andes_pmu_setup() function which is in preparation for adding default PMU mappings in andes_hpm.h Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com> Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com> Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:

committed by
Anup Patel

parent
effd89aa05
commit
1b9e743c3d
12
platform/generic/include/andes/andes_hpm.h
Normal file
12
platform/generic/include/andes/andes_hpm.h
Normal file
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*
|
||||
* Copyright (c) 2023 Andes Technology Corporation
|
||||
*/
|
||||
|
||||
#ifndef _ANDES_HPM_H_
|
||||
#define _ANDES_HPM_H_
|
||||
|
||||
static inline int andes_pmu_setup(void) { return 0; }
|
||||
|
||||
#endif /* _ANDES_HPM_H_ */
|
34
platform/generic/include/andes/andes_pmu.h
Normal file
34
platform/generic/include/andes/andes_pmu.h
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*
|
||||
* Copyright (c) Copyright (c) 2023 Andes Technology Corporation
|
||||
*/
|
||||
|
||||
#ifndef _RISCV_ANDES_PMU_H
|
||||
#define _RISCV_ANDES_PMU_H
|
||||
|
||||
#include <sbi/sbi_hart.h>
|
||||
#include <sbi_utils/fdt/fdt_helper.h>
|
||||
#include <sbi_utils/fdt/fdt_pmu.h>
|
||||
|
||||
#ifdef CONFIG_ANDES_PMU
|
||||
|
||||
int andes_pmu_init(const struct fdt_match *match);
|
||||
int andes_pmu_extensions_init(const struct fdt_match *match,
|
||||
struct sbi_hart_features *hfeatures);
|
||||
|
||||
#else
|
||||
|
||||
static inline int andes_pmu_init(const struct fdt_match *match)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static inline int andes_pmu_extensions_init(const struct fdt_match *match,
|
||||
struct sbi_hart_features *hfeatures)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_ANDES_PMU */
|
||||
|
||||
#endif /* _RISCV_ANDES_PMU_H */
|
Reference in New Issue
Block a user