loongarch.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] tools: Add LoongArch build infrastructure
@ 2022-09-03  9:55 Huacai Chen
  2022-09-03  9:55 ` [PATCH 2/2] selftests/seccomp: Add LoongArch selftesting support Huacai Chen
  2022-09-17  8:57 ` [PATCH 1/2] tools: Add LoongArch build infrastructure Huacai Chen
  0 siblings, 2 replies; 4+ messages in thread
From: Huacai Chen @ 2022-09-03  9:55 UTC (permalink / raw
  To: Shuah Khan, Kees Cook, Andy Lutomirski, Will Drewry,
	Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko
  Cc: loongarch, linux-kselftest, Huacai Chen

We will add tools support for LoongArch (bpf, perf, objtool, etc.), add
build infrastructure and common headers for preparation.

Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
---
 tools/arch/loongarch/include/uapi/asm/bitsperlong.h |  9 +++++++++
 tools/scripts/Makefile.arch                         | 11 ++++++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)
 create mode 100644 tools/arch/loongarch/include/uapi/asm/bitsperlong.h

diff --git a/tools/arch/loongarch/include/uapi/asm/bitsperlong.h b/tools/arch/loongarch/include/uapi/asm/bitsperlong.h
new file mode 100644
index 000000000000..d4e32b3d4843
--- /dev/null
+++ b/tools/arch/loongarch/include/uapi/asm/bitsperlong.h
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
+#ifndef __ASM_LOONGARCH_BITSPERLONG_H
+#define __ASM_LOONGARCH_BITSPERLONG_H
+
+#define __BITS_PER_LONG (__SIZEOF_POINTER__ * 8)
+
+#include <asm-generic/bitsperlong.h>
+
+#endif /* __ASM_LOONGARCH_BITSPERLONG_H */
diff --git a/tools/scripts/Makefile.arch b/tools/scripts/Makefile.arch
index 0c6c7f456887..1c72d07cb9fe 100644
--- a/tools/scripts/Makefile.arch
+++ b/tools/scripts/Makefile.arch
@@ -5,7 +5,7 @@ HOSTARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \
                                   -e s/s390x/s390/ -e s/parisc64/parisc/ \
                                   -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
                                   -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ \
-                                  -e s/riscv.*/riscv/)
+                                  -e s/riscv.*/riscv/ -e s/loongarch.*/loongarch/)
 
 ifndef ARCH
 ARCH := $(HOSTARCH)
@@ -34,6 +34,15 @@ ifeq ($(ARCH),sh64)
        SRCARCH := sh
 endif
 
+# Additional ARCH settings for loongarch
+ifeq ($(ARCH),loongarch32)
+       SRCARCH := loongarch
+endif
+
+ifeq ($(ARCH),loongarch64)
+       SRCARCH := loongarch
+endif
+
 LP64 := $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1)
 ifeq ($(LP64), 1)
   IS_64_BIT := 1
-- 
2.31.1


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

* [PATCH 2/2] selftests/seccomp: Add LoongArch selftesting support
  2022-09-03  9:55 [PATCH 1/2] tools: Add LoongArch build infrastructure Huacai Chen
@ 2022-09-03  9:55 ` Huacai Chen
  2022-09-17  8:57 ` [PATCH 1/2] tools: Add LoongArch build infrastructure Huacai Chen
  1 sibling, 0 replies; 4+ messages in thread
From: Huacai Chen @ 2022-09-03  9:55 UTC (permalink / raw
  To: Shuah Khan, Kees Cook, Andy Lutomirski, Will Drewry,
	Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko
  Cc: loongarch, linux-kselftest, Huacai Chen, Tiezhu Yang

BPF for LoongArch is supported now, add the selftesting support in
seccomp_bpf.c.

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
---
 tools/testing/selftests/seccomp/seccomp_bpf.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c
index 4ae6c8991307..e1c3b7d8ac39 100644
--- a/tools/testing/selftests/seccomp/seccomp_bpf.c
+++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
@@ -128,6 +128,8 @@ struct seccomp_data {
 #  define __NR_seccomp 277
 # elif defined(__csky__)
 #  define __NR_seccomp 277
+# elif defined(__loongarch__)
+#  define __NR_seccomp 277
 # elif defined(__hppa__)
 #  define __NR_seccomp 338
 # elif defined(__powerpc__)
@@ -1751,6 +1753,10 @@ TEST_F(TRACE_poke, getpid_runs_normally)
 				    NT_ARM_SYSTEM_CALL, &__v));	\
 	} while (0)
 # define SYSCALL_RET(_regs)	(_regs).regs[0]
