Hi Thomas, Marc,
This patch series aims at allowing the 3 interrupt controller drivers
used on Broadcom STB platforms to be built as modules in order for those
to be shipped in a GKI enabled system (Android).
The irq-bcm7038-l1 requires us to export a number of symbols, which is
not great, but there are not obvious solutions other than adding
accessor functions to get the same information.
Assuming you are happy with the changes though, please do take the last
two changes as well through your tree.
Thanks!
Changes in v2:
- avoid using irq_to_desc() and use irq_get_irq_data() instead
- re-order patches to avoid linking failure for irq-brcmstb-l2
- removed the use of .irq_cpu_offline() and converted BMIPS to use
irq_migrate_all_off_this_cpu()
- avoid exporting of_irq_count() and use a platform device passed
down from the irqchip platform driver registration code instead
- added kernel-doc fix
Florian Fainelli (12):
arch: Export cpu_logical_map to modules
MIPS: BMIPS: Remove use of irq_cpu_offline
irqchip/irq-bcm7038-l1: Remove .irq_cpu_offline()
irqchip/irq-bcm7038-l1: Use irq_get_irq_data()
irqchip/irq-bcm7038-l1: Switch to IRQCHIP_PLATFORM_DRIVER
genirq: Export irq_gc_{unmask_enable,mask_disable}_reg
irqchip/irq-brcmstb-l2: Switch to IRQCHIP_PLATFORM_DRIVER
irqchip: Provide platform_device to of_irq_init_cb_t
irqchip/irq-bcm7120-l2: Switch to IRQCHIP_PLATFORM_DRIVER
arm64: broadcom: Removed forced select of interrupt controllers
ARM: bcm: Removed forced select of interrupt controllers
irqchip: Fix kernel-doc parameter typo for IRQCHIP_DECLARE
arch/arm/kernel/setup.c | 1 +
arch/arm/mach-bcm/Kconfig | 4 ----
arch/arm64/Kconfig.platforms | 3 ---
arch/arm64/kernel/setup.c | 1 +
arch/mips/Kconfig | 1 +
arch/mips/kernel/smp-bmips.c | 3 ++-
arch/sh/kernel/smp.c | 1 +
drivers/irqchip/Kconfig | 12 +++++++---
drivers/irqchip/irq-bcm7038-l1.c | 38 +++++---------------------------
drivers/irqchip/irq-bcm7120-l2.c | 28 +++++++++++++----------
drivers/irqchip/irq-brcmstb-l2.c | 16 ++++++++------
drivers/irqchip/irqchip.c | 2 +-
drivers/of/irq.c | 2 +-
include/linux/irqchip.h | 2 +-
include/linux/of_irq.h | 5 ++++-
kernel/irq/generic-chip.c | 2 ++
16 files changed, 55 insertions(+), 66 deletions(-)
--
2.25.1
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.")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
arch/arm/kernel/setup.c | 1 +
arch/arm64/kernel/setup.c | 1 +
arch/sh/kernel/smp.c | 1 +
3 files changed, 3 insertions(+)
irq_cpu_offline() is only used by MIPS and we should instead use
irq_migrate_all_off_this_cpu(). This will be helpful in order to remove
drivers/irqchip/irq-bcm7038-l1.c irq_cpu_offline callback which would
have got in the way of making this driver modular.
Suggested-by: Thomas Gleixner <redacted>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
arch/mips/Kconfig | 1 +
arch/mips/kernel/smp-bmips.c | 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)
With arch/mips/kernel/smp-bmips.c having been migrated away from
irq_cpu_offline() and use irq_migrate_all_off_this_cpu() instead, we no
longer need to implement an .irq_cpu_offline() callback. This is a
necessary change to facilitate the building of this driver as a module.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/irqchip/irq-bcm7038-l1.c | 30 ------------------------------
1 file changed, 30 deletions(-)
@@ -221,33 +221,6 @@ static int bcm7038_l1_set_affinity(struct irq_data *d,return0;}-#ifdef CONFIG_SMP-staticvoidbcm7038_l1_cpu_offline(structirq_data*d)-{-structcpumask*mask=irq_data_get_affinity_mask(d);-intcpu=smp_processor_id();-cpumask_tnew_affinity;--/* This CPU was not on the affinity mask */-if(!cpumask_test_cpu(cpu,mask))-return;--if(cpumask_weight(mask)>1){-/*-*MultipleCPUaffinity,removethisCPUfromtheaffinity-*mask-*/-cpumask_copy(&new_affinity,mask);-cpumask_clear_cpu(cpu,&new_affinity);-}else{-/* Only CPU, put on the lowest online CPU */-cpumask_clear(&new_affinity);-cpumask_set_cpu(cpumask_first(cpu_online_mask),&new_affinity);-}-irq_set_affinity_locked(d,&new_affinity,false);-}-#endif-staticint__initbcm7038_l1_init_one(structdevice_node*dn,unsignedintidx,structbcm7038_l1_chip*intc)
Using irq_desc_get_irq_data(irq_to_desc()) to retrieve the irq_data
structure from a virtual interrupt number is going to be problematic to
make irq-bcm7038-l1 a module because irq_to_desc() is not exported, and
there is no intent to export it to modules, see 64a1b95bb9fe ("genirq:
Restrict export of irq_to_desc()").
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/irqchip/irq-bcm7038-l1.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Allow the user selection and building of this interrupt controller
driver as a module since it is used on ARM/ARM64 based systems as a
second level interrupt controller hanging off the ARM GIC and is
therefore loadable during boot.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/irqchip/Kconfig | 4 +++-
drivers/irqchip/irq-bcm7038-l1.c | 6 +++++-
2 files changed, 8 insertions(+), 2 deletions(-)
In order to allow drivers/irqchip/irq-brcmstb-l2.c to be built as a
module we need to export: irq_gc_unmask_enable_reg() and
irq_gc_mask_disable_reg().
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
kernel/irq/generic-chip.c | 2 ++
1 file changed, 2 insertions(+)
Allow the user selection and building of this interrupt controller
driver as a module since it is used on ARM/ARM64 based systems as a
second level interrupt controller hanging off the ARM GIC and is
therefore loadable during boot.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/irqchip/Kconfig | 4 +++-
drivers/irqchip/irq-brcmstb-l2.c | 16 +++++++++-------
2 files changed, 12 insertions(+), 8 deletions(-)
Provide the platform device mapping to the interrupt controller node to
the of_irq_init_cb_t callback such that drivers can make use of it.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/irqchip/irqchip.c | 2 +-
drivers/of/irq.c | 2 +-
include/linux/of_irq.h | 5 ++++-
3 files changed, 6 insertions(+), 3 deletions(-)
Allow the user selection and building of this interrupt controller
driver as a module since it is used on ARM/ARM64 based systems as a
second level interrupt controller hanging off the ARM GIC and is
therefore loadable during boot.
To avoid using of_irq_count() which is not exported towards module,
switch the driver to use the platform_device provided by the irqchip
platform driver code and resolve the number of interrupts using
platform_irq_count().
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/irqchip/Kconfig | 4 +++-
drivers/irqchip/irq-bcm7120-l2.c | 28 ++++++++++++++++------------
2 files changed, 19 insertions(+), 13 deletions(-)
@@ -214,6 +214,7 @@ static int __init bcm7120_l2_intc_iomap_3380(struct device_node *dn,staticint__initbcm7120_l2_intc_probe(structdevice_node*dn,structdevice_node*parent,+structplatform_device*pdev,int(*iomap_regs_fn)(structdevice_node*,structbcm7120_l2_intc_data*),constchar*intc_name)
@@ -230,7 +231,7 @@ static int __init bcm7120_l2_intc_probe(struct device_node *dn,if(!data)return-ENOMEM;-data->num_parent_irqs=of_irq_count(dn);+data->num_parent_irqs=platform_irq_count(pdev);if(data->num_parent_irqs<=0){pr_err("invalid number of parent interrupts\n");ret=-ENOMEM;
Now that the various second level interrupt controllers have been moved
to IRQCHIP_PLATFORM_DRIVER and they do default to ARCH_BRCMSTB and
ARCH_BCM2835 where relevant, remove their forced selection from the
machine entry to allow an user to build them as modules.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
arch/arm64/Kconfig.platforms | 3 ---
1 file changed, 3 deletions(-)
Now that the various second level interrupt controllers have been moved
to IRQCHIP_PLATFORM_DRIVER and they do default to ARCH_BRCMSTB and
ARCH_BCM2835 where relevant, remove their forced selection from the
machine entry to allow an user to build them as modules.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
arch/arm/mach-bcm/Kconfig | 4 ----
1 file changed, 4 deletions(-)
The documentation refers to "compstr" when we have the argument named
"compat", fix the typo.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
include/linux/irqchip.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Christoph Hellwig <hch@infradead.org> Date: 2021-09-28 05:09:54
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.
On Mon, Sep 27, 2021 at 07:27:04PM -0700, Florian Fainelli 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 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