Skip to content

Commit 9dc6ce8

Browse files
atishp04palmer-dabbelt
authored andcommitted
RISC-V: Remove the current perf implementation
The current perf implementation in RISC-V is not very useful as it can not count any events other than cycle/instructions. Moreover, perf record can not be used or the events can not be started or stopped. Remove the implementation now for a better platform driver in future that will implement most of the missing functionality. Reviewed-by: Anup Patel <anup@brainfault.org> Signed-off-by: Atish Patra <atish.patra@wdc.com> Signed-off-by: Atish Patra <atishp@rivosinc.com> Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
1 parent a9b2026 commit 9dc6ce8

4 files changed

Lines changed: 0 additions & 571 deletions

File tree

arch/riscv/Kconfig

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -333,19 +333,6 @@ config RISCV_ISA_C
333333

334334
If you don't know what to do here, say Y.
335335

336-
menu "supported PMU type"
337-
depends on PERF_EVENTS
338-
339-
config RISCV_BASE_PMU
340-
bool "Base Performance Monitoring Unit"
341-
def_bool y
342-
help
343-
A base PMU that serves as a reference implementation and has limited
344-
feature of perf. It can run on any RISC-V machines so serves as the
345-
fallback, but this option can also be disable to reduce kernel size.
346-
347-
endmenu
348-
349336
config FPU
350337
bool "FPU support"
351338
default y

arch/riscv/include/asm/perf_event.h

Lines changed: 0 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -9,77 +9,5 @@
99
#define _ASM_RISCV_PERF_EVENT_H
1010

1111
#include <linux/perf_event.h>
12-
#include <linux/ptrace.h>
13-
#include <linux/interrupt.h>
14-
15-
#ifdef CONFIG_RISCV_BASE_PMU
16-
#define RISCV_BASE_COUNTERS 2
17-
18-
/*
19-
* The RISCV_MAX_COUNTERS parameter should be specified.
20-
*/
21-
22-
#define RISCV_MAX_COUNTERS 2
23-
24-
/*
25-
* These are the indexes of bits in counteren register *minus* 1,
26-
* except for cycle. It would be coherent if it can directly mapped
27-
* to counteren bit definition, but there is a *time* register at
28-
* counteren[1]. Per-cpu structure is scarce resource here.
29-
*
30-
* According to the spec, an implementation can support counter up to
31-
* mhpmcounter31, but many high-end processors has at most 6 general
32-
* PMCs, we give the definition to MHPMCOUNTER8 here.
33-
*/
34-
#define RISCV_PMU_CYCLE 0
35-
#define RISCV_PMU_INSTRET 1
36-
#define RISCV_PMU_MHPMCOUNTER3 2
37-
#define RISCV_PMU_MHPMCOUNTER4 3
38-
#define RISCV_PMU_MHPMCOUNTER5 4
39-
#define RISCV_PMU_MHPMCOUNTER6 5
40-
#define RISCV_PMU_MHPMCOUNTER7 6
41-
#define RISCV_PMU_MHPMCOUNTER8 7
42-
43-
#define RISCV_OP_UNSUPP (-EOPNOTSUPP)
44-
45-
struct cpu_hw_events {
46-
/* # currently enabled events*/
47-
int n_events;
48-
/* currently enabled events */
49-
struct perf_event *events[RISCV_MAX_COUNTERS];
50-
/* vendor-defined PMU data */
51-
void *platform;
52-
};
53-
54-
struct riscv_pmu {
55-
struct pmu *pmu;
56-
57-
/* generic hw/cache events table */
58-
const int *hw_events;
59-
const int (*cache_events)[PERF_COUNT_HW_CACHE_MAX]
60-
[PERF_COUNT_HW_CACHE_OP_MAX]
61-
[PERF_COUNT_HW_CACHE_RESULT_MAX];
62-
/* method used to map hw/cache events */
63-
int (*map_hw_event)(u64 config);
64-
int (*map_cache_event)(u64 config);
65-
66-
/* max generic hw events in map */
67-
int max_events;
68-
/* number total counters, 2(base) + x(general) */
69-
int num_counters;
70-
/* the width of the counter */
71-
int counter_width;
72-
73-
/* vendor-defined PMU features */
74-
void *platform;
75-
76-
irqreturn_t (*handle_irq)(int irq_num, void *dev);
77-
int irq;
78-
};
79-
80-
#endif
81-
#ifdef CONFIG_PERF_EVENTS
8212
#define perf_arch_bpf_user_pt_regs(regs) (struct user_regs_struct *)regs
83-
#endif
84-
8513
#endif /* _ASM_RISCV_PERF_EVENT_H */

arch/riscv/kernel/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ obj-$(CONFIG_MODULE_SECTIONS) += module-sections.o
5151
obj-$(CONFIG_FUNCTION_TRACER) += mcount.o ftrace.o
5252
obj-$(CONFIG_DYNAMIC_FTRACE) += mcount-dyn.o
5353

54-
obj-$(CONFIG_RISCV_BASE_PMU) += perf_event.o
5554
obj-$(CONFIG_PERF_EVENTS) += perf_callchain.o
5655
obj-$(CONFIG_HAVE_PERF_REGS) += perf_regs.o
5756
obj-$(CONFIG_RISCV_SBI) += sbi.o

0 commit comments

Comments
 (0)