Skip to contentSkip to conversation

selftests/powerpc: Add ptrace tests for ppc registers

PATCH New [email protected] 1 participant 16 messages Oct 26, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v16 cover selftests/powerpc: Add ptrace tests for ppc registers

From: Simon Guo <[email protected]>

This selftest suite is for PPC register ptrace functionality. It is also useful for Transaction Memory functionality verification.

Test Result (All tests pass on both BE and LE)
----------------------------------------------
ptrace-ebb PASS
ptrace-gpr PASS
ptrace-tm-gpr PASS
ptrace-tm-spd-gpr PASS
ptrace-tar PASS
ptrace-tm-tar PASS
ptrace-tm-spd-tar PASS
ptrace-vsx PASS
ptrace-tm-vsx PASS
ptrace-tm-spd-vsx PASS
ptrace-tm-spr PASS

Previous versions:
==================

RFC: https://lkml.org/lkml/2014/4/1/292
V1:  https://lkml.org/lkml/2014/4/2/43
V2:  https://lkml.org/lkml/2014/5/5/88
V3:  https://lkml.org/lkml/2014/5/23/486
V4:  https://lkml.org/lkml/2014/11/11/6
V5:  https://lkml.org/lkml/2014/11/25/134
V6:  https://lkml.org/lkml/2014/12/2/98
V7:  https://lkml.org/lkml/2015/1/14/19
V8:  https://lkml.org/lkml/2015/5/19/700
V9:  https://lkml.org/lkml/2015/10/8/522
V10: https://lkml.org/lkml/2016/2/16/219
V11: https://lkml.org/lkml/2016/7/16/231
V12: https://lkml.org/lkml/2016/7/27/134
V13: https://lkml.org/lkml/2016/7/27/656
V14: https://lkml.org/lkml/2016/9/12/57
V15: https://lkml.org/lkml/2016/9/29/722

Changes in V16:
---------------
- Correct expected SIER value in HV mode.
- rebased to latest ppc tree.

Changes in V15:
---------------
- Squash patch 1 and 2 to avoid compile error after patch 1.
- Reorganize some code across patch 3 and 4 to avoid compile error
- Created a new directory utility under tools/testing/selftesting/powerpc to organize common APIs across selftests.
- Use "tbegin." instead of TBEGIN macro. The same for other TM instructions.
- Correct while(ptr); loop without memory barrier.
- Remove an invalid checking on TEXASR in tm-spd-spr.c.
- Use FAIL_IF() as possible to indicate failure line conveniently.
- Consolidate some asm code on GPR/FPR load/save into reg.h/reg.S
- rebased to recent ppc git tree.

Changes in V14:
---------------
- Remove duplicated NT_PPC_xxx register macro in
tools/testing/selftests/powerpc/ptrace/ptrace.h
- Clean some coding style warning

Changes in V13:
---------------
- Remove Cc lines from changelog
- Add more Signed-off-by lines of Simon Guo

Changes in V12:
---------------
- Revert change which is trying to incoporate following patch:
[PATCH 3/5] powerpc: tm: Always use fp_state and vr_state to store live registers
- Release share memory resource in all self test cases
- Optimize tfhar usage in ptrace-tm-spr.c

Changes in V11:
---------------
- Rework based on following patch:
[PATCH 3/5] powerpc: tm: Always use fp_state and vr_state to store live registers
- Split EBB/PMU register ptrace implementation.
- Clean some coding style warning
- Added more shared memory based sync between parent and child during TM tests
- Re worded some of the commit messages and cleaned them up
- selftests/powerpc/ebb/reg.h has already moved as selftests/powerpc/reg.h Dropped the previous patch doing the same thing
- Combined the definitions of SPRN_DSCR from dscr/ test cases
- Fixed dscr/ test cases for new SPRN_DSCR_PRIV definition available

Changes in V10:
---------------
- Rebased against the latest mainline
- Fixed couple of build failures in the test cases related to aux vector

Changes in V9:
--------------
- Fixed static build check failure after tm_orig_msr got dropped
- Fixed asm volatile construct for used registers set
- Fixed EBB, VSX, VMX tests for LE
- Fixed TAR test which was failing because of system calls
- Added checks for PPC_FEATURE2_HTM aux feature in the tests
- Fixed copyright statements

Changes in V8:
--------------
- Split the misc register set into individual ELF core notes
- Implemented support for VSX register set (on and off TM)
- Implemented support for EBB register set
- Implemented review comments on previous versions
- Some code re-arrangements, re-writes and documentation
- Added comprehensive list of test cases into selftests

Changes in V7:
--------------
- Fixed a config directive in the MISC code
- Merged the two gitignore patches into a single one

Changes in V6:
--------------
- Added two git ignore patches for powerpc selftests
- Re-formatted all in-code function definitions in kernel-doc format

Changes in V5:
--------------
- Changed flush_tmregs_to_thread, so not to take into account self tracing
- Dropped the 3rd patch in the series which had merged two functions
- Fixed one build problem for the misc debug register patch
- Accommodated almost all the review comments from Suka on the 6th patch
- Minor changes to the self test program
- Changed commit messages for some of the patches

Changes in V4:
--------------
- Added one test program into the powerpc selftest bucket in this regard
- Split the 2nd patch in the previous series into four different patches
- Accommodated most of the review comments on the previous patch series
- Added a patch to merge functions __switch_to_tm and tm_reclaim_task

Changes in V3:
--------------
- Added two new error paths in every TM related get/set functions when regset support is not present on the system (ENODEV) or when the process does not have any transaction active (ENODATA) in the context
- Installed the active hooks for all the newly added regset core note types

Changes in V2:
--------------
- Removed all the power specific ptrace requests corresponding to new NT_PPC_*
elf core note types. Now all the register sets can be accessed from ptrace
through PTRACE_GETREGSET/PTRACE_SETREGSET using the individual NT_PPC* core
note type instead
- Fixed couple of attribute values for REGSET_TM_CGPR register set
- Renamed flush_tmreg_to_thread as flush_tmregs_to_thread
- Fixed 32 bit checkpointed GPR support
- Changed commit messages accordingly
-------------

Anshuman Khandual (14):
selftests/powerpc: Add more SPR numbers, TM & VMX instructions to

    'reg.h'/'instructions.h'

selftests/powerpc: Add ptrace tests for EBB selftests/powerpc: Add ptrace tests for GPR/FPR registers selftests/powerpc: Add ptrace tests for GPR/FPR registers in TM selftests/powerpc: Add ptrace tests for GPR/FPR registers in suspended
TM
selftests/powerpc: Add ptrace tests for TAR, PPR, DSCR registers selftests/powerpc: Add ptrace tests for TAR, PPR, DSCR in TM selftests/powerpc: Add ptrace tests for TAR, PPR, DSCR in suspended TM selftests/powerpc: Add ptrace tests for VSX, VMX registers selftests/powerpc: Add ptrace tests for VSX, VMX registers in TM selftests/powerpc: Add ptrace tests for VSX, VMX registers in
suspended TM
selftests/powerpc: Add ptrace tests for TM SPR registers selftests/powerpc: Add .gitignore file for ptrace executables selftests/powerpc: Fix a build issue

