Initial support for the Realtek interrupt controller
Subsystems (2)
cover Initial support for the Realtek interrupt controller
Introduce an interrupt controller driver for Realtek DHC (Digital Home Center) SoCs.
James Tai (6):
dt-bindings: interrupt-controller: Add support for Realtek DHC SoCs
irqchip: Add interrupt controller support for Realtek DHC SoCs
irqchip: Introduce RTD1319 support using the Realtek Common Interrupt
Controller Driver
irqchip: Introduce RTD1319D support using the Realtek Common Interrupt
Controller Driver
irqchip: Introduce RTD1325 support using the Realtek Common Interrupt
Controller Driver
irqchip: Introduce RTD1619B support using the Realtek Common Interrupt
Controller Driver
.../interrupt-controller/realtek,intc.yaml | 146 +++++++++++ drivers/irqchip/Kconfig | 28 +++ drivers/irqchip/Makefile | 5 + drivers/irqchip/irq-realtek-intc-common.c | 232 ++++++++++++++++++ drivers/irqchip/irq-realtek-intc-common.h | 75 ++++++ drivers/irqchip/irq-realtek-rtd1319.c | 204 +++++++++++++++ drivers/irqchip/irq-realtek-rtd1319d.c | 211 ++++++++++++++++ drivers/irqchip/irq-realtek-rtd1325.c | 214 ++++++++++++++++ drivers/irqchip/irq-realtek-rtd1619b.c | 201 +++++++++++++++ 9 files changed, 1316 insertions(+) create mode 100644 Documentation/devicetree/bindings/interrupt-controller/realtek,intc.yaml create mode 100644 drivers/irqchip/irq-realtek-intc-common.c create mode 100644 drivers/irqchip/irq-realtek-intc-common.h create mode 100644 drivers/irqchip/irq-realtek-rtd1319.c create mode 100644 drivers/irqchip/irq-realtek-rtd1319d.c create mode 100644 drivers/irqchip/irq-realtek-rtd1325.c create mode 100644 drivers/irqchip/irq-realtek-rtd1619b.c
Signature · 1 line
2.25.1
PATCH 1/6 dt-bindings: interrupt-controller: Add support for Realtek DHC SoCs
Add the YAML documentation for Realtek DHC SoCs.
--- .../interrupt-controller/realtek,intc.yaml | 146 ++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 Documentation/devicetree/bindings/interrupt-controller/realtek,intc.yaml
Documentation/devicetree/bindings/interrupt-controller/realtek,intc.yaml new file +146 -0
@@ -0,0 +1,146 @@ +# SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/interrupt-controller/realtek,intc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Realtek DHC SoCs Interrupt Controller Device Tree Bindings + +description: + This interrupt controller is a component of Realtek DHC SoCs and + is designed to receive interrupts from peripheral devices. + + Each DHC SoC has two sets of interrupt controllers, each capable of + handling up to 32 interrupts. + +maintainers: + - James Tai <[email protected]> + +allOf: + - $ref: /schemas/interrupt-controller.yaml# + +properties: + "#interrupt-cells": + const: 1 + + compatible: + enum: + - realtek,rtd1319-intc-iso + - realtek,rtd1319-intc-misc + - realtek,rtd1319d-intc-iso + - realtek,rtd1319d-intc-misc + - realtek,rtd1325-intc-iso + - realtek,rtd1325-intc-misc + - realtek,rtd1619b-intc-iso + - realtek,rtd1619b-intc-misc + + "#address-cells": + const: 0 + + interrupt-controller: true + + interrupts-extended: + minItems: 1 + + reg: + maxItems: 1 + +required: + - "#interrupt-cells" + - "#address-cells" + - compatible + - interrupt-controller + - interrupts-extended + - reg + +additionalProperties: false + +examples: + - | + iso_irq_mux: iso_irq_mux@40 { + compatible = "realtek,rtd1319-intc-iso"; + reg = <0x00 0x40>; + interrupts-extended = <&gic GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>, + <&gic GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>; + interrupt-controller; + #address-cells = <0>; + #interrupt-cells = <1>; + }; + + misc_irq_mux: misc_irq_mux@80 { + compatible = "realtek,rtd1319-intc-misc"; + reg = <0x00 0x80>; + interrupts-extended = <&gic GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>, + <&gic GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>, + <&gic GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>, + <&gic GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>; + interrupt-controller; + #address-cells = <0>; + #interrupt-cells = <1>; + }; + + iso_irq_mux: iso_irq_mux@40 { + compatible = "realtek,rtd1319d-intc-iso"; + reg = <0x00 0x40>; + interrupts-extended = <&gic GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>, + <&gic GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>; + interrupt-controller; + #address-cells = <0>; + #interrupt-cells = <1>; + }; + + misc_irq_mux: misc_irq_mux@80 { + compatible = "realtek,rtd1319d-intc-misc"; + reg = <0x00 0x80>; + interrupts-extended = <&gic GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>, + <&gic GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>, + <&gic GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>, + <&gic GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>; + interrupt-controller; + #address-cells = <0>; + #interrupt-cells = <1>; + }; + + iso_irq_mux: iso_irq_mux@40 { + compatible = "realtek,rtd1325-intc-iso"; + reg = <0x00 0x40>; + interrupts-extended = <&gic GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>, + <&gic GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>; + interrupt-controller; + #address-cells = <0>; + #interrupt-cells = <1>; + }; + + misc_irq_mux: misc_irq_mux@80 { + compatible = "realtek,rtd1325-intc-misc"; + reg = <0x00 0x80>; + interrupts-extended = <&gic GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>, + <&gic GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>, + <&gic GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>, + <&gic GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>; + interrupt-controller; + #address-cells = <0>; + #interrupt-cells = <1>; + }; + + iso_irq_mux: iso_irq_mux@40 { + compatible = "realtek,rtd1619b-intc-iso"; + reg = <0x00 0x40>; + interrupts-extended = <&gic GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>, + <&gic GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>; + interrupt-controller; + #address-cells = <0>; + #interrupt-cells = <1>; + }; + + misc_irq_mux: misc_irq_mux@80 { + compatible = "realtek,rtd1619b-intc-misc"; + reg = <0x00 0x80>; + interrupts-extended = <&gic GIC_SPI 40 IRQ_TYPE_LEVEL_HIGH>, + <&gic GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>, + <&gic GIC_SPI 90 IRQ_TYPE_LEVEL_HIGH>, + interrupt-controller; + #address-cells = <0>; + #interrupt-cells = <1>; + }; +...
Signature · 1 line
2.25.1
Re: [PATCH 1/6] dt-bindings: interrupt-controller: Add support for Realtek DHC SoCs
Quoted 3 lines · James Tai
Add the YAML documentation for Realtek DHC SoCs.
Change-Id: Ia619582e34fef6b2dbd5f98ba3f5edf70cf11dbf
Please run scripts/checkpatch.pl and fix reported warnings. Some warnings can be ignored, but the code here looks like it needs a fix. Feel free to get in touch if the warning is not clear.
Quoted 1 line
Signed-off-by James Tai <[email protected]>
Please use scripts/get_maintainers.pl to get a list of necessary people and lists to CC. It might happen, that command when run on an older kernel, gives you outdated entries. Therefore please be sure you base your patches on recent Linux kernel.
You missed at least devicetree list (maybe more), so this won't be tested by automated tooling. Performing review on untested code might be a waste of time, thus I will skip this patch entirely till you follow the process allowing the patch to be tested.
Please kindly resend and include all necessary To/Cc entries.
Quoted 11 lines
--- .../interrupt-controller/realtek,intc.yaml | 146 ++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 Documentation/devicetree/bindings/interrupt-controller/realtek,intc.yamlDocumentation/devicetree/bindings/interrupt-controller/realtek,intc.yaml new file +0
-0
Documentation/devicetree/bindings/interrupt-controller/realtek,intc.yaml line 7
Quoted 7 lines
Documentation/devicetree/bindings/interrupt-controller/realtek,intc.yaml new file +7
-0@@ -0,0 +1,146 @@ +# SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/interrupt-controller/realtek,intc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Realtek DHC SoCs Interrupt Controller Device Tree Bindings
It does not look like you tested the bindings, at least after quick look. Please run make dt_binding_check (see Documentation/devicetree/bindings/writing-schema.rst for instructions). Maybe you need to update your dtschema and yamllint.
Best regards,
Krzysztof
RE: [PATCH 1/6] dt-bindings: interrupt-controller: Add support for Realtek DHC SoCs
Hi Krzysztof,
Quoted 5 lines
Please run
scripts/checkpatch.pland fix reported warnings. Some warnings can be ignored, but the code here looks like it needs a fix.
Feel free to get in touch if the warning is not clear.
I will run checkpatch.pl to address and fix the reported warnings.
Quoted 11 lines
Please use
scripts/get_maintainers.plto get a list of necessary people and lists to CC. It might happen, that command when run on an older kernel, gives you outdated entries. Therefore please be sure you base your patches on recent Linux kernel.You missed at least devicetree list (maybe more), so this won't be tested by automated tooling. Performing review on untested code might be a waste of time, thus I will skip this patch entirely till you follow the process allowing the patch to be tested.
Please kindly resend and include all necessary To/Cc entries.
I will fix it in the next patches.
Quoted 6 lines
It does not look like you tested the bindings, at least after quick look. Please run
make dt_binding_check(seeDocumentation/devicetree/bindings/writing-schema.rstfor instructions). Maybe you need to update your dtschema and yamllint.
I will test the bindings using 'make dt_binding_check'.
Thank you for your feedback.
Regards,
James
Re: [PATCH 1/6] dt-bindings: interrupt-controller: Add support for Realtek DHC SoCs
Quoted 25 lines · James Tai [戴志峰]
Hi Krzysztof,
Quoted 5 lines
Please run
scripts/checkpatch.pland fix reported warnings. Some warnings can be ignored, but the code here looks like it needs a fix.
Feel free to get in touch if the warning is not clear.I will run checkpatch.pl to address and fix the reported warnings.
Quoted 11 lines
Please use
scripts/get_maintainers.plto get a list of necessary people and lists to CC. It might happen, that command when run on an older kernel, gives you outdated entries. Therefore please be sure you base your patches on recent Linux kernel.You missed at least devicetree list (maybe more), so this won't be tested by automated tooling. Performing review on untested code might be a waste of time, thus I will skip this patch entirely till you follow the process allowing the patch to be tested.
Please kindly resend and include all necessary To/Cc entries.
I will fix it in the next patches.
Quoted 1 line
Quoted 6 lines
Quoted 5 lines
It does not look like you tested the bindings, at least after quick look. Please run
make dt_binding_check(seeDocumentation/devicetree/bindings/writing-schema.rstfor instructions). Maybe you need to update your dtschema and yamllint.I will test the bindings using 'make
dt_binding_check'.
Please do all above before submitting patches.
Best regards,
Krzysztof
PATCH 2/6 irqchip: Add interrupt controller support for Realtek DHC SoCs
In reply to James TaiRealtek DHC (Digital Home Center) SoCs share a common interrupt controller design. This universal interrupt controller driver provides support for various variants within the Realtek DHC SoC family.
Each DHC SoC features two sets of extended interrupt controllers, each capable of handling up to 32 interrupts. These expansion controllers are connected to the GIC (Generic Interrupt Controller).
--- drivers/irqchip/Kconfig | 4 + drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-realtek-intc-common.c | 232 ++++++++++++++++++++++ drivers/irqchip/irq-realtek-intc-common.h | 75 +++++++ 4 files changed, 312 insertions(+) create mode 100644 drivers/irqchip/irq-realtek-intc-common.c create mode 100644 drivers/irqchip/irq-realtek-intc-common.h
drivers/irqchip/Kconfig +4 -0
@@ -218,6 +218,10 @@ config RDA_INTC bool select IRQ_DOMAIN +config REALTEK_DHC_INTC + tristate + select IRQ_DOMAIN + config RENESAS_INTC_IRQPIN bool "Renesas INTC External IRQ Pin Support" if COMPILE_TEST select IRQ_DOMAIN
drivers/irqchip/Makefile +1 -0
@@ -47,6 +47,7 @@ obj-$(CONFIG_IRQ_MIPS_CPU) += irq-mips-cpu.o obj-$(CONFIG_IXP4XX_IRQ) += irq-ixp4xx.o obj-$(CONFIG_JCORE_AIC) += irq-jcore-aic.o obj-$(CONFIG_RDA_INTC) += irq-rda-intc.o +obj-$(CONFIG_REALTEK_DHC_INTC) += irq-realtek-intc-common.o obj-$(CONFIG_RENESAS_INTC_IRQPIN) += irq-renesas-intc-irqpin.o obj-$(CONFIG_RENESAS_IRQC) += irq-renesas-irqc.o obj-$(CONFIG_RENESAS_RZA1_IRQC) += irq-renesas-rza1.o
drivers/irqchip/irq-realtek-intc-common.c new file +232 -0
232 lines not on this page · raw message
drivers/irqchip/irq-realtek-intc-common.h new file +75 -0
75 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [PATCH 2/6] irqchip: Add interrupt controller support for Realtek DHC SoCs
Quoted 10 lines · James Tai
Realtek DHC (Digital Home Center) SoCs share a common interrupt controller design. This universal interrupt controller driver provides support for various variants within the Realtek DHC SoC family.
Each DHC SoC features two sets of extended interrupt controllers, each capable of handling up to 32 interrupts. These expansion controllers are connected to the GIC (Generic Interrupt Controller).
Signed-off-by James Tai <[email protected]>Change-Id I1e711c70414c97c2c8497bd4ac9e8bbd964225c3
Please remove these internal change ids. They are not useful for anyone outside realtek.
drivers/irqchip/Kconfig config RDA_INTC
Quoted 7 lines
drivers/irqchip/Kconfig +5
-0+config REALTEK_DHC_INTC + tristate + select IRQ_DOMAIN + +static unsigned int realtek_intc_get_ints(struct realtek_intc_data *data)
static inline perhaps?
drivers/irqchip/irq-realtek-intc-common.c line 31
Quoted 13 lines
drivers/irqchip/irq-realtek-intc-common.c new file +13
-0+{ +return readl (data->base + data->info->isr_offset); +} + +static void realtek_intc_clear_ints_bit (struct realtek_intc_data *data,int bit) +{ +writel (BIT (bit) & ~1 , data->base + data->info->isr_offset); +} + +static unsigned int realtek_intc_get_inte (struct realtek_intc_data *data) +{ +unsigned int val; +unsigned long flags;
unsigned long flags; unsigned int val;
https://www.kernel.org/doc/html/latest/process/maintainer-tip.html
Please fix the variable declarations all over the place.
drivers/irqchip/irq-realtek-intc-common.c line 33
Quoted 1 line
drivers/irqchip/irq-realtek-intc-common.c new file +1
-0+spin_lock_irqsave (&data->lock, flags);
This needs to be a raw spinlock.
drivers/irqchip/irq-realtek-intc-common.c line 86
Quoted 12 lines
drivers/irqchip/irq-realtek-intc-common.c new file +10
-0+ val =readl (data->base + data->info->scpu_int_en_offset); +spin_unlock_irqrestore (&data->lock, flags); + +return val; +} +static void realtek_intc_enable_irq (struct irq_data *data) +{ +struct realtek_intc_data *intc_data =irq_data_get_irq_chip_data (data); +unsigned long flags; +u32 scpu_int_en, mask;
See above.
Quoted 31 lines
drivers/irqchip/irq-realtek-intc-common.c new file +31
-0+ + mask = intc_data->info->isr_to_scpu_int_en_mask[data->hwirq]; +if (!mask) +return ; + +spin_lock_irqsave (&intc_data->lock, flags); + + scpu_int_en =readl (intc_data->base + intc_data->info->scpu_int_en_offset); + scpu_int_en |= mask; +writel (scpu_int_en, intc_data->base + intc_data->info->umsk_isr_offset); + +spin_unlock_irqrestore (&intc_data->lock, flags); +} + +static void realtek_intc_disable_irq (struct irq_data *data) +{ +struct realtek_intc_data *intc_data =irq_data_get_irq_chip_data (data); +unsigned long flags; +u32 scpu_int_en, mask; + + mask = intc_data->info->isr_to_scpu_int_en_mask[data->hwirq]; +if (!mask) +return ; + +spin_lock_irqsave (&intc_data->lock, flags); + + scpu_int_en =readl (intc_data->base + intc_data->info->scpu_int_en_offset); + scpu_int_en &= ~mask; +writel (scpu_int_en, intc_data->base + intc_data->info->umsk_isr_offset); + +spin_unlock_irqrestore (&intc_data->lock, flags);
drivers/irqchip/irq-realtek-intc-common.c line 127
Quoted 10 lines
drivers/irqchip/irq-realtek-intc-common.c new file +10
-0+} + +static int realtek_intc_lookup_parent_irq (struct realtek_intc_data *intc_data,struct irq_data *d) +{ +unsigned int mask =BIT (d->hwirq); +int i; + +for (i =0 ; i < intc_data->subset_data_num; i++) +if (intc_data->subset_data[i].cfg->ints_mask & mask) +return intc_data->subset_data[i].parent_irq;
Lacks brackets around the for loop. See documentation.
Quoted 7 lines
drivers/irqchip/irq-realtek-intc-common.c new file +7
-0+ +return -EINVAL ; +} + +static int realtek_intc_set_affinity (struct irq_data *d,const struct cpumask *mask_val,bool force) +{ +struct realtek_intc_data *intc_data =irq_data_get_irq_chip_data (d);
drivers/irqchip/irq-realtek-intc-common.c line 144
Quoted 10 lines
drivers/irqchip/irq-realtek-intc-common.c new file +10
-0+int irq; +struct irq_chip *chip; +struct irq_data *data; + + irq =realtek_intc_lookup_parent_irq (intc_data, d); +if (irq <0 ) +return irq; + + chip =irq_get_chip (irq); + data =irq_get_irq_data (irq);
So instead of two lookups you want to do:
data = irq_get_irq_data(irq);
if (!data)
return;
chip = irq_data_get_irq_chip(data); ...
Review
Quoted 2 lines
(quoted diff) +2
-0+ + irq_data_update_effective_affinity(d, cpu_online_mask);
So you update the effective affinity even if it cannot be set or if the parent irq returns an error code?
Aside of that setting it to cpu_online mask is just wrong. This is _NOT_ the effective affinity because the underlying GIC selects a single target CPU out of the caller provides cpu mask.
That said, this is also completely inconsistent vs. the other interrupts which share that GIC interrupt instance. I.e. /proc/irq/$N/affinity and effective_affinity become random number generators. That'll confuse existing userspace tools.
Having an affinity setter for demultiplexes interrupts is simply wrong.
drivers/irqchip/irq-realtek-intc-common.c line 159
Quoted 13 lines
drivers/irqchip/irq-realtek-intc-common.c new file +13
-0+if (chip && chip->irq_set_affinity) +return chip->irq_set_affinity (data, mask_val, force); +else +return -EINVAL ; +} + +static struct irq_chip realtek_intc_chip = { + .name ="realtek-intc" , + .irq_mask = realtek_intc_mask_irq, + .irq_unmask = realtek_intc_unmask_irq, + .irq_enable = realtek_intc_enable_irq, + .irq_disable = realtek_intc_disable_irq, + .irq_set_affinity = realtek_intc_set_affinity,
See docs vs. formatting of struct initializers.
drivers/irqchip/irq-realtek-intc-common.c line 222
Quoted 7 lines
drivers/irqchip/irq-realtek-intc-common.c new file +7
-0+}; + + + data->subset_data_num = info->cfg_num; +for (i =0 ; i < info->cfg_num; i++) { + ret =realtek_intc_subset (node, data, i); +WARN (ret,"failed to init subset %d: %d" , i, ret);
If this fails, then you still expose the affected interrupts as functional?
Quoted 13 lines
drivers/irqchip/irq-realtek-intc-common.h new file +13
-0+/** +* realtek_intc_subset_cfg - subset interrupt mask +* @ints_mask: inetrrupt mask +*/ +struct realtek_intc_subset_cfg { +unsigned int ints_mask; +}; + +/** +* realtek_intc_info - interrupt controller data. +* @isr_offset: interrupt status register offset. +* @umsk_isr_offset: unmask interrupt status register offset. +* @scpu_int_en_offset: interrupt enable register offset.
drivers/irqchip/irq-realtek-intc-common.h line 33
Quoted 10 lines
drivers/irqchip/irq-realtek-intc-common.h new file +10
-0+* @cfg: cfg of the subset. +* @cfg_num: number of cfg. +*/ +struct realtek_intc_info { +unsigned int isr_offset; +unsigned int umsk_isr_offset; +unsigned int scpu_int_en_offset; +const u32 *isr_to_scpu_int_en_mask; +const struct realtek_intc_subset_cfg *cfg; +int cfg_num;
See formatting doc.
drivers/irqchip/irq-realtek-intc-common.h line 69
Quoted 2 lines
drivers/irqchip/irq-realtek-intc-common.h new file +2
-0+ +#define IRQ_ALWAYS_ENABLED (-1)
U32_MAX ?
drivers/irqchip/irq-realtek-intc-common.h line 71
Quoted 2 lines
drivers/irqchip/irq-realtek-intc-common.h new file +2
-0+#define DISABLE_INTC (0) +#define CLEAN_INTC_STATUS (0xfffffffe)
That's what GENMASK() is for.
Thanks,
tglx
RE: [PATCH 2/6] irqchip: Add interrupt controller support for Realtek DHC SoCs
Hi Thomas,
Quoted 6 lines
Quoted 2 lines
Signed-off-by James Tai <[email protected]>Change-Id I1e711c70414c97c2c8497bd4ac9e8bbd964225c3Please remove these internal change ids. They are not useful for anyone outside realtek.
I will fix it in the next patches.
Quoted 6 lines
Review
Quoted 3 lines
(quoted diff) +2
-0+static unsigned int realtek_intc_get_ints(struct realtek_intc_data +*data)static inline perhaps?
Yes. I will use 'static inline' to replace it.
Quoted 8 lines
drivers/irqchip/irq-realtek-intc-common.c line 31
Quoted 4 lines
drivers/irqchip/irq-realtek-intc-common.c new file +4
-0+static unsigned int realtek_intc_get_inte (struct realtek_intc_data +*data) { +unsigned int val; +unsigned long flags;unsigned long flags; unsigned int val;
Quoted 4 lines
https://www.kernel.org/doc/html/latest/process/maintainer-tip.html
Please fix the variable declarations all over the place.
I will fix it in the next patches.
Quoted 4 lines
Quoted 1 line
+
spin_lock_irqsave(&data->lock, flags);This needs to be a raw spinlock.
I will fix it in the next patches.
Quoted 10 lines
Review
Quoted 4 lines
(quoted diff) +2
-0+static void realtek_intc_enable_irq(struct irq_data *data) { + struct realtek_intc_data *intc_data =
irq_data_get_irq_chip_data(data);Review
Quoted 2 lines
(quoted diff) +2
-0+ unsigned long flags; + u32 scpu_int_en, mask;See above.
I will fix it in the next patches.
Quoted 8 lines
So you update the effective affinity even if it cannot be set or if the parent irq returns an error code?
Aside of that setting it to
cpu_onlinemask is just wrong. This is _NOT_ the effective affinity because the underlying GIC selects a single target CPU out of the caller provides cpu mask.
Quoted 6 lines
That said, this is also completely inconsistent vs. the other interrupts which share that GIC interrupt instance. I.e.
/proc/irq/$N/affinityandeffective_affinitybecome random number generators. That'll confuse existing userspace tools.Having an affinity setter for demultiplexes interrupts is simply wrong.
I will use the 'irq_chip_set_affinity_parent' replace the 'realtek_intc_set_affinity'.
Quoted 10 lines
drivers/irqchip/irq-realtek-intc-common.c line 159
Quoted 7 lines
drivers/irqchip/irq-realtek-intc-common.c new file +7
-0+static struct irq_chip realtek_intc_chip = { + .name ="realtek-intc" , + .irq_mask = realtek_intc_mask_irq, + .irq_unmask = realtek_intc_unmask_irq, + .irq_enable = realtek_intc_enable_irq, + .irq_disable = realtek_intc_disable_irq, + .irq_set_affinity = realtek_intc_set_affinity,See docs vs. formatting of struct initializers.
I will fix it in the next patches.
Quoted 9 lines
drivers/irqchip/irq-realtek-intc-common.c line 222
Quoted 7 lines
drivers/irqchip/irq-realtek-intc-common.c new file +7
-0+}; + + + data->subset_data_num = info->cfg_num; +for (i =0 ; i < info->cfg_num; i++) { + ret =realtek_intc_subset (node, data, i); +WARN (ret,"failed to init subset %d: %d" , i, ret);If this fails, then you still expose the affected interrupts as functional?
I will modify the code to return an error code and stop the driver initialization.
Quoted 18 lines
Quoted 18 lines
drivers/irqchip/irq-realtek-intc-common.h new file +17
-0+/** +* realtek_intc_subset_cfg - subset interrupt mask +* @ints_mask: inetrrupt mask +*/ +struct realtek_intc_subset_cfg { +unsigned int ints_mask; +}; + +/** +* realtek_intc_info - interrupt controller data. +* @isr_offset: interrupt status register offset. +* @umsk_isr_offset: unmask interrupt status register offset. +* @scpu_int_en_offset: interrupt enable register offset. +* @cfg: cfg of the subset. +* @cfg_num: number of cfg. +*/ +struct realtek_intc_info {
Quoted 8 lines
drivers/irqchip/irq-realtek-intc-common.h line 33
Quoted 6 lines
drivers/irqchip/irq-realtek-intc-common.h new file +6
-0+unsigned int isr_offset; +unsigned int umsk_isr_offset; +unsigned int scpu_int_en_offset; +const u32 *isr_to_scpu_int_en_mask; +const struct realtek_intc_subset_cfg *cfg; +int cfg_num;See formatting doc.
I will fix it in the next patches.
Quoted 5 lines
drivers/irqchip/irq-realtek-intc-common.h line 69
Quoted 2 lines
drivers/irqchip/irq-realtek-intc-common.h new file +2
-0+ +#define IRQ_ALWAYS_ENABLED (-1)
U32_MAX?
I will use 'U32_MAX' to replace '-1'.
Quoted 5 lines
drivers/irqchip/irq-realtek-intc-common.h line 71
Quoted 2 lines
drivers/irqchip/irq-realtek-intc-common.h new file +2
-0+#define DISABLE_INTC (0) +#define CLEAN_INTC_STATUS (0xfffffffe)That's what
GENMASK()is for.
I will use ' GENMASK(31, 1) ' to replace '0xfffffffe '.
Thank you for your feedback.
Regards,
James
RE: [PATCH 2/6] irqchip: Add interrupt controller support for Realtek DHC SoCs
Quoted 11 lines
Quoted 11 lines
So you update the effective affinity even if it cannot be set or if the parent irq returns an error code?
Aside of that setting it to
cpu_onlinemask is just wrong. This is _NOT_ the effective affinity because the underlying GIC selects a single target CPU out of the caller provides cpu mask.That said, this is also completely inconsistent vs. the other interrupts which share that GIC interrupt instance. I.e.
/proc/irq/$N/affinityandeffective_affinitybecome random number generators.
Quoted 6 lines
That'll confuse existing userspace tools.
Quoted 3 lines
Having an affinity setter for demultiplexes interrupts is simply wrong.
I will use the '
irq_chip_set_affinity_parent' replace the 'realtek_intc_set_affinity'.
I will remove the capability to set CPU affinity.
Regards,
James
PATCH 3/6 irqchip: Introduce RTD1319 support using the Realtek Common Interrupt Controller Driver
In reply to James TaiAdd support for the RTD1319 platform.
--- drivers/irqchip/Kconfig | 6 + drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-realtek-rtd1319.c | 204 ++++++++++++++++++++++++++ 3 files changed, 211 insertions(+) create mode 100644 drivers/irqchip/irq-realtek-rtd1319.c
drivers/irqchip/Kconfig +6 -0
@@ -222,6 +222,12 @@ config REALTEK_DHC_INTC tristate select IRQ_DOMAIN +config REALTEK_RTD1319_INTC + tristate "Realtek RTD1319 interrupt controller" + select REALTEK_DHC_INTC + help + Support for Realtek RTD1319 Interrupt Controller. + config RENESAS_INTC_IRQPIN bool "Renesas INTC External IRQ Pin Support" if COMPILE_TEST select IRQ_DOMAIN
drivers/irqchip/Makefile +1 -0
@@ -48,6 +48,7 @@ obj-$(CONFIG_IXP4XX_IRQ) += irq-ixp4xx.o obj-$(CONFIG_JCORE_AIC) += irq-jcore-aic.o obj-$(CONFIG_RDA_INTC) += irq-rda-intc.o obj-$(CONFIG_REALTEK_DHC_INTC) += irq-realtek-intc-common.o +obj-$(CONFIG_REALTEK_RTD1319_INTC) += irq-realtek-rtd1319.o obj-$(CONFIG_RENESAS_INTC_IRQPIN) += irq-renesas-intc-irqpin.o obj-$(CONFIG_RENESAS_IRQC) += irq-renesas-irqc.o obj-$(CONFIG_RENESAS_RZA1_IRQC) += irq-renesas-rza1.o
drivers/irqchip/irq-realtek-rtd1319.c new file +204 -0
204 lines not on this page · raw message
Signature · 1 line
2.25.1
kernel test robot
build botRe: [PATCH 3/6] irqchip: Introduce RTD1319 support using the Realtek Common Interrupt Controller Driver
kernel test robot noticed the following build warnings:
Hi James,
kernel test robot noticed the following build warnings:
[auto build test WARNING on tip/irq/core]
[also build test WARNING on linus/master v6.6 next-20231106] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/James-Tai/dt-bindings-interrupt-controller-Add-support-for-Realtek-DHC-SoCs/20231103-074117 base: tip/irq/core patch link: https://lore.kernel.org/r/20231102142731.2087245-4-james.tai%40realtek.com patch subject: [PATCH 3/6] irqchip: Introduce RTD1319 support using the Realtek Common Interrupt Controller Driver config: i386-randconfig-062-20231106 (https://download.01.org/0day-ci/archive/20231106/[email protected]/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231106/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
sparse warnings: (new ones prefixed by >>)
>> drivers/irqchip/irq-realtek-rtd1319.c:165:25: sparse: sparse: symbol 'realtek_intc_rtd1319_pm_ops' was not declared. Should it be static?
vim +/realtek_intc_rtd1319_pm_ops +165 drivers/irqchip/irq-realtek-rtd1319.c
164
> 165 const struct dev_pm_ops realtek_intc_rtd1319_pm_ops = { 166 .suspend_noirq = realtek_intc_rtd1319_suspend,
167 .resume_noirq = realtek_intc_rtd1319_resume,
168 };
169
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Re: [PATCH 3/6] irqchip: Introduce RTD1319 support using the Realtek Common Interrupt Controller Driver
In reply to James Taidrivers/irqchip/irq-realtek-rtd1319.c line 18
Quoted 4 lines · James Tai
drivers/irqchip/irq-realtek-rtd1319.c new file +4
-0+ +enum rtd1319_iso_isr_bits { +RTD1319_ISO_ISR_TC3_SHIFT =1 , +RTD1319_ISO_ISR_UR0_SHIFT =2 ,
Please use tabular formatting all over the place.
drivers/irqchip/irq-realtek-rtd1319.c line 106
Quoted 9 lines
drivers/irqchip/irq-realtek-rtd1319.c new file +7
-0+RTD1319_ISO_ISR_LSADC0_SHIFT =3 , +RTD1319_ISO_ISR_IRDA_SHIFT =5 , + +static const struct realtek_intc_info rtd1319_intc_iso_info = { + .isr_offset =0x0 , + .umsk_isr_offset =0x4 , + .scpu_int_en_offset =0x40 ,
Magic numbers. Defines exist for a reason.
RE: [PATCH 3/6] irqchip: Introduce RTD1319 support using the Realtek Common Interrupt Controller Driver
Hi Thomas,
Quoted 5 lines
drivers/irqchip/irq-realtek-rtd1319.c line 18
Quoted 3 lines
drivers/irqchip/irq-realtek-rtd1319.c new file +3
-0+enum rtd1319_iso_isr_bits { +RTD1319_ISO_ISR_TC3_SHIFT =1 , +RTD1319_ISO_ISR_UR0_SHIFT =2 ,Please use tabular formatting all over the place.
I will fix it in the next patches.
Quoted 6 lines
Quoted 4 lines
drivers/irqchip/irq-realtek-rtd1319.c new file +3
-0+RTD1319_ISO_ISR_LSADC0_SHIFT =3 , + RTD1319_ISO_ISR_IRDA_SHIFT = 5, +
Quoted 6 lines
drivers/irqchip/irq-realtek-rtd1319.c line 106
Quoted 4 lines
drivers/irqchip/irq-realtek-rtd1319.c new file +4
-0+static const struct realtek_intc_info rtd1319_intc_iso_info = { + .isr_offset =0x0 , + .umsk_isr_offset =0x4 , + .scpu_int_en_offset =0x40 ,Magic numbers. Defines exist for a reason.
I will fix it in the next patches.
Thank you for your feedback.
Regards,
James
PATCH 4/6 irqchip: Introduce RTD1319D support using the Realtek Common Interrupt Controller Driver
In reply to James TaiAdd support for the RTD1319D platform.
--- drivers/irqchip/Kconfig | 6 + drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-realtek-rtd1319d.c | 211 +++++++++++++++++++++++++ 3 files changed, 218 insertions(+) create mode 100644 drivers/irqchip/irq-realtek-rtd1319d.c
drivers/irqchip/Kconfig +6 -0
@@ -228,6 +228,12 @@ config REALTEK_RTD1319_INTC help Support for Realtek RTD1319 Interrupt Controller. +config REALTEK_RTD1319D_INTC + tristate "Realtek RTD1319D interrupt controller" + select REALTEK_DHC_INTC + help + Support for Realtek RTD1319D Interrupt Controller. + config RENESAS_INTC_IRQPIN bool "Renesas INTC External IRQ Pin Support" if COMPILE_TEST select IRQ_DOMAIN
drivers/irqchip/Makefile +1 -0
@@ -49,6 +49,7 @@ obj-$(CONFIG_JCORE_AIC) += irq-jcore-aic.o obj-$(CONFIG_RDA_INTC) += irq-rda-intc.o obj-$(CONFIG_REALTEK_DHC_INTC) += irq-realtek-intc-common.o obj-$(CONFIG_REALTEK_RTD1319_INTC) += irq-realtek-rtd1319.o +obj-$(CONFIG_REALTEK_RTD1319D_INTC) += irq-realtek-rtd1319d.o obj-$(CONFIG_RENESAS_INTC_IRQPIN) += irq-renesas-intc-irqpin.o obj-$(CONFIG_RENESAS_IRQC) += irq-renesas-irqc.o obj-$(CONFIG_RENESAS_RZA1_IRQC) += irq-renesas-rza1.o
drivers/irqchip/irq-realtek-rtd1319d.c new file +211 -0
211 lines not on this page · raw message
Signature · 1 line
2.25.1
kernel test robot
build botRe: [PATCH 4/6] irqchip: Introduce RTD1319D support using the Realtek Common Interrupt Controller Driver
kernel test robot noticed the following build warnings:
Hi James,
kernel test robot noticed the following build warnings:
[auto build test WARNING on tip/irq/core]
[also build test WARNING on linus/master v6.6 next-20231106] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/James-Tai/dt-bindings-interrupt-controller-Add-support-for-Realtek-DHC-SoCs/20231103-074117 base: tip/irq/core patch link: https://lore.kernel.org/r/20231102142731.2087245-5-james.tai%40realtek.com patch subject: [PATCH 4/6] irqchip: Introduce RTD1319D support using the Realtek Common Interrupt Controller Driver config: i386-randconfig-061-20231106 (https://download.01.org/0day-ci/archive/20231106/[email protected]/config) compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231106/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
sparse warnings: (new ones prefixed by >>)
>> drivers/irqchip/irq-realtek-rtd1319d.c:172:25: sparse: sparse: symbol 'realtek_intc_rtd1319d_pm_ops' was not declared. Should it be static?
vim +/realtek_intc_rtd1319d_pm_ops +172 drivers/irqchip/irq-realtek-rtd1319d.c
171
> 172 const struct dev_pm_ops realtek_intc_rtd1319d_pm_ops = { 173 .suspend_noirq = realtek_intc_rtd1319d_suspend,
174 .resume_noirq = realtek_intc_rtd1319d_resume,
175 };
176
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
PATCH 5/6 irqchip: Introduce RTD1325 support using the Realtek Common Interrupt Controller Driver
In reply to James TaiAdd support for the RTD1325 platform.
--- drivers/irqchip/Kconfig | 6 + drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-realtek-rtd1325.c | 214 ++++++++++++++++++++++++++ 3 files changed, 221 insertions(+) create mode 100644 drivers/irqchip/irq-realtek-rtd1325.c
drivers/irqchip/Kconfig +6 -0
@@ -234,6 +234,12 @@ config REALTEK_RTD1319D_INTC help Support for Realtek RTD1319D Interrupt Controller. +config REALTEK_RTD1325_INTC + tristate "Realtek RTD1325 interrupt controller" + select REALTEK_DHC_INTC + help + Support for Realtek RTD1325 Interrupt Controller. + config RENESAS_INTC_IRQPIN bool "Renesas INTC External IRQ Pin Support" if COMPILE_TEST select IRQ_DOMAIN
drivers/irqchip/Makefile +1 -0
@@ -50,6 +50,7 @@ obj-$(CONFIG_RDA_INTC) += irq-rda-intc.o obj-$(CONFIG_REALTEK_DHC_INTC) += irq-realtek-intc-common.o obj-$(CONFIG_REALTEK_RTD1319_INTC) += irq-realtek-rtd1319.o obj-$(CONFIG_REALTEK_RTD1319D_INTC) += irq-realtek-rtd1319d.o +obj-$(CONFIG_REALTEK_RTD1325_INTC) += irq-realtek-rtd1325.o obj-$(CONFIG_RENESAS_INTC_IRQPIN) += irq-renesas-intc-irqpin.o obj-$(CONFIG_RENESAS_IRQC) += irq-renesas-irqc.o obj-$(CONFIG_RENESAS_RZA1_IRQC) += irq-renesas-rza1.o
drivers/irqchip/irq-realtek-rtd1325.c new file +214 -0
214 lines not on this page · raw message
Signature · 1 line
2.25.1
kernel test robot
build botRe: [PATCH 5/6] irqchip: Introduce RTD1325 support using the Realtek Common Interrupt Controller Driver
kernel test robot noticed the following build warnings:
Hi James,
kernel test robot noticed the following build warnings:
[auto build test WARNING on tip/irq/core]
[also build test WARNING on linus/master v6.6 next-20231106] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/James-Tai/dt-bindings-interrupt-controller-Add-support-for-Realtek-DHC-SoCs/20231103-074117 base: tip/irq/core patch link: https://lore.kernel.org/r/20231102142731.2087245-6-james.tai%40realtek.com patch subject: [PATCH 5/6] irqchip: Introduce RTD1325 support using the Realtek Common Interrupt Controller Driver config: i386-randconfig-061-20231106 (https://download.01.org/0day-ci/archive/20231106/[email protected]/config) compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231106/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
sparse warnings: (new ones prefixed by >>)
>> drivers/irqchip/irq-realtek-rtd1325.c:175:25: sparse: sparse: symbol 'realtek_intc_rtd1325_pm_ops' was not declared. Should it be static?
vim +/realtek_intc_rtd1325_pm_ops +175 drivers/irqchip/irq-realtek-rtd1325.c
174
> 175 const struct dev_pm_ops realtek_intc_rtd1325_pm_ops = { 176 .suspend_noirq = realtek_intc_rtd1325_suspend,
177 .resume_noirq = realtek_intc_rtd1325_resume,
178 };
179
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
PATCH 6/6 irqchip: Introduce RTD1619B support using the Realtek Common Interrupt Controller Driver
In reply to James TaiAdd support for the RTD1619B platform.
--- drivers/irqchip/Kconfig | 6 + drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-realtek-rtd1619b.c | 201 +++++++++++++++++++++++++ 3 files changed, 208 insertions(+) create mode 100644 drivers/irqchip/irq-realtek-rtd1619b.c
drivers/irqchip/Kconfig +6 -0
@@ -240,6 +240,12 @@ config REALTEK_RTD1325_INTC help Support for Realtek RTD1325 Interrupt Controller. +config REALTEK_RTD1619B_INTC + tristate "Realtek RTD1619B interrupt controller" + select REALTEK_DHC_INTC + help + Support for Realtek RTD1619B Interrupt Controller. + config RENESAS_INTC_IRQPIN bool "Renesas INTC External IRQ Pin Support" if COMPILE_TEST select IRQ_DOMAIN
drivers/irqchip/Makefile +1 -0
@@ -51,6 +51,7 @@ obj-$(CONFIG_REALTEK_DHC_INTC) += irq-realtek-intc-common.o obj-$(CONFIG_REALTEK_RTD1319_INTC) += irq-realtek-rtd1319.o obj-$(CONFIG_REALTEK_RTD1319D_INTC) += irq-realtek-rtd1319d.o obj-$(CONFIG_REALTEK_RTD1325_INTC) += irq-realtek-rtd1325.o +obj-$(CONFIG_REALTEK_RTD1619B_INTC) += irq-realtek-rtd1619b.o obj-$(CONFIG_RENESAS_INTC_IRQPIN) += irq-renesas-intc-irqpin.o obj-$(CONFIG_RENESAS_IRQC) += irq-renesas-irqc.o obj-$(CONFIG_RENESAS_RZA1_IRQC) += irq-renesas-rza1.o
drivers/irqchip/irq-realtek-rtd1619b.c new file +201 -0
201 lines not on this page · raw message
Signature · 1 line
2.25.1
kernel test robot
build botRe: [PATCH 6/6] irqchip: Introduce RTD1619B support using the Realtek Common Interrupt Controller Driver
kernel test robot noticed the following build warnings:
Hi James,
kernel test robot noticed the following build warnings:
[auto build test WARNING on tip/irq/core]
[also build test WARNING on linus/master v6.6 next-20231106] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/James-Tai/dt-bindings-interrupt-controller-Add-support-for-Realtek-DHC-SoCs/20231103-074117 base: tip/irq/core patch link: https://lore.kernel.org/r/20231102142731.2087245-7-james.tai%40realtek.com patch subject: [PATCH 6/6] irqchip: Introduce RTD1619B support using the Realtek Common Interrupt Controller Driver config: i386-randconfig-061-20231106 (https://download.01.org/0day-ci/archive/20231106/[email protected]/config) compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231106/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
sparse warnings: (new ones prefixed by >>)
>> drivers/irqchip/irq-realtek-rtd1619b.c:162:25: sparse: sparse: symbol 'realtek_intc_rtd1619b_pm_ops' was not declared. Should it be static?
vim +/realtek_intc_rtd1619b_pm_ops +162 drivers/irqchip/irq-realtek-rtd1619b.c
161
> 162 const struct dev_pm_ops realtek_intc_rtd1619b_pm_ops = { 163 .suspend_noirq = realtek_intc_rtd1619b_suspend,
164 .resume_noirq = realtek_intc_rtd1619b_resume,
165 };
166
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki