* [PATCH bpf-next] libbpf: Add __NR_bpf definition for LoongArch
@ 2026-05-26 6:39 Tiezhu Yang
2026-05-28 21:50 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Tiezhu Yang @ 2026-05-26 6:39 UTC (permalink / raw)
To: Andrii Nakryiko, Eduard Zingerman; +Cc: loongarch, bpf, linux-kernel
LoongArch uses the generic syscall table, where __NR_bpf is defined
as 280 in include/uapi/asm-generic/unistd.h.
To align with other architectures, add the __NR_bpf definition for
LoongArch to avoid a potential compilation failure: "error __NR_bpf
not defined. libbpf does not support your arch."
This is a follow up patch of:
commit b0c47807d31d ("bpf: Add sparc support to tools and samples.")
commit bad1926dd2f6 ("bpf, s390: fix build for libbpf and selftest suite")
commit ca31ca8247e2 ("tools/bpf: fix perf build error with uClibc (seen on ARC)")
commit e32cb12ff52a ("bpf, mips: Fix build errors about __NR_bpf undeclared")
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
tools/build/feature/test-bpf.c | 2 ++
tools/lib/bpf/bpf.c | 2 ++
2 files changed, 4 insertions(+)
diff --git a/tools/build/feature/test-bpf.c b/tools/build/feature/test-bpf.c
index e7a405f83af6..89d59674f39b 100644
--- a/tools/build/feature/test-bpf.c
+++ b/tools/build/feature/test-bpf.c
@@ -20,6 +20,8 @@
# define __NR_bpf 6319
# elif defined(__mips__) && defined(_ABI64)
# define __NR_bpf 5315
+# elif defined(__loongarch__)
+# define __NR_bpf 280
# else
# error __NR_bpf not defined. libbpf does not support your arch.
# endif
diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c
index 3cd705802330..bc513aa8f404 100644
--- a/tools/lib/bpf/bpf.c
+++ b/tools/lib/bpf/bpf.c
@@ -59,6 +59,8 @@
# define __NR_bpf 6319
# elif defined(__mips__) && defined(_ABI64)
# define __NR_bpf 5315
+# elif defined(__loongarch__)
+# define __NR_bpf 280
# else
# error __NR_bpf not defined. libbpf does not support your arch.
# endif
--
2.42.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH bpf-next] libbpf: Add __NR_bpf definition for LoongArch
2026-05-26 6:39 [PATCH bpf-next] libbpf: Add __NR_bpf definition for LoongArch Tiezhu Yang
@ 2026-05-28 21:50 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-05-28 21:50 UTC (permalink / raw)
To: Tiezhu Yang; +Cc: andrii, eddyz87, loongarch, bpf, linux-kernel
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Andrii Nakryiko <andrii@kernel.org>:
On Tue, 26 May 2026 14:39:36 +0800 you wrote:
> LoongArch uses the generic syscall table, where __NR_bpf is defined
> as 280 in include/uapi/asm-generic/unistd.h.
>
> To align with other architectures, add the __NR_bpf definition for
> LoongArch to avoid a potential compilation failure: "error __NR_bpf
> not defined. libbpf does not support your arch."
>
> [...]
Here is the summary with links:
- [bpf-next] libbpf: Add __NR_bpf definition for LoongArch
https://git.kernel.org/bpf/bpf-next/c/a4a5d4ee0612
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] 2+ messages in thread
end of thread, other threads:[~2026-05-28 21:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-26 6:39 [PATCH bpf-next] libbpf: Add __NR_bpf definition for LoongArch Tiezhu Yang
2026-05-28 21:50 ` 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
all inboxes | Powered by JetHome®