Simon Guo (1):
selftests/powerpc: move shared utility files into new utility/ dir

 tools/testing/selftests/powerpc/Makefile           |   5 +-
 tools/testing/selftests/powerpc/alignment/Makefile |   2 +-
 tools/testing/selftests/powerpc/basic_asm.h        |  70 --
 .../testing/selftests/powerpc/benchmarks/Makefile  |   2 +-
 .../selftests/powerpc/benchmarks/context_switch.c  |   2 +-
 .../selftests/powerpc/context_switch/Makefile      |   2 +-
 .../selftests/powerpc/context_switch/cp_abort.c    |   6 +-
 .../testing/selftests/powerpc/copyloops/validate.c |   2 +-
 tools/testing/selftests/powerpc/dscr/dscr.h        |  10 +-
 tools/testing/selftests/powerpc/fpu_asm.h          |  80 ---
 tools/testing/selftests/powerpc/gpr_asm.h          |  96 ---
 tools/testing/selftests/powerpc/instructions.h     |  68 --
 tools/testing/selftests/powerpc/math/fpu_asm.S     |   4 +-
 tools/testing/selftests/powerpc/math/vmx_asm.S     |   4 +-
 tools/testing/selftests/powerpc/math/vsx_asm.S     |   4 +-
 tools/testing/selftests/powerpc/mm/Makefile        |   2 +-
 tools/testing/selftests/powerpc/pmu/Makefile       |   4 +-
 tools/testing/selftests/powerpc/pmu/ebb/Makefile   |   2 +-
 tools/testing/selftests/powerpc/ptrace/.gitignore  |  11 +
 tools/testing/selftests/powerpc/ptrace/Makefile    |  14 +
 .../testing/selftests/powerpc/ptrace/ptrace-ebb.c  | 188 +++++
 .../testing/selftests/powerpc/ptrace/ptrace-ebb.h  | 100 +++
 .../testing/selftests/powerpc/ptrace/ptrace-gpr.c  | 123 ++++
 .../testing/selftests/powerpc/ptrace/ptrace-gpr.h  |  74 ++
 .../testing/selftests/powerpc/ptrace/ptrace-tar.c  | 135 ++++
 .../testing/selftests/powerpc/ptrace/ptrace-tar.h  |  50 ++
 .../selftests/powerpc/ptrace/ptrace-tm-gpr.c       | 158 +++++
 .../selftests/powerpc/ptrace/ptrace-tm-spd-gpr.c   | 169 +++++
 .../selftests/powerpc/ptrace/ptrace-tm-spd-tar.c   | 174 +++++
 .../selftests/powerpc/ptrace/ptrace-tm-spd-vsx.c   | 185 +++++
 .../selftests/powerpc/ptrace/ptrace-tm-spr.c       | 168 +++++
 .../selftests/powerpc/ptrace/ptrace-tm-tar.c       | 160 +++++
 .../selftests/powerpc/ptrace/ptrace-tm-vsx.c       | 168 +++++
 .../testing/selftests/powerpc/ptrace/ptrace-vsx.c  | 117 ++++
 .../testing/selftests/powerpc/ptrace/ptrace-vsx.h  | 127 ++++
 tools/testing/selftests/powerpc/ptrace/ptrace.h    | 771 +++++++++++++++++++++
 tools/testing/selftests/powerpc/reg.h              |  60 --
 tools/testing/selftests/powerpc/signal/Makefile    |   2 +-
 tools/testing/selftests/powerpc/signal/signal.S    |   2 +-
 .../testing/selftests/powerpc/stringloops/memcmp.c |   2 +-
 tools/testing/selftests/powerpc/tm/Makefile        |   2 +-
 tools/testing/selftests/powerpc/tm/tm-signal.S     |  10 +-
 tools/testing/selftests/powerpc/tm/tm.h            |   2 +-
 .../testing/selftests/powerpc/utility/basic_asm.h  |  73 ++
 tools/testing/selftests/powerpc/utility/fpu_asm.h  |  80 +++
 tools/testing/selftests/powerpc/utility/gpr_asm.h  |  96 +++
 .../selftests/powerpc/utility/instructions.h       |  68 ++
 tools/testing/selftests/powerpc/utility/reg.S      | 397 +++++++++++
 tools/testing/selftests/powerpc/utility/reg.h      | 150 ++++
 tools/testing/selftests/powerpc/utility/utils.c    |  87 +++
 tools/testing/selftests/powerpc/utility/utils.h    |  77 ++
 tools/testing/selftests/powerpc/utility/vmx_asm.h  |  96 +++
 tools/testing/selftests/powerpc/utility/vsx_asm.h  |  71 ++
 tools/testing/selftests/powerpc/utils.c            |  87 ---
 tools/testing/selftests/powerpc/utils.h            |  77 --
 tools/testing/selftests/powerpc/vmx_asm.h          |  96 ---
 tools/testing/selftests/powerpc/vsx_asm.h          |  71 --
 57 files changed, 4122 insertions(+), 741 deletions(-)
 delete mode 100644 tools/testing/selftests/powerpc/basic_asm.h
 delete mode 100644 tools/testing/selftests/powerpc/fpu_asm.h
 delete mode 100644 tools/testing/selftests/powerpc/gpr_asm.h
 delete mode 100644 tools/testing/selftests/powerpc/instructions.h
 create mode 100644 tools/testing/selftests/powerpc/ptrace/.gitignore
 create mode 100644 tools/testing/selftests/powerpc/ptrace/Makefile
 create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-ebb.c
 create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-ebb.h
 create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-gpr.c
 create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-gpr.h
 create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-tar.c
 create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-tar.h
 create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-tm-gpr.c
 create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-tm-spd-gpr.c
 create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-tm-spd-tar.c
 create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-tm-spd-vsx.c
 create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-tm-spr.c
 create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-tm-tar.c
 create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-tm-vsx.c
 create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-vsx.c
 create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-vsx.h
 create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace.h
 delete mode 100644 tools/testing/selftests/powerpc/reg.h
 create mode 100644 tools/testing/selftests/powerpc/utility/basic_asm.h
 create mode 100644 tools/testing/selftests/powerpc/utility/fpu_asm.h
 create mode 100644 tools/testing/selftests/powerpc/utility/gpr_asm.h
 create mode 100644 tools/testing/selftests/powerpc/utility/instructions.h
 create mode 100644 tools/testing/selftests/powerpc/utility/reg.S
 create mode 100644 tools/testing/selftests/powerpc/utility/reg.h
 create mode 100644 tools/testing/selftests/powerpc/utility/utils.c
 create mode 100644 tools/testing/selftests/powerpc/utility/utils.h
 create mode 100644 tools/testing/selftests/powerpc/utility/vmx_asm.h
 create mode 100644 tools/testing/selftests/powerpc/utility/vsx_asm.h
 delete mode 100644 tools/testing/selftests/powerpc/utils.c
 delete mode 100644 tools/testing/selftests/powerpc/utils.h
 delete mode 100644 tools/testing/selftests/powerpc/vmx_asm.h
 delete mode 100644 tools/testing/selftests/powerpc/vsx_asm.h
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH v16 1/15 selftests/powerpc: Add more SPR numbers, TM & VMX instructions to 'reg.h'/'instructions.h'

