Thread (31 messages) 31 messages, 5 authors, 2021-09-28

Re: [PATCH 01/11] arch: Export cpu_logical_map to modules

From: Florian Fainelli <f.fainelli@gmail.com>
Date: 2021-09-27 19:43:54
Also in: linux-arm-kernel, linux-mips, linux-sh, lkml

On 9/27/21 12:32 PM, Rob Herring wrote:
On Fri, Sep 24, 2021 at 12:06 PM Florian Fainelli [off-list ref] wrote:
quoted
In order to allow drivers/irqchip/irq-bcm7038-l1.c to be built as a
module and usable in GKI, export cpu_logical_map or __cpu_logical_map
towards the modules.
This is the usage:

#ifdef CONFIG_SMP
        cpu = intc->cpus[cpu_logical_map(smp_processor_id())];
#else
        cpu = intc->cpus[0];
#endif

This is totally broken! cpu_logical_map() takes the logical cpu
number, 0-N, and returns the MPIDR which you then use as an array
index.
There is no MPIDR on MIPS, which is where this code is being primarily
used as-is. On ARM/ARM64 the driver is used as a second level interrupt
controller with only a single "bank" of registers as opposed to one
per-CPU, meaning that we would always use intc->cpus[0] because you
cannot change the interrupt affinity of a second level interrupt
controller AFAICT. Maybe the above deserves to be made CONFIG_SMP &&
CONFIG_MIPS somehow.
-- 
Florian
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help