Skip to content

Commit 48084c3

Browse files
Kefeng Wangpalmer-dabbelt
authored andcommitted
riscv: perf: RISCV_BASE_PMU should be independent
Selecting PERF_EVENTS without selecting RISCV_BASE_PMU results in a build error. Signed-off-by: Kefeng Wang <[email protected]> [Palmer: commit text] Fixes: 178e9fc("perf: riscv: preliminary RISC-V support") Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent e7b146a commit 48084c3

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

arch/riscv/include/asm/perf_event.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,14 @@
1212
#include <linux/ptrace.h>
1313
#include <linux/interrupt.h>
1414

15+
#ifdef CONFIG_RISCV_BASE_PMU
1516
#define RISCV_BASE_COUNTERS 2
1617

1718
/*
1819
* The RISCV_MAX_COUNTERS parameter should be specified.
1920
*/
2021

21-
#ifdef CONFIG_RISCV_BASE_PMU
2222
#define RISCV_MAX_COUNTERS 2
23-
#endif
24-
25-
#ifndef RISCV_MAX_COUNTERS
26-
#error "Please provide a valid RISCV_MAX_COUNTERS for the PMU."
27-
#endif
2823

2924
/*
3025
* These are the indexes of bits in counteren register *minus* 1,
@@ -82,6 +77,7 @@ struct riscv_pmu {
8277
int irq;
8378
};
8479

80+
#endif
8581
#ifdef CONFIG_PERF_EVENTS
8682
#define perf_arch_bpf_user_pt_regs(regs) (struct user_regs_struct *)regs
8783
#endif

arch/riscv/kernel/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ obj-$(CONFIG_MODULE_SECTIONS) += module-sections.o
4343
obj-$(CONFIG_FUNCTION_TRACER) += mcount.o ftrace.o
4444
obj-$(CONFIG_DYNAMIC_FTRACE) += mcount-dyn.o
4545

46-
obj-$(CONFIG_PERF_EVENTS) += perf_event.o
46+
obj-$(CONFIG_RISCV_BASE_PMU) += perf_event.o
4747
obj-$(CONFIG_PERF_EVENTS) += perf_callchain.o
4848
obj-$(CONFIG_HAVE_PERF_REGS) += perf_regs.o
4949
obj-$(CONFIG_RISCV_SBI) += sbi.o

0 commit comments

Comments
 (0)