From 2428987cc06310f0e54abd4ce2efe3ed60f52245 Mon Sep 17 00:00:00 2001 From: Vincent Chen Date: Wed, 1 Dec 2021 17:45:42 -0800 Subject: lib: pmu: support the event ID encoded by a bitmap. RISC-V privilege specification does not specify how to encode the event ID. Therefore, each platform is allowed to customize its own encoding rule. The common encoding methods are as follow, directly assigning a number to an event, or every bit in the mphmevent CSR controls one specified event or mixes the above two methods. To enable OpenSBI to support the above three encoding methods simultaneously, this patch repurpose the dt property "riscv,raw-event-to-mhpmcounters". The "riscv,raw-event-to-mhpmcounters" will describes the one or multiple raw events that could be counted by a set of counters. But, the column number of "riscv,raw-event-to-mhpmcounters" is extended from 2 to 3. The 1st column (64bit) is the ID of the raw events. The 2nd column (64bit) represents a select_mask now to represent the bits used for event ID encoding. If a platform directly encodes each raw PMU event as a unique ID, the value of select_mask will be 0xffffffff_ffffffff. Signed-off-by: Vincent Chen Signed-off-by: Atish Patra Reviewed-by: Anup Patel --- include/sbi/sbi_pmu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/sbi/sbi_pmu.h b/include/sbi/sbi_pmu.h index f0185566..6a1c62cc 100644 --- a/include/sbi/sbi_pmu.h +++ b/include/sbi/sbi_pmu.h @@ -51,7 +51,7 @@ int sbi_pmu_add_hw_event_counter_map(u32 eidx_start, u32 eidx_end, u32 cmap); * @return 0 on success, error otherwise. */ -int sbi_pmu_add_raw_event_counter_map(uint64_t select, u32 cmap); +int sbi_pmu_add_raw_event_counter_map(uint64_t select, uint64_t select_mask, u32 cmap); int sbi_pmu_ctr_read(uint32_t cidx, unsigned long *cval); -- cgit v1.3.1