[RFC/PATCH 2/4] powerpc/64/kexec: Fix MMU cleanup on radix

Balbir Singh bsingharora at gmail.com
Fri Jul 8 12:55:09 AEST 2016



On 06/07/16 14:34, Benjamin Herrenschmidt wrote:
> Just using the hash ops won't work anymore since radix will have
> NULL in there. Instead create an mmu_cleanup_all() function which
> will do the right thing based on the MMU mode.
> 
> For Radix, for now I clear UPRT and the PTCR, effectively switching
> back to Radix with no partition table setup.
> 
> Currently set it to NULL on BookE thought it might be a good idea
> to wipe the TLB there (Scott ?)
> 
> Signed-off-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>

<snip>

> +
> +/* For use by kexec */
> +void mmu_cleanup_all(void)
> +{
> +	if (radix_enabled())
> +		radix__mmu_cleanup_all();


Should this be more than just radix -- cpu_has_feature(CPU_FTR_ARCH_300)?

> +	else if (mmu_hash_ops.hpte_clear_all)
> +		mmu_hash_ops.hpte_clear_all();
> +}
> diff --git a/arch/powerpc/mm/pgtable-radix.c b/arch/powerpc/mm/pgtable-radix.c
> index 3ababda..f127baa 100644
> --- a/arch/powerpc/mm/pgtable-radix.c
> +++ b/arch/powerpc/mm/pgtable-radix.c
> @@ -366,6 +366,16 @@ void radix__early_init_mmu_secondary(void)
>  	}
>  }
>  
> +void radix__mmu_cleanup_all(void)
> +{
> +	unsigned long lpcr;
> +	if (!firmware_has_feature(FW_FEATURE_LPAR)) {
> +		lpcr = mfspr(SPRN_LPCR);
> +		mtspr(SPRN_LPCR, lpcr & ~LPCR_UPRT);
> +		mtspr(SPRN_PTCR, 0);

Free up the patb data structure here?

We also need tlbie's to invalidate any caches pointing to the patb entries

Balbir Singh.


More information about the Linuxppc-dev mailing list