From: Anshuman Khandual <[email protected]>

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.

---
 tools/testing/selftests/powerpc/dscr/dscr.h | 10 ++++-----
 tools/testing/selftests/powerpc/reg.h       | 35 ++++++++++++++++++++++++++---
 2 files changed, 36 insertions(+), 9 deletions(-)
tools/testing/selftests/powerpc/dscr/dscr.h +4 -6
index a36af1b..18ea223b 100644
@@ -28,8 +28,6 @@
 
 #include "utils.h"
 
-#define SPRN_DSCR	0x11	/* Privilege state SPR */
-#define SPRN_DSCR_USR	0x03	/* Problem state SPR */
 #define THREADS		100	/* Max threads */
 #define COUNT		100	/* Max iterations */
 #define DSCR_MAX	16	/* Max DSCR value */
@@ -48,14 +46,14 @@ inline unsigned long get_dscr(void)
 {
 	unsigned long ret;
 
-	asm volatile("mfspr %0,%1" : "=r" (ret): "i" (SPRN_DSCR));
+	asm volatile("mfspr %0,%1" : "=r" (ret) : "i" (SPRN_DSCR_PRIV));
 
 	return ret;
 }
 
 inline void set_dscr(unsigned long val)
 {
-	asm volatile("mtspr %1,%0" : : "r" (val), "i" (SPRN_DSCR));
+	asm volatile("mtspr %1,%0" : : "r" (val), "i" (SPRN_DSCR_PRIV));
 }
 
 /* Problem state DSCR access */
@@ -63,14 +61,14 @@ inline unsigned long get_dscr_usr(void)
 {
 	unsigned long ret;
 
-	asm volatile("mfspr %0,%1" : "=r" (ret): "i" (SPRN_DSCR_USR));
+	asm volatile("mfspr %0,%1" : "=r" (ret) : "i" (SPRN_DSCR));
 
 	return ret;
 }
 
 inline void set_dscr_usr(unsigned long val)
 {
-	asm volatile("mtspr %1,%0" : : "r" (val), "i" (SPRN_DSCR_USR));
+	asm volatile("mtspr %1,%0" : : "r" (val), "i" (SPRN_DSCR));
 }
 
 /* Default DSCR access */
tools/testing/selftests/powerpc/reg.h +32 -3
index fddf368..f5d33db 100644
@@ -51,10 +51,39 @@
 #define SPRN_SDAR      781
 #define SPRN_SIER      768
 
-#define SPRN_TEXASR     0x82
+#define SPRN_TEXASR     0x82    /* Transaction Exception and Status Register */
 #define SPRN_TFIAR      0x81    /* Transaction Failure Inst Addr    */
 #define SPRN_TFHAR      0x80    /* Transaction Failure Handler Addr */
-#define TEXASR_FS       0x08000000
-#define SPRN_TAR        0x32f
+#define SPRN_TAR        0x32f	/* Target Address Register */
+
+#define SPRN_DSCR_PRIV 0x11	/* Privilege State DSCR */
+#define SPRN_DSCR      0x03	/* Data Stream Control Register */
+#define SPRN_PPR       896	/* Program Priority Register */
+
+/* TEXASR register bits */
+#define TEXASR_FC	0xFE00000000000000
+#define TEXASR_FP	0x0100000000000000
+#define TEXASR_DA	0x0080000000000000
+#define TEXASR_NO	0x0040000000000000
+#define TEXASR_FO	0x0020000000000000
+#define TEXASR_SIC	0x0010000000000000
+#define TEXASR_NTC	0x0008000000000000
+#define TEXASR_TC	0x0004000000000000
+#define TEXASR_TIC	0x0002000000000000
+#define TEXASR_IC	0x0001000000000000
+#define TEXASR_IFC	0x0000800000000000
+#define TEXASR_ABT	0x0000000100000000
+#define TEXASR_SPD	0x0000000080000000
+#define TEXASR_HV	0x0000000020000000
+#define TEXASR_PR	0x0000000010000000
+#define TEXASR_FS	0x0000000008000000
+#define TEXASR_TE	0x0000000004000000
+#define TEXASR_ROT	0x0000000002000000
+
+/* Vector Instructions */
+#define VSX_XX1(xs, ra, rb)	(((xs) & 0x1f) << 21 | ((ra) << 16) |  \
+				 ((rb) << 11) | (((xs) >> 5)))
+#define STXVD2X(xs, ra, rb)	.long (0x7c000798 | VSX_XX1((xs), (ra), (rb)))
+#define LXVD2X(xs, ra, rb)	.long (0x7c000698 | VSX_XX1((xs), (ra), (rb)))
 
 #endif /* _SELFTESTS_POWERPC_REG_H */
Signature · 1 line
1.8.3.1
#2 lore raw

PATCH v16 2/15 selftests/powerpc: move shared utility files into new utility/ dir

In reply to [email protected]

From: Simon Guo <[email protected]>

There are some functions, especially register related, which can be shared across multiple selftests/powerpc test directories.

This patch creates a new utility directory to store those shared functionalities, so that the file layout becomes more neat.