+#elif defined(__loongarch__)
+# define ARCH_REGS		struct user_pt_regs
+# define SYSCALL_NUM(_regs)	(_regs).regs[11]
+# define SYSCALL_RET(_regs)	(_regs).regs[4]
 #elif defined(__riscv) && __riscv_xlen == 64
 # define ARCH_REGS		struct user_regs_struct
 # define SYSCALL_NUM(_regs)	(_regs).a7
-- 
2.31.1


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

* Re: [PATCH 1/2] tools: Add LoongArch build infrastructure
  2022-09-03  9:55 [PATCH 1/2] tools: Add LoongArch build infrastructure Huacai Chen
  2022-09-03  9:55 ` [PATCH 2/2] selftests/seccomp: Add LoongArch selftesting support Huacai Chen
@ 2022-09-17  8:57 ` Huacai Chen
  2022-10-17  3:46   ` Huacai Chen
  1 sibling, 1 reply; 4+ messages in thread
From: Huacai Chen @ 2022-09-17  8:57 UTC (permalink / raw
  To: Huacai Chen
  Cc: Shuah Khan, Kees Cook, Andy Lutomirski, Will Drewry,
	Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, loongarch,
	linux-kselftest

Ping?

On Sat, Sep 3, 2022 at 5:55 PM Huacai Chen <chenhuacai@loongson.cn> wrote:
>
> We will add tools support for LoongArch (bpf, perf, objtool, etc.), add
> build infrastructure and common headers for preparation.
>
> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
> ---
>  tools/arch/loongarch/include/uapi/asm/bitsperlong.h |  9 +++++++++
>  tools/scripts/Makefile.arch                         | 11 ++++++++++-
>  2 files changed, 19 insertions(+), 1 deletion(-)
>  create mode 100644 tools/arch/loongarch/include/uapi/asm/bitsperlong.h
>
> diff --git a/tools/arch/loongarch/include/uapi/asm/bitsperlong.h b/tools/arch/loongarch/include/uapi/asm/bitsperlong.h
> new file mode 100644
> index 000000000000..d4e32b3d4843
> --- /dev/null
> +++ b/tools/arch/loongarch/include/uapi/asm/bitsperlong.h
> @@ -0,0 +1,9 @@
> +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
> +#ifndef __ASM_LOONGARCH_BITSPERLONG_H
> +#define __ASM_LOONGARCH_BITSPERLONG_H
> +
> +#define __BITS_PER_LONG (__SIZEOF_POINTER__ * 8)
> +
> +#include <asm-generic/bitsperlong.h>
> +
> +#endif /* __ASM_LOONGARCH_BITSPERLONG_H */
> diff --git a/tools/scripts/Makefile.arch b/tools/scripts/Makefile.arch
> index 0c6c7f456887..1c72d07cb9fe 100644
> --- a/tools/scripts/Makefile.arch
> +++ b/tools/scripts/Makefile.arch
> @@ -5,7 +5,7 @@ HOSTARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \
>                                    -e s/s390x/s390/ -e s/parisc64/parisc/ \
>                                    -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
>                                    -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ \
> -                                  -e s/riscv.*/riscv/)
> +                                  -e s/riscv.*/riscv/ -e s/loongarch.*/loongarch/)
>
>  ifndef ARCH
>  ARCH := $(HOSTARCH)
> @@ -34,6 +34,15 @@ ifeq ($(ARCH),sh64)
>         SRCARCH := sh
>  endif
>
> +# Additional ARCH settings for loongarch
> +ifeq ($(ARCH),loongarch32)
> +       SRCARCH := loongarch
> +endif
> +
> +ifeq ($(ARCH),loongarch64)
> +       SRCARCH := loongarch
> +endif
> +
>  LP64 := $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1)
>  ifeq ($(LP64), 1)
>    IS_64_BIT := 1
> --
> 2.31.1
>
>

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

* Re: [PATCH 1/2] tools: Add LoongArch build infrastructure
  2022-09-17  8:57 ` [PATCH 1/2] tools: Add LoongArch build infrastructure Huacai Chen
