* [PATCH] mips: smp-bmips: fix CPU mappings
@ 2021-02-23 12:48 Álvaro Fernández Rojas
2021-02-24 3:45 ` Florian Fainelli
2021-02-24 7:33 ` [PATCH v2] " Álvaro Fernández Rojas
0 siblings, 2 replies; 7+ messages in thread
From: Álvaro Fernández Rojas @ 2021-02-23 12:48 UTC (permalink / raw)
To: jonas.gorski, Florian Fainelli, Thomas Gleixner, Marc Zyngier,
bcm-kernel-feedback-list, linux-mips, linux-kernel
Cc: Á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(): 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.
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
---
arch/mips/kernel/smp-bmips.c | 27 +++++++++++++++++----------
1 file changed, 17 insertions(+), 10 deletions(-)
diff --git a/arch/mips/kernel/smp-bmips.c b/arch/mips/kernel/smp-bmips.c
index 359b176b665f..c4760cb48a67 100644
--- a/arch/mips/kernel/smp-bmips.c
+++ b/arch/mips/kernel/smp-bmips.c
@@ -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);
}
}
--
2.20.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] mips: smp-bmips: fix CPU mappings
2021-02-23 12:48 [PATCH] mips: smp-bmips: fix CPU mappings Álvaro Fernández Rojas
@ 2021-02-24 3:45 ` Florian Fainelli
2021-02-24 7:07 ` Álvaro Fernández Rojas
2021-02-24 7:33 ` [PATCH v2] " Álvaro Fernández Rojas
1 sibling, 1 reply; 7+ messages in thread
From: Florian Fainelli @ 2021-02-24 3:45 UTC (permalink / raw)
To: Álvaro Fernández Rojas, jonas.gorski, Florian Fainelli,
Thomas Gleixner, Marc Zyngier, bcm-kernel-feedback-list,
linux-mips, linux-kernel
On 2/23/2021 4:48 AM, Álvaro Fernández Rojas wrote:
> 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.
>
> Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
> ---
> arch/mips/kernel/smp-bmips.c | 27 +++++++++++++++++----------
> 1 file changed, 17 insertions(+), 10 deletions(-)
>
> diff --git a/arch/mips/kernel/smp-bmips.c b/arch/mips/kernel/smp-bmips.c
> index 359b176b665f..c4760cb48a67 100644
> --- a/arch/mips/kernel/smp-bmips.c
> +++ b/arch/mips/kernel/smp-bmips.c
> @@ -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);
Duplicate line, with that fixed:
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
--
Florian
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mips: smp-bmips: fix CPU mappings
2021-02-24 3:45 ` Florian Fainelli
@ 2021-02-24 7:07 ` Álvaro Fernández Rojas
0 siblings, 0 replies; 7+ messages in thread
From: Álvaro Fernández Rojas @ 2021-02-24 7:07 UTC (permalink / raw)
To: Florian Fainelli
Cc: Jonas Gorski, Thomas Gleixner, Marc Zyngier,
bcm-kernel-feedback-list, linux-mips, linux-kernel
Hi Florian,
> El 24 feb 2021, a las 4:45, Florian Fainelli <f.fainelli@gmail.com> escribió:
>
>
>
> On 2/23/2021 4:48 AM, Álvaro Fernández Rojas wrote:
>> 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.
>>
>> Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
>> ---
>> arch/mips/kernel/smp-bmips.c | 27 +++++++++++++++++----------
>> 1 file changed, 17 insertions(+), 10 deletions(-)
>>
>> diff --git a/arch/mips/kernel/smp-bmips.c b/arch/mips/kernel/smp-bmips.c
>> index 359b176b665f..c4760cb48a67 100644
>> --- a/arch/mips/kernel/smp-bmips.c
>> +++ b/arch/mips/kernel/smp-bmips.c
>> @@ -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);
>
> Duplicate line, with that fixed:
Nice catch, it should be set_cpu_present().
>
> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
> --
> Florian
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2] mips: smp-bmips: fix CPU mappings
2021-02-23 12:48 [PATCH] mips: smp-bmips: fix CPU mappings Álvaro Fernández Rojas
2021-02-24 3:45 ` Florian Fainelli
@ 2021-02-24 7:33 ` Álvaro Fernández Rojas
2021-02-27 6:47 ` Álvaro Fernández Rojas
2021-03-01 14:50 ` Thomas Bogendoerfer
1 sibling, 2 replies; 7+ messages in thread
From: Álvaro Fernández Rojas @ 2021-02-24 7:33 UTC (permalink / raw)
To: jonas.gorski, Florian Fainelli, Thomas Gleixner, Marc Zyngier,
bcm-kernel-feedback-list, linux-mips, linux-kernel
Cc: Á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): 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.
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---
v2: Fix duplicated line
arch/mips/kernel/smp-bmips.c | 27 +++++++++++++++++----------
1 file changed, 17 insertions(+), 10 deletions(-)
diff --git a/arch/mips/kernel/smp-bmips.c b/arch/mips/kernel/smp-bmips.c
index 359b176b665f..b6ef5f7312cf 100644
--- a/arch/mips/kernel/smp-bmips.c
+++ b/arch/mips/kernel/smp-bmips.c
@@ -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);
}
}
--
2.20.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2] mips: smp-bmips: fix CPU mappings
2021-02-24 7:33 ` [PATCH v2] " Álvaro Fernández Rojas
@ 2021-02-27 6:47 ` Álvaro Fernández Rojas
2021-03-01 12:33 ` Thomas Bogendoerfer
2021-03-01 14:50 ` Thomas Bogendoerfer
1 sibling, 1 reply; 7+ messages in thread
From: Álvaro Fernández Rojas @ 2021-02-27 6:47 UTC (permalink / raw)
To: Jonas Gorski, Florian Fainelli, Thomas Gleixner, Marc Zyngier,
bcm-kernel-feedback-list, linux-mips, linux-kernel
Hi all,
Apparently, this patch was flagged as "Not Applicable" without an explanation. Why?
https://patchwork.kernel.org/project/linux-mips/patch/20210224073336.32265-1-noltari@gmail.com/
Best regarss,
Álvaro.
> El 24 feb 2021, a las 8:33, Álvaro Fernández Rojas <noltari@gmail.com> escribió:
>
> 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): 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.
>
> Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
> v2: Fix duplicated line
>
> arch/mips/kernel/smp-bmips.c | 27 +++++++++++++++++----------
> 1 file changed, 17 insertions(+), 10 deletions(-)
>
> diff --git a/arch/mips/kernel/smp-bmips.c b/arch/mips/kernel/smp-bmips.c
> index 359b176b665f..b6ef5f7312cf 100644
> --- a/arch/mips/kernel/smp-bmips.c
> +++ b/arch/mips/kernel/smp-bmips.c
> @@ -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);
> }
> }
>
> --
> 2.20.1
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] mips: smp-bmips: fix CPU mappings
2021-02-27 6:47 ` Álvaro Fernández Rojas
@ 2021-03-01 12:33 ` Thomas Bogendoerfer
0 siblings, 0 replies; 7+ messages in thread
From: Thomas Bogendoerfer @ 2021-03-01 12:33 UTC (permalink / raw)
To: Álvaro Fernández Rojas
Cc: Jonas Gorski, Florian Fainelli, Thomas Gleixner, Marc Zyngier,
bcm-kernel-feedback-list, linux-mips, linux-kernel
On Sat, Feb 27, 2021 at 07:47:42AM +0100, Álvaro Fernández Rojas wrote:
> 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.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] mips: smp-bmips: fix CPU mappings
2021-02-24 7:33 ` [PATCH v2] " Álvaro Fernández Rojas
2021-02-27 6:47 ` Álvaro Fernández Rojas
@ 2021-03-01 14:50 ` Thomas Bogendoerfer
1 sibling, 0 replies; 7+ messages in thread
From: Thomas Bogendoerfer @ 2021-03-01 14:50 UTC (permalink / raw)
To: Álvaro Fernández Rojas
Cc: jonas.gorski, Florian Fainelli, Thomas Gleixner, Marc Zyngier,
bcm-kernel-feedback-list, linux-mips, linux-kernel
On Wed, Feb 24, 2021 at 08:33:36AM +0100, Álvaro Fernández Rojas wrote:
> 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): 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.
>
> Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
> v2: Fix duplicated line
>
> arch/mips/kernel/smp-bmips.c | 27 +++++++++++++++++----------
> 1 file changed, 17 insertions(+), 10 deletions(-)
applied to mips-next.
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-03-01 15:04 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-23 12:48 [PATCH] mips: smp-bmips: fix CPU mappings Álvaro Fernández Rojas
2021-02-24 3:45 ` Florian Fainelli
2021-02-24 7:07 ` Álvaro Fernández Rojas
2021-02-24 7:33 ` [PATCH v2] " Álvaro Fernández Rojas
2021-02-27 6:47 ` Álvaro Fernández Rojas
2021-03-01 12:33 ` Thomas Bogendoerfer
2021-03-01 14:50 ` Thomas Bogendoerfer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).