BPF List
 help / color / mirror / Atom feed
* [PATCH] libbpf: add ARC support to bpf_tracing.h
@ 2022-04-08 15:38 Sergey Matyukevich
  2022-04-08 19:51 ` Song Liu
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Sergey Matyukevich @ 2022-04-08 15:38 UTC (permalink / raw)
  To: bpf; +Cc: Vladimir Isaev, Vineet Gupta

From: Vladimir Isaev <isaev@synopsys.com>

Add PT_REGS macros suitable for ARCompact and ARCv2.

Signed-off-by: Vladimir Isaev <isaev@synopsys.com>
---
 tools/include/uapi/asm/bpf_perf_event.h |  2 ++
 tools/lib/bpf/bpf_tracing.h             | 23 +++++++++++++++++++++++
 2 files changed, 25 insertions(+)

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)
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] libbpf: add ARC support to bpf_tracing.h
  2022-04-08 15:38 [PATCH] libbpf: add ARC support to bpf_tracing.h Sergey Matyukevich
@ 2022-04-08 19:51 ` Song Liu
  2022-04-08 22:18 ` Andrii Nakryiko
  2022-04-08 22:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 5+ messages in thread
From: Song Liu @ 2022-04-08 19:51 UTC (permalink / raw)
  To: Sergey Matyukevich; +Cc: bpf, Vladimir Isaev, Vineet Gupta

On Fri, Apr 8, 2022 at 8:39 AM 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>

Hi Sergey,

The patch looks good to me. However, since you are sending the patch for
Vladimir Isaev, we also need your Signed-off-by tag.

Song


> ---
>  tools/include/uapi/asm/bpf_perf_event.h |  2 ++
>  tools/lib/bpf/bpf_tracing.h             | 23 +++++++++++++++++++++++
>  2 files changed, 25 insertions(+)
>
> 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)
> --
> 2.35.1
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] libbpf: add ARC support to bpf_tracing.h
  2022-04-08 15:38 [PATCH] libbpf: add ARC support to bpf_tracing.h Sergey Matyukevich
  2022-04-08 19:51 ` Song Liu
@ 2022-04-08 22:18 ` Andrii Nakryiko
  2022-04-08 22:26   ` Andrii Nakryiko
  2022-04-08 22:20 ` patchwork-bot+netdevbpf
  2 siblings, 1 reply; 5+ messages in thread
From: Andrii Nakryiko @ 2022-04-08 22:18 UTC (permalink / raw)
  To: Sergey Matyukevich; +Cc: bpf, Vladimir Isaev, Vineet Gupta

On Fri, Apr 8, 2022 at 10:21 AM 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>
> ---

I have no way to test this unfortunately. Please be available to help
with ARC-specific issues if those come up. Thanks. Applied to
bpf-next.

>  tools/include/uapi/asm/bpf_perf_event.h |  2 ++
>  tools/lib/bpf/bpf_tracing.h             | 23 +++++++++++++++++++++++
>  2 files changed, 25 insertions(+)
>
> 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)
> --
> 2.35.1
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] libbpf: add ARC support to bpf_tracing.h
  2022-04-08 15:38 [PATCH] libbpf: add ARC support to bpf_tracing.h Sergey Matyukevich
  2022-04-08 19:51 ` Song Liu
  2022-04-08 22:18 ` Andrii Nakryiko
@ 2022-04-08 22:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-04-08 22:20 UTC (permalink / raw)
  To: Sergey Matyukevich; +Cc: bpf, isaev, vgupta

Hello:

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

On Fri,  8 Apr 2022 18:38:29 +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>
> ---
>  tools/include/uapi/asm/bpf_perf_event.h |  2 ++
>  tools/lib/bpf/bpf_tracing.h             | 23 +++++++++++++++++++++++
>  2 files changed, 25 insertions(+)

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

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] libbpf: add ARC support to bpf_tracing.h
  2022-04-08 22:18 ` Andrii Nakryiko
@ 2022-04-08 22:26   ` Andrii Nakryiko
  0 siblings, 0 replies; 5+ messages in thread
From: Andrii Nakryiko @ 2022-04-08 22:26 UTC (permalink / raw)
  To: Sergey Matyukevich; +Cc: bpf, Vladimir Isaev, Vineet Gupta

On Fri, Apr 8, 2022 at 3:18 PM Andrii Nakryiko
<andrii.nakryiko@gmail.com> wrote:
>
> On Fri, Apr 8, 2022 at 10:21 AM 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>
> > ---
>
> I have no way to test this unfortunately. Please be available to help
> with ARC-specific issues if those come up. Thanks. Applied to
> bpf-next.
>

Welp, didn't see Song's email before applying and sending. Song is
right, we'll need your SoB. Backed out patch for now.

> >  tools/include/uapi/asm/bpf_perf_event.h |  2 ++
> >  tools/lib/bpf/bpf_tracing.h             | 23 +++++++++++++++++++++++
> >  2 files changed, 25 insertions(+)
> >
> > 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)
> > --
> > 2.35.1
> >

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-04-08 22:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-08 15:38 [PATCH] libbpf: add ARC support to bpf_tracing.h Sergey Matyukevich
2022-04-08 19:51 ` Song Liu
2022-04-08 22:18 ` Andrii Nakryiko
2022-04-08 22:26   ` Andrii Nakryiko
2022-04-08 22:20 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox