powerpc: Restore VDSO information on critical exception om BookE
authorMihai Caraman <mihai.caraman@freescale.com>
Thu, 6 Sep 2012 02:49:44 +0000 (02:49 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Thu, 6 Sep 2012 23:48:49 +0000 (09:48 +1000)
Critical exception on 64-bit booke uses user-visible SPRG3 as scratch.
Restore VDSO information in SPRG3 on exception prolog.

Use a common sprg3 field in PACA for all powerpc64 architectures.

Signed-off-by: Mihai Caraman <mihai.caraman@freescale.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/include/asm/kvm_book3s_asm.h
arch/powerpc/include/asm/paca.h
arch/powerpc/kernel/asm-offsets.c
arch/powerpc/kernel/exceptions-64e.S
arch/powerpc/kernel/vdso.c
arch/powerpc/kvm/book3s_hv_rmhandlers.S

index bfcd00c1485d04474c00461d4f7b9097bd624fb4..88609b23b775460c96a4d9d805feaf49fecf94a3 100644 (file)
@@ -74,7 +74,6 @@ struct kvmppc_host_state {
        ulong vmhandler;
        ulong scratch0;
        ulong scratch1;
-       ulong sprg3;
        u8 in_guest;
        u8 restore_hid5;
        u8 napping;
index daf813fea91fa6998322ff4d0fba63b2398f52e0..7796519fd23870ab1706e41017f4831aacf7c8a5 100644 (file)
@@ -136,6 +136,7 @@ struct paca_struct {
        u8 io_sync;                     /* writel() needs spin_unlock sync */
        u8 irq_work_pending;            /* IRQ_WORK interrupt while soft-disable */
        u8 nap_state_lost;              /* NV GPR values lost in power7_idle */
+       u64 sprg3;                      /* Saved user-visible sprg */
 
 #ifdef CONFIG_PPC_POWERNV
        /* Pointer to OPAL machine check event structure set by the
index 85b05c463fae9077b4490bacfa80c31050a617fa..72f26166007a88be2db072b68869131006e387b0 100644 (file)
@@ -205,6 +205,7 @@ int main(void)
        DEFINE(PACA_SYSTEM_TIME, offsetof(struct paca_struct, system_time));
        DEFINE(PACA_TRAP_SAVE, offsetof(struct paca_struct, trap_save));
        DEFINE(PACA_NAPSTATELOST, offsetof(struct paca_struct, nap_state_lost));
+       DEFINE(PACA_SPRG3, offsetof(struct paca_struct, sprg3));
 #endif /* CONFIG_PPC64 */
 
        /* RTAS */
@@ -533,7 +534,6 @@ int main(void)
        HSTATE_FIELD(HSTATE_VMHANDLER, vmhandler);
        HSTATE_FIELD(HSTATE_SCRATCH0, scratch0);
        HSTATE_FIELD(HSTATE_SCRATCH1, scratch1);
-       HSTATE_FIELD(HSTATE_SPRG3, sprg3);
        HSTATE_FIELD(HSTATE_IN_GUEST, in_guest);
        HSTATE_FIELD(HSTATE_RESTORE_HID5, restore_hid5);
        HSTATE_FIELD(HSTATE_NAPPING, napping);
index 7476b0ae09fbb9816afc42b09e2ed1cb17ea39a9..87a82fbdf05afa1791deae718e81d4e5bfb63db2 100644 (file)
 
 #define PROLOG_STORE_RESTORE_SCRATCH_CRIT                                  \
        mfspr   r10,SPRN_SPRG_CRIT_SCRATCH;     /* get r13 */               \
-       std     r10,PACA_EXCRIT+EX_R13(r13)
+       std     r10,PACA_EXCRIT+EX_R13(r13);                                \
+       ld      r11,PACA_SPRG3(r13);                                        \
+       mtspr   SPRN_SPRG_CRIT_SCRATCH,r11;
 
 /* Variants of the "addition" argument for the prolog
  */
index b67db22e102dd93dc11ec131ac7e942cf6de3d5c..1b2076f049cecaf954b111df7a6a07b964258c52 100644 (file)
@@ -723,9 +723,7 @@ int __cpuinit vdso_getcpu_init(void)
 
        val = (cpu & 0xfff) | ((node & 0xffff) << 16);
        mtspr(SPRN_SPRG3, val);
-#ifdef CONFIG_KVM_BOOK3S_HANDLER
-       get_paca()->kvm_hstate.sprg3 = val;
-#endif
+       get_paca()->sprg3 = val;
 
        put_cpu();
 
index 5a84c8d3d04050b98ab818c9d83cedeb74b8f235..39a21bfb5d4b7a5ba32f4967967ee44b801f5f15 100644 (file)
@@ -1065,7 +1065,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_206)
        mtspr   SPRN_DABRX,r6
 
        /* Restore SPRG3 */
-       ld      r3,HSTATE_SPRG3(r13)
+       ld      r3,PACA_SPRG3(r13)
        mtspr   SPRN_SPRG3,r3
 
        /*
This page took 0.030581 seconds and 5 git commands to generate.