aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/powerpc (follow)
AgeCommit message (Collapse)AuthorFilesLines
2017-01-05selftests: enable O and KBUILD_OUTPUTbamvor.zhangjian@huawei.com10-40/+43
Enable O and KBUILD_OUTPUT for kselftest. User could compile kselftest to another directory by passing O or KBUILD_OUTPUT. And O is high priority than KBUILD_OUTPUT. Signed-off-by: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-01-05selftests: add EXTRA_CLEAN for clean targetbamvor.zhangjian@huawei.com1-3/+2
Some testcases need the clean extra data after running. This patch introduce the "EXTRA_CLEAN" variable to address this requirement. After KBUILD_OUTPUT is enabled in later patch, it will be easy to decide to if we need do the cleanup in the KBUILD_OUTPUT path(if the testcase ran immediately after compiled). Signed-off-by: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2017-01-05selftests: remove duplicated all and clean targetbamvor.zhangjian@huawei.com15-111/+46
Currently, kselftest use TEST_PROGS, TEST_PROGS_EXTENDED, TEST_FILES to indicate the test program, extended test program and test files. It is easy to understand the purpose of these files. But mix of compiled and uncompiled files lead to duplicated "all" and "clean" targets. In order to remove the duplicated targets, introduce TEST_GEN_PROGS, TEST_GEN_PROGS_EXTENDED, TEST_GEN_FILES to indicate the compiled objects. Also, the later patch will make use of TEST_GEN_XXX to redirect these files to output directory indicated by KBUILD_OUTPUT or O. And add this changes to "Contributing new tests(details)" of Documentation/kselftest.txt. Signed-off-by: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2016-11-17selftests/powerpc: Add ptrace tests for TM SPR registersAnshuman Khandual4-1/+205
This patch adds ptrace interface test for TM SPR registers. This also adds ptrace interface based helper functions related to TM SPR registers access. Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com> Signed-off-by: Simon Guo <wei.guo.simon@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-11-17selftests/powerpc: Add ptrace tests for VSX, VMX registers in suspended TMAnshuman Khandual3-1/+188
This patch adds ptrace interface test for VSX, VMX registers inside suspended TM context. Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com> Signed-off-by: Simon Guo <wei.guo.simon@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-11-17selftests/powerpc: Add ptrace tests for VSX, VMX registers in TMAnshuman Khandual3-1/+170
This patch adds ptrace interface test for VSX, VMX registers inside TM context. This also adds ptrace interface based helper functions related to chckpointed VSX, VMX registers access. Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com> Signed-off-by: Simon Guo <wei.guo.simon@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-11-17selftests/powerpc: Add ptrace tests for VSX, VMX registersAnshuman Khandual6-1/+630
This patch adds ptrace interface test for VSX, VMX registers. This also adds ptrace interface based helper functions related to VSX, VMX registers access. This also adds some assembly helper functions related to VSX and VMX registers. Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com> Signed-off-by: Simon Guo <wei.guo.simon@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-11-17selftests/powerpc: Add ptrace tests for TAR, PPR, DSCR in suspended TMAnshuman Khandual3-1/+176
This patch adds ptrace interface test for TAR, PPR, DSCR registers inside suspended TM context. Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com> Signed-off-by: Simon Guo <wei.guo.simon@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-11-17selftests/powerpc: Add ptrace tests for TAR, PPR, DSCR in TMAnshuman Khandual3-2/+163
This patch adds ptrace interface test for TAR, PPR, DSCR registers inside TM context. This also adds ptrace interface based helper functions related to checkpointed TAR, PPR, DSCR register access. Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com> Signed-off-by: Simon Guo <wei.guo.simon@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-11-17selftests/powerpc: Add ptrace tests for TAR, PPR, DSCR registersAnshuman Khandual5-2/+370
This patch adds ptrace interface test for TAR, PPR, DSCR registers. This also adds ptrace interface based helper functions related to TAR, PPR, DSCR register access. Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com> Signed-off-by: Simon Guo <wei.guo.simon@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-11-17selftests/powerpc: Add ptrace tests for GPR/FPR registers in suspended TMAnshuman Khandual3-2/+172
This patch adds ptrace interface test for GPR/FPR registers inside suspended TM context. Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com> Signed-off-by: Simon Guo <wei.guo.simon@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-11-17selftests/powerpc: Add ptrace tests for GPR/FPR registers in TMAnshuman Khandual3-3/+162
This patch adds ptrace interface test for GPR/FPR registers inside TM context. This adds ptrace interface based helper functions related to checkpointed GPR/FPR access. Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com> Signed-off-by: Simon Guo <wei.guo.simon@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-11-17selftests/powerpc: Add ptrace tests for GPR/FPR registersAnshuman Khandual8-1/+781
This patch adds ptrace interface test for GPR/FPR registers. This adds ptrace interface based helper functions related to GPR/FPR access and some assembly helper functions related to GPR/FPR registers. Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com> Signed-off-by: Simon Guo <wei.guo.simon@gmail.com> [mpe: Add #defines for the new note types when headers don't define them] Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-11-17selftests/powerpc: Move shared headers into new include dirSimon Guo19-34/+37
There are some functions, especially register related, which can be shared across multiple selftests/powerpc test directories. This patch creates a new include directory to store those shared files, so that the file layout becomes more neat. Signed-off-by: Simon Guo <wei.guo.simon@gmail.com> [mpe: Reworked to move the headers only] Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-11-17selftests/powerpc: Add more SPR numbers, TM & VMX instructions to 'reg.h'/'instructions.h'Anshuman Khandual2-9/+36
This patch adds SPR number for TAR, PPR, DSCR special purpose registers. It also adds TM, VSX, VMX related instructions which will then be used by patches later in the series. Now that the new DSCR register definitions (SPRN_DSCR_PRIV and SPRN_DSCR) are defined outside this directory, use them instead. Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com> Signed-off-by: Simon Guo <wei.guo.simon@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-11-14selftests/powerpc: Return false instead of -1 in require_paranoia_below()Peter Senna Tschudin1-3/+3
Returning a negative value for a boolean function seem to have the undesired effect of returning true. require_paranoia_below() is a boolean function, but the variable used to store the return value is an integer, receiving -1 or 0. This patch converts rc to bool, replaces -1 by false, and 0 by true. mpe: This wasn't exhibiting in practice because the common case, where we do the comparison of the desired level vs the current value, was being compiled into a computation based on the result of the comparison, ie. it wasn't using the default -1 value at all. However that was just luck and the code is still wrong. Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com> Signed-off-by: Andrew Shadura <andrew.shadura@collabora.co.uk> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-11-14selftests/powerpc: Revert Load Monitor Register TestsMichael Neuling6-227/+1
Load monitored won't be supported in POWER9, so PPC_FEATURE2_ARCH_3_00 (in HWCAP2) will no longer imply Load monitor support. These Load monitored tests are enabled by PPC_FEATURE2_ARCH_3_00 so they are now bogus and need to be removed. This reverts commit 16c19a2e9833 ("selftests/powerpc: Load Monitor Register Tests"). Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-11-14powerpc: Add support for relative exception tablesNicholas Piggin1-4/+8
This halves the exception table size on 64-bit builds, and it allows build-time sorting of exception tables to work on relocated kernels. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> [mpe: Minor asm fixups and bits to keep the selftests working] Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-11-14powerpc: EX_TABLE macro for exception tablesNicholas Piggin5-0/+3
This macro is taken from s390, and allows more flexibility in changing exception table format. mpe: Put it in ppc_asm.h and only define one version using stringinfy_in_c(). Add some empty definitions and headers to keep the selftests happy. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-11-14selftests/powerpc: Fail load_unaligned_zeropad on miscompareMichael Ellerman1-1/+3
If the result returned by load_unaligned_zeropad() doesn't match what we expect we should fail the test! Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-11-14selftests/powerpc: Abort load_unaligned_zeropad on unhandled SEGVMichael Ellerman1-4/+1
If the load unaligned zeropad test takes a SEGV which can't be handled, we increment segv_error, print the offending NIP and then return without taking any further action. In almost all cases this means we'll just take the SEGV again, and loop eternally spamming the console. Instead just abort(), it's a fatal error in the test. The test harness will notice that the child died and print a nice message for us. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-11-14selftests/powerpc: Add Anton's null_syscall benchmark to the selftestsAnton Blanchard3-2/+160
Pull in a version of Anton's null_syscall benchmark: http://ozlabs.org/~anton/junkcode/null_syscall.c Suggested-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Anton Blanchard <anton@au.ibm.com> Signed-off-by: Rui Teng <rui.teng@linux.vnet.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-10-06selftests/powerpc: Fix build break caused by EXPORT_SYMBOL changesMichael Ellerman2-0/+2
The changes to make EXPORT_SYMBOL work in asm, specifically commit 9445aa1a3062 ("ppc: move exports to definitions"), in the kbuild tree, breaks some of our selftests. That is because we symlink the kernel code into the selftest, and shim the required headers, and we are now missing asm/export.h So create a minimal export.h to keep the tests building once powerpc and the kbuild trees are merged. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-10-06selftests/powerpc: Add missing binaries to .gitignoresMichael Ellerman3-0/+7
Some of the recent new selftests were missing additions to .gitignore, add them now. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-10-04selftests/powerpc: Add checks for transactional VSXs in signal contextsCyril Bur2-1/+126
If a thread receives a signal while transactional the kernel creates a second context to show the transactional state of the process. This test loads some known values and waits for a signal and confirms that the expected values are in the signal context. Signed-off-by: Cyril Bur <cyrilbur@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-10-04selftests/powerpc: Add checks for transactional VMXs in signal contextsCyril Bur2-1/+112
If a thread receives a signal while transactional the kernel creates a second context to show the transactional state of the process. This test loads some known values and waits for a signal and confirms that the expected values are in the signal context. Signed-off-by: Cyril Bur <cyrilbur@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-10-04selftests/powerpc: Add checks for transactional FPUs in signal contextsCyril Bur2-1/+93
If a thread receives a signal while transactional the kernel creates a second context to show the transactional state of the process. This test loads some known values and waits for a signal and confirms that the expected values are in the signal context. Signed-off-by: Cyril Bur <cyrilbur@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-10-04selftests/powerpc: Add checks for transactional GPRs in signal contextsCyril Bur3-1/+210
If a thread receives a signal while transactional the kernel creates a second context to show the transactional state of the process. This test loads some known values and waits for a signal and confirms that the expected values are in the signal context. Signed-off-by: Cyril Bur <cyrilbur@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-10-04selftests/powerpc: Check that signals always get deliveredCyril Bur5-0/+285
Signed-off-by: Cyril Bur <cyrilbur@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-10-04selftests/powerpc: Add TM tcheck helpers in CCyril Bur1-0/+27
Signed-off-by: Cyril Bur <cyrilbur@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-10-04selftests/powerpc: Allow tests to extend their kill timeoutCyril Bur2-3/+8
Signed-off-by: Cyril Bur <cyrilbur@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-10-04selftests/powerpc: Introduce GPR asm helper header fileCyril Bur1-0/+96
Signed-off-by: Cyril Bur <cyrilbur@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-10-04selftests/powerpc: Move VMX stack frame macros to header fileCyril Bur2-84/+97
Signed-off-by: Cyril Bur <cyrilbur@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-10-04selftests/powerpc: Rework FPU stack placement macros and move to header fileCyril Bur2-68/+85
The FPU regs are placed at the top of the stack frame. Currently the position expected to be passed to the macro. The macros now should be passed the stack frame size and from there they can calculate where to put the regs, this makes the use simpler. Also move them to a header file to be used in an different area of the powerpc selftests Signed-off-by: Cyril Bur <cyrilbur@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-10-04selftests/powerpc: Check for VSX preservation across userspace preemptionCyril Bur4-1/+283
Ensure the kernel correctly switches VSX registers correctly. VSX registers are all volatile, and despite the kernel preserving VSX across syscalls, it doesn't have to. Test that during interrupts and timeslices ending the VSX regs remain the same. Signed-off-by: Cyril Bur <cyrilbur@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-09-23selftests/powerpc: Compile selftests against headers without AT_HWCAP2Cyril Bur1-0/+7
It might be nice to compile selftests against older kernels and headers but which may not have HWCAP2. Signed-off-by: Cyril Bur <cyrilbur@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-08-10selftests/powerpc: Specify we expect to build with std=gnu99Michael Ellerman1-1/+1
We have some tests that assume we're using std=gnu99, which is fine on most compilers, but some old compilers use a different default. So make it explicit that we want to use std=gnu99. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-07-26selftests/powerpc: exec() with suspended transactionCyril Bur5-18/+98
Perform an exec() class syscall with a suspended transaction. This is a test for the bug we fixed in 8e96a87c5431 ("powerpc/tm: Always reclaim in start_thread() for exec() class syscalls"). Signed-off-by: Cyril Bur <cyrilbur@gmail.com> [mpe: Fix build errors, use a single binary for the test] Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-07-14selftests/powerpc: Add a test for PROT_SAOMichael Ellerman4-1/+51
PROT_SAO is a powerpc-specific flag to mmap(), and we rely on arch specific logic to allow it to be passed to mmap(). Add a small test to ensure mmap() accepts PROT_SAO. We don't have a good way to test that it actually causes the mapping to be created with the right flags, so for now we just touch the mapping so it's faulted in. In future we might be able to do something better. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-07-07selftests/powerpc: Use "Delta" rather than "Error" in normal outputMichael Ellerman1-1/+1
Use "Delta" to refer to the difference between measurements, rather than "Error", so scripts that look for "Error" aren't confused into thinking there was a failure. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-07-05selftests/powerpc: Test unaligned copy and pasteChris Smart10-1/+332
Test that an ISA 3.0 compliant machine performing an unaligned copy, copy_first, paste or paste_last is sent a SIGBUS. Signed-off-by: Chris Smart <chris@distroguy.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-07-05selftests/powerpc: Import Anton's mmap & futex micro benchmarksMichael Ellerman4-1/+86
These are useful little loops for smoke testing performance. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-07-05selftests/powerpc: Fix generation of vector instructions/types in context_switchCyril Bur2-3/+9
Currently it doesn't appear the resulting binary actually uses any Altivec or VSX instructions the solution is to explicitly tell GCC to use vector instructions and use vector types in the code. Part of this this issue can be GCC version specific: GCC 4.9.x is happy to use Altivec and VSX instructions if altivec.h is includedi (and possibly if vector types are used), this also means that 4.9.x will use VSX instructions even if only -maltivec is passed. It is also possible that Altivec instructions will be used even without -maltivec or -mabi=altivec. GCC 5.2.x complains about the lack of -maltivec parameter if altivec.h is included and will not use VSX unless -mvsx is present on commandline. GCC 5.3.0 has a regression that means __attribute__((__target__("no-vsx")) fails to build. A fix is targeted for 5.4. Furthermore LTO (Link Time Optimisation) doesn't play well with __attribute__((__target__("no-vsx")), LTO can cause GCC to forget about the attribute and compile with VSX instructions regardless. Be wary when enabling -flfo for this test. Signed-off-by: Cyril Bur <cyrilbur@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-07-05selftests/powerpc: Fix usage message in context_switchCyril Bur1-3/+3
When we inverted the behaviour of the flags we forgot to update the usage message. Fixes: 51c21e72eb99 ("selftests/powerpc: Make context_switch touch FP/altivec/vector by default") Signed-off-by: Cyril Bur <cyrilbur@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-07-05selftests/powerpc/pmu: Use signed long to read perf_event_paranoidCyril Bur1-3/+3
Excerpt from man 2 perf_event_open: /proc/sys/kernel/perf_event_paranoid The perf_event_paranoid file can be set to restrict access to the performance counters. 2 allow only user-space measurements. 1 allow both kernel and user measurements (default). 0 allow access to CPU-specific data but not raw tracepoint samples. -1 no restrictions. require_paranoia_below() should return 0 if perf_event_paranoid is below a specified level, the value from perf_event_paranoid is read into an unsigned long so the incorrect value is returned when perf_event_paranoid is set to -1. Without this patch applied there is the same number of selftests/powerpc which skip when /proc/sys/kernel/perf_event_paranoid is set to 1 or -1 but no skips when set to zero. With this patch applied there are no skipped selftests/powerpc test when /proc/sys/kernel/perf_event_paranoid is set to 0 or -1. Signed-off-by: Cyril Bur <cyrilbur@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-06-21selftests/powerpc: Load Monitor Register TestsJack Miller6-1/+227
Adds two tests. One is a simple test to ensure that the new registers LMRR and LMSER are properly maintained. The other actually uses the existing EBB test infrastructure to test that LMRR and LMSER behave as documented. Signed-off-by: Jack Miller <jack@codezen.org> Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-05-11selftests/powerpc: Add test to check if TM SPRs are corruptedRashmica Gupta3-1/+146
Testing that the TM SPRs are behaving the way they should. Uses more threads than cpus to see if the following register values persist with context switching: - the FS (failure summary) flag in TEXASR - TFIAR and TFHAR Signed-off-by: Rashmica Gupta <rashmicy@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-05-11selftests/powerpc: Add TM test to check if TAR is corruptedRashmica Gupta3-1/+92
If the transaction is aborted, the TAR should be rolled back to the checkpointed value before the transaction began. The value written to the TAR when the transaction is suspended should only remain there if the transaction completes successfully. Signed-off-by: Rashmica Gupta <rashmicy@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-05-11selftests/powerpc: Add test for forking inside transactionRashmica Gupta3-1/+44
This test does a fork syscall inside a transaction. Basic sniff test to see if we can enter the kernel during a transaction. Signed-off-by: Rashmica Gupta <rashmicy@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-05-11selftests/powerpc: Standardise TM callsRashmica Gupta2-13/+7
Currently tbegin, tend etc are written as opcodes or asm instructions. So standardise these to asm instructions. Signed-off-by: Rashmica Gupta <rashmicy@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>