# Re: \[PATCH\] powerpc/64s: Fix hypercall entry clobbering r12 input

- From: Michael Ellerman \<mpe@ellerman.id.au\>
- Date: 2017-07-18 10:30:14 
- List: linuxppc-dev
- Page: https://ratatoskr.run/linuxppc-dev/2017/07/9498424
- Thread: https://ratatoskr.run/linuxppc-dev/2017/07/9498421/t.md

```text
Nicholas Piggin [ref] writes:

> A previous optimisation incorrectly assumed the PAPR hcall does
> not use r12, and clobbers it upon entry. In fact it is used as
> an input. This can result in KVM guests crashing (observed with
> PR KVM).
>
> Instead of using r12 to save r13, tihs patch saves r13 in ctr.
> This is more costly, but not as slow as using the SPRG.
>
> Fixes: acd7d8cef0153 ("powerpc/64s: Optimize hypercall/syscall entry")
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
>
> ---
> One brown paper bag please.

We're all out, Ben, Mikey and I used them all up :)

cheers
```
