xref: /linux/arch/riscv/include/asm/perf_event.h (revision 7b541d557f705c7e5bcd874f3b960c8fb8dee562)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (C) 2018 SiFive
4  * Copyright (C) 2018 Andes Technology Corporation
5  *
6  */
7 
8 #ifndef _ASM_RISCV_PERF_EVENT_H
9 #define _ASM_RISCV_PERF_EVENT_H
10 
11 #ifdef CONFIG_PERF_EVENTS
12 #include <linux/perf_event.h>
13 extern unsigned long perf_instruction_pointer(struct pt_regs *regs);
14 extern unsigned long perf_misc_flags(struct pt_regs *regs);
15 #define perf_misc_flags(regs) perf_misc_flags(regs)
16 #define perf_arch_bpf_user_pt_regs(regs) (struct user_regs_struct *)regs
17 
18 #define perf_arch_fetch_caller_regs(regs, __ip) { \
19 	(regs)->epc = (__ip); \
20 	(regs)->s0 = (unsigned long) __builtin_frame_address(0); \
21 	(regs)->sp = current_stack_pointer; \
22 	(regs)->status = SR_PP; \
23 }
24 #endif
25 
26 #endif /* _ASM_RISCV_PERF_EVENT_H */
27