diff mbox series

[v2] libbpf: add ARC support to bpf_tracing.h

Message ID 20220408224442.599566-1-geomatsi@gmail.com (mailing list archive)
State Accepted
Commit 0738599856542bab0ebcd73cab9d8f15bddedcee
Delegated to: BPF
Headers show
Series [v2] libbpf: add ARC support to bpf_tracing.h | expand

Checks

Context Check Description
bpf/vmtest-bpf-next-VM_Test-1 success Logs for Kernel LATEST on ubuntu-latest + selftests
bpf/vmtest-bpf-next-PR fail PR summary
bpf/vmtest-bpf-next-VM_Test-2 fail Logs for Kernel LATEST on z15 + selftests
netdev/tree_selection success Not a local patch

Commit Message

Sergey Matyukevich April 8, 2022, 10:44 p.m. UTC
From: Vladimir Isaev <isaev@synopsys.com>

Add PT_REGS macros suitable for ARCompact and ARCv2.

Signed-off-by: Vladimir Isaev <isaev@synopsys.com>
Signed-off-by: Sergey Matyukevich <geomatsi@gmail.com>

---

v1 -> v2
- according to request from Song Liu, added my SoB

 tools/include/uapi/asm/bpf_perf_event.h |  2 ++
 tools/lib/bpf/bpf_tracing.h             | 23 +++++++++++++++++++++++
 2 files changed, 25 insertions(+)

Comments

Song Liu April 9, 2022, 12:01 a.m. UTC | #1
On Fri, Apr 8, 2022 at 3:44 PM Sergey Matyukevich <geomatsi@gmail.com> wrote:
>
> From: Vladimir Isaev <isaev@synopsys.com>
>
> Add PT_REGS macros suitable for ARCompact and ARCv2.
>
> Signed-off-by: Vladimir Isaev <isaev@synopsys.com>
> Signed-off-by: Sergey Matyukevich <geomatsi@gmail.com>

Acked-by: Song Liu <songliubraving@fb.com>
patchwork-bot+netdevbpf@kernel.org April 11, 2022, 2 a.m. UTC | #2
Hello:

This patch was applied to bpf/bpf-next.git (master)
by Andrii Nakryiko <andrii@kernel.org>:

On Sat,  9 Apr 2022 01:44:42 +0300 you wrote:
> From: Vladimir Isaev <isaev@synopsys.com>
> 
> Add PT_REGS macros suitable for ARCompact and ARCv2.
> 
> Signed-off-by: Vladimir Isaev <isaev@synopsys.com>
> Signed-off-by: Sergey Matyukevich <geomatsi@gmail.com>
> 
> [...]

Here is the summary with links:
  - [v2] libbpf: add ARC support to bpf_tracing.h
    https://git.kernel.org/bpf/bpf-next/c/073859985654

You are awesome, thank you!
diff mbox series

Patch

diff --git a/tools/include/uapi/asm/bpf_perf_event.h b/tools/include/uapi/asm/bpf_perf_event.h
index 39acc149d843..d7dfeab0d71a 100644
--- a/tools/include/uapi/asm/bpf_perf_event.h
+++ b/tools/include/uapi/asm/bpf_perf_event.h
@@ -1,5 +1,7 @@ 
 #if defined(__aarch64__)
 #include "../../arch/arm64/include/uapi/asm/bpf_perf_event.h"
+#elif defined(__arc__)
+#include "../../arch/arc/include/uapi/asm/bpf_perf_event.h"
 #elif defined(__s390__)
 #include "../../arch/s390/include/uapi/asm/bpf_perf_event.h"
 #elif defined(__riscv)
diff --git a/tools/lib/bpf/bpf_tracing.h b/tools/lib/bpf/bpf_tracing.h
index e3a8c947e89f..01ce121c302d 100644
--- a/tools/lib/bpf/bpf_tracing.h
+++ b/tools/lib/bpf/bpf_tracing.h
@@ -27,6 +27,9 @@ 
 #elif defined(__TARGET_ARCH_riscv)
 	#define bpf_target_riscv
 	#define bpf_target_defined
+#elif defined(__TARGET_ARCH_arc)
+	#define bpf_target_arc
+	#define bpf_target_defined
 #else
 
 /* Fall back to what the compiler says */
@@ -54,6 +57,9 @@ 
 #elif defined(__riscv) && __riscv_xlen == 64
 	#define bpf_target_riscv
 	#define bpf_target_defined
+#elif defined(__arc__)
+	#define bpf_target_arc
+	#define bpf_target_defined
 #endif /* no compiler target */
 
 #endif
@@ -233,6 +239,23 @@  struct pt_regs___arm64 {
 /* riscv does not select ARCH_HAS_SYSCALL_WRAPPER. */
 #define PT_REGS_SYSCALL_REGS(ctx) ctx
 
+#elif defined(bpf_target_arc)
+
+/* arc provides struct user_pt_regs instead of struct pt_regs to userspace */
+#define __PT_REGS_CAST(x) ((const struct user_regs_struct *)(x))
+#define __PT_PARM1_REG scratch.r0
+#define __PT_PARM2_REG scratch.r1
+#define __PT_PARM3_REG scratch.r2
+#define __PT_PARM4_REG scratch.r3
+#define __PT_PARM5_REG scratch.r4
+#define __PT_RET_REG scratch.blink
+#define __PT_FP_REG __unsupported__
+#define __PT_RC_REG scratch.r0
+#define __PT_SP_REG scratch.sp
+#define __PT_IP_REG scratch.ret
+/* arc does not select ARCH_HAS_SYSCALL_WRAPPER. */
+#define PT_REGS_SYSCALL_REGS(ctx) ctx
+
 #endif
 
 #if defined(bpf_target_defined)