diff mbox

[1/3] powerpc/mm/radix: Update LPCR only if it is powernv

Message ID 1464675991-13023-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com (mailing list archive)
State Accepted
Headers show

Commit Message

Aneesh Kumar K.V May 31, 2016, 6:26 a.m. UTC
LPCR cannot be updated when running in guest mode.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
 arch/powerpc/mm/pgtable-radix.c | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)

Comments

Balbir Singh June 3, 2016, 5:38 a.m. UTC | #1
On 31/05/16 16:26, Aneesh Kumar K.V wrote:
> LPCR cannot be updated when running in guest mode.
> 
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
> ---
>  arch/powerpc/mm/pgtable-radix.c | 23 ++++++++++-------------
>  1 file changed, 10 insertions(+), 13 deletions(-)
> 
> diff --git a/arch/powerpc/mm/pgtable-radix.c b/arch/powerpc/mm/pgtable-radix.c
> index 18b2c11604fa..c939e6e57a9e 100644
> --- a/arch/powerpc/mm/pgtable-radix.c
> +++ b/arch/powerpc/mm/pgtable-radix.c
> @@ -296,11 +296,6 @@ found:
>  void __init radix__early_init_mmu(void)
>  {
>  	unsigned long lpcr;

Move this to

> -	/*
> -	 * setup LPCR UPRT based on mmu_features
> -	 */
> -	lpcr = mfspr(SPRN_LPCR);
> -	mtspr(SPRN_LPCR, lpcr | LPCR_UPRT);
>  
>  #ifdef CONFIG_PPC_64K_PAGES
>  	/* PAGE_SIZE mappings */
> @@ -343,8 +338,11 @@ void __init radix__early_init_mmu(void)
>  	__pte_frag_size_shift = H_PTE_FRAG_SIZE_SHIFT;
>  
>  	radix_init_page_sizes();
> -	if (!firmware_has_feature(FW_FEATURE_LPAR))
> +	if (!firmware_has_feature(FW_FEATURE_LPAR)) {
>  	unsigned long lpcr;

Here

> +		lpcr = mfspr(SPRN_LPCR);
> +		mtspr(SPRN_LPCR, lpcr | LPCR_UPRT);
>  		radix_init_partition_table();
> +	}
>  
>  	radix_init_pgtable();
>  }
> @@ -353,16 +351,15 @@ void radix__early_init_mmu_secondary(void)
>  {
>  	unsigned long lpcr;

Same as above

>  	/*
> -	 * setup LPCR UPRT based on mmu_features
> +	 * update partition table control register and UPRT
>  	 */
> -	lpcr = mfspr(SPRN_LPCR);
> -	mtspr(SPRN_LPCR, lpcr | LPCR_UPRT);
> -	/*
> -	 * update partition table control register, 64 K size.
> -	 */
> -	if (!firmware_has_feature(FW_FEATURE_LPAR))
> +	if (!firmware_has_feature(FW_FEATURE_LPAR)) {
> +		lpcr = mfspr(SPRN_LPCR);
> +		mtspr(SPRN_LPCR, lpcr | LPCR_UPRT);
> +
>  		mtspr(SPRN_PTCR,
>  		      __pa(partition_tb) | (PATB_SIZE_SHIFT - 12));
> +	}
>  }
>  
>  void radix__setup_initial_memory_limit(phys_addr_t first_memblock_base,
> 


Balbir Singh.
Michael Ellerman June 6, 2016, 12:17 a.m. UTC | #2
On Tue, 2016-31-05 at 06:26:29 UTC, "Aneesh Kumar K.V" wrote:
> LPCR cannot be updated when running in guest mode.
> 
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>

Applied to powerpc fixes, thanks.

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

cheers
diff mbox

Patch

diff --git a/arch/powerpc/mm/pgtable-radix.c b/arch/powerpc/mm/pgtable-radix.c
index 18b2c11604fa..c939e6e57a9e 100644
--- a/arch/powerpc/mm/pgtable-radix.c
+++ b/arch/powerpc/mm/pgtable-radix.c
@@ -296,11 +296,6 @@  found:
 void __init radix__early_init_mmu(void)
 {
 	unsigned long lpcr;
-	/*
-	 * setup LPCR UPRT based on mmu_features
-	 */
-	lpcr = mfspr(SPRN_LPCR);
-	mtspr(SPRN_LPCR, lpcr | LPCR_UPRT);
 
 #ifdef CONFIG_PPC_64K_PAGES
 	/* PAGE_SIZE mappings */
@@ -343,8 +338,11 @@  void __init radix__early_init_mmu(void)
 	__pte_frag_size_shift = H_PTE_FRAG_SIZE_SHIFT;
 
 	radix_init_page_sizes();
-	if (!firmware_has_feature(FW_FEATURE_LPAR))
+	if (!firmware_has_feature(FW_FEATURE_LPAR)) {
+		lpcr = mfspr(SPRN_LPCR);
+		mtspr(SPRN_LPCR, lpcr | LPCR_UPRT);
 		radix_init_partition_table();
+	}
 
 	radix_init_pgtable();
 }
@@ -353,16 +351,15 @@  void radix__early_init_mmu_secondary(void)
 {
 	unsigned long lpcr;
 	/*
-	 * setup LPCR UPRT based on mmu_features
+	 * update partition table control register and UPRT
 	 */
-	lpcr = mfspr(SPRN_LPCR);
-	mtspr(SPRN_LPCR, lpcr | LPCR_UPRT);
-	/*
-	 * update partition table control register, 64 K size.
-	 */
-	if (!firmware_has_feature(FW_FEATURE_LPAR))
+	if (!firmware_has_feature(FW_FEATURE_LPAR)) {
+		lpcr = mfspr(SPRN_LPCR);
+		mtspr(SPRN_LPCR, lpcr | LPCR_UPRT);
+
 		mtspr(SPRN_PTCR,
 		      __pa(partition_tb) | (PATB_SIZE_SHIFT - 12));
+	}
 }
 
 void radix__setup_initial_memory_limit(phys_addr_t first_memblock_base,