ARC: bpf: define uapi for BPF_PROG_TYPE_PERF_EVENT program type
authorSergey Matyukevich <sergey.matyukevich@synopsys.com>
Thu, 14 Apr 2022 08:11:26 +0000 (11:11 +0300)
committerVineet Gupta <vgupta@kernel.org>
Tue, 26 Apr 2022 16:35:28 +0000 (09:35 -0700)
Define appropriate uapi for the BPF_PROG_TYPE_PERF_EVENT program type
by exporting the user_regs_struct structure instead of the pt_regs
structure that is in-kernel only.

Signed-off-by: Sergey Matyukevich <sergey.matyukevich@synopsys.com>
Signed-off-by: Vineet Gupta <vgupta@kernel.org>
arch/arc/include/asm/perf_event.h
arch/arc/include/uapi/asm/bpf_perf_event.h [new file with mode: 0644]

index 4c919c0f4b305ec8bc3127d2b4cf66d3f7881c84..d5719a260864c999862a2d0f38429153b6321f4e 100644 (file)
@@ -63,4 +63,8 @@ struct arc_reg_cc_build {
 
 #define PERF_COUNT_ARC_HW_MAX  (PERF_COUNT_HW_MAX + 8)
 
+#ifdef CONFIG_PERF_EVENTS
+#define perf_arch_bpf_user_pt_regs(regs) (struct user_regs_struct *)regs
+#endif
+
 #endif /* __ASM_PERF_EVENT_H */
diff --git a/arch/arc/include/uapi/asm/bpf_perf_event.h b/arch/arc/include/uapi/asm/bpf_perf_event.h
new file mode 100644 (file)
index 0000000..6cb1c28
--- /dev/null
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+#ifndef _UAPI__ASM_BPF_PERF_EVENT_H__
+#define _UAPI__ASM_BPF_PERF_EVENT_H__
+
+#include <asm/ptrace.h>
+
+typedef struct user_regs_struct bpf_user_pt_regs_t;
+
+#endif /* _UAPI__ASM_BPF_PERF_EVENT_H__ */