Commit 964b6411af10fbddc827fdd3887c49f7f5d2bfd3

Authored by Alexander Graf
Committed by Avi Kivity
1 parent 20a340abd3

KVM: PPC: Simplify kvmppc_load_up_(FPU|VMX|VSX)

We don't need as complex code. I had some thinkos while writing it, figuring
I needed to support PPC32 paths on PPC64 which would have required DR=0, but
everything just runs fine with DR=1.

So let's make the functions simple C call wrappers that reserve some space on
the stack for the respective functions to clobber.

Fixes out-of-RMA-access (and thus guest FPU loading) on the PS3.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Avi Kivity <avi@redhat.com>

Showing 1 changed file with 2 additions and 11 deletions Side-by-side Diff

arch/powerpc/kvm/book3s_64_rmhandlers.S
... ... @@ -164,24 +164,15 @@
164 164 #define define_load_up(what) \
165 165 \
166 166 _GLOBAL(kvmppc_load_up_ ## what); \
167   - subi r1, r1, INT_FRAME_SIZE; \
  167 + stdu r1, -INT_FRAME_SIZE(r1); \
168 168 mflr r3; \
169 169 std r3, _LINK(r1); \
170   - mfmsr r4; \
171   - std r31, GPR3(r1); \
172   - mr r31, r4; \
173   - li r5, MSR_DR; \
174   - oris r5, r5, MSR_EE@h; \
175   - andc r4, r4, r5; \
176   - mtmsr r4; \
177 170 \
178 171 bl .load_up_ ## what; \
179 172 \
180   - mtmsr r31; \
181 173 ld r3, _LINK(r1); \
182   - ld r31, GPR3(r1); \
183   - addi r1, r1, INT_FRAME_SIZE; \
184 174 mtlr r3; \
  175 + addi r1, r1, INT_FRAME_SIZE; \
185 176 blr
186 177  
187 178 define_load_up(fpu)