summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorIlya Leoshkevich <iii@linux.ibm.com>2026-02-17 19:05:08 +0300
committerAlexei Starovoitov <ast@kernel.org>2026-03-03 19:35:07 +0300
commit6fe54677bcc2e7a42f5fcaa3c66600232ba54d44 (patch)
treeba956500a3e669fa3fd6e355cbccdb64f28d221d /arch
parent309d8808eef93d29b65ae69241a4475b2c8bd6fe (diff)
downloadlinux-6fe54677bcc2e7a42f5fcaa3c66600232ba54d44.tar.xz
s390: Introduce bpf_get_lowcore() kfunc
Implementing BPF version of preempt_count() requires accessing lowcore from BPF. Since lowcore can be relocated, open-coding (struct lowcore *)0 does not work, so add a kfunc. Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> Link: https://lore.kernel.org/r/20260217160813.100855-2-iii@linux.ibm.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/s390/kernel/Makefile2
-rw-r--r--arch/s390/kernel/bpf.c12
2 files changed, 14 insertions, 0 deletions
diff --git a/arch/s390/kernel/Makefile b/arch/s390/kernel/Makefile
index 42c83d60d6fa..b522c6649fcc 100644
--- a/arch/s390/kernel/Makefile
+++ b/arch/s390/kernel/Makefile
@@ -80,5 +80,7 @@ obj-$(CONFIG_PERF_EVENTS) += perf_pai.o
obj-$(CONFIG_TRACEPOINTS) += trace.o
+obj-$(CONFIG_BPF_SYSCALL) += bpf.o
+
# vdso
obj-y += vdso/
diff --git a/arch/s390/kernel/bpf.c b/arch/s390/kernel/bpf.c
new file mode 100644
index 000000000000..713337fae626
--- /dev/null
+++ b/arch/s390/kernel/bpf.c
@@ -0,0 +1,12 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <asm/lowcore.h>
+#include <linux/btf.h>
+
+__bpf_kfunc_start_defs();
+
+__bpf_kfunc struct lowcore *bpf_get_lowcore(void)
+{
+ return get_lowcore();
+}
+
+__bpf_kfunc_end_defs();