diff mbox

[06/38] powerpc: Move 64-bit feature fixup earlier

Message ID 1467026976-7974-7-git-send-email-benh@kernel.crashing.org (mailing list archive)
State Superseded
Headers show

Commit Message

Benjamin Herrenschmidt June 27, 2016, 11:29 a.m. UTC
Make it part of early_setup() as we really want the feature fixups
to be applied before we turn on the MMU since they can have an impact
on the various assembly path related to MMU management and interrupts.

This makes 64-bit match what 32-bit does.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 arch/powerpc/kernel/setup_64.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Aneesh Kumar K.V June 28, 2016, 11:05 a.m. UTC | #1
Benjamin Herrenschmidt <benh@kernel.crashing.org> writes:

> Make it part of early_setup() as we really want the feature fixups
> to be applied before we turn on the MMU since they can have an impact
> on the various assembly path related to MMU management and interrupts.
>
> This makes 64-bit match what 32-bit does.
>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
>  arch/powerpc/kernel/setup_64.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
> index 996bed2..e79cf1b 100644
> --- a/arch/powerpc/kernel/setup_64.c
> +++ b/arch/powerpc/kernel/setup_64.c
> @@ -286,6 +286,9 @@ void __init early_setup(unsigned long dt_ptr)
>  	/* Initialize the hash table or TLB handling */
>  	early_init_mmu();
>  
> +	/* Apply all the dynamic patching */
> +	apply_feature_fixups();
> +
>  	/*
>  	 * At this point, we can let interrupts switch to virtual mode
>  	 * (the MMU has been setup), so adjust the MSR in the PACA to
> @@ -468,8 +471,6 @@ void __init setup_system(void)
>  {
>  	DBG(" -> setup_system()\n");
>  
> -	apply_feature_fixups();
> -
>  	/*
>  	 * Unflatten the device-tree passed by prom_init or kexec
>  	 */

Why not move it immediately after we finish all the device tress scan.

ie,
	early_init_devtree(__va(dt_ptr));

	epapr_paravirt_early_init();

  +      apply_feature_fixups();
	/* Now we know the logical id of our boot cpu, setup the paca. */
	setup_paca(&paca[boot_cpuid]);
	fixup_boot_paca();

Also with a comment explaining why we can't move it further up ?


-aneesh
Benjamin Herrenschmidt June 28, 2016, 11:14 a.m. UTC | #2
On Tue, 2016-06-28 at 16:35 +0530, Aneesh Kumar K.V wrote:
> Why not move it immediately after we finish all the device tress
> scan.

Do you need it in early_init_mmu ? The important thing is to have it
done before we *turn on* the MMU but yeah, there's no big deal
moving it even further up I think..

> ie,
>         early_init_devtree(__va(dt_ptr));
> 
>         epapr_paravirt_early_init();
> 
>   +      apply_feature_fixups();
>         /* Now we know the logical id of our boot cpu, setup the
> paca. */
>         setup_paca(&paca[boot_cpuid]);
>         fixup_boot_paca();
> 
> Also with a comment explaining why we can't move it further up ?

Yup, adding some comments about the why things are done in that order
would be good, I'll improve that

Cheers,
Ben.
Aneesh Kumar K.V June 28, 2016, 11:49 a.m. UTC | #3
Benjamin Herrenschmidt <benh@kernel.crashing.org> writes:

> On Tue, 2016-06-28 at 16:35 +0530, Aneesh Kumar K.V wrote:
>> Why not move it immediately after we finish all the device tress
>> scan.
>
> Do you need it in early_init_mmu ? The important thing is to have it
> done before we *turn on* the MMU but yeah, there's no big deal
> moving it even further up I think..

If we can do feature fixup early. Then this patch series become simpler.

https://lkml.kernel.org/r/1465887288-12952-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com

ie, we can now start using cpu_has_feature/mmu_has_feature early instead
of using __cpu/mmu_has_feature.

>
>> ie,
>>         early_init_devtree(__va(dt_ptr));
>> 
>>         epapr_paravirt_early_init();
>> 
>>   +      apply_feature_fixups();
>>         /* Now we know the logical id of our boot cpu, setup the
>> paca. */
>>         setup_paca(&paca[boot_cpuid]);
>>         fixup_boot_paca();
>> 
>> Also with a comment explaining why we can't move it further up ?
>
> Yup, adding some comments about the why things are done in that order
> would be good, I'll improve that
>
> Cheers,
> Ben.

-aneesh
Benjamin Herrenschmidt June 28, 2016, 11:57 a.m. UTC | #4
On Tue, 2016-06-28 at 17:19 +0530, Aneesh Kumar K.V wrote:
> If we can do feature fixup early. Then this patch series become
> simpler.
> 
> https://lkml.kernel.org/r/1465887288-12952-1-git-send-email-aneesh.ku
> mar@linux.vnet.ibm.com
> 
> ie, we can now start using cpu_has_feature/mmu_has_feature early
> instead of using __cpu/mmu_has_feature.

Ok, I'll look into it tomorrow.

Cheers,
Ben.
diff mbox

Patch

diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 996bed2..e79cf1b 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -286,6 +286,9 @@  void __init early_setup(unsigned long dt_ptr)
 	/* Initialize the hash table or TLB handling */
 	early_init_mmu();
 
+	/* Apply all the dynamic patching */
+	apply_feature_fixups();
+
 	/*
 	 * At this point, we can let interrupts switch to virtual mode
 	 * (the MMU has been setup), so adjust the MSR in the PACA to
@@ -468,8 +471,6 @@  void __init setup_system(void)
 {
 	DBG(" -> setup_system()\n");
 
-	apply_feature_fixups();
-
 	/*
 	 * Unflatten the device-tree passed by prom_init or kexec
 	 */