summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaket Kumar Bhaskar <skb99@linux.ibm.com>2026-02-12 12:25:58 +0300
committerAlexei Starovoitov <ast@kernel.org>2026-02-14 01:42:38 +0300
commit4c51f90d45dca71e7974ed5a7c40b9c04a6c6762 (patch)
tree8c7179d05fcdd4a504e90cd80ace5a275f3bddf4
parentbd86ab5bbe3c0d61bfcbe1ba12e693b82f419cfb (diff)
downloadlinux-4c51f90d45dca71e7974ed5a7c40b9c04a6c6762.tar.xz
selftests/bpf: Add powerpc support for get_preempt_count() in selftest
get_preempt_count() is enabled to return preempt_count for powerpc, so that bpf_in_interrupt()/bpf_in_nmi()/bpf_in_serving_softirq()/ bpf_in_task()/bpf_in_hardirq()/get_preempt_count() works for powerpc as well. Signed-off-by: Saket Kumar Bhaskar <skb99@linux.ibm.com> Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com> Link: https://lore.kernel.org/r/20260212092558.370623-1-skb99@linux.ibm.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
-rw-r--r--tools/testing/selftests/bpf/bpf_experimental.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/bpf_experimental.h b/tools/testing/selftests/bpf/bpf_experimental.h
index 4b7210c318dd..9df77e59d4f5 100644
--- a/tools/testing/selftests/bpf/bpf_experimental.h
+++ b/tools/testing/selftests/bpf/bpf_experimental.h
@@ -645,6 +645,8 @@ static inline int get_preempt_count(void)
bpf_this_cpu_ptr(&pcpu_hot))->preempt_count;
#elif defined(bpf_target_arm64)
return bpf_get_current_task_btf()->thread_info.preempt.count;
+#elif defined(bpf_target_powerpc)
+ return bpf_get_current_task_btf()->thread_info.preempt_count;
#endif
return 0;
}
@@ -653,6 +655,7 @@ static inline int get_preempt_count(void)
* Report whether it is in interrupt context. Only works on the following archs:
* * x86
* * arm64
+ * * powerpc64
*/
static inline int bpf_in_interrupt(void)
{
@@ -672,6 +675,7 @@ static inline int bpf_in_interrupt(void)
* Report whether it is in NMI context. Only works on the following archs:
* * x86
* * arm64
+ * * powerpc64
*/
static inline int bpf_in_nmi(void)
{
@@ -682,6 +686,7 @@ static inline int bpf_in_nmi(void)
* Report whether it is in hard IRQ context. Only works on the following archs:
* * x86
* * arm64
+ * * powerpc64
*/
static inline int bpf_in_hardirq(void)
{
@@ -692,6 +697,7 @@ static inline int bpf_in_hardirq(void)
* Report whether it is in softirq context. Only works on the following archs:
* * x86
* * arm64
+ * * powerpc64
*/
static inline int bpf_in_serving_softirq(void)
{
@@ -710,6 +716,7 @@ static inline int bpf_in_serving_softirq(void)
* Report whether it is in task context. Only works on the following archs:
* * x86
* * arm64
+ * * powerpc64
*/
static inline int bpf_in_task(void)
{