diff mbox

powerpc/64: Fix setting of AIL in hypervisor mode

Message ID 1479184113.2608.45.camel@kernel.crashing.org (mailing list archive)
State Accepted
Headers show

Commit Message

Benjamin Herrenschmidt Nov. 15, 2016, 4:28 a.m. UTC
Commit d3cbff1b5 "powerpc: Put exception configuration in a common place"
broke the setting of the AIL bit (which enables taking exceptions with
the MMU still on) on all processors, moving it incorrectly to a function
called only on the boot CPU. This was correct for the guest case but
not when running in hypervisor mode.

This fixes it by partially reverting that commit, putting the setting
back in cpu_ready_for_interrupts()

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Fixes: d3cbff1b5 ("powerpc: Put exception configuration in a common place")
CC: stable@vger.kernel.org # v4.8+
---
 arch/powerpc/kernel/setup_64.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

Comments

Michael Ellerman Nov. 17, 2016, 5 a.m. UTC | #1
On Tue, 2016-15-11 at 04:28:33 UTC, Benjamin Herrenschmidt wrote:
> Commit d3cbff1b5 "powerpc: Put exception configuration in a common place"
> broke the setting of the AIL bit (which enables taking exceptions with
> the MMU still on) on all processors, moving it incorrectly to a function
> called only on the boot CPU. This was correct for the guest case but
> not when running in hypervisor mode.
> 
> This fixes it by partially reverting that commit, putting the setting
> back in cpu_ready_for_interrupts()
> 
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Fixes: d3cbff1b5 ("powerpc: Put exception configuration in a common place")
> CC: stable@vger.kernel.org # v4.8+

Applied to powerpc fixes, thanks.

https://git.kernel.org/powerpc/c/c0a36013639b06760f7c2c21a8387e

cheers
Michael Neuling Nov. 17, 2016, 10:38 p.m. UTC | #2
On Tue, 2016-11-15 at 15:28 +1100, Benjamin Herrenschmidt wrote:
> Commit d3cbff1b5 "powerpc: Put exception configuration in a common place"
> broke the setting of the AIL bit (which enables taking exceptions with
> the MMU still on) on all processors, moving it incorrectly to a function
> called only on the boot CPU. This was correct for the guest case but
> not when running in hypervisor mode.
> 
> This fixes it by partially reverting that commit, putting the setting
> back in cpu_ready_for_interrupts()
> 
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Fixes: d3cbff1b5 ("powerpc: Put exception configuration in a common place")
> CC: stable@vger.kernel.org # v4.8+

Acked-By: Michael Neuling <mikey@neuling.org>

> ---
>  arch/powerpc/kernel/setup_64.c | 20 ++++++++++++++------
>  1 file changed, 14 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
> index 7ac8e6e..ac75224 100644
> --- a/arch/powerpc/kernel/setup_64.c
> +++ b/arch/powerpc/kernel/setup_64.c
> @@ -226,17 +226,25 @@ static void __init configure_exceptions(void)
>  		if (firmware_has_feature(FW_FEATURE_OPAL))
>  			opal_configure_cores();
>  
> -		/* Enable AIL if supported, and we are in hypervisor mode */
> -		if (early_cpu_has_feature(CPU_FTR_HVMODE) &&
> -		    early_cpu_has_feature(CPU_FTR_ARCH_207S)) {
> -			unsigned long lpcr = mfspr(SPRN_LPCR);
> -			mtspr(SPRN_LPCR, lpcr | LPCR_AIL_3);
> -		}
> +		/* AIL on native is done in cpu_ready_for_interrupts */
>  	}
>  }
>  
>  static void cpu_ready_for_interrupts(void)
>  {
> +	/*
> +	 * Enable AIL if supported, and we are in hypervisor mode. This
> +	 * is called once for every processor.
> +	 *
> +	 * If we are not in hypervisor mode the job is done once for
> +	 * the whole partition in configure_exceptions().
> +	 */
> +	if (early_cpu_has_feature(CPU_FTR_HVMODE) &&
> +	    early_cpu_has_feature(CPU_FTR_ARCH_207S)) {
> +		unsigned long lpcr = mfspr(SPRN_LPCR);
> +		mtspr(SPRN_LPCR, lpcr | LPCR_AIL_3);
> +	}
> +
>  	/* Set IR and DR in PACA MSR */
>  	get_paca()->kernel_msr = MSR_KERNEL;
>  }
>
diff mbox

Patch

diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 7ac8e6e..ac75224 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -226,17 +226,25 @@  static void __init configure_exceptions(void)
 		if (firmware_has_feature(FW_FEATURE_OPAL))
 			opal_configure_cores();
 
-		/* Enable AIL if supported, and we are in hypervisor mode */
-		if (early_cpu_has_feature(CPU_FTR_HVMODE) &&
-		    early_cpu_has_feature(CPU_FTR_ARCH_207S)) {
-			unsigned long lpcr = mfspr(SPRN_LPCR);
-			mtspr(SPRN_LPCR, lpcr | LPCR_AIL_3);
-		}
+		/* AIL on native is done in cpu_ready_for_interrupts */
 	}
 }
 
 static void cpu_ready_for_interrupts(void)
 {
+	/*
+	 * Enable AIL if supported, and we are in hypervisor mode. This
+	 * is called once for every processor.
+	 *
+	 * If we are not in hypervisor mode the job is done once for
+	 * the whole partition in configure_exceptions().
+	 */
+	if (early_cpu_has_feature(CPU_FTR_HVMODE) &&
+	    early_cpu_has_feature(CPU_FTR_ARCH_207S)) {
+		unsigned long lpcr = mfspr(SPRN_LPCR);
+		mtspr(SPRN_LPCR, lpcr | LPCR_AIL_3);
+	}
+
 	/* Set IR and DR in PACA MSR */
 	get_paca()->kernel_msr = MSR_KERNEL;
 }