Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/pseries: Add hcall to read 4 ptes at a time in real mode

This adds plpar_pte_read_4_raw() which can be used read 4 PTEs from
PHYP at a time, while in real mode.

It also creates a new hcall9 which can be used in real mode. It's the
same as plpar_hcall9 but minus the tracing hcall statistics which may
require variables outside the RMO.

Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

authored by

Michael Neuling and committed by
Benjamin Herrenschmidt
f90ece28 095c7965

+57
+1
arch/powerpc/include/asm/hvcall.h
··· 282 282 */ 283 283 #define PLPAR_HCALL9_BUFSIZE 9 284 284 long plpar_hcall9(unsigned long opcode, unsigned long *retbuf, ...); 285 + long plpar_hcall9_raw(unsigned long opcode, unsigned long *retbuf, ...); 285 286 286 287 /* For hcall instrumentation. One structure per-hcall, per-CPU */ 287 288 struct hcall_stats {
+38
arch/powerpc/platforms/pseries/hvCall.S
··· 228 228 mtcrf 0xff,r0 229 229 230 230 blr /* return r3 = status */ 231 + 232 + /* See plpar_hcall_raw to see why this is needed */ 233 + _GLOBAL(plpar_hcall9_raw) 234 + HMT_MEDIUM 235 + 236 + mfcr r0 237 + stw r0,8(r1) 238 + 239 + std r4,STK_PARM(r4)(r1) /* Save ret buffer */ 240 + 241 + mr r4,r5 242 + mr r5,r6 243 + mr r6,r7 244 + mr r7,r8 245 + mr r8,r9 246 + mr r9,r10 247 + ld r10,STK_PARM(r11)(r1) /* put arg7 in R10 */ 248 + ld r11,STK_PARM(r12)(r1) /* put arg8 in R11 */ 249 + ld r12,STK_PARM(r13)(r1) /* put arg9 in R12 */ 250 + 251 + HVSC /* invoke the hypervisor */ 252 + 253 + mr r0,r12 254 + ld r12,STK_PARM(r4)(r1) 255 + std r4, 0(r12) 256 + std r5, 8(r12) 257 + std r6, 16(r12) 258 + std r7, 24(r12) 259 + std r8, 32(r12) 260 + std r9, 40(r12) 261 + std r10,48(r12) 262 + std r11,56(r12) 263 + std r0, 64(r12) 264 + 265 + lwz r0,8(r1) 266 + mtcrf 0xff,r0 267 + 268 + blr /* return r3 = status */
+18
arch/powerpc/platforms/pseries/plpar_wrappers.h
··· 191 191 return rc; 192 192 } 193 193 194 + /* 195 + * plpar_pte_read_4_raw can be called in real mode. 196 + * ptes must be 8*sizeof(unsigned long) 197 + */ 198 + static inline long plpar_pte_read_4_raw(unsigned long flags, unsigned long ptex, 199 + unsigned long *ptes) 200 + 201 + { 202 + long rc; 203 + unsigned long retbuf[PLPAR_HCALL9_BUFSIZE]; 204 + 205 + rc = plpar_hcall9_raw(H_READ, retbuf, flags | H_READ_4, ptex); 206 + 207 + memcpy(ptes, retbuf, 8*sizeof(unsigned long)); 208 + 209 + return rc; 210 + } 211 + 194 212 static inline long plpar_pte_protect(unsigned long flags, unsigned long ptex, 195 213 unsigned long avpn) 196 214 {