selftests/powerpc/64: Test all paths through copy routines
The hand-coded assembler 64-bit copy routines include feature sections that select one code path or another depending on which CPU we are executing on. The self-tests for these copy routines end up testing just one path. This adds a mechanism for selecting any desired code path at compile time, and makes 2 or 3 versions of each test, each using a different code path, so as to cover all the possible paths. Signed-off-by: Paul Mackerras <paulus@ozlabs.org> [mpe: Add -mcpu=power4 to CFLAGS for older compilers] Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:

committed by
Michael Ellerman

parent
a7c81ce398
commit
98c45f51f7
@@ -1,4 +1,10 @@
|
||||
copyuser_64
|
||||
copyuser_power7
|
||||
memcpy_64
|
||||
memcpy_power7
|
||||
copyuser_64_t0
|
||||
copyuser_64_t1
|
||||
copyuser_64_t2
|
||||
copyuser_power7_t0
|
||||
copyuser_power7_t1
|
||||
memcpy_64_t0
|
||||
memcpy_64_t1
|
||||
memcpy_64_t2
|
||||
memcpy_power7_t0
|
||||
memcpy_power7_t1
|
||||
|
@@ -4,18 +4,41 @@ CFLAGS += -m64
|
||||
CFLAGS += -I$(CURDIR)
|
||||
CFLAGS += -D SELFTEST
|
||||
CFLAGS += -maltivec
|
||||
CFLAGS += -mcpu=power4
|
||||
|
||||
# Use our CFLAGS for the implicit .S rule & set the asm machine type
|
||||
ASFLAGS = $(CFLAGS) -Wa,-mpower4
|
||||
|
||||
TEST_GEN_PROGS := copyuser_64 copyuser_power7 memcpy_64 memcpy_power7
|
||||
TEST_GEN_PROGS := copyuser_64_t0 copyuser_64_t1 copyuser_64_t2 \
|
||||
copyuser_p7_t0 copyuser_p7_t1 \
|
||||
memcpy_64_t0 memcpy_64_t1 memcpy_64_t2 \
|
||||
memcpy_p7_t0 memcpy_p7_t1
|
||||
|
||||
EXTRA_SOURCES := validate.c ../harness.c
|
||||
|
||||
include ../../lib.mk
|
||||
|
||||
$(OUTPUT)/copyuser_64: CPPFLAGS += -D COPY_LOOP=test___copy_tofrom_user_base
|
||||
$(OUTPUT)/copyuser_power7: CPPFLAGS += -D COPY_LOOP=test___copy_tofrom_user_power7
|
||||
$(OUTPUT)/memcpy_64: CPPFLAGS += -D COPY_LOOP=test_memcpy
|
||||
$(OUTPUT)/memcpy_power7: CPPFLAGS += -D COPY_LOOP=test_memcpy_power7
|
||||
$(OUTPUT)/copyuser_64_t%: copyuser_64.S $(EXTRA_SOURCES)
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) \
|
||||
-D COPY_LOOP=test___copy_tofrom_user_base \
|
||||
-D SELFTEST_CASE=$(subst copyuser_64_t,,$(notdir $@)) \
|
||||
-o $@ $^
|
||||
|
||||
$(TEST_GEN_PROGS): $(EXTRA_SOURCES)
|
||||
$(OUTPUT)/copyuser_p7_t%: copyuser_power7.S $(EXTRA_SOURCES)
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) \
|
||||
-D COPY_LOOP=test___copy_tofrom_user_power7 \
|
||||
-D SELFTEST_CASE=$(subst copyuser_p7_t,,$(notdir $@)) \
|
||||
-o $@ $^
|
||||
|
||||
# Strictly speaking, we only need the memcpy_64 test cases for big-endian
|
||||
$(OUTPUT)/memcpy_64_t%: memcpy_64.S $(EXTRA_SOURCES)
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) \
|
||||
-D COPY_LOOP=test_memcpy \
|
||||
-D SELFTEST_CASE=$(subst memcpy_64_t,,$(notdir $@)) \
|
||||
-o $@ $^
|
||||
|
||||
$(OUTPUT)/memcpy_p7_t%: memcpy_power7.S $(EXTRA_SOURCES)
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) \
|
||||
-D COPY_LOOP=test_memcpy_power7 \
|
||||
-D SELFTEST_CASE=$(subst memcpy_p7_t,,$(notdir $@)) \
|
||||
-o $@ $^
|
||||
|
@@ -43,17 +43,16 @@ FUNC_START(enter_vmx_ops)
|
||||
FUNC_START(exit_vmx_ops)
|
||||
blr
|
||||
|
||||
FUNC_START(memcpy_power7)
|
||||
blr
|
||||
|
||||
FUNC_START(__copy_tofrom_user_power7)
|
||||
blr
|
||||
|
||||
FUNC_START(__copy_tofrom_user_base)
|
||||
blr
|
||||
|
||||
#define BEGIN_FTR_SECTION
|
||||
#define FTR_SECTION_ELSE
|
||||
#define ALT_FTR_SECTION_END_IFCLR(x)
|
||||
#define ALT_FTR_SECTION_END(x, y)
|
||||
#define END_FTR_SECTION_IFCLR(x)
|
||||
#define BEGIN_FTR_SECTION .if test_feature
|
||||
#define FTR_SECTION_ELSE .else
|
||||
#define ALT_FTR_SECTION_END_IFCLR(x) .endif
|
||||
#define ALT_FTR_SECTION_END_IFSET(x) .endif
|
||||
#define ALT_FTR_SECTION_END(x, y) .endif
|
||||
#define END_FTR_SECTION_IFCLR(x) .endif
|
||||
#define END_FTR_SECTION_IFSET(x) .endif
|
||||
|
||||
/* Default to taking the first of any alternative feature sections */
|
||||
test_feature = 1
|
||||
|
Reference in New Issue
Block a user