diff options
author | Mohan Kumar M <mohan@in.ibm.com> | 2007-03-21 01:51:32 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-03-22 00:01:43 -0400 |
commit | b4aea36b7956eeebfc56314ce0944db1441255ce (patch) | |
tree | a0c84f25e1f5a2ef0af624871e8f892654fd79a4 | |
parent | f144e7c7272bf527c380bffaa5e789dc28a09d8d (diff) |
[POWERPC] Avoid hypervisor statistics calculation in real mode
kexec invokes plpar_hcall hypervisor call in real mode. plpar_hcall
refers to per cpu variables for accounting hypervisor statistics.
These variables may not be in the RMO region, so accesses to them
in real mode may result in a data storage exception.
This fixes this problem by using a new plpar_hcall_raw function which
does not update the hypervisor call statistics. Thanks to Anton for
suggesting this idea.
Signed-off-by: Mohan Kumar M <mohan@in.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r-- | arch/powerpc/platforms/pseries/hvCall.S | 34 | ||||
-rw-r--r-- | arch/powerpc/platforms/pseries/lpar.c | 2 | ||||
-rw-r--r-- | arch/powerpc/platforms/pseries/plpar_wrappers.h | 16 | ||||
-rw-r--r-- | include/asm-powerpc/hvcall.h | 14 |
4 files changed, 65 insertions, 1 deletions
diff --git a/arch/powerpc/platforms/pseries/hvCall.S b/arch/powerpc/platforms/pseries/hvCall.S index 5c7e38789897..1501b0a9e749 100644 --- a/arch/powerpc/platforms/pseries/hvCall.S +++ b/arch/powerpc/platforms/pseries/hvCall.S | |||
@@ -123,6 +123,40 @@ _GLOBAL(plpar_hcall) | |||
123 | 123 | ||
124 | blr /* return r3 = status */ | 124 | blr /* return r3 = status */ |
125 | 125 | ||
126 | /* | ||
127 | * plpar_hcall_raw can be called in real mode. kexec/kdump need some | ||
128 | * hypervisor calls to be executed in real mode. So plpar_hcall_raw | ||
129 | * does not access the per cpu hypervisor call statistics variables, | ||
130 | * since these variables may not be present in the RMO region. | ||
131 | */ | ||
132 | _GLOBAL(plpar_hcall_raw) | ||
133 | HMT_MEDIUM | ||
134 | |||
135 | mfcr r0 | ||
136 | stw r0,8(r1) | ||
137 | |||
138 | std r4,STK_PARM(r4)(r1) /* Save ret buffer */ | ||
139 | |||
140 | mr r4,r5 | ||
141 | mr r5,r6 | ||
142 | mr r6,r7 | ||
143 | mr r7,r8 | ||
144 | mr r8,r9 | ||
145 | mr r9,r10 | ||
146 | |||
147 | HVSC /* invoke the hypervisor */ | ||
148 | |||
149 | ld r12,STK_PARM(r4)(r1) | ||
150 | std r4, 0(r12) | ||
151 | std r5, 8(r12) | ||
152 | std r6, 16(r12) | ||
153 | std r7, 24(r12) | ||
154 | |||
155 | lwz r0,8(r1) | ||
156 | mtcrf 0xff,r0 | ||
157 | |||
158 | blr /* return r3 = status */ | ||
159 | |||
126 | _GLOBAL(plpar_hcall9) | 160 | _GLOBAL(plpar_hcall9) |
127 | HMT_MEDIUM | 161 | HMT_MEDIUM |
128 | 162 | ||
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c index 7496005566ef..843ee9643211 100644 --- a/arch/powerpc/platforms/pseries/lpar.c +++ b/arch/powerpc/platforms/pseries/lpar.c | |||
@@ -378,7 +378,7 @@ static void pSeries_lpar_hptab_clear(void) | |||
378 | 378 | ||
379 | /* TODO: Use bulk call */ | 379 | /* TODO: Use bulk call */ |
380 | for (i = 0; i < hpte_count; i++) | 380 | for (i = 0; i < hpte_count; i++) |
381 | plpar_pte_remove(0, i, 0, &dummy1, &dummy2); | 381 | plpar_pte_remove_raw(0, i, 0, &dummy1, &dummy2); |
382 | } | 382 | } |
383 | 383 | ||
384 | /* | 384 | /* |
diff --git a/arch/powerpc/platforms/pseries/plpar_wrappers.h b/arch/powerpc/platforms/pseries/plpar_wrappers.h index 3eb7b294d92f..2e4d10c9eea8 100644 --- a/arch/powerpc/platforms/pseries/plpar_wrappers.h +++ b/arch/powerpc/platforms/pseries/plpar_wrappers.h | |||
@@ -78,6 +78,22 @@ static inline long plpar_pte_remove(unsigned long flags, unsigned long ptex, | |||
78 | return rc; | 78 | return rc; |
79 | } | 79 | } |
80 | 80 | ||
81 | /* plpar_pte_remove_raw can be called in real mode. It calls plpar_hcall_raw */ | ||
82 | static inline long plpar_pte_remove_raw(unsigned long flags, unsigned long ptex, | ||
83 | unsigned long avpn, unsigned long *old_pteh_ret, | ||
84 | unsigned long *old_ptel_ret) | ||
85 | { | ||
86 | long rc; | ||
87 | unsigned long retbuf[PLPAR_HCALL_BUFSIZE]; | ||
88 | |||
89 | rc = plpar_hcall_raw(H_REMOVE, retbuf, flags, ptex, avpn); | ||
90 | |||
91 | *old_pteh_ret = retbuf[0]; | ||
92 | *old_ptel_ret = retbuf[1]; | ||
93 | |||
94 | return rc; | ||
95 | } | ||
96 | |||
81 | static inline long plpar_pte_read(unsigned long flags, unsigned long ptex, | 97 | static inline long plpar_pte_read(unsigned long flags, unsigned long ptex, |
82 | unsigned long *old_pteh_ret, unsigned long *old_ptel_ret) | 98 | unsigned long *old_pteh_ret, unsigned long *old_ptel_ret) |
83 | { | 99 | { |
diff --git a/include/asm-powerpc/hvcall.h b/include/asm-powerpc/hvcall.h index 60977806d2f4..62efd9d7a43d 100644 --- a/include/asm-powerpc/hvcall.h +++ b/include/asm-powerpc/hvcall.h | |||
@@ -237,6 +237,20 @@ long plpar_hcall_norets(unsigned long opcode, ...); | |||
237 | long plpar_hcall(unsigned long opcode, unsigned long *retbuf, ...); | 237 | long plpar_hcall(unsigned long opcode, unsigned long *retbuf, ...); |
238 | 238 | ||
239 | /** | 239 | /** |
240 | * plpar_hcall_raw: - Make a hypervisor call without calculating hcall stats | ||
241 | * @opcode: The hypervisor call to make. | ||
242 | * @retbuf: Buffer to store up to 4 return arguments in. | ||
243 | * | ||
244 | * This call supports up to 6 arguments and 4 return arguments. Use | ||
245 | * PLPAR_HCALL_BUFSIZE to size the return argument buffer. | ||
246 | * | ||
247 | * Used when phyp interface needs to be called in real mode. Similar to | ||
248 | * plpar_hcall, but plpar_hcall_raw works in real mode and does not | ||
249 | * calculate hypervisor call statistics. | ||
250 | */ | ||
251 | long plpar_hcall_raw(unsigned long opcode, unsigned long *retbuf, ...); | ||
252 | |||
253 | /** | ||
240 | * plpar_hcall9: - Make a pseries hypervisor call with up to 9 return arguments | 254 | * plpar_hcall9: - Make a pseries hypervisor call with up to 9 return arguments |
241 | * @opcode: The hypervisor call to make. | 255 | * @opcode: The hypervisor call to make. |
242 | * @retbuf: Buffer to store up to 9 return arguments in. | 256 | * @retbuf: Buffer to store up to 9 return arguments in. |