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

powerpc: Restore VDSO information on critical exception om BookE

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>

authored by

Mihai Caraman and committed by
Benjamin Herrenschmidt
0127262c 8b64a9df

+7 -7
-1
arch/powerpc/include/asm/kvm_book3s_asm.h
··· 74 74 ulong vmhandler; 75 75 ulong scratch0; 76 76 ulong scratch1; 77 - ulong sprg3; 78 77 u8 in_guest; 79 78 u8 restore_hid5; 80 79 u8 napping;
+1
arch/powerpc/include/asm/paca.h
··· 136 136 u8 io_sync; /* writel() needs spin_unlock sync */ 137 137 u8 irq_work_pending; /* IRQ_WORK interrupt while soft-disable */ 138 138 u8 nap_state_lost; /* NV GPR values lost in power7_idle */ 139 + u64 sprg3; /* Saved user-visible sprg */ 139 140 140 141 #ifdef CONFIG_PPC_POWERNV 141 142 /* Pointer to OPAL machine check event structure set by the
+1 -1
arch/powerpc/kernel/asm-offsets.c
··· 205 205 DEFINE(PACA_SYSTEM_TIME, offsetof(struct paca_struct, system_time)); 206 206 DEFINE(PACA_TRAP_SAVE, offsetof(struct paca_struct, trap_save)); 207 207 DEFINE(PACA_NAPSTATELOST, offsetof(struct paca_struct, nap_state_lost)); 208 + DEFINE(PACA_SPRG3, offsetof(struct paca_struct, sprg3)); 208 209 #endif /* CONFIG_PPC64 */ 209 210 210 211 /* RTAS */ ··· 534 533 HSTATE_FIELD(HSTATE_VMHANDLER, vmhandler); 535 534 HSTATE_FIELD(HSTATE_SCRATCH0, scratch0); 536 535 HSTATE_FIELD(HSTATE_SCRATCH1, scratch1); 537 - HSTATE_FIELD(HSTATE_SPRG3, sprg3); 538 536 HSTATE_FIELD(HSTATE_IN_GUEST, in_guest); 539 537 HSTATE_FIELD(HSTATE_RESTORE_HID5, restore_hid5); 540 538 HSTATE_FIELD(HSTATE_NAPPING, napping);
+3 -1
arch/powerpc/kernel/exceptions-64e.S
··· 110 110 111 111 #define PROLOG_STORE_RESTORE_SCRATCH_CRIT \ 112 112 mfspr r10,SPRN_SPRG_CRIT_SCRATCH; /* get r13 */ \ 113 - std r10,PACA_EXCRIT+EX_R13(r13) 113 + std r10,PACA_EXCRIT+EX_R13(r13); \ 114 + ld r11,PACA_SPRG3(r13); \ 115 + mtspr SPRN_SPRG_CRIT_SCRATCH,r11; 114 116 115 117 /* Variants of the "addition" argument for the prolog 116 118 */
+1 -3
arch/powerpc/kernel/vdso.c
··· 723 723 724 724 val = (cpu & 0xfff) | ((node & 0xffff) << 16); 725 725 mtspr(SPRN_SPRG3, val); 726 - #ifdef CONFIG_KVM_BOOK3S_HANDLER 727 - get_paca()->kvm_hstate.sprg3 = val; 728 - #endif 726 + get_paca()->sprg3 = val; 729 727 730 728 put_cpu(); 731 729
+1 -1
arch/powerpc/kvm/book3s_hv_rmhandlers.S
··· 1065 1065 mtspr SPRN_DABRX,r6 1066 1066 1067 1067 /* Restore SPRG3 */ 1068 - ld r3,HSTATE_SPRG3(r13) 1068 + ld r3,PACA_SPRG3(r13) 1069 1069 mtspr SPRN_SPRG3,r3 1070 1070 1071 1071 /*