---
 tools/testing/selftests/powerpc/Makefile           |  2 +-
 tools/testing/selftests/powerpc/alignment/Makefile |  2 +-
 tools/testing/selftests/powerpc/basic_asm.h        | 70 ----------------
 .../testing/selftests/powerpc/benchmarks/Makefile  |  2 +-
 .../selftests/powerpc/benchmarks/context_switch.c  |  2 +-
 .../selftests/powerpc/context_switch/Makefile      |  2 +-
 .../testing/selftests/powerpc/copyloops/validate.c |  2 +-
 tools/testing/selftests/powerpc/fpu_asm.h          | 80 ------------------
 tools/testing/selftests/powerpc/gpr_asm.h          | 96 ----------------------
 tools/testing/selftests/powerpc/instructions.h     | 68 ---------------
 tools/testing/selftests/powerpc/math/fpu_asm.S     |  4 +-
 tools/testing/selftests/powerpc/math/vmx_asm.S     |  4 +-
 tools/testing/selftests/powerpc/math/vsx_asm.S     |  4 +-
 tools/testing/selftests/powerpc/mm/Makefile        |  2 +-
 tools/testing/selftests/powerpc/pmu/Makefile       |  4 +-
 tools/testing/selftests/powerpc/pmu/ebb/Makefile   |  2 +-
 tools/testing/selftests/powerpc/reg.h              | 89 --------------------
 tools/testing/selftests/powerpc/signal/Makefile    |  2 +-
 tools/testing/selftests/powerpc/signal/signal.S    |  2 +-
 .../testing/selftests/powerpc/stringloops/memcmp.c |  2 +-
 tools/testing/selftests/powerpc/tm/Makefile        |  2 +-
 tools/testing/selftests/powerpc/tm/tm-signal.S     | 10 +--
 tools/testing/selftests/powerpc/tm/tm.h            |  2 +-
 .../testing/selftests/powerpc/utility/basic_asm.h  | 73 ++++++++++++++++
 tools/testing/selftests/powerpc/utility/fpu_asm.h  | 80 ++++++++++++++++++
 tools/testing/selftests/powerpc/utility/gpr_asm.h  | 96 ++++++++++++++++++++++
 .../selftests/powerpc/utility/instructions.h       | 68 +++++++++++++++
 tools/testing/selftests/powerpc/utility/reg.h      | 89 ++++++++++++++++++++
 tools/testing/selftests/powerpc/utility/utils.c    | 87 ++++++++++++++++++++
 tools/testing/selftests/powerpc/utility/utils.h    | 77 +++++++++++++++++
 tools/testing/selftests/powerpc/utility/vmx_asm.h  | 96 ++++++++++++++++++++++
 tools/testing/selftests/powerpc/utility/vsx_asm.h  | 71 ++++++++++++++++
 tools/testing/selftests/powerpc/utils.c            | 87 --------------------
 tools/testing/selftests/powerpc/utils.h            | 77 -----------------
 tools/testing/selftests/powerpc/vmx_asm.h          | 96 ----------------------
 tools/testing/selftests/powerpc/vsx_asm.h          | 71 ----------------
 36 files changed, 763 insertions(+), 760 deletions(-)
 delete mode 100644 tools/testing/selftests/powerpc/basic_asm.h
 delete mode 100644 tools/testing/selftests/powerpc/fpu_asm.h
 delete mode 100644 tools/testing/selftests/powerpc/gpr_asm.h
 delete mode 100644 tools/testing/selftests/powerpc/instructions.h
 delete mode 100644 tools/testing/selftests/powerpc/reg.h
 create mode 100644 tools/testing/selftests/powerpc/utility/basic_asm.h
 create mode 100644 tools/testing/selftests/powerpc/utility/fpu_asm.h
 create mode 100644 tools/testing/selftests/powerpc/utility/gpr_asm.h
 create mode 100644 tools/testing/selftests/powerpc/utility/instructions.h
 create mode 100644 tools/testing/selftests/powerpc/utility/reg.h
 create mode 100644 tools/testing/selftests/powerpc/utility/utils.c
 create mode 100644 tools/testing/selftests/powerpc/utility/utils.h
 create mode 100644 tools/testing/selftests/powerpc/utility/vmx_asm.h
 create mode 100644 tools/testing/selftests/powerpc/utility/vsx_asm.h
 delete mode 100644 tools/testing/selftests/powerpc/utils.c
 delete mode 100644 tools/testing/selftests/powerpc/utils.h
 delete mode 100644 tools/testing/selftests/powerpc/vmx_asm.h
 delete mode 100644 tools/testing/selftests/powerpc/vsx_asm.h
tools/testing/selftests/powerpc/Makefile +1 -1
index db54a33..cd65cb5 100644
@@ -8,7 +8,7 @@ ifeq ($(ARCH),powerpc)
 
 GIT_VERSION = $(shell git describe --always --long --dirty || echo "unknown")
 
-CFLAGS := -std=gnu99 -Wall -O2 -Wall -Werror -DGIT_VERSION='"$(GIT_VERSION)"' -I$(CURDIR) $(CFLAGS)
+CFLAGS := -std=gnu99 -Wall -O2 -Wall -Werror -DGIT_VERSION='"$(GIT_VERSION)"' -I$(CURDIR) -I$(CURDIR)/utility $(CFLAGS)
 
 export CFLAGS
 
tools/testing/selftests/powerpc/alignment/Makefile +1 -1
index ad6a4e4..b61e5e7 100644
@@ -2,7 +2,7 @@ TEST_PROGS := copy_unaligned copy_first_unaligned paste_unaligned paste_last_una
 
 all: $(TEST_PROGS)
 
-$(TEST_PROGS): ../harness.c ../utils.c copy_paste_unaligned_common.c
+$(TEST_PROGS): ../harness.c ../utility/utils.c copy_paste_unaligned_common.c
 
 include ../../lib.mk
 
tools/testing/selftests/powerpc/basic_asm.h deleted +0 -70

70 lines not on this page · raw message

tools/testing/selftests/powerpc/benchmarks/Makefile +1 -1
index a9adfb7..fc55d2b 100644
@@ -6,7 +6,7 @@ all: $(TEST_PROGS)
 
 $(TEST_PROGS): ../harness.c
 
-context_switch: ../utils.c
+context_switch: ../utility/utils.c
 context_switch: CFLAGS += -maltivec -mvsx -mabi=altivec
 context_switch: LDLIBS += -lpthread
 
tools/testing/selftests/powerpc/benchmarks/context_switch.c +1 -1
index a36883a..778f5fb 100644
@@ -28,7 +28,7 @@
 #ifdef __powerpc__
 #include <altivec.h>
 #endif
-#include "../utils.h"
+#include "utils.h"
 
 static unsigned int timeout = 30;
 
tools/testing/selftests/powerpc/context_switch/Makefile +1 -1
index e164d14..48b558f 100644
@@ -2,7 +2,7 @@ TEST_PROGS := cp_abort
 
 all: $(TEST_PROGS)
 
-$(TEST_PROGS): ../harness.c ../utils.c
+$(TEST_PROGS): ../harness.c ../utility/utils.c
 
 include ../../lib.mk
 
tools/testing/selftests/powerpc/copyloops/validate.c +1 -1
index 1750ff5..7fb436f 100644
@@ -3,7 +3,7 @@
 #include <stdlib.h>
 #include <stdbool.h>
 
-#include "../utils.h"
+#include "utils.h"
 
 #define MAX_LEN 8192
 #define MAX_OFFSET 16
tools/testing/selftests/powerpc/fpu_asm.h deleted +0 -80

80 lines not on this page · raw message

tools/testing/selftests/powerpc/gpr_asm.h deleted +0 -96

96 lines not on this page · raw message

tools/testing/selftests/powerpc/instructions.h deleted +0 -68

68 lines not on this page · raw message

tools/testing/selftests/powerpc/math/fpu_asm.S +2 -2
index 241f067..8a04bb1 100644
@@ -7,8 +7,8 @@
  * 2 of the License, or (at your option) any later version.
  */
 
-#include "../basic_asm.h"
-#include "../fpu_asm.h"
+#include "basic_asm.h"
+#include "fpu_asm.h"
 
 FUNC_START(check_fpu)
 	mr r4,r3
tools/testing/selftests/powerpc/math/vmx_asm.S +2 -2
index fd74da4..cb1e5ae 100644
@@ -7,8 +7,8 @@
  * 2 of the License, or (at your option) any later version.
  */
 
