diff mbox

[6/6] powerpc/booke64: restore VDSO information on critical exception

Message ID 1344259628-31161-7-git-send-email-mihai.caraman@freescale.com
State New, archived
Headers show

Commit Message

Mihai Caraman Aug. 6, 2012, 1:27 p.m. UTC
Critical exception handler on 64-bit booke uses user-visible SPRG3 as scratch.
Restore VDSO information in SPRG3 on exception prolog.

Signed-off-by: Mihai Caraman <mihai.caraman@freescale.com>
---
 arch/powerpc/include/asm/paca.h      |    3 +++
 arch/powerpc/kernel/asm-offsets.c    |    1 +
 arch/powerpc/kernel/exceptions-64e.S |    4 +++-
 arch/powerpc/kernel/vdso.c           |    2 ++
 4 files changed, 9 insertions(+), 1 deletions(-)

Comments

Benjamin Herrenschmidt Sept. 5, 2012, 5:38 a.m. UTC | #1
On Mon, 2012-08-06 at 16:27 +0300, Mihai Caraman wrote:
> Critical exception handler on 64-bit booke uses user-visible SPRG3 as scratch.
> Restore VDSO information in SPRG3 on exception prolog.

Breaks the build on !BOOKE because of :

> diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
> index b67db22..a0b0d08 100644
> --- a/arch/powerpc/kernel/vdso.c
> +++ b/arch/powerpc/kernel/vdso.c
> @@ -725,6 +725,8 @@ int __cpuinit vdso_getcpu_init(void)
>  	mtspr(SPRN_SPRG3, val);
>  #ifdef CONFIG_KVM_BOOK3S_HANDLER
>  	get_paca()->kvm_hstate.sprg3 = val;
> +#elif CONFIG_PPC_BOOK3E
    ^^^^

You can't "#elif" a CONFIG option.

> +	get_paca()->sprg3 = val;
>  #endif
>  
>  	put_cpu();

Now, my suggestion is to actually move the bloody thing out of
kvm_hstate on server as well, just make it a common "sprg3" field
accross the board.

I'm dropping this one patch (the other ones seem fine so far and will
land in next soon unless I find another problem).

Cheers,
Ben.


--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h
index daf813f..6b98ad4 100644
--- a/arch/powerpc/include/asm/paca.h
+++ b/arch/powerpc/include/asm/paca.h
@@ -118,6 +118,9 @@  struct paca_struct {
 	void *mc_kstack;
 	void *crit_kstack;
 	void *dbg_kstack;
+
+	/* User-visible sprg information */
+	ulong sprg3;
 #endif /* CONFIG_PPC_BOOK3E */
 
 	mm_context_t context;
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index 85b05c4..8ca338d 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -168,6 +168,7 @@  int main(void)
 	DEFINE(PACA_MC_STACK, offsetof(struct paca_struct, mc_kstack));
 	DEFINE(PACA_CRIT_STACK, offsetof(struct paca_struct, crit_kstack));
 	DEFINE(PACA_DBG_STACK, offsetof(struct paca_struct, dbg_kstack));
+	DEFINE(PACA_SPRG3, offsetof(struct paca_struct, sprg3));
 #endif /* CONFIG_PPC_BOOK3E */
 
 #ifdef CONFIG_PPC_STD_MMU_64
diff --git a/arch/powerpc/kernel/exceptions-64e.S b/arch/powerpc/kernel/exceptions-64e.S
index 7476b0a..87a82fb 100644
--- a/arch/powerpc/kernel/exceptions-64e.S
+++ b/arch/powerpc/kernel/exceptions-64e.S
@@ -110,7 +110,9 @@ 
 
 #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
  */
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
index b67db22..a0b0d08 100644
--- a/arch/powerpc/kernel/vdso.c
+++ b/arch/powerpc/kernel/vdso.c
@@ -725,6 +725,8 @@  int __cpuinit vdso_getcpu_init(void)
 	mtspr(SPRN_SPRG3, val);
 #ifdef CONFIG_KVM_BOOK3S_HANDLER
 	get_paca()->kvm_hstate.sprg3 = val;
+#elif CONFIG_PPC_BOOK3E
+	get_paca()->sprg3 = val;
 #endif
 
 	put_cpu();