Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests/bpf: Add __arch_s390x macro

Make it possible to limit certain tests to s390x, just like it's
already done for x86_64, arm64, and riscv64.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Link: https://lore.kernel.org/r/20250821113339.292434-4-iii@linux.ibm.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>

authored by

Ilya Leoshkevich and committed by
Alexei Starovoitov
1e4e6b9e b68dfcc1

+6
+1
tools/testing/selftests/bpf/progs/bpf_misc.h
··· 136 136 #define __arch_x86_64 __arch("X86_64") 137 137 #define __arch_arm64 __arch("ARM64") 138 138 #define __arch_riscv64 __arch("RISCV64") 139 + #define __arch_s390x __arch("s390x") 139 140 #define __caps_unpriv(caps) __attribute__((btf_decl_tag("comment:test_caps_unpriv=" EXPAND_QUOTE(caps)))) 140 141 #define __load_if_JITed() __attribute__((btf_decl_tag("comment:load_mode=jited"))) 141 142 #define __load_if_no_JITed() __attribute__((btf_decl_tag("comment:load_mode=no_jited")))
+5
tools/testing/selftests/bpf/test_loader.c
··· 374 374 ARCH_X86_64 = 0x2, 375 375 ARCH_ARM64 = 0x4, 376 376 ARCH_RISCV64 = 0x8, 377 + ARCH_S390X = 0x10, 377 378 }; 378 379 379 380 static int get_current_arch(void) ··· 385 384 return ARCH_ARM64; 386 385 #elif defined(__riscv) && __riscv_xlen == 64 387 386 return ARCH_RISCV64; 387 + #elif defined(__s390x__) 388 + return ARCH_S390X; 388 389 #endif 389 390 return ARCH_UNKNOWN; 390 391 } ··· 568 565 arch = ARCH_ARM64; 569 566 } else if (strcmp(val, "RISCV64") == 0) { 570 567 arch = ARCH_RISCV64; 568 + } else if (strcmp(val, "s390x") == 0) { 569 + arch = ARCH_S390X; 571 570 } else { 572 571 PRINT_FAIL("bad arch spec: '%s'\n", val); 573 572 err = -EINVAL;