All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shivani Nittor <shivani@linux.ibm.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: maddy@linux.ibm.com, hbathini@linux.ibm.com, chleroy@kernel.org,
	ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
	eddyz87@gmail.com, shuah@kernel.org, bpf@vger.kernel.org,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] selftests/bpf: Add callx tests for PPC64
Date: Mon, 30 Nov 2026 12:33:07 +0530	[thread overview]
Message-ID: <20261130070307.126765-2-shivani@linux.ibm.com> (raw)
In-Reply-To: <20261130070307.126765-1-shivani@linux.ibm.com>

Extend the existing BPF CALLX selftests to support PPC64.

Enable the callx_func_ptr_map and callx_rodata_lskel tests for PPC64
by adding a PPC64 ELF ABI v2 condition to their architecture checks.
The gate uses (defined(__powerpc64__) && defined(_CALL_ELF) &&
_CALL_ELF == 2) to ensure tests run only on ELF ABI v2 builds,
where JIT CALLX support is enabled, and skip cleanly on ELF ABI v1
builds.

Also enable verifier_callx and verifier_callx_rodata for the PPC64
BPF target by adding __TARGET_ARCH_powerpc to their architecture
checks. This allows the verifier tests to exercise indirect calls
through function pointers, including pointers stored in read-only
data, for the PPC64 BPF target.

Signed-off-by: Shivani Nittor <shivani@linux.ibm.com>
---
 tools/testing/selftests/bpf/prog_tests/callx_func_ptr_map.c | 3 ++-
 tools/testing/selftests/bpf/prog_tests/callx_rodata_lskel.c | 3 ++-
 tools/testing/selftests/bpf/progs/verifier_callx.c          | 3 ++-
 tools/testing/selftests/bpf/progs/verifier_callx_rodata.c   | 3 ++-
 4 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/callx_func_ptr_map.c b/tools/testing/selftests/bpf/prog_tests/callx_func_ptr_map.c
index cc63b84e4d94..ddb488708b94 100644
--- a/tools/testing/selftests/bpf/prog_tests/callx_func_ptr_map.c
+++ b/tools/testing/selftests/bpf/prog_tests/callx_func_ptr_map.c
@@ -9,7 +9,8 @@
 #include <bpf/btf.h>
 
 #if defined(__x86_64__) || defined(__aarch64__) || \
-    (defined(__riscv) && __riscv_xlen == 64)
+    (defined(__riscv) && __riscv_xlen == 64) || \
+    (defined(__powerpc64__) && defined(_CALL_ELF) && _CALL_ELF == 2)
 
 #define CALLEE_INSN	6
 #define DATA		0x1234
diff --git a/tools/testing/selftests/bpf/prog_tests/callx_rodata_lskel.c b/tools/testing/selftests/bpf/prog_tests/callx_rodata_lskel.c
index f6ef67c3141e..80f029f358e1 100644
--- a/tools/testing/selftests/bpf/prog_tests/callx_rodata_lskel.c
+++ b/tools/testing/selftests/bpf/prog_tests/callx_rodata_lskel.c
@@ -4,7 +4,8 @@
 #include "callx_rodata.lskel.h"
 
 #if defined(__x86_64__) || defined(__aarch64__) || \
-    (defined(__riscv) && __riscv_xlen == 64)
+    (defined(__riscv) && __riscv_xlen == 64) || \
+    (defined(__powerpc64__) && defined(_CALL_ELF) && _CALL_ELF == 2)
 
 static void run(int prog_fd, int expected, const char *name)
 {
diff --git a/tools/testing/selftests/bpf/progs/verifier_callx.c b/tools/testing/selftests/bpf/progs/verifier_callx.c
index a12bc421e75c..b99eab7b3725 100644
--- a/tools/testing/selftests/bpf/progs/verifier_callx.c
+++ b/tools/testing/selftests/bpf/progs/verifier_callx.c
@@ -8,7 +8,8 @@
 
 /* gcc doesn't support indirect calls */
 #if defined(__clang__) && (defined(__TARGET_ARCH_x86) || defined(__TARGET_ARCH_arm64) || \
-    (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64))
+    (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \
+    defined(__TARGET_ARCH_powerpc))
 
 #define CALLX_INSN(DST, SRC, OFF, IMM) \
 	BPF_RAW_INSN(BPF_JMP | BPF_CALL | BPF_X, DST, SRC, OFF, IMM)
diff --git a/tools/testing/selftests/bpf/progs/verifier_callx_rodata.c b/tools/testing/selftests/bpf/progs/verifier_callx_rodata.c
index 6cf58ca9ac5b..56be21e7bbcd 100644
--- a/tools/testing/selftests/bpf/progs/verifier_callx_rodata.c
+++ b/tools/testing/selftests/bpf/progs/verifier_callx_rodata.c
@@ -8,7 +8,8 @@
 
 /* gcc doesn't support indirect calls */
 #if defined(__clang__) && (defined(__TARGET_ARCH_x86) || defined(__TARGET_ARCH_arm64) || \
-    (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64))
+    (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \
+    defined(__TARGET_ARCH_powerpc))
 
 /*
  * Read-only data with pointers to functions, where the compiler puts tables
-- 
2.52.0



  reply	other threads:[~2026-11-30  7:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30  7:03 [PATCH 1/2] powerpc/bpf: Support indirect calls to BPF subprograms Shivani Nittor
2026-11-30  7:03 ` Shivani Nittor [this message]
2026-11-30  7:15   ` [PATCH 2/2] selftests/bpf: Add callx tests for PPC64 sashiko-bot
2026-12-01 10:29   ` Christophe Leroy (CS GROUP)
2026-12-01 10:20 ` [PATCH 1/2] powerpc/bpf: Support indirect calls to BPF subprograms Christophe Leroy (CS GROUP)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261130070307.126765-2-shivani@linux.ibm.com \
    --to=shivani@linux.ibm.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=chleroy@kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=hbathini@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.