-#include "../basic_asm.h"
-#include "../vmx_asm.h"
+#include "basic_asm.h"
+#include "vmx_asm.h"
 
 # Should be safe from C, only touches r4, r5 and v0,v1,v2
 FUNC_START(check_vmx)
tools/testing/selftests/powerpc/math/vsx_asm.S +2 -2
index a110dd8..8f431f6 100644
@@ -7,8 +7,8 @@
  * 2 of the License, or (at your option) any later version.
  */
 
-#include "../basic_asm.h"
-#include "../vsx_asm.h"
+#include "basic_asm.h"
+#include "vsx_asm.h"
 
 #long check_vsx(vector int *r3);
 #This function wraps storeing VSX regs to the end of an array and a
tools/testing/selftests/powerpc/mm/Makefile +1 -1
index 3bdb96e..813797b 100644
@@ -8,7 +8,7 @@ all: $(TEST_PROGS) $(TEST_FILES)
 
 $(TEST_PROGS): ../harness.c
 
-prot_sao: ../utils.c
+prot_sao: ../utility/utils.c
 
 include ../../lib.mk
 
tools/testing/selftests/powerpc/pmu/Makefile +2 -2
index ac41a71..5ca77af 100644
@@ -2,7 +2,7 @@ noarg:
 	$(MAKE) -C ../
 
 TEST_PROGS := count_instructions l3_bank_test per_event_excludes
-EXTRA_SOURCES := ../harness.c event.c lib.c ../utils.c
+EXTRA_SOURCES := ../harness.c event.c lib.c ../utility/utils.c
 
 all: $(TEST_PROGS) ebb
 
@@ -12,7 +12,7 @@ $(TEST_PROGS): $(EXTRA_SOURCES)
 count_instructions: loop.S count_instructions.c $(EXTRA_SOURCES)
 	$(CC) $(CFLAGS) -m64 -o $@ $^
 
-per_event_excludes: ../utils.c
+per_event_excludes: ../utility/utils.c
 
 include ../../lib.mk
 
tools/testing/selftests/powerpc/pmu/ebb/Makefile +1 -1
index 6b0453e..db4a64f 100644
@@ -18,7 +18,7 @@ TEST_PROGS := reg_access_test event_attributes_test cycles_test	\
 
 all: $(TEST_PROGS)
 
-$(TEST_PROGS): ../../harness.c ../../utils.c ../event.c ../lib.c \
+$(TEST_PROGS): ../../harness.c ../../utility/utils.c ../event.c ../lib.c \
 	       ebb.c ebb_handler.S trace.c busy_loop.S
 
 instruction_count_test: ../loop.S
tools/testing/selftests/powerpc/reg.h deleted +0 -89

89 lines not on this page · raw message

tools/testing/selftests/powerpc/signal/Makefile +1 -1
index f0eef27..285e1b0 100644
@@ -2,7 +2,7 @@ TEST_PROGS := signal signal_tm
 
 all: $(TEST_PROGS)
 
-$(TEST_PROGS): ../harness.c ../utils.c signal.S
+$(TEST_PROGS): ../harness.c ../utility/utils.c signal.S
 
 CFLAGS += -maltivec
 signal_tm: CFLAGS += -mhtm
tools/testing/selftests/powerpc/signal/signal.S +1 -1
index 7043d52..322f2f1 100644
@@ -7,7 +7,7 @@
  * 2 of the License, or (at your option) any later version.
  */
 
-#include "../basic_asm.h"
+#include "basic_asm.h"
 
 /* long signal_self(pid_t pid, int sig); */
 FUNC_START(signal_self)
tools/testing/selftests/powerpc/stringloops/memcmp.c +1 -1
index 17417dd..30b1222 100644
@@ -1,7 +1,7 @@
 #include <malloc.h>
 #include <stdlib.h>
 #include <string.h>
-#include "../utils.h"
+#include "utils.h"
 
 #define SIZE 256
 #define ITERATIONS 10000
tools/testing/selftests/powerpc/tm/Makefile +1 -1
index c6c53c8..d7d99de 100644
@@ -6,7 +6,7 @@ TEST_PROGS := tm-resched-dscr tm-syscall tm-signal-msr-resv tm-signal-stack \
 
 all: $(TEST_PROGS)
 
-$(TEST_PROGS): ../harness.c ../utils.c
+$(TEST_PROGS): ../harness.c ../utility/utils.c
 
 CFLAGS += -mhtm
 
tools/testing/selftests/powerpc/tm/tm-signal.S +5 -5
index 4e13e8b..506a4eb 100644
@@ -7,11 +7,11 @@
  * 2 of the License, or (at your option) any later version.
  */
 
-#include "../basic_asm.h"
-#include "../gpr_asm.h"
-#include "../fpu_asm.h"
-#include "../vmx_asm.h"
-#include "../vsx_asm.h"
+#include "basic_asm.h"
+#include "gpr_asm.h"
+#include "fpu_asm.h"
+#include "vmx_asm.h"
+#include "vsx_asm.h"
 
 /*
  * Large caveat here being that the caller cannot expect the
tools/testing/selftests/powerpc/tm/tm.h +1 -1
index 2c8da74..0ffff04 100644
@@ -10,7 +10,7 @@
 #include <asm/cputable.h>
 #include <stdbool.h>
 
-#include "../utils.h"
+#include "utils.h"
 
 static inline bool have_htm(void)
 {
tools/testing/selftests/powerpc/utility/basic_asm.h new file +73 -0

73 lines not on this page · raw message

tools/testing/selftests/powerpc/utility/fpu_asm.h new file +80 -0

80 lines not on this page · raw message

tools/testing/selftests/powerpc/utility/gpr_asm.h new file +96 -0

96 lines not on this page · raw message

tools/testing/selftests/powerpc/utility/instructions.h new file +68 -0

68 lines not on this page · raw message

tools/testing/selftests/powerpc/utility/reg.h new file +89 -0

89 lines not on this page · raw message

tools/testing/selftests/powerpc/utility/utils.c new file +87 -0

87 lines not on this page · raw message

tools/testing/selftests/powerpc/utility/utils.h new file +77 -0

77 lines not on this page · raw message

tools/testing/selftests/powerpc/utility/vmx_asm.h new file +96 -0

96 lines not on this page · raw message

tools/testing/selftests/powerpc/utility/vsx_asm.h new file +71 -0

71 lines not on this page · raw message

tools/testing/selftests/powerpc/utils.c deleted +0 -87

87 lines not on this page · raw message

tools/testing/selftests/powerpc/utils.h deleted +0 -77

77 lines not on this page · raw message

tools/testing/selftests/powerpc/vmx_asm.h deleted +0 -96

96 lines not on this page · raw message

tools/testing/selftests/powerpc/vsx_asm.h deleted +0 -71

71 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#3 lore raw

PATCH v16 3/15 selftests/powerpc: Add ptrace tests for EBB

In reply to [email protected]

From: Anshuman Khandual <[email protected]>

This patch adds ptrace interface test for EBB/PMU specific registers. This also adds some generic ptrace interface based helper functions to be used by other patches later on in the series.

---
 tools/testing/selftests/powerpc/Makefile           |   3 +-
 tools/testing/selftests/powerpc/ptrace/Makefile    |  11 +
 .../testing/selftests/powerpc/ptrace/ptrace-ebb.c  | 188 +++++++++++++++++
 .../testing/selftests/powerpc/ptrace/ptrace-ebb.h  | 100 +++++++++
 tools/testing/selftests/powerpc/ptrace/ptrace.h    | 225 +++++++++++++++++++++
 5 files changed, 526 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/powerpc/ptrace/Makefile
 create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-ebb.c
 create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-ebb.h
 create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace.h
tools/testing/selftests/powerpc/Makefile +2 -1
index cd65cb5..c46bc3a 100644
@@ -26,7 +26,8 @@ SUB_DIRS = alignment		\
 	   syscalls		\
 	   tm			\
 	   vphn         \
-	   math
+	   math		\
+	   ptrace
 
 endif
 
tools/testing/selftests/powerpc/ptrace/Makefile new file +11 -0
new file mode 100644
index 0000000..84c1c01
@@ -0,0 +1,11 @@
+TEST_PROGS := ptrace-ebb
+
+include ../../lib.mk
+
+all: $(TEST_PROGS)
+CFLAGS += -m64
+$(TEST_PROGS): ../harness.c ../utility/utils.c ptrace.h
+ptrace-ebb: ../pmu/event.c ../pmu/lib.c ../pmu/ebb/ebb_handler.S ../pmu/ebb/busy_loop.S
+ptrace-ebb: CFLAGS += -I../pmu/ebb
+clean:
+	rm -f $(TEST_PROGS) *.o
tools/testing/selftests/powerpc/ptrace/ptrace-ebb.c new file +188 -0

188 lines not on this page · raw message

tools/testing/selftests/powerpc/ptrace/ptrace-ebb.h new file +100 -0

100 lines not on this page · raw message

tools/testing/selftests/powerpc/ptrace/ptrace.h new file +225 -0

225 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#4 lore raw

PATCH v16 4/15 selftests/powerpc: Add ptrace tests for GPR/FPR registers

In reply to [email protected]

From: Anshuman Khandual <[email protected]>

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.

---
 tools/testing/selftests/powerpc/ptrace/Makefile    |   4 +-
 .../testing/selftests/powerpc/ptrace/ptrace-gpr.c  | 123 ++++++++++++
 .../testing/selftests/powerpc/ptrace/ptrace-gpr.h  |  74 ++++++++
 tools/testing/selftests/powerpc/ptrace/ptrace.h    | 211 +++++++++++++++++++++
 tools/testing/selftests/powerpc/utility/reg.S      | 132 +++++++++++++
 tools/testing/selftests/powerpc/utility/reg.h      |  61 ++++++
 6 files changed, 603 insertions(+), 2 deletions(-)
 create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-gpr.c
 create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-gpr.h
 create mode 100644 tools/testing/selftests/powerpc/utility/reg.S
tools/testing/selftests/powerpc/ptrace/Makefile +2 -2
index 84c1c01..e9b8e7d 100644
@@ -1,10 +1,10 @@
-TEST_PROGS := ptrace-ebb
+TEST_PROGS := ptrace-ebb ptrace-gpr
 
 include ../../lib.mk
 
 all: $(TEST_PROGS)
 CFLAGS += -m64
-$(TEST_PROGS): ../harness.c ../utility/utils.c ptrace.h
+$(TEST_PROGS): ../harness.c ../utility/reg.S ../utility/utils.c ptrace.h
 ptrace-ebb: ../pmu/event.c ../pmu/lib.c ../pmu/ebb/ebb_handler.S ../pmu/ebb/busy_loop.S
 ptrace-ebb: CFLAGS += -I../pmu/ebb
 clean:
tools/testing/selftests/powerpc/ptrace/ptrace-gpr.c new file +123 -0

123 lines not on this page · raw message

tools/testing/selftests/powerpc/ptrace/ptrace-gpr.h new file +74 -0

74 lines not on this page · raw message

tools/testing/selftests/powerpc/ptrace/ptrace.h +211 -0

220 lines not on this page · raw message

tools/testing/selftests/powerpc/utility/reg.S new file +132 -0

132 lines not on this page · raw message

tools/testing/selftests/powerpc/utility/reg.h +61 -0

65 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#5 lore raw

PATCH v16 5/15 selftests/powerpc: Add ptrace tests for GPR/FPR registers in TM

In reply to [email protected]

From: Anshuman Khandual <[email protected]>

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.

---
 tools/testing/selftests/powerpc/ptrace/Makefile    |   5 +-
 .../selftests/powerpc/ptrace/ptrace-tm-gpr.c       | 158 +++++++++++++++++++++
 2 files changed, 161 insertions(+), 2 deletions(-)
 create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-tm-gpr.c
tools/testing/selftests/powerpc/ptrace/Makefile +3 -2
index e9b8e7d..bb958a8 100644
@@ -1,11 +1,12 @@
-TEST_PROGS := ptrace-ebb ptrace-gpr
+TEST_PROGS := ptrace-ebb ptrace-gpr ptrace-tm-gpr
 
 include ../../lib.mk
 
 all: $(TEST_PROGS)
-CFLAGS += -m64
+CFLAGS += -m64 -I../tm -mhtm
 $(TEST_PROGS): ../harness.c ../utility/reg.S ../utility/utils.c ptrace.h
 ptrace-ebb: ../pmu/event.c ../pmu/lib.c ../pmu/ebb/ebb_handler.S ../pmu/ebb/busy_loop.S
 ptrace-ebb: CFLAGS += -I../pmu/ebb
+
 clean:
 	rm -f $(TEST_PROGS) *.o
tools/testing/selftests/powerpc/ptrace/ptrace-tm-gpr.c new file +158 -0

158 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#6 lore raw

PATCH v16 6/15 selftests/powerpc: Add ptrace tests for GPR/FPR registers in suspended TM

In reply to [email protected]

From: Anshuman Khandual <[email protected]>

This patch adds ptrace interface test for GPR/FPR registers inside suspended TM context.

---
 tools/testing/selftests/powerpc/ptrace/Makefile    |   2 +-
 .../selftests/powerpc/ptrace/ptrace-tm-spd-gpr.c   | 169 +++++++++++++++++++++
 2 files changed, 170 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-tm-spd-gpr.c
tools/testing/selftests/powerpc/ptrace/Makefile +1 -1
index bb958a8..9f3ed2b 100644
@@ -1,4 +1,4 @@
-TEST_PROGS := ptrace-ebb ptrace-gpr ptrace-tm-gpr
+TEST_PROGS := ptrace-ebb ptrace-gpr ptrace-tm-gpr ptrace-tm-spd-gpr
 
 include ../../lib.mk
 
tools/testing/selftests/powerpc/ptrace/ptrace-tm-spd-gpr.c new file +169 -0

169 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#7 lore raw

PATCH v16 7/15 selftests/powerpc: Add ptrace tests for TAR, PPR, DSCR registers

In reply to [email protected]

From: Anshuman Khandual <[email protected]>

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.

---
 tools/testing/selftests/powerpc/ptrace/Makefile    |   3 +-
 .../testing/selftests/powerpc/ptrace/ptrace-tar.c  | 135 +++++++++++++++
 .../testing/selftests/powerpc/ptrace/ptrace-tar.h  |  50 ++++++
 tools/testing/selftests/powerpc/ptrace/ptrace.h    | 181 +++++++++++++++++++++
 4 files changed, 368 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-tar.c
 create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-tar.h
tools/testing/selftests/powerpc/ptrace/Makefile +2 -1
index 9f3ed2b..dfb0847 100644
@@ -1,4 +1,5 @@
-TEST_PROGS := ptrace-ebb ptrace-gpr ptrace-tm-gpr ptrace-tm-spd-gpr
+TEST_PROGS := ptrace-ebb ptrace-gpr ptrace-tm-gpr ptrace-tm-spd-gpr \
+ptrace-tar
 
 include ../../lib.mk
 
tools/testing/selftests/powerpc/ptrace/ptrace-tar.c new file +135 -0

135 lines not on this page · raw message

tools/testing/selftests/powerpc/ptrace/ptrace-tar.h new file +50 -0

50 lines not on this page · raw message

tools/testing/selftests/powerpc/ptrace/ptrace.h +181 -0

187 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#8 lore raw

PATCH v16 8/15 selftests/powerpc: Add ptrace tests for TAR, PPR, DSCR in TM

In reply to [email protected]

From: Anshuman Khandual <[email protected]>

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.

---
 tools/testing/selftests/powerpc/ptrace/Makefile    |   2 +-
 .../selftests/powerpc/ptrace/ptrace-tm-tar.c       | 160 +++++++++++++++++++++
 2 files changed, 161 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-tm-tar.c
tools/testing/selftests/powerpc/ptrace/Makefile +1 -1
index dfb0847..9af9ad5 100644
@@ -1,5 +1,5 @@
 TEST_PROGS := ptrace-ebb ptrace-gpr ptrace-tm-gpr ptrace-tm-spd-gpr \
-ptrace-tar
+ptrace-tar ptrace-tm-tar
 
 include ../../lib.mk
 
tools/testing/selftests/powerpc/ptrace/ptrace-tm-tar.c new file +160 -0

160 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#9 lore raw

PATCH v16 9/15 selftests/powerpc: Add ptrace tests for TAR, PPR, DSCR in suspended TM

In reply to [email protected]

From: Anshuman Khandual <[email protected]>

This patch adds ptrace interface test for TAR, PPR, DSCR registers inside suspended TM context.

---
 tools/testing/selftests/powerpc/ptrace/Makefile    |   2 +-
 .../selftests/powerpc/ptrace/ptrace-tm-spd-tar.c   | 174 +++++++++++++++++++++
 2 files changed, 175 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-tm-spd-tar.c
tools/testing/selftests/powerpc/ptrace/Makefile +1 -1
index 9af9ad5..19e4a7c 100644
@@ -1,5 +1,5 @@
 TEST_PROGS := ptrace-ebb ptrace-gpr ptrace-tm-gpr ptrace-tm-spd-gpr \
-ptrace-tar ptrace-tm-tar
+ptrace-tar ptrace-tm-tar ptrace-tm-spd-tar
 
 include ../../lib.mk
 
tools/testing/selftests/powerpc/ptrace/ptrace-tm-spd-tar.c new file +174 -0

174 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#10 lore raw

PATCH v16 10/15 selftests/powerpc: Add ptrace tests for VSX, VMX registers

In reply to [email protected]

From: Anshuman Khandual <[email protected]>

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.

---
 tools/testing/selftests/powerpc/ptrace/Makefile    |   2 +-
 .../testing/selftests/powerpc/ptrace/ptrace-vsx.c  | 117 +++++++++
 .../testing/selftests/powerpc/ptrace/ptrace-vsx.h  | 127 ++++++++++
 tools/testing/selftests/powerpc/ptrace/ptrace.h    | 119 +++++++++
 tools/testing/selftests/powerpc/utility/reg.S      | 265 +++++++++++++++++++++
 5 files changed, 629 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-vsx.c
 create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-vsx.h
tools/testing/selftests/powerpc/ptrace/Makefile +1 -1
index 19e4a7c..9d9f658 100644
@@ -1,5 +1,5 @@
 TEST_PROGS := ptrace-ebb ptrace-gpr ptrace-tm-gpr ptrace-tm-spd-gpr \
-ptrace-tar ptrace-tm-tar ptrace-tm-spd-tar
+ptrace-tar ptrace-tm-tar ptrace-tm-spd-tar ptrace-vsx
 
 include ../../lib.mk
 
tools/testing/selftests/powerpc/ptrace/ptrace-vsx.c new file +117 -0

117 lines not on this page · raw message

tools/testing/selftests/powerpc/ptrace/ptrace-vsx.h new file +127 -0

127 lines not on this page · raw message

tools/testing/selftests/powerpc/ptrace/ptrace.h +119 -0

125 lines not on this page · raw message

tools/testing/selftests/powerpc/utility/reg.S +265 -0

268 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#11 lore raw

PATCH v16 11/15 selftests/powerpc: Add ptrace tests for VSX, VMX registers in TM

In reply to [email protected]

From: Anshuman Khandual <[email protected]>

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.

---
 tools/testing/selftests/powerpc/ptrace/Makefile    |   3 +-
 .../selftests/powerpc/ptrace/ptrace-tm-vsx.c       | 168 +++++++++++++++++++++
 2 files changed, 170 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-tm-vsx.c
tools/testing/selftests/powerpc/ptrace/Makefile +2 -1
index 9d9f658..a518fbd 100644
@@ -1,5 +1,6 @@
 TEST_PROGS := ptrace-ebb ptrace-gpr ptrace-tm-gpr ptrace-tm-spd-gpr \
-ptrace-tar ptrace-tm-tar ptrace-tm-spd-tar ptrace-vsx
+ptrace-tar ptrace-tm-tar ptrace-tm-spd-tar ptrace-vsx ptrace-tm-vsx
+
 
 include ../../lib.mk
 
tools/testing/selftests/powerpc/ptrace/ptrace-tm-vsx.c new file +168 -0

168 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#12 lore raw

PATCH v16 12/15 selftests/powerpc: Add ptrace tests for VSX, VMX registers in suspended TM

In reply to [email protected]

From: Anshuman Khandual <[email protected]>

This patch adds ptrace interface test for VSX, VMX registers inside suspended TM context.

---
 tools/testing/selftests/powerpc/ptrace/Makefile    |   3 +-
 .../selftests/powerpc/ptrace/ptrace-tm-spd-vsx.c   | 185 +++++++++++++++++++++
 2 files changed, 187 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-tm-spd-vsx.c
tools/testing/selftests/powerpc/ptrace/Makefile +2 -1
index a518fbd..b5b097a 100644
@@ -1,5 +1,6 @@
 TEST_PROGS := ptrace-ebb ptrace-gpr ptrace-tm-gpr ptrace-tm-spd-gpr \
-ptrace-tar ptrace-tm-tar ptrace-tm-spd-tar ptrace-vsx ptrace-tm-vsx
+ptrace-tar ptrace-tm-tar ptrace-tm-spd-tar ptrace-vsx ptrace-tm-vsx \
+ptrace-tm-spd-vsx
 
 
 include ../../lib.mk
tools/testing/selftests/powerpc/ptrace/ptrace-tm-spd-vsx.c new file +185 -0

185 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#13 lore raw

PATCH v16 13/15 selftests/powerpc: Add ptrace tests for TM SPR registers

In reply to [email protected]

From: Anshuman Khandual <[email protected]>

This patch adds ptrace interface test for TM SPR registers. This also adds ptrace interface based helper functions related to TM SPR registers access.

---
 tools/testing/selftests/powerpc/ptrace/Makefile    |   3 +-
 .../selftests/powerpc/ptrace/ptrace-tm-spr.c       | 168 +++++++++++++++++++++
 tools/testing/selftests/powerpc/ptrace/ptrace.h    |  35 +++++
 3 files changed, 204 insertions(+), 2 deletions(-)
 create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-tm-spr.c
tools/testing/selftests/powerpc/ptrace/Makefile +1 -2
index b5b097a..ec2a9b0 100644
@@ -1,7 +1,6 @@
 TEST_PROGS := ptrace-ebb ptrace-gpr ptrace-tm-gpr ptrace-tm-spd-gpr \
 ptrace-tar ptrace-tm-tar ptrace-tm-spd-tar ptrace-vsx ptrace-tm-vsx \
-ptrace-tm-spd-vsx
-
+ptrace-tm-spd-vsx ptrace-tm-spr
 
 include ../../lib.mk
 
tools/testing/selftests/powerpc/ptrace/ptrace-tm-spr.c new file +168 -0

168 lines not on this page · raw message

tools/testing/selftests/powerpc/ptrace/ptrace.h +35 -0
index 7dea180..ed7a199 100644
@@ -52,6 +52,11 @@ struct fpr_regs {
 	unsigned long fpscr;
 };
 
+struct tm_spr_regs {
+	unsigned long tm_tfhar;
+	unsigned long tm_texasr;
+	unsigned long tm_tfiar;
+};
 
 /* Basic ptrace operations */
 int start_trace(pid_t child)
@@ -665,6 +670,36 @@ int write_vsx_ckpt(pid_t child, unsigned long *vsx)
 	return TEST_PASS;
 }
 
+/* TM SPR */
+int show_tm_spr(pid_t child, struct tm_spr_regs *out)
+{
+	struct tm_spr_regs *regs;
+	struct iovec iov;
+	int ret;
+
+	regs = (struct tm_spr_regs *) malloc(sizeof(struct tm_spr_regs));
+	if (!regs) {
+		perror("malloc() failed");
+		return TEST_FAIL;
+	}
+
+	iov.iov_base = (u64 *) regs;
+	iov.iov_len = sizeof(struct tm_spr_regs);
+
+	ret = ptrace(PTRACE_GETREGSET, child, NT_PPC_TM_SPR, &iov);
+	if (ret) {
+		perror("ptrace(PTRACE_GETREGSET) failed");
+		return TEST_FAIL;
+	}
+
+	if (out)
+		memcpy(out, regs, sizeof(struct tm_spr_regs));
+
+	return TEST_PASS;
+}
+
+
+
 /* Analyse TEXASR after TM failure */
 inline unsigned long get_tfiar(void)
 {
Signature · 1 line
1.8.3.1
#14 lore raw

PATCH v16 14/15 selftests/powerpc: Add .gitignore file for ptrace executables

In reply to [email protected]

From: Anshuman Khandual <[email protected]>

This patch adds a .gitignore file for all the executables in the ptrace test directory thus making invisible with git status query.

---
 tools/testing/selftests/powerpc/ptrace/.gitignore | 11 +++++++++++
 1 file changed, 11 insertions(+)
 create mode 100644 tools/testing/selftests/powerpc/ptrace/.gitignore
tools/testing/selftests/powerpc/ptrace/.gitignore new file +11 -0
new file mode 100644
index 0000000..bdf3566
@@ -0,0 +1,11 @@
+ptrace-ebb
+ptrace-gpr
+ptrace-tm-gpr
+ptrace-tm-spd-gpr
+ptrace-tar
+ptrace-tm-tar
+ptrace-tm-spd-tar
+ptrace-vsx
+ptrace-tm-vsx
+ptrace-tm-spd-vsx
+ptrace-tm-spr
Signature · 1 line
1.8.3.1
#15 lore raw

PATCH v16 15/15 selftests/powerpc: Fix a build issue

In reply to [email protected]

From: Anshuman Khandual <[email protected]>

Fixes the following build failure -

cp_abort.c:90:3: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
for (int i = 0; i < NUM_LOOPS; i++) {
^
cp_abort.c:90:3: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code
cp_abort.c:97:3: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
for (int i = 0; i < NUM_LOOPS; i++) {

---
 tools/testing/selftests/powerpc/context_switch/cp_abort.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
tools/testing/selftests/powerpc/context_switch/cp_abort.c +3 -3
index 5a5b55a..1ce7dce 100644
@@ -67,7 +67,7 @@ int test_cp_abort(void)
 	/* 128 bytes for a full cache line */
 	char buf[128] __cacheline_aligned;
 	cpu_set_t cpuset;
-	int fd1[2], fd2[2], pid;
+	int fd1[2], fd2[2], pid, i;
 	char c;
 
 	/* only run this test on a P9 or later */
@@ -87,14 +87,14 @@ int test_cp_abort(void)
 	FAIL_IF(pid < 0);
 
 	if (!pid) {
-		for (int i = 0; i < NUM_LOOPS; i++) {
+		for (i = 0; i < NUM_LOOPS; i++) {
 			FAIL_IF((write(fd1[WRITE_FD], &c, 1)) != 1);
 			FAIL_IF((read(fd2[READ_FD], &c, 1)) != 1);
 			/* A paste succeeds if CR0 EQ bit is set */
 			FAIL_IF(paste(buf) & 0x20000000);
 		}
 	} else {
-		for (int i = 0; i < NUM_LOOPS; i++) {
+		for (i = 0; i < NUM_LOOPS; i++) {
 			FAIL_IF((read(fd1[READ_FD], &c, 1)) != 1);
 			copy(buf);
 			FAIL_IF((write(fd2[WRITE_FD], &c, 1) != 1));
Signature · 1 line
1.8.3.1