Skip to contentSkip to conversation

selftests/powerpc: Add ptrace tests for ppc registers

PATCH Applied [email protected] 3 participants 29 messages Sep 30, 2016 – Nov 17, 2016

Subsystems (2)

v15 of 16 Applied Latest is v16 →

lore
Share & tools
lore
#0 lore raw

v15 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

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/instructions.h     |  68 --
 tools/testing/selftests/powerpc/math/fpu_asm.S     |  44 +-
 tools/testing/selftests/powerpc/math/vmx_asm.S     |   2 +-
 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  | 187 +++++
 .../testing/selftests/powerpc/ptrace/ptrace-ebb.h  |  99 +++
 .../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 --
 .../testing/selftests/powerpc/stringloops/memcmp.c |   2 +-
 tools/testing/selftests/powerpc/tm/Makefile        |   2 +-
 tools/testing/selftests/powerpc/tm/tm.h            |   2 +-
 .../testing/selftests/powerpc/utility/basic_asm.h  |  73 ++
 .../selftests/powerpc/utility/instructions.h       |  68 ++
 tools/testing/selftests/powerpc/utility/reg.S      | 397 +++++++++++
 tools/testing/selftests/powerpc/utility/reg.h      | 190 +++++
 tools/testing/selftests/powerpc/utility/utils.c    |  87 +++
 tools/testing/selftests/powerpc/utility/utils.h    |  70 ++
 tools/testing/selftests/powerpc/utils.c            |  87 ---
 tools/testing/selftests/powerpc/utils.h            |  70 --
 45 files changed, 3801 insertions(+), 420 deletions(-)
 delete mode 100644 tools/testing/selftests/powerpc/basic_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/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
 delete mode 100644 tools/testing/selftests/powerpc/utils.c
 delete mode 100644 tools/testing/selftests/powerpc/utils.h
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH v15 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

Re: [v15, 01/15] selftests/powerpc: Add more SPR numbers, TM & VMX instructions to 'reg.h'/'instructions.h'

Quoted 7 lines · Simon Guo

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.

Quoted 5 lines

Now that the new DSCR register definitions (SPRN_DSCR_PRIV and SPRN_DSCR) are defined outside this directory, use them instead.

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/efe71a67b5aa89e0348ac862ca92a5

cheers

#3 lore raw

PATCH v15 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/instructions.h     | 68 -----------------
 tools/testing/selftests/powerpc/math/fpu_asm.S     |  2 +-
 tools/testing/selftests/powerpc/math/vmx_asm.S     |  2 +-
 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 ----------------------
 .../testing/selftests/powerpc/stringloops/memcmp.c |  2 +-
 tools/testing/selftests/powerpc/tm/Makefile        |  2 +-
 tools/testing/selftests/powerpc/tm/tm.h            |  2 +-
 .../testing/selftests/powerpc/utility/basic_asm.h  | 73 ++++++++++++++++++
 .../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    | 70 +++++++++++++++++
 tools/testing/selftests/powerpc/utils.c            | 87 ---------------------
 tools/testing/selftests/powerpc/utils.h            | 70 -----------------
 24 files changed, 402 insertions(+), 399 deletions(-)
 delete mode 100644 tools/testing/selftests/powerpc/basic_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/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
 delete mode 100644 tools/testing/selftests/powerpc/utils.c
 delete mode 100644 tools/testing/selftests/powerpc/utils.h
tools/testing/selftests/powerpc/Makefile +1 -1
index 1cc6d64..b6eb817 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/instructions.h deleted +0 -68

68 lines not on this page · raw message

tools/testing/selftests/powerpc/math/fpu_asm.S +1 -1
index f3711d8..8d4eb96 100644
@@ -7,7 +7,7 @@
  * 2 of the License, or (at your option) any later version.
  */
 
-#include "../basic_asm.h"
+#include "basic_asm.h"
 
 #define PUSH_FPU(pos) \
 	stfd	f14,pos(sp); \
tools/testing/selftests/powerpc/math/vmx_asm.S +1 -1
index 1b8c248..1b6fd53 100644
@@ -7,7 +7,7 @@
  * 2 of the License, or (at your option) any later version.
  */
 
-#include "../basic_asm.h"
+#include "basic_asm.h"
 
 # POS MUST BE 16 ALIGNED!
 #define PUSH_VMX(pos,reg) \
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/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 9d301d7..8b69f1f 100644
@@ -3,7 +3,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.h +1 -1
index 60318ba..5cafbc3 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/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 +70 -0

70 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 -70

70 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#4 lore raw

PATCH v15 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  | 187 +++++++++++++++++
 .../testing/selftests/powerpc/ptrace/ptrace-ebb.h  |  99 +++++++++
 tools/testing/selftests/powerpc/ptrace/ptrace.h    | 225 +++++++++++++++++++++
 5 files changed, 524 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 b6eb817..2fe383c 100644
@@ -25,7 +25,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 +187 -0

187 lines not on this page · raw message

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

99 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
#5 lore raw

Re: [PATCH v15 03/15] selftests/powerpc: Add ptrace tests for EBB

Quoted 6 lines · [email protected] writes:

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.

This is consistently failing for me on a P8 Tuleta (pvr 004b 0201):

# ./ptrace-ebb 
test: ptrace_ebb_pmu
tags: git_version:v4.8-rc5-176-g89cf1de0ae90
EBBRR: 100059f8
EBBHR: 100053cc; expected: 100053cc
BESCR: 8000000100000000
SIAR:  100012d0
SDAR:  3fff7e4cc000
SIER:  3000000; expected: 2000000
MMCR2: 0; expected: 0
MMCR0: 180000080; expected: 180000080
failure: ptrace_ebb_pmu

cheers

author
#6 lore raw

Re: [PATCH v15 03/15] selftests/powerpc: Add ptrace tests for EBB

Quoted 24 lines · Michael Ellerman
Quoted 6 lines · [email protected] writes:

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.

This is consistently failing for me on a P8 Tuleta (pvr 004b 0201):

# ./ptrace-ebb 
test: ptrace_ebb_pmu
tags: git_version:v4.8-rc5-176-g89cf1de0ae90
EBBRR: 100059f8
EBBHR: 100053cc; expected: 100053cc
BESCR: 8000000100000000
SIAR:  100012d0
SDAR:  3fff7e4cc000
SIER:  3000000; expected: 2000000
MMCR2: 0; expected: 0
MMCR0: 180000080; expected: 180000080
failure: ptrace_ebb_pmu
Quoted 1 line

cheers

Michael,

Yes.. SIER has different value in baremetal and virtual machine due to different MSR[HV] value. I will correct it. Originally I only tested in virtual BE/LE machines.

Currently all tests cases (with fix) passed on one baremetal P8 machine with LE OS installed. And I will try to find another baremetal with BE OS installed to test.

Thanks for indicating it.

BR,
Simon

#7 lore raw

Re: [v15,03/15] selftests/powerpc: Add ptrace tests for EBB

In reply to [email protected]
Quoted 9 lines · Simon Guo

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.

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/f666ad413db6f7fbfaeec6b11ed6f8

cheers

#8 lore raw

PATCH v15 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/math/fpu_asm.S     |  42 +---
 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      | 101 ++++++++++
 7 files changed, 645 insertions(+), 42 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/math/fpu_asm.S +2 -40
index 8d4eb96..6e423fa 100644
@@ -8,49 +8,11 @@
  */
 
 #include "basic_asm.h"
-
-#define PUSH_FPU(pos) \
-	stfd	f14,pos(sp); \
-	stfd	f15,pos+8(sp); \
-	stfd	f16,pos+16(sp); \
-	stfd	f17,pos+24(sp); \
-	stfd	f18,pos+32(sp); \
-	stfd	f19,pos+40(sp); \
-	stfd	f20,pos+48(sp); \
-	stfd	f21,pos+56(sp); \
-	stfd	f22,pos+64(sp); \
-	stfd	f23,pos+72(sp); \
-	stfd	f24,pos+80(sp); \
-	stfd	f25,pos+88(sp); \
-	stfd	f26,pos+96(sp); \
-	stfd	f27,pos+104(sp); \
-	stfd	f28,pos+112(sp); \
-	stfd	f29,pos+120(sp); \
-	stfd	f30,pos+128(sp); \
-	stfd	f31,pos+136(sp);
-
-#define POP_FPU(pos) \
-	lfd	f14,pos(sp); \
-	lfd	f15,pos+8(sp); \
-	lfd	f16,pos+16(sp); \
-	lfd	f17,pos+24(sp); \
-	lfd	f18,pos+32(sp); \
-	lfd	f19,pos+40(sp); \
-	lfd	f20,pos+48(sp); \
-	lfd	f21,pos+56(sp); \
-	lfd	f22,pos+64(sp); \
-	lfd	f23,pos+72(sp); \
-	lfd	f24,pos+80(sp); \
-	lfd	f25,pos+88(sp); \
-	lfd	f26,pos+96(sp); \
-	lfd	f27,pos+104(sp); \
-	lfd	f28,pos+112(sp); \
-	lfd	f29,pos+120(sp); \
-	lfd	f30,pos+128(sp); \
-	lfd	f31,pos+136(sp);
+#include "reg.h"
 
 # Careful calling this, it will 'clobber' fpu (by design)
 # Don't call this from C
+# double precision
 FUNC_START(load_fpu)
 	lfd	f14,0(r3)
 	lfd	f15,8(r3)
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 +101 -0

105 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#9 lore raw

PATCH v15 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
#10 lore raw

Re: [v15, 05/15] selftests/powerpc: Add ptrace tests for GPR/FPR registers in TM

Quoted 8 lines · Simon Guo

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.

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/509fcfe57b09637a80fe0fcacd052e

cheers

#11 lore raw

PATCH v15 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
#12 lore raw

Re: [v15, 06/15] selftests/powerpc: Add ptrace tests for GPR/FPR registers in suspended TM

Quoted 7 lines · Simon Guo

From: Anshuman Khandual <[email protected]>

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

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/c7096dc0ee02ee7fd885c8010aad2c

cheers

#13 lore raw

PATCH v15 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
#14 lore raw

Re: [v15, 07/15] selftests/powerpc: Add ptrace tests for TAR, PPR, DSCR registers

Quoted 8 lines · Simon Guo

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.

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/254dae59af6791f02bad50c70a1e5a

cheers

#15 lore raw

PATCH v15 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
#16 lore raw

Re: [v15, 08/15] selftests/powerpc: Add ptrace tests for TAR, PPR, DSCR in TM

Quoted 9 lines · Simon Guo

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.

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/fcf73a6bd9cb2b09045307e3ae8844

cheers

#17 lore raw

PATCH v15 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
#18 lore raw

Re: [v15, 09/15] selftests/powerpc: Add ptrace tests for TAR, PPR, DSCR in suspended TM

Quoted 7 lines · Simon Guo

From: Anshuman Khandual <[email protected]>

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

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/01f7fdc7b90e5afc3fafa19da970ec

cheers

#19 lore raw

PATCH v15 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
#20 lore raw

Re: [v15, 10/15] selftests/powerpc: Add ptrace tests for VSX, VMX registers

Quoted 9 lines · Simon Guo

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.

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/0da535c0844b81111f837670e0b9b3

cheers

#21 lore raw

PATCH v15 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
#22 lore raw

Re: [v15, 11/15] selftests/powerpc: Add ptrace tests for VSX, VMX registers in TM

Quoted 8 lines · Simon Guo

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.

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/11508074c9a74a00df1aa6cfba81d1

cheers

#23 lore raw

PATCH v15 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
#24 lore raw

Re: [v15, 12/15] selftests/powerpc: Add ptrace tests for VSX, VMX registers in suspended TM

Quoted 7 lines · Simon Guo

From: Anshuman Khandual <[email protected]>

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

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/a18b55bf51b32136fb9c5190b1cbf8

cheers

#25 lore raw

PATCH v15 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
#26 lore raw

Re: [v15,13/15] selftests/powerpc: Add ptrace tests for TM SPR registers

Quoted 8 lines · Simon Guo

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.

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/5bdac52f3c67e1262b1979081a362f

cheers

#27 lore raw

PATCH v15 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
#28 lore raw

PATCH v15 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