@ 2022-10-17  3:46   ` Huacai Chen
  0 siblings, 0 replies; 4+ messages in thread
From: Huacai Chen @ 2022-10-17  3:46 UTC (permalink / raw
  To: Huacai Chen
  Cc: Shuah Khan, Kees Cook, Andy Lutomirski, Will Drewry,
	Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, loongarch,
	linux-kselftest

Ping^2?

On Sat, Sep 17, 2022 at 4:57 PM Huacai Chen <chenhuacai@kernel.org> wrote:
>
> Ping?
>
> On Sat, Sep 3, 2022 at 5:55 PM Huacai Chen <chenhuacai@loongson.cn> wrote:
> >
> > We will add tools support for LoongArch (bpf, perf, objtool, etc.), add
> > build infrastructure and common headers for preparation.
> >
> > Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
> > ---
> >  tools/arch/loongarch/include/uapi/asm/bitsperlong.h |  9 +++++++++
> >  tools/scripts/Makefile.arch                         | 11 ++++++++++-
> >  2 files changed, 19 insertions(+), 1 deletion(-)
> >  create mode 100644 tools/arch/loongarch/include/uapi/asm/bitsperlong.h
> >
> > diff --git a/tools/arch/loongarch/include/uapi/asm/bitsperlong.h b/tools/arch/loongarch/include/uapi/asm/bitsperlong.h
> > new file mode 100644
> > index 000000000000..d4e32b3d4843
> > --- /dev/null
> > +++ b/tools/arch/loongarch/include/uapi/asm/bitsperlong.h
> > @@ -0,0 +1,9 @@
> > +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
> > +#ifndef __ASM_LOONGARCH_BITSPERLONG_H
> > +#define __ASM_LOONGARCH_BITSPERLONG_H
> > +
> > +#define __BITS_PER_LONG (__SIZEOF_POINTER__ * 8)
> > +
> > +#include <asm-generic/bitsperlong.h>
> > +
> > +#endif /* __ASM_LOONGARCH_BITSPERLONG_H */
> > diff --git a/tools/scripts/Makefile.arch b/tools/scripts/Makefile.arch
> > index 0c6c7f456887..1c72d07cb9fe 100644
> > --- a/tools/scripts/Makefile.arch
> > +++ b/tools/scripts/Makefile.arch
> > @@ -5,7 +5,7 @@ HOSTARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \
> >                                    -e s/s390x/s390/ -e s/parisc64/parisc/ \
> >                                    -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
> >                                    -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ \
> > -                                  -e s/riscv.*/riscv/)
> > +                                  -e s/riscv.*/riscv/ -e s/loongarch.*/loongarch/)
> >
> >  ifndef ARCH
> >  ARCH := $(HOSTARCH)
> > @@ -34,6 +34,15 @@ ifeq ($(ARCH),sh64)
> >         SRCARCH := sh
> >  endif
> >
> > +# Additional ARCH settings for loongarch
> > +ifeq ($(ARCH),loongarch32)
> > +       SRCARCH := loongarch
> > +endif
> > +
> > +ifeq ($(ARCH),loongarch64)
> > +       SRCARCH := loongarch
> > +endif
> > +
> >  LP64 := $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1)
> >  ifeq ($(LP64), 1)
> >    IS_64_BIT := 1
> > --
> > 2.31.1
> >
> >

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

end of thread, other threads:[~2022-10-17  3:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-03  9:55 [PATCH 1/2] tools: Add LoongArch build infrastructure Huacai Chen
2022-09-03  9:55 ` [PATCH 2/2] selftests/seccomp: Add LoongArch selftesting support Huacai Chen
2022-09-17  8:57 ` [PATCH 1/2] tools: Add LoongArch build infrastructure Huacai Chen
2022-10-17  3:46   ` Huacai Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).