Skip to contentSkip to conversation

irqchip/bcm-6345-l1: fix SMP support

PATCH In review Álvaro Fernández Rojas 2 participants 3 messages Feb 22, 2021 – Feb 23, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 irqchip/bcm-6345-l1: fix SMP support

Some BCM6358 devices start with Core #1 instead of Core #0. Apart from that, SMP is restricted to 1 CPU since BCM6358 has a shared TLB, which makes it impossible for the current SMP support to start both CPUs.

The problem is that smp_processor_id() returns 0 and then cpu_logical_map() converts that to 1, which accesses an uninitialized position of intc->cpus[], resulting in a kernel panic.

---
 drivers/irqchip/irq-bcm6345-l1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-bcm6345-l1.c +1 -1
index e3483789f4df..b2173ce4743d 100644
@@ -121,7 +121,7 @@ static void bcm6345_l1_irq_handle(struct irq_desc *desc)
 	unsigned int idx;
 
 #ifdef CONFIG_SMP
-	cpu = intc->cpus[cpu_logical_map(smp_processor_id())];
+	cpu = intc->cpus[smp_processor_id()];
 #else
 	cpu = intc->cpus[0];
 #endif
Signature · 1 line
2.20.1
#1 lore raw
Quoted 7 lines · Álvaro Fernández Rojas

Some BCM6358 devices start with Core #1 instead of Core #0. Apart from that, SMP is restricted to 1 CPU since BCM6358 has a shared TLB, which makes it impossible for the current SMP support to start both CPUs.

The problem is that smp_processor_id() returns 0 and then cpu_logical_map() converts that to 1, which accesses an uninitialized position of intc->cpus[], resulting in a kernel panic.

Sounds like you nee to correct the way the cpu_logical_map[] is populated then?

Signature · 1 line
Florian
#2 lore raw

Hi Florian,

Yes, you’re right, there seems to be a bug, because cpu_number_map() and cpu_logical_map() are returning the same when BCM6358 starts with CMT 1:

[    4.662896] bcm6345_l1_irq_handle: smp_id=0 cpu_logical=1 cpu_number=1

Let’s see if I can fix it…

Best regards,
Álvaro.

Quoted 17 lines · Florian Fainelli
Quoted 7 lines · Álvaro Fernández Rojas

Some BCM6358 devices start with Core #1 instead of Core #0. Apart from that, SMP is restricted to 1 CPU since BCM6358 has a shared TLB, which makes it impossible for the current SMP support to start both CPUs.

The problem is that smp_processor_id() returns 0 and then cpu_logical_map() converts that to 1, which accesses an uninitialized position of intc->cpus[], resulting in a kernel panic.

Sounds like you nee to correct the way the cpu_logical_map[] is populated then?

Signature · 1 line
Florian