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

From: Florian Fainelli
Date: Tue Sep 28 2021 - 12:30:38 EST


On 9/27/21 10:08 PM, Christoph Hellwig wrote:
> On Mon, Sep 27, 2021 at 07:27:04PM -0700, Florian Fainelli wrote:
>> 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 follows what MIPS has been doing since
>> 2dc2ae344e0e ("MIPS: Export __cpu_number_map and __cpu_logical_map.")
>
> This seems like a pretty bad idea. For one you should export an
> accessor instead of the data structure. And this probably should be an
> EXPORT_SYMBOL_GPL.

In hindsight, we should not need that change, and the use of
cpu_logical_map[] within drivers/irqchip/irq-bcm7038-l1.c should be
restricted to a MIPS build where the driver is a level 1 interrupt
controller and there are multiple per-cpu register copies.

In an ARM/ARM64 configuration that driver is always used as a second
level interrupt controller whereby it is hanging off the ARM GIC
interrupt controller, and the intc->cpus[] array will only be 1 element.
Fortunately since you cannot re-parent a L2 interrupt controller's
interrupt handler to a different CPU, "it just happens to work".

Thanks!
--
Florian