aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kvm/booke_interrupts.S
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-07-14 16:52:54 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-08-19 20:12:27 -0400
commitee43eb788b3a06425fffb912677e2e1c8b00dd3b (patch)
tree7233cb47647837ab00af81270b3a16555d88a1f1 /arch/powerpc/kvm/booke_interrupts.S
parent8aa34ab8b2dc96ca6c4feecfb87ed13f0d40ef98 (diff)
powerpc: Use names rather than numbers for SPRGs (v2)
The kernel uses SPRG registers for various purposes, typically in low level assembly code as scratch registers or to hold per-cpu global infos such as the PACA or the current thread_info pointer. We want to be able to easily shuffle the usage of those registers as some implementations have specific constraints realted to some of them, for example, some have userspace readable aliases, etc.. and the current choice isn't always the best. This patch should not change any code generation, and replaces the usage of SPRN_SPRGn everywhere in the kernel with a named replacement and adds documentation next to the definition of the names as to what those are used for on each processor family. The only parts that still use the original numbers are bits of KVM or suspend/resume code that just blindly needs to save/restore all the SPRGs. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kvm/booke_interrupts.S')
-rw-r--r--arch/powerpc/kvm/booke_interrupts.S18
1 files changed, 9 insertions, 9 deletions
diff --git a/arch/powerpc/kvm/booke_interrupts.S b/arch/powerpc/kvm/booke_interrupts.S
index d0c6f841bbd1..380a78cf484d 100644
--- a/arch/powerpc/kvm/booke_interrupts.S
+++ b/arch/powerpc/kvm/booke_interrupts.S
@@ -56,8 +56,8 @@
56.macro KVM_HANDLER ivor_nr 56.macro KVM_HANDLER ivor_nr
57_GLOBAL(kvmppc_handler_\ivor_nr) 57_GLOBAL(kvmppc_handler_\ivor_nr)
58 /* Get pointer to vcpu and record exit number. */ 58 /* Get pointer to vcpu and record exit number. */
59 mtspr SPRN_SPRG0, r4 59 mtspr SPRN_SPRG_WSCRATCH0, r4
60 mfspr r4, SPRN_SPRG1 60 mfspr r4, SPRN_SPRG_RVCPU
61 stw r5, VCPU_GPR(r5)(r4) 61 stw r5, VCPU_GPR(r5)(r4)
62 stw r6, VCPU_GPR(r6)(r4) 62 stw r6, VCPU_GPR(r6)(r4)
63 mfctr r5 63 mfctr r5
@@ -95,7 +95,7 @@ _GLOBAL(kvmppc_handler_len)
95 95
96 96
97/* Registers: 97/* Registers:
98 * SPRG0: guest r4 98 * SPRG_SCRATCH0: guest r4
99 * r4: vcpu pointer 99 * r4: vcpu pointer
100 * r5: KVM exit number 100 * r5: KVM exit number
101 */ 101 */
@@ -181,7 +181,7 @@ _GLOBAL(kvmppc_resume_host)
181 stw r3, VCPU_LR(r4) 181 stw r3, VCPU_LR(r4)
182 mfxer r3 182 mfxer r3
183 stw r3, VCPU_XER(r4) 183 stw r3, VCPU_XER(r4)
184 mfspr r3, SPRN_SPRG0 184 mfspr r3, SPRN_SPRG_RSCRATCH0
185 stw r3, VCPU_GPR(r4)(r4) 185 stw r3, VCPU_GPR(r4)(r4)
186 mfspr r3, SPRN_SRR0 186 mfspr r3, SPRN_SRR0
187 stw r3, VCPU_PC(r4) 187 stw r3, VCPU_PC(r4)
@@ -374,7 +374,7 @@ lightweight_exit:
374 mtspr SPRN_IVPR, r8 374 mtspr SPRN_IVPR, r8
375 375
376 /* Save vcpu pointer for the exception handlers. */ 376 /* Save vcpu pointer for the exception handlers. */
377 mtspr SPRN_SPRG1, r4 377 mtspr SPRN_SPRG_WVCPU, r4
378 378
379 /* Can't switch the stack pointer until after IVPR is switched, 379 /* Can't switch the stack pointer until after IVPR is switched,
380 * because host interrupt handlers would get confused. */ 380 * because host interrupt handlers would get confused. */
@@ -384,13 +384,13 @@ lightweight_exit:
384 /* Host interrupt handlers may have clobbered these guest-readable 384 /* Host interrupt handlers may have clobbered these guest-readable
385 * SPRGs, so we need to reload them here with the guest's values. */ 385 * SPRGs, so we need to reload them here with the guest's values. */
386 lwz r3, VCPU_SPRG4(r4) 386 lwz r3, VCPU_SPRG4(r4)
387 mtspr SPRN_SPRG4, r3 387 mtspr SPRN_SPRG4W, r3
388 lwz r3, VCPU_SPRG5(r4) 388 lwz r3, VCPU_SPRG5(r4)
389 mtspr SPRN_SPRG5, r3 389 mtspr SPRN_SPRG5W, r3
390 lwz r3, VCPU_SPRG6(r4) 390 lwz r3, VCPU_SPRG6(r4)
391 mtspr SPRN_SPRG6, r3 391 mtspr SPRN_SPRG6W, r3
392 lwz r3, VCPU_SPRG7(r4) 392 lwz r3, VCPU_SPRG7(r4)
393 mtspr SPRN_SPRG7, r3 393 mtspr SPRN_SPRG7W, r3
394 394
395#ifdef CONFIG_KVM_EXIT_TIMING 395#ifdef CONFIG_KVM_EXIT_TIMING
396 /* save enter time */ 396 /* save enter time */