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!
Florian Fainelli (11):
arch: Export cpu_logical_map to modules
genirq: Export irq_to_desc() again to modules
genirq: Export irq_set_affinity_locked()
irqchip/irq-bcm7038-l1: Switch to IRQCHIP_PLATFORM_DRIVER
irqchip/irq-brcmstb-l2: Switch to IRQCHIP_PLATFORM_DRIVER
genirq: Export irq_gc_{unmask_enable,mask_disable}_reg
of/irq: Export of_irq_count to drivers
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
arch/arm/kernel/setup.c | 1 +
arch/arm/mach-bcm/Kconfig | 4 ----
arch/arm64/Kconfig.platforms | 3 ---
arch/arm64/kernel/setup.c | 1 +
arch/sh/kernel/smp.c | 1 +
drivers/irqchip/Kconfig | 12 +++++++++---
drivers/irqchip/irq-bcm7038-l1.c | 6 +++++-
drivers/irqchip/irq-bcm7120-l2.c | 11 ++++++-----
drivers/irqchip/irq-brcmstb-l2.c | 16 +++++++++-------
drivers/of/irq.c | 1 +
kernel/irq/generic-chip.c | 3 +++
kernel/irq/irqdesc.c | 2 --
kernel/irq/manage.c | 1 +
13 files changed, 37 insertions(+), 25 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.
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(+)
In order to build drivers/irqchip/irq-bcm7038-l1.c as a module (for use
in GKI), we need to export_to_desc() which is used in this snippet of
code:
irqd_set_single_target(irq_desc_get_irq_data(irq_to_desc(virq)));
This effectively reverts 64a1b95bb9fe ("genirq: Restrict export of
irq_to_desc()").
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
kernel/irq/irqdesc.c | 2 --
1 file changed, 2 deletions(-)
In order to build drivers/irqchip/irq-bcm7120-l2.c as a module, we will
need to have of_irq_count() exported to modules.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/of/irq.c | 1 +
1 file changed, 1 insertion(+)
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(+)
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.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/irqchip/Kconfig | 4 +++-
drivers/irqchip/irq-bcm7120-l2.c | 11 ++++++-----
2 files changed, 9 insertions(+), 6 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(-)
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(-)
irq-bcm7038-l1 uses that symbol and we want to make it a loadable module
in subsequent changes.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
kernel/irq/manage.c | 1 +
1 file changed, 1 insertion(+)
irq-bcm7038-l1 uses that symbol and we want to make it a loadable module
in subsequent changes.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
kernel/irq/manage.c | 1 +
1 file changed, 1 insertion(+)
This doesn't seem right.
This driver seem to try and move interrupts on its own when the CPU
goes down. Why can't it rely on the normal CPU hotplug infrastructure
to do so like all the other drivers (bar some Cavium driver that does
the same thing)?
I'd rather you take this opportunity to move these drivers into the
21st century, so that we can kill irq_cpu_offline() and co altogether.
Thanks,
M.
--
Without deviation from the norm, progress is not possible.
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(-)
How does the user know about that? People will build a kernel
selecting their platform, and find out it doesn't work. This seems
terribly counter-productive to me.
M.
--
Without deviation from the norm, progress is not possible.
On Sat, Sep 25, 2021 at 2:10 PM Marc Zyngier [off-list ref] wrote:
On Fri, 24 Sep 2021 18:05:45 +0100, Florian Fainelli [off-list ref] wrote:
How does the user know about that? People will build a kernel
selecting their platform, and find out it doesn't work. This seems
terribly counter-productive to me.
It's default-enabled on the platforms that need it, see one of the
earlier patches.
Having the option to make it a loadable module is a definite benefit as
far as I'm concerned, and I generally like the idea of having individually
selectable symbols for consistency as that is what we have in other
subsystems as well.
Ideally I'd do away with all the 'select' statements for the platforms and
only have them control dependencies as we do for most other subsystems.
irqchip is one of the few exceptions here, though I understand the reason
for having the most important drivers tied to the platform more closely.
Arnd
From: Thomas Gleixner <hidden> Date: 2021-09-25 21:00:10
On Fri, Sep 24 2021 at 10:05, Florian Fainelli wrote:
In order to build drivers/irqchip/irq-bcm7038-l1.c as a module (for use
in GKI), we need to export_to_desc() which is used in this snippet of
code:
irqd_set_single_target(irq_desc_get_irq_data(irq_to_desc(virq)));
This effectively reverts 64a1b95bb9fe ("genirq: Restrict export of
irq_to_desc()").
No. I'm not reexporting this. We've spent quite some time to prevent all
kind of drivers for fiddle with irq descriptors and I'm not going
to reopen that can of worms.
irq_get_irq_data() is exported and provides you what you need.
Thanks,
tglx
This doesn't seem right.
This driver seem to try and move interrupts on its own when the CPU
goes down. Why can't it rely on the normal CPU hotplug infrastructure
to do so like all the other drivers (bar some Cavium driver that does
the same thing)?
I'd rather you take this opportunity to move these drivers into the
21st century, so that we can kill irq_cpu_offline() and co altogether.
I wanted to kill these callbacks years ago. Cavium has two variants of
those offline/online callbacks:
1) octeon_irq_cpu_offline_ciu() which is doing the same as that BCM
driver. These really can go away. Just remove the callback and
everything just works.
2) Two other variants to fiddle with chip internals, but those chips do
not have an irq_affinity() callback which makes it more interesting.
I don't see a proper way to solve that except for removing Cavium
alltogether, but once the BCM one is gone, we just can make this
muck depend on CAVIUM and be done with it. And I mean depend and not
select.
Thanks,
tglx
This doesn't seem right.
This driver seem to try and move interrupts on its own when the CPU
goes down. Why can't it rely on the normal CPU hotplug infrastructure
to do so like all the other drivers (bar some Cavium driver that does
the same thing)?
I'd rather you take this opportunity to move these drivers into the
21st century, so that we can kill irq_cpu_offline() and co altogether.
I wanted to kill these callbacks years ago. Cavium has two variants of
those offline/online callbacks:
1) octeon_irq_cpu_offline_ciu() which is doing the same as that BCM
driver. These really can go away. Just remove the callback and
everything just works.
For BCM this works today when that chip is used on ARM[64] simply
because the only architecture which invokes irq_cpu_offline() is MIPS.
Thanks,
tglx
On Fri, Sep 24 2021 at 10:05, Florian Fainelli wrote:
quoted
In order to build drivers/irqchip/irq-bcm7038-l1.c as a module (for use
in GKI), we need to export_to_desc() which is used in this snippet of
code:
irqd_set_single_target(irq_desc_get_irq_data(irq_to_desc(virq)));
This effectively reverts 64a1b95bb9fe ("genirq: Restrict export of
irq_to_desc()").
No. I'm not reexporting this. We've spent quite some time to prevent all
kind of drivers for fiddle with irq descriptors and I'm not going
to reopen that can of worms.
irq_get_irq_data() is exported and provides you what you need.
That is exactly what I was looking for and somehow missed it during my
search the other day, thanks!
--
Florian
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().
Note to self: this needs to come before patch 5 to avoid a modular build
linking failure.
--
Florian
This doesn't seem right.
This driver seem to try and move interrupts on its own when the CPU
goes down. Why can't it rely on the normal CPU hotplug infrastructure
to do so like all the other drivers (bar some Cavium driver that does
the same thing)?
I'd rather you take this opportunity to move these drivers into the
21st century, so that we can kill irq_cpu_offline() and co altogether.
I wanted to kill these callbacks years ago. Cavium has two variants of
those offline/online callbacks:
1) octeon_irq_cpu_offline_ciu() which is doing the same as that BCM
driver. These really can go away. Just remove the callback and
everything just works.
For BCM this works today when that chip is used on ARM[64] simply
because the only architecture which invokes irq_cpu_offline() is MIPS.
That is correct. How would you recommend addressing that? In premise
when this driver is used on ARM[64] it is used as a second level
interrupt controller hanging off the ARM GIC (or another ARM CPU
interrupt controller), so in that case I suppose I could make the
irq_set_cpu_offline be dependent upon CONFIG_SMP and CONFIG_MIPS, would
that be acceptable?
--
Florian
From: Thomas Gleixner <hidden> Date: 2021-09-27 18:18:41
On Mon, Sep 27 2021 at 10:47, Florian Fainelli wrote:
On 9/25/21 2:37 PM, Thomas Gleixner wrote:
quoted
quoted
I wanted to kill these callbacks years ago. Cavium has two variants of
those offline/online callbacks:
1) octeon_irq_cpu_offline_ciu() which is doing the same as that BCM
driver. These really can go away. Just remove the callback and
everything just works.
For BCM this works today when that chip is used on ARM[64] simply
because the only architecture which invokes irq_cpu_offline() is MIPS.
That is correct. How would you recommend addressing that? In premise
when this driver is used on ARM[64] it is used as a second level
interrupt controller hanging off the ARM GIC (or another ARM CPU
interrupt controller), so in that case I suppose I could make the
irq_set_cpu_offline be dependent upon CONFIG_SMP and CONFIG_MIPS, would
that be acceptable?
Why? Just get rid of the callback in that driver and ensure that
irq_migrate_all_off_this_cpu() is invoked when the CPU dies.
arch/mips/kernel/smp-cps.c already does that, but I don't know whether
your MIPS platform uses those SMP ops. If not you surely have a template
there.
Thanks,
tglx
On Mon, Sep 27 2021 at 10:47, Florian Fainelli wrote:
quoted
On 9/25/21 2:37 PM, Thomas Gleixner wrote:
quoted
quoted
I wanted to kill these callbacks years ago. Cavium has two variants of
those offline/online callbacks:
1) octeon_irq_cpu_offline_ciu() which is doing the same as that BCM
driver. These really can go away. Just remove the callback and
everything just works.
For BCM this works today when that chip is used on ARM[64] simply
because the only architecture which invokes irq_cpu_offline() is MIPS.
That is correct. How would you recommend addressing that? In premise
when this driver is used on ARM[64] it is used as a second level
interrupt controller hanging off the ARM GIC (or another ARM CPU
interrupt controller), so in that case I suppose I could make the
irq_set_cpu_offline be dependent upon CONFIG_SMP and CONFIG_MIPS, would
that be acceptable?
Why? Just get rid of the callback in that driver and ensure that
irq_migrate_all_off_this_cpu() is invoked when the CPU dies.
arch/mips/kernel/smp-cps.c already does that, but I don't know whether
your MIPS platform uses those SMP ops. If not you surely have a template
there.
We use arch/mips/kernel/smp-bmips.c but I do see the path forward, thanks!
--
--
Florian
From: Rob Herring <robh+dt@kernel.org> Date: 2021-09-27 19:08:48
On Fri, Sep 24, 2021 at 12:07 PM Florian Fainelli [off-list ref] wrote:
quoted hunk
In order to build drivers/irqchip/irq-bcm7120-l2.c as a module, we will
need to have of_irq_count() exported to modules.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/of/irq.c | 1 +
1 file changed, 1 insertion(+)
On Fri, Sep 24, 2021 at 12:07 PM Florian Fainelli [off-list ref] wrote:
quoted
In order to build drivers/irqchip/irq-bcm7120-l2.c as a module, we will
need to have of_irq_count() exported to modules.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/of/irq.c | 1 +
1 file changed, 1 insertion(+)
@@ -440,6 +440,7 @@ int of_irq_count(struct device_node *dev)returnnr;}+EXPORT_SYMBOL_GPL(of_irq_count);
Please convert to use platform_irq_count() instead.
That requires a platform_device to be passed to platform_irq_count(),
will that work even when the drivers remain built into the kernel and
get initialized early on?
--
Florian
From: Rob Herring <robh+dt@kernel.org> Date: 2021-09-27 19:32:28
On Fri, Sep 24, 2021 at 12:06 PM Florian Fainelli [off-list ref] 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 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.
Rob
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
From: Rob Herring <robh+dt@kernel.org> Date: 2021-09-27 19:44:03
On Mon, Sep 27, 2021 at 2:28 PM Florian Fainelli [off-list ref] wrote:
On 9/27/21 12:08 PM, Rob Herring wrote:
quoted
On Fri, Sep 24, 2021 at 12:07 PM Florian Fainelli [off-list ref] wrote:
quoted
In order to build drivers/irqchip/irq-bcm7120-l2.c as a module, we will
need to have of_irq_count() exported to modules.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/of/irq.c | 1 +
1 file changed, 1 insertion(+)
@@ -440,6 +440,7 @@ int of_irq_count(struct device_node *dev)returnnr;}+EXPORT_SYMBOL_GPL(of_irq_count);
Please convert to use platform_irq_count() instead.
That requires a platform_device to be passed to platform_irq_count(),
will that work even when the drivers remain built into the kernel and
get initialized early on?
No, does your irqchip using this do both? Looks to me like it is
always a platform_device.
Rob
On Mon, Sep 27, 2021 at 2:28 PM Florian Fainelli [off-list ref] wrote:
quoted
On 9/27/21 12:08 PM, Rob Herring wrote:
quoted
On Fri, Sep 24, 2021 at 12:07 PM Florian Fainelli [off-list ref] wrote:
quoted
In order to build drivers/irqchip/irq-bcm7120-l2.c as a module, we will
need to have of_irq_count() exported to modules.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/of/irq.c | 1 +
1 file changed, 1 insertion(+)
@@ -440,6 +440,7 @@ int of_irq_count(struct device_node *dev)returnnr;}+EXPORT_SYMBOL_GPL(of_irq_count);
Please convert to use platform_irq_count() instead.
That requires a platform_device to be passed to platform_irq_count(),
will that work even when the drivers remain built into the kernel and
get initialized early on?
No, does your irqchip using this do both? Looks to me like it is
always a platform_device.
On ARM/ARM64 not using GKI as well as MIPS, we would want the module to
be built into the kernel image, however when using GKI that driver would
become a module. How do you suggest reconciling both usages?
--
Florian
From: Rob Herring <robh+dt@kernel.org> Date: 2021-09-27 20:09:26
On Mon, Sep 27, 2021 at 2:49 PM Florian Fainelli [off-list ref] wrote:
On 9/27/21 12:43 PM, Rob Herring wrote:
quoted
On Mon, Sep 27, 2021 at 2:28 PM Florian Fainelli [off-list ref] wrote:
quoted
On 9/27/21 12:08 PM, Rob Herring wrote:
quoted
On Fri, Sep 24, 2021 at 12:07 PM Florian Fainelli [off-list ref] wrote:
quoted
In order to build drivers/irqchip/irq-bcm7120-l2.c as a module, we will
need to have of_irq_count() exported to modules.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/of/irq.c | 1 +
1 file changed, 1 insertion(+)
@@ -440,6 +440,7 @@ int of_irq_count(struct device_node *dev)returnnr;}+EXPORT_SYMBOL_GPL(of_irq_count);
Please convert to use platform_irq_count() instead.
That requires a platform_device to be passed to platform_irq_count(),
will that work even when the drivers remain built into the kernel and
get initialized early on?
No, does your irqchip using this do both? Looks to me like it is
always a platform_device.
On ARM/ARM64 not using GKI as well as MIPS, we would want the module to
be built into the kernel image, however when using GKI that driver would
become a module. How do you suggest reconciling both usages?
What's there to resolve? Every driver that works as a module can be
built-in. Is there something special about irqchip drivers?
The only issue I see here is platform_irqchip_probe() doesn't pass the
platform_device pointer to the irq_init_cb function. There's 3 ways to
fix that. Add a platform_device pointer to the init hook. That's a
global change though. That's the right thing to do IMO. Or you can use
of_find_device_by_node(). That's fairly expensive, but easy and
isolated. You could also set device_node.data pointer to the
platform_device, but ideally I'd like to get rid of that pointer as
it's hardly used.
Rob
On Mon, Sep 27, 2021 at 2:28 PM Florian Fainelli [off-list ref] wrote:
quoted
On 9/27/21 12:08 PM, Rob Herring wrote:
quoted
On Fri, Sep 24, 2021 at 12:07 PM Florian Fainelli [off-list ref] wrote:
quoted
In order to build drivers/irqchip/irq-bcm7120-l2.c as a module, we will
need to have of_irq_count() exported to modules.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/of/irq.c | 1 +
1 file changed, 1 insertion(+)
@@ -440,6 +440,7 @@ int of_irq_count(struct device_node *dev)returnnr;}+EXPORT_SYMBOL_GPL(of_irq_count);
Please convert to use platform_irq_count() instead.
That requires a platform_device to be passed to platform_irq_count(),
will that work even when the drivers remain built into the kernel and
get initialized early on?
No, does your irqchip using this do both? Looks to me like it is
always a platform_device.
On ARM/ARM64 not using GKI as well as MIPS, we would want the module to
be built into the kernel image, however when using GKI that driver would
become a module. How do you suggest reconciling both usages?
I don't see what GKI has to do with anything. Either the driver can be
built as a module (and it is in this case a platform device at all
times, built-in or not), or it cannot, and it falls into the
IRQCHIP_DECLARE() category (and there is no export problem).
Pick your poison!
Thanks,
M.
--
Without deviation from the norm, progress is not possible.