diff mbox

[09/19] ARM64 / ACPI: Move the initialization of cpu_logical_map(0) before acpi_boot_init()

Message ID 1406206825-15590-10-git-send-email-hanjun.guo@linaro.org
State New
Headers show

Commit Message

Hanjun Guo July 24, 2014, 1 p.m. UTC
Move the initialization of cpu_logical_map(0) before acpi_boot_init()
to remove the duplicated initialization of cpu_logical_map(0).

Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 arch/arm64/kernel/acpi.c  |    3 ---
 arch/arm64/kernel/setup.c |    3 ++-
 2 files changed, 2 insertions(+), 4 deletions(-)

Comments

Mark Rutland July 24, 2014, 3:21 p.m. UTC | #1
On Thu, Jul 24, 2014 at 02:00:15PM +0100, Hanjun Guo wrote:
> Move the initialization of cpu_logical_map(0) before acpi_boot_init()
> to remove the duplicated initialization of cpu_logical_map(0).

It always make sense to initialise CPU0's logical map entry from the
hardware values, so you could do this earlier in the series, before you
introduce any ACPI code. Then you don't have the churn in acpi.c

> 
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
> ---
>  arch/arm64/kernel/acpi.c  |    3 ---
>  arch/arm64/kernel/setup.c |    3 ++-
>  2 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
> index 801e268..ff0f6a0 100644
> --- a/arch/arm64/kernel/acpi.c
> +++ b/arch/arm64/kernel/acpi.c
> @@ -244,9 +244,6 @@ int __init acpi_boot_init(void)
>  	if (err)
>  		pr_err("Can't find FADT\n");
>  
> -	/* Get the boot CPU's MPIDR before MADT parsing */
> -	cpu_logical_map(0) = read_cpuid_mpidr() & MPIDR_HWID_BITMASK;
> -
>  	err = acpi_parse_madt_gic_cpu_interface_entries();
>  
>  	return err;
> diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
> index e00d40c..17ab98e 100644
> --- a/arch/arm64/kernel/setup.c
> +++ b/arch/arm64/kernel/setup.c
> @@ -394,13 +394,14 @@ void __init setup_arch(char **cmdline_p)
>  
>  	efi_idmap_init();
>  
> +	/* Get the boot CPU's MPIDR before cpu logical map is built */

That comment's a bit useless; I think it can just be dropped.

All you need to do is move the initialisation of cpu_logical_map(0)
before unflatten_device_tree(). When you introduce acpi_boot_init(),
place it after the initialisation.

Thanks,
Mark.

> +	cpu_logical_map(0) = read_cpuid_mpidr() & MPIDR_HWID_BITMASK;
>  	acpi_boot_init();
>  
>  	unflatten_device_tree();
>  
>  	psci_init();
>  
> -	cpu_logical_map(0) = read_cpuid_mpidr() & MPIDR_HWID_BITMASK;
>  	cpu_read_bootcpu_ops();
>  #ifdef CONFIG_SMP
>  	smp_init_cpus();
> -- 
> 1.7.9.5
> 
>
Hanjun Guo July 25, 2014, 10:39 a.m. UTC | #2
On 2014-7-24 23:21, Mark Rutland wrote:
> On Thu, Jul 24, 2014 at 02:00:15PM +0100, Hanjun Guo wrote:
>> Move the initialization of cpu_logical_map(0) before acpi_boot_init()
>> to remove the duplicated initialization of cpu_logical_map(0).
> 
> It always make sense to initialise CPU0's logical map entry from the
> hardware values, so you could do this earlier in the series, before you
> introduce any ACPI code. Then you don't have the churn in acpi.c

ok, I will prepare a separate patch to do this before ACPI code, does it
make sense to you?

> 
>>
>> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
>> ---
>>  arch/arm64/kernel/acpi.c  |    3 ---
>>  arch/arm64/kernel/setup.c |    3 ++-
>>  2 files changed, 2 insertions(+), 4 deletions(-)
>>
>> diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
>> index 801e268..ff0f6a0 100644
>> --- a/arch/arm64/kernel/acpi.c
>> +++ b/arch/arm64/kernel/acpi.c
>> @@ -244,9 +244,6 @@ int __init acpi_boot_init(void)
>>  	if (err)
>>  		pr_err("Can't find FADT\n");
>>  
>> -	/* Get the boot CPU's MPIDR before MADT parsing */
>> -	cpu_logical_map(0) = read_cpuid_mpidr() & MPIDR_HWID_BITMASK;
>> -
>>  	err = acpi_parse_madt_gic_cpu_interface_entries();
>>  
>>  	return err;
>> diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
>> index e00d40c..17ab98e 100644
>> --- a/arch/arm64/kernel/setup.c
>> +++ b/arch/arm64/kernel/setup.c
>> @@ -394,13 +394,14 @@ void __init setup_arch(char **cmdline_p)
>>  
>>  	efi_idmap_init();
>>  
>> +	/* Get the boot CPU's MPIDR before cpu logical map is built */
> 
> That comment's a bit useless; I think it can just be dropped.
> 
> All you need to do is move the initialisation of cpu_logical_map(0)
> before unflatten_device_tree(). When you introduce acpi_boot_init(),
> place it after the initialisation.

ok, I agree with you, will update it.

Thanks
Hanjun

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Mark Rutland July 25, 2014, 12:18 p.m. UTC | #3
On Fri, Jul 25, 2014 at 11:39:08AM +0100, Hanjun Guo wrote:
> On 2014-7-24 23:21, Mark Rutland wrote:
> > On Thu, Jul 24, 2014 at 02:00:15PM +0100, Hanjun Guo wrote:
> >> Move the initialization of cpu_logical_map(0) before acpi_boot_init()
> >> to remove the duplicated initialization of cpu_logical_map(0).
> > 
> > It always make sense to initialise CPU0's logical map entry from the
> > hardware values, so you could do this earlier in the series, before you
> > introduce any ACPI code. Then you don't have the churn in acpi.c
> 
> ok, I will prepare a separate patch to do this before ACPI code, does it
> make sense to you?

Yes. Just put that at the start of the series.

Thanks,
Mark.
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" 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/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
index 801e268..ff0f6a0 100644
--- a/arch/arm64/kernel/acpi.c
+++ b/arch/arm64/kernel/acpi.c
@@ -244,9 +244,6 @@  int __init acpi_boot_init(void)
 	if (err)
 		pr_err("Can't find FADT\n");
 
-	/* Get the boot CPU's MPIDR before MADT parsing */
-	cpu_logical_map(0) = read_cpuid_mpidr() & MPIDR_HWID_BITMASK;
-
 	err = acpi_parse_madt_gic_cpu_interface_entries();
 
 	return err;
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index e00d40c..17ab98e 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -394,13 +394,14 @@  void __init setup_arch(char **cmdline_p)
 
 	efi_idmap_init();
 
+	/* Get the boot CPU's MPIDR before cpu logical map is built */
+	cpu_logical_map(0) = read_cpuid_mpidr() & MPIDR_HWID_BITMASK;
 	acpi_boot_init();
 
 	unflatten_device_tree();
 
 	psci_init();
 
-	cpu_logical_map(0) = read_cpuid_mpidr() & MPIDR_HWID_BITMASK;
 	cpu_read_bootcpu_ops();
 #ifdef CONFIG_SMP
 	smp_init_cpus();