arch/loongarch/include/asm/unistd.h | 1 + arch/loongarch/kernel/Makefile.syscalls | 6 +++--- tools/testing/selftests/mm/Makefile | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-)
From: "Lain \"Fearyncess\" Yang" <fearyncess@aosc.io>
LoongArch supports ARCH_HAS_SET_DIRECT_MAP, therefore wire up the
memfd_secret system call, which depends on it.
Signed-off-by: Lain "Fearyncess" Yang <fearyncess@aosc.io>
---
arch/loongarch/include/asm/unistd.h | 1 +
arch/loongarch/kernel/Makefile.syscalls | 6 +++---
tools/testing/selftests/mm/Makefile | 2 +-
3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/arch/loongarch/include/asm/unistd.h b/arch/loongarch/include/asm/unistd.h
index e2c0f3d86c7bd..e7649c1582482 100644
--- a/arch/loongarch/include/asm/unistd.h
+++ b/arch/loongarch/include/asm/unistd.h
@@ -10,5 +10,6 @@
#define __ARCH_WANT_NEW_STAT
#define __ARCH_WANT_SYS_CLONE
+#define __ARCH_WANT_MEMFD_SECRET
#define NR_syscalls (__NR_syscalls)
diff --git a/arch/loongarch/kernel/Makefile.syscalls b/arch/loongarch/kernel/Makefile.syscalls
index cd46c2b69c7fd..6360381baf931 100644
--- a/arch/loongarch/kernel/Makefile.syscalls
+++ b/arch/loongarch/kernel/Makefile.syscalls
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0
-# No special ABIs on loongarch so far
-syscall_abis_32 +=
-syscall_abis_64 +=
+# Add memfd_secret explictly for la64 and la32
+syscall_abis_32 += memfd_secret
+syscall_abis_64 += memfd_secret
diff --git a/tools/testing/selftests/mm/Makefile b/tools/testing/selftests/mm/Makefile
index eaf9312097f7b..79582438efc4d 100644
--- a/tools/testing/selftests/mm/Makefile
+++ b/tools/testing/selftests/mm/Makefile
@@ -72,7 +72,7 @@ TEST_GEN_FILES += madv_populate
TEST_GEN_FILES += map_fixed_noreplace
TEST_GEN_FILES += map_hugetlb
TEST_GEN_FILES += map_populate
-ifneq (,$(filter $(ARCH),arm64 riscv riscv64 x86 x86_64))
+ifneq (,$(filter $(ARCH),arm64 riscv riscv64 x86 x86_64 loongarch32 loongarch64))
TEST_GEN_FILES += memfd_secret
endif
TEST_GEN_FILES += migration
--
2.52.0
Applied, thanks. Huacai On Fri, Jan 9, 2026 at 1:11 PM Lain Fearyncess Yang <fearyncess@aosc.io> wrote: > > From: "Lain \"Fearyncess\" Yang" <fearyncess@aosc.io> > > LoongArch supports ARCH_HAS_SET_DIRECT_MAP, therefore wire up the > memfd_secret system call, which depends on it. > > Signed-off-by: Lain "Fearyncess" Yang <fearyncess@aosc.io> > --- > arch/loongarch/include/asm/unistd.h | 1 + > arch/loongarch/kernel/Makefile.syscalls | 6 +++--- > tools/testing/selftests/mm/Makefile | 2 +- > 3 files changed, 5 insertions(+), 4 deletions(-) > > diff --git a/arch/loongarch/include/asm/unistd.h b/arch/loongarch/include/asm/unistd.h > index e2c0f3d86c7bd..e7649c1582482 100644 > --- a/arch/loongarch/include/asm/unistd.h > +++ b/arch/loongarch/include/asm/unistd.h > @@ -10,5 +10,6 @@ > > #define __ARCH_WANT_NEW_STAT > #define __ARCH_WANT_SYS_CLONE > +#define __ARCH_WANT_MEMFD_SECRET > > #define NR_syscalls (__NR_syscalls) > diff --git a/arch/loongarch/kernel/Makefile.syscalls b/arch/loongarch/kernel/Makefile.syscalls > index cd46c2b69c7fd..6360381baf931 100644 > --- a/arch/loongarch/kernel/Makefile.syscalls > +++ b/arch/loongarch/kernel/Makefile.syscalls > @@ -1,5 +1,5 @@ > # SPDX-License-Identifier: GPL-2.0 > > -# No special ABIs on loongarch so far > -syscall_abis_32 += > -syscall_abis_64 += > +# Add memfd_secret explictly for la64 and la32 > +syscall_abis_32 += memfd_secret > +syscall_abis_64 += memfd_secret > diff --git a/tools/testing/selftests/mm/Makefile b/tools/testing/selftests/mm/Makefile > index eaf9312097f7b..79582438efc4d 100644 > --- a/tools/testing/selftests/mm/Makefile > +++ b/tools/testing/selftests/mm/Makefile > @@ -72,7 +72,7 @@ TEST_GEN_FILES += madv_populate > TEST_GEN_FILES += map_fixed_noreplace > TEST_GEN_FILES += map_hugetlb > TEST_GEN_FILES += map_populate > -ifneq (,$(filter $(ARCH),arm64 riscv riscv64 x86 x86_64)) > +ifneq (,$(filter $(ARCH),arm64 riscv riscv64 x86 x86_64 loongarch32 loongarch64)) > TEST_GEN_FILES += memfd_secret > endif > TEST_GEN_FILES += migration > -- > 2.52.0 >
On 1/9/26 06:10, Lain Fearyncess Yang wrote: > From: "Lain \"Fearyncess\" Yang" <fearyncess@aosc.io> > > LoongArch supports ARCH_HAS_SET_DIRECT_MAP, therefore wire up the > memfd_secret system call, which depends on it. > > Signed-off-by: Lain "Fearyncess" Yang <fearyncess@aosc.io> > --- > arch/loongarch/include/asm/unistd.h | 1 + > arch/loongarch/kernel/Makefile.syscalls | 6 +++--- > tools/testing/selftests/mm/Makefile | 2 +- > 3 files changed, 5 insertions(+), 4 deletions(-) > > diff --git a/arch/loongarch/include/asm/unistd.h b/arch/loongarch/include/asm/unistd.h > index e2c0f3d86c7bd..e7649c1582482 100644 > --- a/arch/loongarch/include/asm/unistd.h > +++ b/arch/loongarch/include/asm/unistd.h > @@ -10,5 +10,6 @@ > > #define __ARCH_WANT_NEW_STAT > #define __ARCH_WANT_SYS_CLONE > +#define __ARCH_WANT_MEMFD_SECRET > > #define NR_syscalls (__NR_syscalls) > diff --git a/arch/loongarch/kernel/Makefile.syscalls b/arch/loongarch/kernel/Makefile.syscalls > index cd46c2b69c7fd..6360381baf931 100644 > --- a/arch/loongarch/kernel/Makefile.syscalls > +++ b/arch/loongarch/kernel/Makefile.syscalls > @@ -1,5 +1,5 @@ > # SPDX-License-Identifier: GPL-2.0 > > -# No special ABIs on loongarch so far > -syscall_abis_32 += > -syscall_abis_64 += > +# Add memfd_secret explictly for la64 and la32 > +syscall_abis_32 += memfd_secret > +syscall_abis_64 += memfd_secret > diff --git a/tools/testing/selftests/mm/Makefile b/tools/testing/selftests/mm/Makefile > index eaf9312097f7b..79582438efc4d 100644 > --- a/tools/testing/selftests/mm/Makefile > +++ b/tools/testing/selftests/mm/Makefile > @@ -72,7 +72,7 @@ TEST_GEN_FILES += madv_populate > TEST_GEN_FILES += map_fixed_noreplace > TEST_GEN_FILES += map_hugetlb > TEST_GEN_FILES += map_populate > -ifneq (,$(filter $(ARCH),arm64 riscv riscv64 x86 x86_64)) > +ifneq (,$(filter $(ARCH),arm64 riscv riscv64 x86 x86_64 loongarch32 loongarch64)) For the core-mm bits Acked-by: David Hildenbrand (Red Hat) <david@kernel.org> -- Cheers David
On Fri, Jan 09, 2026 at 01:10:51PM +0800, Lain Fearyncess Yang wrote: > From: "Lain \"Fearyncess\" Yang" <fearyncess@aosc.io> > > LoongArch supports ARCH_HAS_SET_DIRECT_MAP, therefore wire up the > memfd_secret system call, which depends on it. LoongArch version of set_memory* does not support splitting of leaf PMD entries. Does LoongArch always use PTE-level mappings in the direct map? > Signed-off-by: Lain "Fearyncess" Yang <fearyncess@aosc.io> > --- > arch/loongarch/include/asm/unistd.h | 1 + > arch/loongarch/kernel/Makefile.syscalls | 6 +++--- > tools/testing/selftests/mm/Makefile | 2 +- > 3 files changed, 5 insertions(+), 4 deletions(-) -- Sincerely yours, Mike.
On Fri, Jan 9, 2026 at 4:21 PM Mike Rapoport <rppt@kernel.org> wrote: > > On Fri, Jan 09, 2026 at 01:10:51PM +0800, Lain Fearyncess Yang wrote: > > From: "Lain \"Fearyncess\" Yang" <fearyncess@aosc.io> > > > > LoongArch supports ARCH_HAS_SET_DIRECT_MAP, therefore wire up the > > memfd_secret system call, which depends on it. > > LoongArch version of set_memory* does not support splitting of leaf PMD > entries. Does LoongArch always use PTE-level mappings in the direct map? No PMD level mappings now. Huacai > > > Signed-off-by: Lain "Fearyncess" Yang <fearyncess@aosc.io> > > --- > > arch/loongarch/include/asm/unistd.h | 1 + > > arch/loongarch/kernel/Makefile.syscalls | 6 +++--- > > tools/testing/selftests/mm/Makefile | 2 +- > > 3 files changed, 5 insertions(+), 4 deletions(-) > > -- > Sincerely yours, > Mike.
On Sun, Jan 25, 2026 at 12:03:25PM +0800, Huacai Chen wrote: > On Fri, Jan 9, 2026 at 4:21 PM Mike Rapoport <rppt@kernel.org> wrote: > > > > On Fri, Jan 09, 2026 at 01:10:51PM +0800, Lain Fearyncess Yang wrote: > > > From: "Lain \"Fearyncess\" Yang" <fearyncess@aosc.io> > > > > > > LoongArch supports ARCH_HAS_SET_DIRECT_MAP, therefore wire up the > > > memfd_secret system call, which depends on it. > > > > LoongArch version of set_memory* does not support splitting of leaf PMD > > entries. Does LoongArch always use PTE-level mappings in the direct map? > No PMD level mappings now. Thanks for the clarification. You can add Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org> if it's not too late :) > Huacai -- Sincerely yours, Mike.
On Fri, Jan 9, 2026, at 06:10, Lain Fearyncess Yang wrote: > From: "Lain \"Fearyncess\" Yang" <fearyncess@aosc.io> > > LoongArch supports ARCH_HAS_SET_DIRECT_MAP, therefore wire up the > memfd_secret system call, which depends on it. > > Signed-off-by: Lain "Fearyncess" Yang <fearyncess@aosc.io> > --- Acked-by: Arnd Bergmann <arnd@arndb.de>
© 2016 - 2026 Red Hat, Inc.