* [PATCH 0/3] irqchip/bcm2712-mip: Expose all 20 MIP1 outputs
@ 2026-12-02 10:12 Nicolai Buchwitz
2026-12-02 10:12 ` [PATCH 1/3] dt-bindings: interrupt-controller: brcm,bcm2712-msix: Allow multiple ranges Nicolai Buchwitz
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Nicolai Buchwitz @ 2026-12-02 10:12 UTC (permalink / raw)
To: Thomas Gleixner, Radu Rendec, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Florian Fainelli,
Broadcom internal kernel review list, Stanimir Varbanov
Cc: linux-kernel, devicetree, linux-rpi-kernel, linux-arm-kernel,
Jonathan Bell, Stefan Wahren, Nicolai Buchwitz
This series makes all 20 outputs of MIP1 (the MSI controller of BCM2712's
pcie1) usable. Previously it was limited to only 8 of them.
The remaining outputs are routed to GIC SPIs which are not contiguous, so
a single msi-ranges entry can't describe them. Jonathan from Raspberry Pi
checked the mapping against the Broadcom documentation they have and
confirmed my measurements [1]. The mapping applies to all revisions of
BCM2712, as every rpi-eeprom release for Pi 5 sets the enable bit on C1
and D0 has it hardwired [1].
Patch 1 extends the binding to allow multiple msi-ranges entries, patch 2
adds support for them to the driver and patch 3 adds the missing outputs
to bcm2712.dtsi. DTs with a single range keep working as before. The
series is based on tip irq/drivers, as it depends on e5cd48011ba4
("irqchip/bcm2712-mip: Fix multi-MSI allocation for non-power-of-two
counts").
Please let me know how the patches should ideally be routed. I guess
Florian will take the DTS patch through the Broadcom tree and the other
two will go through the irq tree?
An earlier version of this patchset has already been merged in the
Raspberry Pi downstream kernel [2] and was also tested there. Additionally
I've tested the series on a Revolution Pi Connect 5 (CM5), which has three
LAN7430 (6 MSI-X vectors each) behind a Diodes PCIe switch. With DPC
enabled the switch ports take another 6 outputs. Vectors per NIC:
8 outputs 20 outputs
--------------------------------------------
without DPC 6, 2, INTx 6, 6, 6
with DPC 2, INTx, INTx 6, 6, 2
As the RC MSI interrupt can't be pinned to a certain core, more MIP outputs
are beneficial for our industrial Ethernet applications. Multiple NVMe
drives or custom FPGA designs [3] would benefit from these changes as well.
[1] https://github.com/raspberrypi/linux/pull/7729#issuecomment-6581536952
https://github.com/raspberrypi/linux/pull/7729#issuecomment-6581999696
[2] https://github.com/raspberrypi/linux/pull/7729
[3] https://forums.raspberrypi.com/viewtopic.php?t=398134
Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
---
Nicolai Buchwitz (3):
dt-bindings: interrupt-controller: brcm,bcm2712-msix: Allow multiple ranges
irqchip/bcm2712-mip: Support multiple MSI ranges
arm64: dts: broadcom: bcm2712: Expose all 20 MIP1 outputs
.../interrupt-controller/brcm,bcm2712-msix.yaml | 16 +++-
arch/arm64/boot/dts/broadcom/bcm2712.dtsi | 13 ++-
drivers/irqchip/irq-bcm2712-mip.c | 105 ++++++++++++++-------
3 files changed, 95 insertions(+), 39 deletions(-)
---
base-commit: 21f3995610426ef9c930b49b1e8e21eb771d8568
change-id: 20261202-nb-bcm2712-mip-msi-ranges-74e4c68a87e0
Best regards,
--
Nicolai Buchwitz <nb@tipi-net.de>
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 1/3] dt-bindings: interrupt-controller: brcm,bcm2712-msix: Allow multiple ranges 2026-12-02 10:12 [PATCH 0/3] irqchip/bcm2712-mip: Expose all 20 MIP1 outputs Nicolai Buchwitz @ 2026-12-02 10:12 ` Nicolai Buchwitz 2026-12-02 10:12 ` [PATCH 2/3] irqchip/bcm2712-mip: Support multiple MSI ranges Nicolai Buchwitz 2026-12-02 10:12 ` [PATCH 3/3] arm64: dts: broadcom: bcm2712: Expose all 20 MIP1 outputs Nicolai Buchwitz 2 siblings, 0 replies; 6+ messages in thread From: Nicolai Buchwitz @ 2026-12-02 10:12 UTC (permalink / raw) To: Thomas Gleixner, Radu Rendec, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Florian Fainelli, Broadcom internal kernel review list, Stanimir Varbanov Cc: linux-kernel, devicetree, linux-rpi-kernel, linux-arm-kernel, Jonathan Bell, Stefan Wahren, Nicolai Buchwitz The MIP outputs are not wired to one contiguous block of GIC SPIs, so a single msi-ranges entry cannot describe all of them. Define how several entries map to the outputs. Allow the legacy brcm,msi-offset only with a single entry, which is the only case the driver has handled. Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de> --- .../bindings/interrupt-controller/brcm,bcm2712-msix.yaml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/interrupt-controller/brcm,bcm2712-msix.yaml b/Documentation/devicetree/bindings/interrupt-controller/brcm,bcm2712-msix.yaml index c84614663b5d..5ad380b28c57 100644 --- a/Documentation/devicetree/bindings/interrupt-controller/brcm,bcm2712-msix.yaml +++ b/Documentation/devicetree/bindings/interrupt-controller/brcm,bcm2712-msix.yaml @@ -16,6 +16,13 @@ description: allOf: - $ref: /schemas/interrupt-controller/msi-controller.yaml# + - if: + required: + - brcm,msi-offset + then: + properties: + msi-ranges: + maxItems: 1 properties: compatible: @@ -29,9 +36,16 @@ properties: "#msi-cells": const: 0 + msi-ranges: + description: + Each entry maps the next consecutive MIP outputs, starting at + output 0, to the given GIC SPIs. + brcm,msi-offset: $ref: /schemas/types.yaml#/definitions/uint32 - description: Shift the allocated MSI's. + description: + Legacy. Shifts both the MIP output and the GIC SPI of a single + msi-ranges entry. Not allowed with more than one entry. unevaluatedProperties: false -- 2.53.0 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3] irqchip/bcm2712-mip: Support multiple MSI ranges 2026-12-02 10:12 [PATCH 0/3] irqchip/bcm2712-mip: Expose all 20 MIP1 outputs Nicolai Buchwitz 2026-12-02 10:12 ` [PATCH 1/3] dt-bindings: interrupt-controller: brcm,bcm2712-msix: Allow multiple ranges Nicolai Buchwitz @ 2026-12-02 10:12 ` Nicolai Buchwitz 2026-12-04 19:44 ` Thomas Gleixner 2026-12-02 10:12 ` [PATCH 3/3] arm64: dts: broadcom: bcm2712: Expose all 20 MIP1 outputs Nicolai Buchwitz 2 siblings, 1 reply; 6+ messages in thread From: Nicolai Buchwitz @ 2026-12-02 10:12 UTC (permalink / raw) To: Thomas Gleixner, Radu Rendec, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Florian Fainelli, Broadcom internal kernel review list, Stanimir Varbanov Cc: linux-kernel, devicetree, linux-rpi-kernel, linux-arm-kernel, Jonathan Bell, Stefan Wahren, Nicolai Buchwitz The MIP outputs are not wired to one contiguous block of GIC SPIs, so a single msi-ranges entry can only describe part of a MIP. Accept one entry per contiguous run, in output order, and look up the SPI for each message. brcm,msi-offset keeps its meaning for the existing single range and is rejected when more than one range is given. Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de> --- drivers/irqchip/irq-bcm2712-mip.c | 105 +++++++++++++++++++++++++------------- 1 file changed, 69 insertions(+), 36 deletions(-) diff --git a/drivers/irqchip/irq-bcm2712-mip.c b/drivers/irqchip/irq-bcm2712-mip.c index 5a13bb4c18f6..c05932dc7b12 100644 --- a/drivers/irqchip/irq-bcm2712-mip.c +++ b/drivers/irqchip/irq-bcm2712-mip.c @@ -26,12 +26,14 @@ #define MIP_INT_STATUSL_VPU 0xa0 #define MIP_INT_STATUSH_VPU 0xb0 +#define MIP_NUM_IRQS 64 + /** * struct mip_priv - MSI-X interrupt controller data * @lock: Used to protect bitmap alloc/free * @base: Base address of MMIO area * @msg_addr: PCIe MSI-X address - * @msi_base: MSI base + * @parent_irqs: GIC SPI numbers indexed by MIP message data * @num_msis: Count of MSIs * @msi_offset: MSI offset * @bitmap: A bitmap for hwirqs @@ -42,7 +44,7 @@ struct mip_priv { spinlock_t lock; void __iomem *base; u64 msg_addr; - u32 msi_base; + u32 parent_irqs[MIP_NUM_IRQS]; u32 num_msis; u32 msi_offset; unsigned long *bitmap; @@ -74,10 +76,9 @@ static int mip_alloc_hwirq(struct mip_priv *mip, unsigned int nr_irqs) unsigned long hwirq; guard(spinlock)(&mip->lock); - hwirq = bitmap_find_next_zero_area_off(mip->bitmap, mip->num_msis, 0, - nr_irqs, roundup_pow_of_two(nr_irqs) - 1, - mip->msi_offset); - if (hwirq >= mip->num_msis) + hwirq = bitmap_find_next_zero_area(mip->bitmap, MIP_NUM_IRQS, 0, nr_irqs, + roundup_pow_of_two(nr_irqs) - 1); + if (hwirq >= MIP_NUM_IRQS) return -ENOSPC; bitmap_set(mip->bitmap, hwirq, nr_irqs); @@ -96,7 +97,7 @@ static int mip_middle_domain_alloc(struct irq_domain *domain, unsigned int virq, { struct mip_priv *mip = domain->host_data; struct irq_fwspec fwspec = {0}; - unsigned int hwirq, i; + unsigned int hwirq, i, allocated = 0; struct irq_data *irqd; int irq, ret; @@ -104,21 +105,24 @@ static int mip_middle_domain_alloc(struct irq_domain *domain, unsigned int virq, if (irq < 0) return irq; - hwirq = irq + mip->msi_offset; + hwirq = irq; fwspec.fwnode = domain->parent->fwnode; fwspec.param_count = 3; fwspec.param[0] = 0; - fwspec.param[1] = hwirq + mip->msi_base; fwspec.param[2] = IRQ_TYPE_EDGE_RISING; - ret = irq_domain_alloc_irqs_parent(domain, virq, nr_irqs, &fwspec); - if (ret) - goto err_free_hwirq; - for (i = 0; i < nr_irqs; i++) { + fwspec.param[1] = mip->parent_irqs[hwirq + i]; + ret = irq_domain_alloc_irqs_parent(domain, virq + i, 1, &fwspec); + if (ret) + goto err_free; + allocated++; + irqd = irq_domain_get_irq_data(domain->parent, virq + i); - irqd->chip->irq_set_type(irqd, IRQ_TYPE_EDGE_RISING); + ret = irqd->chip->irq_set_type(irqd, IRQ_TYPE_EDGE_RISING); + if (ret) + goto err_free; ret = irq_domain_set_hwirq_and_chip(domain, virq + i, hwirq + i, &mip_middle_irq_chip, mip); @@ -133,8 +137,8 @@ static int mip_middle_domain_alloc(struct irq_domain *domain, unsigned int virq, return 0; err_free: - irq_domain_free_irqs_parent(domain, virq, nr_irqs); -err_free_hwirq: + if (allocated) + irq_domain_free_irqs_parent(domain, virq, allocated); mip_free_hwirq(mip, irq, nr_irqs); return ret; } @@ -152,7 +156,7 @@ static void mip_middle_domain_free(struct irq_domain *domain, unsigned int virq, mip = irq_data_get_irq_chip_data(irqd); hwirq = irqd_to_hwirq(irqd); irq_domain_free_irqs_parent(domain, virq, nr_irqs); - mip_free_hwirq(mip, hwirq - mip->msi_offset, nr_irqs); + mip_free_hwirq(mip, hwirq, nr_irqs); } static const struct irq_domain_ops mip_middle_domain_ops = { @@ -185,7 +189,7 @@ static int mip_init_domains(struct mip_priv *mip, struct device_node *np) .fwnode = of_fwnode_handle(np), .ops = &mip_middle_domain_ops, .host_data = mip, - .size = mip->num_msis, + .size = MIP_NUM_IRQS, .parent = mip->parent, .dev = mip->dev, }; @@ -209,32 +213,59 @@ static int mip_init_domains(struct mip_priv *mip, struct device_node *np) static int mip_parse_dt(struct mip_priv *mip, struct device_node *np) { struct of_phandle_args args; + struct irq_domain *parent; + u32 first, span, i, cells; u64 size; - int ret; + int ret, count, range; ret = of_property_read_u32(np, "brcm,msi-offset", &mip->msi_offset); if (ret) mip->msi_offset = 0; - - ret = of_parse_phandle_with_args(np, "msi-ranges", "#interrupt-cells", - 0, &args); - if (ret) - return ret; - - ret = of_property_read_u32_index(np, "msi-ranges", args.args_count + 1, - &mip->num_msis); - if (ret) - goto err_put; + if (mip->msi_offset >= MIP_NUM_IRQS) + return -EINVAL; ret = of_property_read_reg(np, 1, &mip->msg_addr, &size); if (ret) - goto err_put; + return ret; - mip->msi_base = args.args[1]; + /* <&gic type spi flags span> per range */ + count = of_property_count_u32_elems(np, "msi-ranges"); + if (count <= 0 || count % 5) + return -EINVAL; + if (count > 5 && of_property_present(np, "brcm,msi-offset")) + return -EINVAL; + + first = mip->msi_offset; + for (range = 0; range < count / 5; range++) { + ret = of_parse_phandle_with_fixed_args(np, "msi-ranges", 4, + range, &args); + if (ret) + return ret; - mip->parent = irq_find_host(args.np); - if (!mip->parent) + ret = of_property_read_u32(args.np, "#interrupt-cells", &cells); + if (ret) + goto err_put; ret = -EINVAL; + span = args.args[3]; + if (cells != 3 || args.args[0] != 0 || + args.args[2] != IRQ_TYPE_EDGE_RISING || + !span || span > MIP_NUM_IRQS - first) + goto err_put; + + parent = irq_find_host(args.np); + if (!parent || (mip->parent && parent != mip->parent)) + goto err_put; + mip->parent = parent; + + /* The legacy offset shifts the SPI as well as the message data */ + for (i = 0; i < span; i++) + mip->parent_irqs[first + i] = args.args[1] + + mip->msi_offset + i; + first += span; + of_node_put(args.np); + } + mip->num_msis = first - mip->msi_offset; + return 0; err_put: of_node_put(args.np); @@ -264,18 +295,20 @@ static int mip_msi_probe(struct platform_device *pdev, struct device_node *paren goto err_priv; } - mip->bitmap = bitmap_zalloc(mip->num_msis, GFP_KERNEL); + mip->bitmap = bitmap_alloc(MIP_NUM_IRQS, GFP_KERNEL); if (!mip->bitmap) { ret = -ENOMEM; goto err_base; } + bitmap_fill(mip->bitmap, MIP_NUM_IRQS); + bitmap_clear(mip->bitmap, mip->msi_offset, mip->num_msis); ret = mip_init_domains(mip, node); if (ret) goto err_map; - dev_dbg(&pdev->dev, "MIP: MSI-X count: %u, base: %u, offset: %u, msg_addr: %llx\n", - mip->num_msis, mip->msi_base, mip->msi_offset, mip->msg_addr); + dev_dbg(&pdev->dev, "MIP: MSI-X count: %u, offset: %u, msg_addr: %llx\n", + mip->num_msis, mip->msi_offset, mip->msg_addr); return 0; -- 2.53.0 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/3] irqchip/bcm2712-mip: Support multiple MSI ranges 2026-12-02 10:12 ` [PATCH 2/3] irqchip/bcm2712-mip: Support multiple MSI ranges Nicolai Buchwitz @ 2026-12-04 19:44 ` Thomas Gleixner 2026-12-04 20:16 ` Nicolai Buchwitz 0 siblings, 1 reply; 6+ messages in thread From: Thomas Gleixner @ 2026-12-04 19:44 UTC (permalink / raw) To: Nicolai Buchwitz, Radu Rendec, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Florian Fainelli, Broadcom internal kernel review list, Stanimir Varbanov Cc: linux-kernel, devicetree, linux-rpi-kernel, linux-arm-kernel, Jonathan Bell, Stefan Wahren, Nicolai Buchwitz On Wed, Dec 02 2026 at 11:12, Nicolai Buchwitz wrote: > /** > * struct mip_priv - MSI-X interrupt controller data > * @lock: Used to protect bitmap alloc/free > * @base: Base address of MMIO area > * @msg_addr: PCIe MSI-X address > - * @msi_base: MSI base > + * @parent_irqs: GIC SPI numbers indexed by MIP message data Please realign these entries so they are all tabular. > * @num_msis: Count of MSIs > * @msi_offset: MSI offset > * @bitmap: A bitmap for hwirqs > @@ -96,7 +97,7 @@ static int mip_middle_domain_alloc(struct irq_domain *domain, unsigned int virq, > { > struct mip_priv *mip = domain->host_data; > struct irq_fwspec fwspec = {0}; > - unsigned int hwirq, i; > + unsigned int hwirq, i, allocated = 0; Reverse fir tree order. See https://docs.kernel.org/process/maintainer-tip.html > struct irq_data *irqd; > int irq, ret; > > @@ -104,21 +105,24 @@ static int mip_middle_domain_alloc(struct irq_domain *domain, unsigned int virq, > if (irq < 0) > return irq; > > - hwirq = irq + mip->msi_offset; > + hwirq = irq; > > fwspec.fwnode = domain->parent->fwnode; > fwspec.param_count = 3; > fwspec.param[0] = 0; > - fwspec.param[1] = hwirq + mip->msi_base; > fwspec.param[2] = IRQ_TYPE_EDGE_RISING; > > - ret = irq_domain_alloc_irqs_parent(domain, virq, nr_irqs, &fwspec); > - if (ret) > - goto err_free_hwirq; > - > for (i = 0; i < nr_irqs; i++) { > + fwspec.param[1] = mip->parent_irqs[hwirq + i]; > + ret = irq_domain_alloc_irqs_parent(domain, virq + i, 1, &fwspec); > + if (ret) > + goto err_free; > + allocated++; > + > irqd = irq_domain_get_irq_data(domain->parent, virq + i); > - irqd->chip->irq_set_type(irqd, IRQ_TYPE_EDGE_RISING); > + ret = irqd->chip->irq_set_type(irqd, IRQ_TYPE_EDGE_RISING); > + if (ret) > + goto err_free; > > ret = irq_domain_set_hwirq_and_chip(domain, virq + i, hwirq + i, > &mip_middle_irq_chip, mip); > @@ -133,8 +137,8 @@ static int mip_middle_domain_alloc(struct irq_domain *domain, unsigned int virq, > return 0; > > err_free: > - irq_domain_free_irqs_parent(domain, virq, nr_irqs); > -err_free_hwirq: > + if (allocated) > + irq_domain_free_irqs_parent(domain, virq, allocated); > mip_free_hwirq(mip, irq, nr_irqs); > return ret; > } > @@ -152,7 +156,7 @@ static void mip_middle_domain_free(struct irq_domain *domain, unsigned int virq, > mip = irq_data_get_irq_chip_data(irqd); > hwirq = irqd_to_hwirq(irqd); > irq_domain_free_irqs_parent(domain, virq, nr_irqs); > - mip_free_hwirq(mip, hwirq - mip->msi_offset, nr_irqs); > + mip_free_hwirq(mip, hwirq, nr_irqs); > } > > static const struct irq_domain_ops mip_middle_domain_ops = { > @@ -185,7 +189,7 @@ static int mip_init_domains(struct mip_priv *mip, struct device_node *np) > .fwnode = of_fwnode_handle(np), > .ops = &mip_middle_domain_ops, > .host_data = mip, > - .size = mip->num_msis, > + .size = MIP_NUM_IRQS, > .parent = mip->parent, > .dev = mip->dev, > }; > @@ -209,32 +213,59 @@ static int mip_init_domains(struct mip_priv *mip, struct device_node *np) > static int mip_parse_dt(struct mip_priv *mip, struct device_node *np) > { > struct of_phandle_args args; > + struct irq_domain *parent; > + u32 first, span, i, cells; > u64 size; > - int ret; > + int ret, count, range; Please declare the variables which are only used in the for() loop in that scope and not here. > ret = of_property_read_u32(np, "brcm,msi-offset", &mip->msi_offset); > if (ret) > mip->msi_offset = 0; > - > - ret = of_parse_phandle_with_args(np, "msi-ranges", "#interrupt-cells", > - 0, &args); > - if (ret) > - return ret; > - > - ret = of_property_read_u32_index(np, "msi-ranges", args.args_count + 1, > - &mip->num_msis); > - if (ret) > - goto err_put; > + if (mip->msi_offset >= MIP_NUM_IRQS) > + return -EINVAL; > > ret = of_property_read_reg(np, 1, &mip->msg_addr, &size); > if (ret) > - goto err_put; > + return ret; > > - mip->msi_base = args.args[1]; > + /* <&gic type spi flags span> per range */ > + count = of_property_count_u32_elems(np, "msi-ranges"); > + if (count <= 0 || count % 5) > + return -EINVAL; > + if (count > 5 && of_property_present(np, "brcm,msi-offset")) > + return -EINVAL; > + > + first = mip->msi_offset; > + for (range = 0; range < count / 5; range++) { for (int range = 0; .... > + ret = of_parse_phandle_with_fixed_args(np, "msi-ranges", 4, > + range, &args); > + if (ret) > + return ret; > > - mip->parent = irq_find_host(args.np); > - if (!mip->parent) > + ret = of_property_read_u32(args.np, "#interrupt-cells", &cells); > + if (ret) > + goto err_put; > ret = -EINVAL; > + span = args.args[3]; > + if (cells != 3 || args.args[0] != 0 || > + args.args[2] != IRQ_TYPE_EDGE_RISING || > + !span || span > MIP_NUM_IRQS - first) > + goto err_put; > + You have 100 characters. Please make it use of them > + parent = irq_find_host(args.np); > + if (!parent || (mip->parent && parent != mip->parent)) > + goto err_put; > + mip->parent = parent; > + > + /* The legacy offset shifts the SPI as well as the message data */ > + for (i = 0; i < span; i++) > + mip->parent_irqs[first + i] = args.args[1] + > + mip->msi_offset + i; See bracket rules in documentation. > + first += span; > + of_node_put(args.np); > + } > + mip->num_msis = first - mip->msi_offset; > + return 0; > > err_put: > of_node_put(args.np); > @@ -264,18 +295,20 @@ static int mip_msi_probe(struct platform_device *pdev, struct device_node *paren > goto err_priv; > } > > - mip->bitmap = bitmap_zalloc(mip->num_msis, GFP_KERNEL); > + mip->bitmap = bitmap_alloc(MIP_NUM_IRQS, GFP_KERNEL); > if (!mip->bitmap) { > ret = -ENOMEM; > goto err_base; > } > + bitmap_fill(mip->bitmap, MIP_NUM_IRQS); > + bitmap_clear(mip->bitmap, mip->msi_offset, mip->num_msis); That want's a comment. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/3] irqchip/bcm2712-mip: Support multiple MSI ranges 2026-12-04 19:44 ` Thomas Gleixner @ 2026-12-04 20:16 ` Nicolai Buchwitz 0 siblings, 0 replies; 6+ messages in thread From: Nicolai Buchwitz @ 2026-12-04 20:16 UTC (permalink / raw) To: Thomas Gleixner Cc: Radu Rendec, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Florian Fainelli, Broadcom internal kernel review list, Stanimir Varbanov, linux-kernel, devicetree, linux-rpi-kernel, linux-arm-kernel, Jonathan Bell, Stefan Wahren On 4.12.2026 20:44, Thomas Gleixner wrote: > On Wed, Dec 02 2026 at 11:12, Nicolai Buchwitz wrote: >> /** >> * struct mip_priv - MSI-X interrupt controller data >> * @lock: Used to protect bitmap alloc/free >> * @base: Base address of MMIO area >> * @msg_addr: PCIe MSI-X address >> - * @msi_base: MSI base >> + * @parent_irqs: GIC SPI numbers indexed by MIP message data > > Please realign these entries so they are all tabular. > >> * @num_msis: Count of MSIs >> * @msi_offset: MSI offset >> * @bitmap: A bitmap for hwirqs > >> @@ -96,7 +97,7 @@ static int mip_middle_domain_alloc(struct irq_domain >> *domain, unsigned int virq, >> { >> struct mip_priv *mip = domain->host_data; >> struct irq_fwspec fwspec = {0}; >> - unsigned int hwirq, i; >> + unsigned int hwirq, i, allocated = 0; > > Reverse fir tree order. See > > https://docs.kernel.org/process/maintainer-tip.html > >> struct irq_data *irqd; >> int irq, ret; >> >> @@ -104,21 +105,24 @@ static int mip_middle_domain_alloc(struct >> irq_domain *domain, unsigned int virq, >> if (irq < 0) >> return irq; >> >> - hwirq = irq + mip->msi_offset; >> + hwirq = irq; >> >> fwspec.fwnode = domain->parent->fwnode; >> fwspec.param_count = 3; >> fwspec.param[0] = 0; >> - fwspec.param[1] = hwirq + mip->msi_base; >> fwspec.param[2] = IRQ_TYPE_EDGE_RISING; >> >> - ret = irq_domain_alloc_irqs_parent(domain, virq, nr_irqs, &fwspec); >> - if (ret) >> - goto err_free_hwirq; >> - >> for (i = 0; i < nr_irqs; i++) { >> + fwspec.param[1] = mip->parent_irqs[hwirq + i]; >> + ret = irq_domain_alloc_irqs_parent(domain, virq + i, 1, &fwspec); >> + if (ret) >> + goto err_free; >> + allocated++; >> + >> irqd = irq_domain_get_irq_data(domain->parent, virq + i); >> - irqd->chip->irq_set_type(irqd, IRQ_TYPE_EDGE_RISING); >> + ret = irqd->chip->irq_set_type(irqd, IRQ_TYPE_EDGE_RISING); >> + if (ret) >> + goto err_free; >> >> ret = irq_domain_set_hwirq_and_chip(domain, virq + i, hwirq + i, >> &mip_middle_irq_chip, mip); >> @@ -133,8 +137,8 @@ static int mip_middle_domain_alloc(struct >> irq_domain *domain, unsigned int virq, >> return 0; >> >> err_free: >> - irq_domain_free_irqs_parent(domain, virq, nr_irqs); >> -err_free_hwirq: >> + if (allocated) >> + irq_domain_free_irqs_parent(domain, virq, allocated); >> mip_free_hwirq(mip, irq, nr_irqs); >> return ret; >> } >> @@ -152,7 +156,7 @@ static void mip_middle_domain_free(struct >> irq_domain *domain, unsigned int virq, >> mip = irq_data_get_irq_chip_data(irqd); >> hwirq = irqd_to_hwirq(irqd); >> irq_domain_free_irqs_parent(domain, virq, nr_irqs); >> - mip_free_hwirq(mip, hwirq - mip->msi_offset, nr_irqs); >> + mip_free_hwirq(mip, hwirq, nr_irqs); >> } >> >> static const struct irq_domain_ops mip_middle_domain_ops = { >> @@ -185,7 +189,7 @@ static int mip_init_domains(struct mip_priv *mip, >> struct device_node *np) >> .fwnode = of_fwnode_handle(np), >> .ops = &mip_middle_domain_ops, >> .host_data = mip, >> - .size = mip->num_msis, >> + .size = MIP_NUM_IRQS, >> .parent = mip->parent, >> .dev = mip->dev, >> }; >> @@ -209,32 +213,59 @@ static int mip_init_domains(struct mip_priv >> *mip, struct device_node *np) >> static int mip_parse_dt(struct mip_priv *mip, struct device_node *np) >> { >> struct of_phandle_args args; >> + struct irq_domain *parent; >> + u32 first, span, i, cells; >> u64 size; >> - int ret; >> + int ret, count, range; > > Please declare the variables which are only used in the for() loop in > that scope and not here. > >> ret = of_property_read_u32(np, "brcm,msi-offset", &mip->msi_offset); >> if (ret) >> mip->msi_offset = 0; >> - >> - ret = of_parse_phandle_with_args(np, "msi-ranges", >> "#interrupt-cells", >> - 0, &args); >> - if (ret) >> - return ret; >> - >> - ret = of_property_read_u32_index(np, "msi-ranges", args.args_count + >> 1, >> - &mip->num_msis); >> - if (ret) >> - goto err_put; >> + if (mip->msi_offset >= MIP_NUM_IRQS) >> + return -EINVAL; >> >> ret = of_property_read_reg(np, 1, &mip->msg_addr, &size); >> if (ret) >> - goto err_put; >> + return ret; >> >> - mip->msi_base = args.args[1]; >> + /* <&gic type spi flags span> per range */ >> + count = of_property_count_u32_elems(np, "msi-ranges"); >> + if (count <= 0 || count % 5) >> + return -EINVAL; >> + if (count > 5 && of_property_present(np, "brcm,msi-offset")) >> + return -EINVAL; >> + >> + first = mip->msi_offset; >> + for (range = 0; range < count / 5; range++) { > > for (int range = 0; .... > >> + ret = of_parse_phandle_with_fixed_args(np, "msi-ranges", 4, >> + range, &args); >> + if (ret) >> + return ret; >> >> - mip->parent = irq_find_host(args.np); >> - if (!mip->parent) >> + ret = of_property_read_u32(args.np, "#interrupt-cells", &cells); >> + if (ret) >> + goto err_put; >> ret = -EINVAL; >> + span = args.args[3]; >> + if (cells != 3 || args.args[0] != 0 || >> + args.args[2] != IRQ_TYPE_EDGE_RISING || >> + !span || span > MIP_NUM_IRQS - first) >> + goto err_put; >> + > > You have 100 characters. Please make it use of them > > >> + parent = irq_find_host(args.np); >> + if (!parent || (mip->parent && parent != mip->parent)) >> + goto err_put; >> + mip->parent = parent; >> + >> + /* The legacy offset shifts the SPI as well as the message data */ >> + for (i = 0; i < span; i++) >> + mip->parent_irqs[first + i] = args.args[1] + >> + mip->msi_offset + i; > > See bracket rules in documentation. > >> + first += span; >> + of_node_put(args.np); >> + } >> + mip->num_msis = first - mip->msi_offset; >> + return 0; >> >> err_put: >> of_node_put(args.np); >> @@ -264,18 +295,20 @@ static int mip_msi_probe(struct platform_device >> *pdev, struct device_node *paren >> goto err_priv; >> } >> >> - mip->bitmap = bitmap_zalloc(mip->num_msis, GFP_KERNEL); >> + mip->bitmap = bitmap_alloc(MIP_NUM_IRQS, GFP_KERNEL); >> if (!mip->bitmap) { >> ret = -ENOMEM; >> goto err_base; >> } >> + bitmap_fill(mip->bitmap, MIP_NUM_IRQS); >> + bitmap_clear(mip->bitmap, mip->msi_offset, mip->num_msis); > > That want's a comment. Thanks, I will send a v2 with the style fixups + comment. Regards Nicolai ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 3/3] arm64: dts: broadcom: bcm2712: Expose all 20 MIP1 outputs 2026-12-02 10:12 [PATCH 0/3] irqchip/bcm2712-mip: Expose all 20 MIP1 outputs Nicolai Buchwitz 2026-12-02 10:12 ` [PATCH 1/3] dt-bindings: interrupt-controller: brcm,bcm2712-msix: Allow multiple ranges Nicolai Buchwitz 2026-12-02 10:12 ` [PATCH 2/3] irqchip/bcm2712-mip: Support multiple MSI ranges Nicolai Buchwitz @ 2026-12-02 10:12 ` Nicolai Buchwitz 2 siblings, 0 replies; 6+ messages in thread From: Nicolai Buchwitz @ 2026-12-02 10:12 UTC (permalink / raw) To: Thomas Gleixner, Radu Rendec, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Florian Fainelli, Broadcom internal kernel review list, Stanimir Varbanov Cc: linux-kernel, devicetree, linux-rpi-kernel, linux-arm-kernel, Jonathan Bell, Stefan Wahren, Nicolai Buchwitz MIP1 serves pcie1, the external PCIe x1 port on Pi 5 and CM5, but only 8 of its outputs are described. A single multi-queue device can use most of them, and further devices get fewer vectors or none. Raising each MIP output on a CM5 and checking which SPI goes pending shows 20 wired outputs. The others have no route. The mapping matches the Broadcom documentation for BCM2712. On C1 every rpi-eeprom release for Pi 5 sets the bit that enables it. On D0 it is always on. MIP output GIC SPI 0..1 196..197 2..3 200..201 4..5 206..207 6 240 7 246 8..15 255..262 16 275 17 282 18 263 19 283 Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de> --- arch/arm64/boot/dts/broadcom/bcm2712.dtsi | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/broadcom/bcm2712.dtsi b/arch/arm64/boot/dts/broadcom/bcm2712.dtsi index edae2f3584a8..dcbd1e674042 100644 --- a/arch/arm64/boot/dts/broadcom/bcm2712.dtsi +++ b/arch/arm64/boot/dts/broadcom/bcm2712.dtsi @@ -690,8 +690,17 @@ mip1: msi-controller@1000131000 { reg = <0x10 0x00131000 0x00 0xc0>, <0xff 0xfffff000 0x00 0x1000>; msi-controller; - msi-ranges = <&gicv2 GIC_SPI 247 IRQ_TYPE_EDGE_RISING 8>; - brcm,msi-offset = <8>; + /* In MIP output order, the SPIs are not contiguous */ + msi-ranges = <&gicv2 GIC_SPI 196 IRQ_TYPE_EDGE_RISING 2>, + <&gicv2 GIC_SPI 200 IRQ_TYPE_EDGE_RISING 2>, + <&gicv2 GIC_SPI 206 IRQ_TYPE_EDGE_RISING 2>, + <&gicv2 GIC_SPI 240 IRQ_TYPE_EDGE_RISING 1>, + <&gicv2 GIC_SPI 246 IRQ_TYPE_EDGE_RISING 1>, + <&gicv2 GIC_SPI 255 IRQ_TYPE_EDGE_RISING 8>, + <&gicv2 GIC_SPI 275 IRQ_TYPE_EDGE_RISING 1>, + <&gicv2 GIC_SPI 282 IRQ_TYPE_EDGE_RISING 1>, + <&gicv2 GIC_SPI 263 IRQ_TYPE_EDGE_RISING 1>, + <&gicv2 GIC_SPI 283 IRQ_TYPE_EDGE_RISING 1>; }; isp: isp@1000880000 { -- 2.53.0 ^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-12-04 20:16 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-12-02 10:12 [PATCH 0/3] irqchip/bcm2712-mip: Expose all 20 MIP1 outputs Nicolai Buchwitz 2026-12-02 10:12 ` [PATCH 1/3] dt-bindings: interrupt-controller: brcm,bcm2712-msix: Allow multiple ranges Nicolai Buchwitz 2026-12-02 10:12 ` [PATCH 2/3] irqchip/bcm2712-mip: Support multiple MSI ranges Nicolai Buchwitz 2026-12-04 19:44 ` Thomas Gleixner 2026-12-04 20:16 ` Nicolai Buchwitz 2026-12-02 10:12 ` [PATCH 3/3] arm64: dts: broadcom: bcm2712: Expose all 20 MIP1 outputs Nicolai Buchwitz
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox