aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAnton Blanchard <anton@samba.org>2009-10-26 14:51:09 -0400
committerPaul Mackerras <paulus@samba.org>2009-10-28 01:13:04 -0400
commit6f26353ca29e96475208bce673efb6a2c58b73f2 (patch)
treea564c9c71407a83f81d42e15bbe48f647ec72285 /arch
parentc8cd093a6e9f96ea6b871576fd4e46d7c818bb89 (diff)
powerpc: tracing: Give hypervisor call tracepoints access to arguments
While most users of the hcall tracepoints will only want the opcode and return code, some will want all the arguments. To avoid the complexity of using varargs we pass a pointer to the register save area, which contains all the arguments. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/include/asm/trace.h9
-rw-r--r--arch/powerpc/platforms/pseries/hvCall.S31
-rw-r--r--arch/powerpc/platforms/pseries/hvCall_inst.c5
-rw-r--r--arch/powerpc/platforms/pseries/lpar.c9
4 files changed, 34 insertions, 20 deletions
diff --git a/arch/powerpc/include/asm/trace.h b/arch/powerpc/include/asm/trace.h
index 9b01c0e43b55..cbe2297d68b6 100644
--- a/arch/powerpc/include/asm/trace.h
+++ b/arch/powerpc/include/asm/trace.h
@@ -82,9 +82,9 @@ extern void hcall_tracepoint_unregfunc(void);
82 82
83TRACE_EVENT_FN(hcall_entry, 83TRACE_EVENT_FN(hcall_entry,
84 84
85 TP_PROTO(unsigned long opcode), 85 TP_PROTO(unsigned long opcode, unsigned long *args),
86 86
87 TP_ARGS(opcode), 87 TP_ARGS(opcode, args),
88 88
89 TP_STRUCT__entry( 89 TP_STRUCT__entry(
90 __field(unsigned long, opcode) 90 __field(unsigned long, opcode)
@@ -101,9 +101,10 @@ TRACE_EVENT_FN(hcall_entry,
101 101
102TRACE_EVENT_FN(hcall_exit, 102TRACE_EVENT_FN(hcall_exit,
103 103
104 TP_PROTO(unsigned long opcode, unsigned long retval), 104 TP_PROTO(unsigned long opcode, unsigned long retval,
105 unsigned long *retbuf),
105 106
106 TP_ARGS(opcode, retval), 107 TP_ARGS(opcode, retval, retbuf),
107 108
108 TP_STRUCT__entry( 109 TP_STRUCT__entry(
109 __field(unsigned long, opcode) 110 __field(unsigned long, opcode)
diff --git a/arch/powerpc/platforms/pseries/hvCall.S b/arch/powerpc/platforms/pseries/hvCall.S
index 01e95ab18d35..383a5d0e9818 100644
--- a/arch/powerpc/platforms/pseries/hvCall.S
+++ b/arch/powerpc/platforms/pseries/hvCall.S
@@ -30,7 +30,7 @@ hcall_tracepoint_refcount:
30 * in early init (eg when populating the MMU hashtable) by using an 30 * in early init (eg when populating the MMU hashtable) by using an
31 * unconditional cpu feature. 31 * unconditional cpu feature.
32 */ 32 */
33#define HCALL_INST_PRECALL \ 33#define HCALL_INST_PRECALL(FIRST_REG) \
34BEGIN_FTR_SECTION; \ 34BEGIN_FTR_SECTION; \
35 b 1f; \ 35 b 1f; \
36END_FTR_SECTION(0, 1); \ 36END_FTR_SECTION(0, 1); \
@@ -47,6 +47,7 @@ END_FTR_SECTION(0, 1); \
47 std r9,STK_PARM(r9)(r1); \ 47 std r9,STK_PARM(r9)(r1); \
48 std r10,STK_PARM(r10)(r1); \ 48 std r10,STK_PARM(r10)(r1); \
49 std r0,16(r1); \ 49 std r0,16(r1); \
50 addi r4,r1,STK_PARM(FIRST_REG); \
50 stdu r1,-STACK_FRAME_OVERHEAD(r1); \ 51 stdu r1,-STACK_FRAME_OVERHEAD(r1); \
51 bl .__trace_hcall_entry; \ 52 bl .__trace_hcall_entry; \
52 addi r1,r1,STACK_FRAME_OVERHEAD; \ 53 addi r1,r1,STACK_FRAME_OVERHEAD; \
@@ -68,7 +69,7 @@ END_FTR_SECTION(0, 1); \
68 * in early init (eg when populating the MMU hashtable) by using an 69 * in early init (eg when populating the MMU hashtable) by using an
69 * unconditional cpu feature. 70 * unconditional cpu feature.
70 */ 71 */
71#define HCALL_INST_POSTCALL \ 72#define __HCALL_INST_POSTCALL \
72BEGIN_FTR_SECTION; \ 73BEGIN_FTR_SECTION; \
73 b 1f; \ 74 b 1f; \
74END_FTR_SECTION(0, 1); \ 75END_FTR_SECTION(0, 1); \
@@ -88,9 +89,19 @@ END_FTR_SECTION(0, 1); \
88 ld r3,STK_PARM(r3)(r1); \ 89 ld r3,STK_PARM(r3)(r1); \
89 mtlr r0; \ 90 mtlr r0; \
901: 911:
92
93#define HCALL_INST_POSTCALL_NORETS \
94 li r5,0; \
95 __HCALL_INST_POSTCALL
96
97#define HCALL_INST_POSTCALL(BUFREG) \
98 mr r5,BUFREG; \
99 __HCALL_INST_POSTCALL
100
91#else 101#else
92#define HCALL_INST_PRECALL 102#define HCALL_INST_PRECALL(FIRST_ARG)
93#define HCALL_INST_POSTCALL 103#define HCALL_INST_POSTCALL_NORETS
104#define HCALL_INST_POSTCALL(BUFREG)
94#endif 105#endif
95 106
96 .text 107 .text
@@ -101,11 +112,11 @@ _GLOBAL(plpar_hcall_norets)
101 mfcr r0 112 mfcr r0
102 stw r0,8(r1) 113 stw r0,8(r1)
103 114
104 HCALL_INST_PRECALL 115 HCALL_INST_PRECALL(r4)
105 116
106 HVSC /* invoke the hypervisor */ 117 HVSC /* invoke the hypervisor */
107 118
108 HCALL_INST_POSTCALL 119 HCALL_INST_POSTCALL_NORETS
109 120
110 lwz r0,8(r1) 121 lwz r0,8(r1)
111 mtcrf 0xff,r0 122 mtcrf 0xff,r0
@@ -117,7 +128,7 @@ _GLOBAL(plpar_hcall)
117 mfcr r0 128 mfcr r0
118 stw r0,8(r1) 129 stw r0,8(r1)
119 130
120 HCALL_INST_PRECALL 131 HCALL_INST_PRECALL(r5)
121 132
122 std r4,STK_PARM(r4)(r1) /* Save ret buffer */ 133 std r4,STK_PARM(r4)(r1) /* Save ret buffer */
123 134
@@ -136,7 +147,7 @@ _GLOBAL(plpar_hcall)
136 std r6, 16(r12) 147 std r6, 16(r12)
137 std r7, 24(r12) 148 std r7, 24(r12)
138 149
139 HCALL_INST_POSTCALL 150 HCALL_INST_POSTCALL(r12)
140 151
141 lwz r0,8(r1) 152 lwz r0,8(r1)
142 mtcrf 0xff,r0 153 mtcrf 0xff,r0
@@ -183,7 +194,7 @@ _GLOBAL(plpar_hcall9)
183 mfcr r0 194 mfcr r0
184 stw r0,8(r1) 195 stw r0,8(r1)
185 196
186 HCALL_INST_PRECALL 197 HCALL_INST_PRECALL(r5)
187 198
188 std r4,STK_PARM(r4)(r1) /* Save ret buffer */ 199 std r4,STK_PARM(r4)(r1) /* Save ret buffer */
189 200
@@ -211,7 +222,7 @@ _GLOBAL(plpar_hcall9)
211 std r11,56(r12) 222 std r11,56(r12)
212 std r0, 64(r12) 223 std r0, 64(r12)
213 224
214 HCALL_INST_POSTCALL 225 HCALL_INST_POSTCALL(r12)
215 226
216 lwz r0,8(r1) 227 lwz r0,8(r1)
217 mtcrf 0xff,r0 228 mtcrf 0xff,r0
diff --git a/arch/powerpc/platforms/pseries/hvCall_inst.c b/arch/powerpc/platforms/pseries/hvCall_inst.c
index e44e1035f133..2f58c71b7259 100644
--- a/arch/powerpc/platforms/pseries/hvCall_inst.c
+++ b/arch/powerpc/platforms/pseries/hvCall_inst.c
@@ -102,7 +102,7 @@ static const struct file_operations hcall_inst_seq_fops = {
102#define CPU_NAME_BUF_SIZE 32 102#define CPU_NAME_BUF_SIZE 32
103 103
104 104
105static void probe_hcall_entry(unsigned long opcode) 105static void probe_hcall_entry(unsigned long opcode, unsigned long *args)
106{ 106{
107 struct hcall_stats *h; 107 struct hcall_stats *h;
108 108
@@ -114,7 +114,8 @@ static void probe_hcall_entry(unsigned long opcode)
114 h->purr_start = mfspr(SPRN_PURR); 114 h->purr_start = mfspr(SPRN_PURR);
115} 115}
116 116
117static void probe_hcall_exit(unsigned long opcode, unsigned long retval) 117static void probe_hcall_exit(unsigned long opcode, unsigned long retval,
118 unsigned long *retbuf)
118{ 119{
119 struct hcall_stats *h; 120 struct hcall_stats *h;
120 121
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index 4b7b6e8e32de..0707653612ba 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -683,13 +683,14 @@ void hcall_tracepoint_unregfunc(void)
683 hcall_tracepoint_refcount--; 683 hcall_tracepoint_refcount--;
684} 684}
685 685
686void __trace_hcall_entry(unsigned long opcode) 686void __trace_hcall_entry(unsigned long opcode, unsigned long *args)
687{ 687{
688 trace_hcall_entry(opcode); 688 trace_hcall_entry(opcode, args);
689} 689}
690 690
691void __trace_hcall_exit(long opcode, unsigned long retval) 691void __trace_hcall_exit(long opcode, unsigned long retval,
692 unsigned long *retbuf)
692{ 693{
693 trace_hcall_exit(opcode, retval); 694 trace_hcall_exit(opcode, retval, retbuf);
694} 695}
695#endif 696#endif