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

Configure Feed

Select the types of activity you want to include in your feed.

powerpc/selftests/copyloops: extend selftest to exercise __copy_tofrom_user_power7_vmx

The new PowerPC VMX fast path (__copy_tofrom_user_power7_vmx) is not
exercised by existing copyloops selftests. This patch updates
the selftest to exercise the VMX variant, ensuring the VMX copy path
is validated.

Changes include:
- COPY_LOOP=test___copy_tofrom_user_power7_vmx with -D VMX_TEST is used
in existing selftest build targets.
- Inclusion of ../utils.c to provide get_auxv_entry() for hardware
feature detection.
- At runtime, the test skips execution if Altivec is not available.
- Copy sizes above VMX_COPY_THRESHOLD are used to ensure the VMX
path is taken.

This enables validation of the VMX fast path without affecting systems
that do not support Altivec.

Signed-off-by: Sayali Patil <sayalip@linux.ibm.com>
Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20260304122201.153049-2-sayalip@linux.ibm.com

authored by

Sayali Patil and committed by
Madhavan Srinivasan
146c9ab3 6bc9c0a9

+24 -14
+2 -2
tools/testing/selftests/powerpc/copyloops/.gitignore
··· 2 2 copyuser_64_t0 3 3 copyuser_64_t1 4 4 copyuser_64_t2 5 - copyuser_p7_t0 6 - copyuser_p7_t1 5 + copyuser_p7 6 + copyuser_p7_vmx 7 7 memcpy_64_t0 8 8 memcpy_64_t1 9 9 memcpy_64_t2
+8 -3
tools/testing/selftests/powerpc/copyloops/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 TEST_GEN_PROGS := copyuser_64_t0 copyuser_64_t1 copyuser_64_t2 \ 3 - copyuser_p7_t0 copyuser_p7_t1 \ 3 + copyuser_p7 copyuser_p7_vmx \ 4 4 memcpy_64_t0 memcpy_64_t1 memcpy_64_t2 \ 5 5 memcpy_p7_t0 memcpy_p7_t1 copy_mc_64 \ 6 6 copyuser_64_exc_t0 copyuser_64_exc_t1 copyuser_64_exc_t2 \ ··· 28 28 -D SELFTEST_CASE=$(subst copyuser_64_t,,$(notdir $@)) \ 29 29 -o $@ $^ 30 30 31 - $(OUTPUT)/copyuser_p7_t%: copyuser_power7.S $(EXTRA_SOURCES) 31 + $(OUTPUT)/copyuser_p7: copyuser_power7.S $(EXTRA_SOURCES) 32 32 $(CC) $(CPPFLAGS) $(CFLAGS) \ 33 33 -D COPY_LOOP=test___copy_tofrom_user_power7 \ 34 - -D SELFTEST_CASE=$(subst copyuser_p7_t,,$(notdir $@)) \ 34 + -o $@ $^ 35 + 36 + $(OUTPUT)/copyuser_p7_vmx: copyuser_power7.S $(EXTRA_SOURCES) ../utils.c 37 + $(CC) $(CPPFLAGS) $(CFLAGS) \ 38 + -D COPY_LOOP=test___copy_tofrom_user_power7_vmx \ 39 + -D VMX_TEST \ 35 40 -o $@ $^ 36 41 37 42 # Strictly speaking, we only need the memcpy_64 test cases for big-endian
-8
tools/testing/selftests/powerpc/copyloops/stubs.S
··· 1 1 #include <asm/ppc_asm.h> 2 2 3 - FUNC_START(enter_vmx_usercopy) 4 - li r3,1 5 - blr 6 - 7 - FUNC_START(exit_vmx_usercopy) 8 - li r3,0 9 - blr 10 - 11 3 FUNC_START(enter_vmx_ops) 12 4 li r3,1 13 5 blr
+14 -1
tools/testing/selftests/powerpc/copyloops/validate.c
··· 12 12 #define BUFLEN (MAX_LEN+MAX_OFFSET+2*MIN_REDZONE) 13 13 #define POISON 0xa5 14 14 15 + #ifdef VMX_TEST 16 + #define VMX_COPY_THRESHOLD 3328 17 + #endif 18 + 15 19 unsigned long COPY_LOOP(void *to, const void *from, unsigned long size); 16 20 17 21 static void do_one(char *src, char *dst, unsigned long src_off, ··· 85 81 /* Fill with sequential bytes */ 86 82 for (i = 0; i < BUFLEN; i++) 87 83 fill[i] = i & 0xff; 88 - 84 + #ifdef VMX_TEST 85 + /* Force sizes above kernel VMX threshold (3328) */ 86 + for (len = VMX_COPY_THRESHOLD + 1; len < MAX_LEN; len++) { 87 + #else 89 88 for (len = 1; len < MAX_LEN; len++) { 89 + #endif 90 90 for (src_off = 0; src_off < MAX_OFFSET; src_off++) { 91 91 for (dst_off = 0; dst_off < MAX_OFFSET; dst_off++) { 92 92 do_one(src, dst, src_off, dst_off, len, ··· 104 96 105 97 int main(void) 106 98 { 99 + #ifdef VMX_TEST 100 + /* Skip if Altivec not present */ 101 + SKIP_IF_MSG(!have_hwcap(PPC_FEATURE_HAS_ALTIVEC), "ALTIVEC not supported"); 102 + #endif 103 + 107 104 return test_harness(test_copy_loop, str(COPY_LOOP)); 108 105 }