mips: smp-bmips: fix CPU mappings
Subsystems (2)
PATCH 1/1 mips: smp-bmips: fix CPU mappings
When booting bmips with SMP enabled on a BCM6358 running on CPU #1 instead of CPU #0, the current CPU mapping code produces the following:
- smp_processor_id(): 0
- cpu_logical_map(): 1
- cpu_number_map(): 1
This is because SMP isn't supported on BCM6358 since it has a shared TLB, so it is disabled and max_cpus is decreased from 2 to 1.
--- arch/mips/kernel/smp-bmips.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-)
arch/mips/kernel/smp-bmips.c +17 -10
@@ -134,17 +134,24 @@ static void __init bmips_smp_setup(void)if (!board_ebase_setup) board_ebase_setup = &bmips_ebase_setup; - __cpu_number_map[boot_cpu] =0 ; - __cpu_logical_map[0 ] = boot_cpu; - -for (i =0 ; i < max_cpus; i++) { -if (i != boot_cpu) { - __cpu_number_map[i] = cpu; - __cpu_logical_map[cpu] = i; - cpu++; +if (max_cpus >1 ) { + __cpu_number_map[boot_cpu] =0 ; + __cpu_logical_map[0 ] = boot_cpu; + +for (i =0 ; i < max_cpus; i++) { +if (i != boot_cpu) { + __cpu_number_map[i] = cpu; + __cpu_logical_map[cpu] = i; + cpu++; + } +set_cpu_possible (i,1 ); +set_cpu_present (i,1 ); } -set_cpu_possible (i,1 ); -set_cpu_present (i,1 ); + }else { + __cpu_number_map[0 ] = boot_cpu; + __cpu_logical_map[0 ] =0 ; +set_cpu_possible (0 ,1 ); +set_cpu_possible (0 ,1 ); } }
Signature · 1 line
2.20.1
Quoted 40 lines · Álvaro Fernández Rojas
When booting bmips with SMP enabled on a BCM6358 running on CPU #1 instead of CPU #0, the current CPU mapping code produces the following:
-smp_processor_id(): 0
-cpu_logical_map(): 1
-cpu_number_map(): 1This is because SMP isn't supported on BCM6358 since it has a shared TLB, so it is disabled and
max_cpusis decreased from 2 to 1.Signed-off-by Álvaro Fernández Rojas <[email protected]>--- arch/mips/kernel/smp-bmips.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-)arch/mips/kernel/smp-bmips.c +10
-8@@ -134,17 +134,24 @@ static void __init bmips_smp_setup(void)if (!board_ebase_setup) board_ebase_setup = &bmips_ebase_setup; - __cpu_number_map[boot_cpu] =0 ; - __cpu_logical_map[0 ] = boot_cpu; - -for (i =0 ; i < max_cpus; i++) { -if (i != boot_cpu) { - __cpu_number_map[i] = cpu; - __cpu_logical_map[cpu] = i; - cpu++; +if (max_cpus >1 ) { + __cpu_number_map[boot_cpu] =0 ; + __cpu_logical_map[0 ] = boot_cpu; + +for (i =0 ; i < max_cpus; i++) { +if (i != boot_cpu) { + __cpu_number_map[i] = cpu; + __cpu_logical_map[cpu] = i; + cpu++; + }
arch/mips/kernel/smp-bmips.c static void __init bmips_smp_setup(void) · line 154
Quoted 10 lines
arch/mips/kernel/smp-bmips.c +7
-2+set_cpu_possible (i,1 ); +set_cpu_present (i,1 ); } -set_cpu_possible (i,1 ); -set_cpu_present (i,1 ); + }else { + __cpu_number_map[0 ] = boot_cpu; + __cpu_logical_map[0 ] =0 ; +set_cpu_possible (0 ,1 ); +set_cpu_possible (0 ,1 );
Duplicate line, with that fixed:
Signature · 1 line
Florian
Hi Florian,
Quoted 49 lines · Florian Fainelli
Quoted 44 lines · Álvaro Fernández Rojas
When booting bmips with SMP enabled on a BCM6358 running on CPU #1 instead of CPU #0, the current CPU mapping code produces the following:
-smp_processor_id(): 0
-cpu_logical_map(): 1
-cpu_number_map(): 1This is because SMP isn't supported on BCM6358 since it has a shared TLB, so it is disabled and
max_cpusis decreased from 2 to 1.Signed-off-by Álvaro Fernández Rojas <[email protected]>---
arch/mips/kernel/smp-bmips.c| 27 +++++++++++++++++----------1 file changed, 17 insertions(+), 10 deletions(-)arch/mips/kernel/smp-bmips.c +12
-9@@ -134,17 +134,24 @@ static void __init bmips_smp_setup(void)if (!board_ebase_setup) board_ebase_setup = &bmips_ebase_setup; - __cpu_number_map[boot_cpu] =0 ; - __cpu_logical_map[0 ] = boot_cpu; - -for (i =0 ; i < max_cpus; i++) { -if (i != boot_cpu) { - __cpu_number_map[i] = cpu; - __cpu_logical_map[cpu] = i; - cpu++; +if (max_cpus >1 ) { + __cpu_number_map[boot_cpu] =0 ; + __cpu_logical_map[0 ] = boot_cpu; + +for (i =0 ; i < max_cpus; i++) { +if (i != boot_cpu) { + __cpu_number_map[i] = cpu; + __cpu_logical_map[cpu] = i; + cpu++; + } +set_cpu_possible (i,1 ); +set_cpu_present (i,1 ); } -set_cpu_possible (i,1 );
Quoted 8 lines
arch/mips/kernel/smp-bmips.c static void __init bmips_smp_setup(void) · line 154
Quoted 6 lines
arch/mips/kernel/smp-bmips.c +5
-1-set_cpu_present (i,1 ); + }else { + __cpu_number_map[0 ] = boot_cpu; + __cpu_logical_map[0 ] =0 ; +set_cpu_possible (0 ,1 ); +set_cpu_possible (0 ,1 );Duplicate line, with that fixed:
Nice catch, it should be set_cpu_present().
Quoted 4 lines
Reviewed-by Florian Fainelli <[email protected]>Signature · 1 line
Florian
PATCH v2 1/1 mips: smp-bmips: fix CPU mappings
In reply to Álvaro Fernández RojasWhen booting bmips with SMP enabled on a BCM6358 running on CPU #1 instead of CPU #0, the current CPU mapping code produces the following:
- smp_processor_id(): 0
- cpu_logical_map(0): 1
- cpu_number_map(0): 1
This is because SMP isn't supported on BCM6358 since it has a shared TLB, so it is disabled and max_cpus is decreased from 2 to 1.
---
v2: Fix duplicated line
arch/mips/kernel/smp-bmips.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-)
arch/mips/kernel/smp-bmips.c +17 -10
@@ -134,17 +134,24 @@ static void __init bmips_smp_setup(void)if (!board_ebase_setup) board_ebase_setup = &bmips_ebase_setup; - __cpu_number_map[boot_cpu] =0 ; - __cpu_logical_map[0 ] = boot_cpu; - -for (i =0 ; i < max_cpus; i++) { -if (i != boot_cpu) { - __cpu_number_map[i] = cpu; - __cpu_logical_map[cpu] = i; - cpu++; +if (max_cpus >1 ) { + __cpu_number_map[boot_cpu] =0 ; + __cpu_logical_map[0 ] = boot_cpu; + +for (i =0 ; i < max_cpus; i++) { +if (i != boot_cpu) { + __cpu_number_map[i] = cpu; + __cpu_logical_map[cpu] = i; + cpu++; + } +set_cpu_possible (i,1 ); +set_cpu_present (i,1 ); } -set_cpu_possible (i,1 ); -set_cpu_present (i,1 ); + }else { + __cpu_number_map[0 ] = boot_cpu; + __cpu_logical_map[0 ] =0 ; +set_cpu_possible (0 ,1 ); +set_cpu_present (0 ,1 ); } }
Signature · 1 line
2.20.1
Hi all,
Apparently, this patch was flagged as "Not Applicable" without an explanation. Why?
https://patchwork.kernel.org/project/linux-mips/patch/[email protected]/
Best regarss,
Álvaro.
Quoted 61 lines · Álvaro Fernández Rojas
When booting bmips with SMP enabled on a BCM6358 running on CPU #1 instead of CPU #0, the current CPU mapping code produces the following:
-smp_processor_id(): 0
-cpu_logical_map(0): 1
-cpu_number_map(0): 1This is because SMP isn't supported on BCM6358 since it has a shared TLB, so it is disabled and
max_cpusis decreased from 2 to 1.Signed-off-by Álvaro Fernández Rojas <[email protected]>Reviewed-by Florian Fainelli <[email protected]>---
v2: Fix duplicated line
arch/mips/kernel/smp-bmips.c| 27 +++++++++++++++++----------1 file changed, 17 insertions(+), 10 deletions(-)arch/mips/kernel/smp-bmips.c +17
-10@@ -134,17 +134,24 @@ static void __init bmips_smp_setup(void)if (!board_ebase_setup) board_ebase_setup = &bmips_ebase_setup; - __cpu_number_map[boot_cpu] =0 ; - __cpu_logical_map[0 ] = boot_cpu; - -for (i =0 ; i < max_cpus; i++) { -if (i != boot_cpu) { - __cpu_number_map[i] = cpu; - __cpu_logical_map[cpu] = i; - cpu++; +if (max_cpus >1 ) { + __cpu_number_map[boot_cpu] =0 ; + __cpu_logical_map[0 ] = boot_cpu; + +for (i =0 ; i < max_cpus; i++) { +if (i != boot_cpu) { + __cpu_number_map[i] = cpu; + __cpu_logical_map[cpu] = i; + cpu++; + } +set_cpu_possible (i,1 ); +set_cpu_present (i,1 ); } -set_cpu_possible (i,1 ); -set_cpu_present (i,1 ); + }else { + __cpu_number_map[0 ] = boot_cpu; + __cpu_logical_map[0 ] =0 ; +set_cpu_possible (0 ,1 ); +set_cpu_present (0 ,1 ); } }Signature · 1 line
2.20.1
Thomas Bogendoerfer
maintainerQuoted 4 lines · Álvaro Fernández Rojas
Hi all,
Apparently, this patch was flagged as "Not Applicable" without an explanation. Why?
hmm, I probaly wanted to drop the first version, but changed v2. It's back to new again and I'm gogin to apply it soon.
Sorry about that.
Thomas.
Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ]
Quoted 9 lines · Álvaro Fernández Rojas
When booting bmips with SMP enabled on a BCM6358 running on CPU #1 instead of CPU #0, the current CPU mapping code produces the following:
-smp_processor_id(): 0
-cpu_logical_map(0): 1
-cpu_number_map(0): 1This is because SMP isn't supported on BCM6358 since it has a shared TLB, so it is disabled and
max_cpusis decreased from 2 to 1.
Quoted 7 lines
Signed-off-by Álvaro Fernández Rojas <[email protected]>Reviewed-by Florian Fainelli <[email protected]>---
v2: Fix duplicated linearch/mips/kernel/smp-bmips.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-)
applied to mips-next.
Thomas.
Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ]