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 v3:
- avoid the use of the cpu_logical_map array for platforms other than
MIPS
- removed the bogus irq_set_affinity callback for platforms other than
MIPS
- bring-back the export of irq_gc_noop() lost in the v2
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 (14):
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: Gate use of CPU logical map to MIPS
irqchip/irq-bcm7038-l1: Restrict affinity setting to MIPS
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
genirq: Export irq_gc_noop()
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/mach-bcm/Kconfig | 4 ---
arch/arm64/Kconfig.platforms | 3 --
arch/mips/Kconfig | 1 +
arch/mips/kernel/smp-bmips.c | 3 +-
drivers/irqchip/Kconfig | 12 ++++++--
drivers/irqchip/irq-bcm7038-l1.c | 47 ++++++++------------------------
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 | 3 ++
13 files changed, 58 insertions(+), 70 deletions(-)
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
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(-)
The use of the cpu_logical_map[] array is only relevant for MIPS based
platform where this driver is used as a first level interrupt controller
and contains multiple register groups to map with an associated CPU.
On ARM/ARM64 based systems this interrupt controller is present and used
as a second level interrupt controller hanging off the ARM GIC. That
copy of the interrupt controller contains a single group, resulting in
the intc->cpus[] array to be of size 1.
Things happened to work in that case because we install that interrupt
controller as a chained handler which does not allow it to be affine to
any CPU but the boot CPU which happens to be 0, therefore we never
de-reference past intc->cpus[] but with the current code in place, we do
leave a chance of de-referencing the array past its bounds.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/irqchip/irq-bcm7038-l1.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
@@ -301,7 +298,7 @@ static int bcm7038_l1_suspend(void)u32val;/* Wakeup interrupt should only come from the boot cpu */-#ifdef CONFIG_SMP+#if defined(CONFIG_SMP) && defined(CONFIG_MIPS)boot_cpu=cpu_logical_map(0);#elseboot_cpu=0;
Only MIPS based platforms using this interrupt controller as first level
interrupt controller can actually change the affinity of interrupts by
re-programming the affinity mask of the interrupt controller and use
another word group to have another CPU process the interrupt.
When this interrupt is used as a second level interrupt controller on
ARM/ARM64 there is no way to change the interrupt affinity. This fixes a
NULL pointer de-reference while trying to change the affinity since
there is only a single word group in that case, and we would have been
overruning the intc->cpus[] array.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/irqchip/irq-bcm7038-l1.c | 4 ++++
1 file changed, 4 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-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(-)
In order to build drivers/irqchip/irq-bcm7120-l2.c as a module which
references irq_gc_noop(), we need to export it towards modules.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
kernel/irq/generic-chip.c | 1 +
1 file changed, 1 insertion(+)
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(-)
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(-)
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(-)
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(-)
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;
From: Rob Herring <robh+dt@kernel.org> Date: 2021-09-28 19:36:20
On Tue, Sep 28, 2021 at 1:22 PM Florian Fainelli [off-list ref] wrote:
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(-)
Less invasive than I thought as we lose any function typing. Maybe at
least the one platform driver, drivers/irqchip/qcom-pdc.c, should have
its function parameters updated.
Reviewed-by: Rob Herring <robh@kernel.org>
From: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Date: 2021-10-03 16:09:42
On Tue, Sep 28, 2021 at 11:21:26AM -0700, Florian Fainelli wrote:
quoted hunk
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(-)
@@ -373,7 +374,7 @@ static int bmips_cpu_disable(void)set_cpu_online(cpu,false);calculate_cpu_foreign_map();-irq_cpu_offline();+irq_migrate_all_off_this_cpu();clear_c0_status(IE_IRQ5);local_flush_tlb_all();
Acked-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
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!
I will be re-submitting a v4 with the Acked-by from Thomas on patch 1,
and the Reviewed-by from Rob on patch 9 along with the update he
proposed to the qcom-pdc driver. Finally, I will take Sergey's update as
well on patch 14.
--
Florian
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel