* [PATCH v2 1/3] dt-bindings: interrupt-controller: brcm,bcm2712-msix: Allow multiple ranges
2026-12-04 21:18 [PATCH v2 0/3] irqchip/bcm2712-mip: Expose all 20 MIP1 outputs Nicolai Buchwitz
@ 2026-12-04 21:18 ` Nicolai Buchwitz
2026-12-04 21:18 ` [PATCH v2 2/3] irqchip/bcm2712-mip: Support multiple MSI ranges Nicolai Buchwitz
2026-12-04 21:18 ` [PATCH v2 3/3] arm64: dts: broadcom: bcm2712: Expose all 20 MIP1 outputs Nicolai Buchwitz
2 siblings, 0 replies; 5+ messages in thread
From: Nicolai Buchwitz @ 2026-12-04 21:18 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] 5+ messages in thread* [PATCH v2 2/3] irqchip/bcm2712-mip: Support multiple MSI ranges
2026-12-04 21:18 [PATCH v2 0/3] irqchip/bcm2712-mip: Expose all 20 MIP1 outputs Nicolai Buchwitz
2026-12-04 21:18 ` [PATCH v2 1/3] dt-bindings: interrupt-controller: brcm,bcm2712-msix: Allow multiple ranges Nicolai Buchwitz
@ 2026-12-04 21:18 ` Nicolai Buchwitz
2026-12-04 21:18 ` [PATCH v2 3/3] arm64: dts: broadcom: bcm2712: Expose all 20 MIP1 outputs Nicolai Buchwitz
2 siblings, 0 replies; 5+ messages in thread
From: Nicolai Buchwitz @ 2026-12-04 21:18 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 | 126 ++++++++++++++++++++++++--------------
1 file changed, 79 insertions(+), 47 deletions(-)
diff --git a/drivers/irqchip/irq-bcm2712-mip.c b/drivers/irqchip/irq-bcm2712-mip.c
index 5a13bb4c18f6..be2630d20cf7 100644
--- a/drivers/irqchip/irq-bcm2712-mip.c
+++ b/drivers/irqchip/irq-bcm2712-mip.c
@@ -26,23 +26,25 @@
#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
- * @num_msis: Count of MSIs
- * @msi_offset: MSI offset
- * @bitmap: A bitmap for hwirqs
- * @parent: Parent domain (GIC)
- * @dev: A device pointer
+ * @lock: Used to protect bitmap alloc/free
+ * @base: Base address of MMIO area
+ * @msg_addr: PCIe MSI-X address
+ * @parent_irqs: GIC SPI numbers indexed by MIP message data
+ * @num_msis: Count of MSIs
+ * @msi_offset: MSI offset
+ * @bitmap: A bitmap for hwirqs
+ * @parent: Parent domain (GIC)
+ * @dev: A device pointer
*/
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);
@@ -95,8 +96,8 @@ static int mip_middle_domain_alloc(struct irq_domain *domain, unsigned int virq,
unsigned int nr_irqs, void *arg)
{
struct mip_priv *mip = domain->host_data;
+ unsigned int hwirq, i, allocated = 0;
struct irq_fwspec fwspec = {0};
- unsigned int hwirq, i;
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,
};
@@ -208,37 +212,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;
+ int ret, count;
+ u32 first;
u64 size;
- int ret;
ret = of_property_read_u32(np, "brcm,msi-offset", &mip->msi_offset);
if (ret)
mip->msi_offset = 0;
+ if (mip->msi_offset >= MIP_NUM_IRQS)
+ return -EINVAL;
- ret = of_parse_phandle_with_args(np, "msi-ranges", "#interrupt-cells",
- 0, &args);
+ ret = of_property_read_reg(np, 1, &mip->msg_addr, &size);
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;
+ /* <&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;
- ret = of_property_read_reg(np, 1, &mip->msg_addr, &size);
- if (ret)
- goto err_put;
+ first = mip->msi_offset;
+ for (int range = 0; range < count / 5; range++) {
+ struct of_phandle_args args;
+ struct irq_domain *parent;
+ u32 span, cells;
+
+ ret = of_parse_phandle_with_fixed_args(np, "msi-ranges", 4, range, &args);
+ if (ret)
+ return ret;
- mip->msi_base = args.args[1];
+ ret = of_property_read_u32(args.np, "#interrupt-cells", &cells);
+ parent = irq_find_host(args.np);
+ of_node_put(args.np);
+ if (ret)
+ return ret;
- mip->parent = irq_find_host(args.np);
- if (!mip->parent)
- 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)
+ return -EINVAL;
-err_put:
- of_node_put(args.np);
- return ret;
+ if (!parent || (mip->parent && parent != mip->parent))
+ return -EINVAL;
+ mip->parent = parent;
+
+ /* The legacy offset shifts the SPI as well as the message data */
+ for (unsigned int i = 0; i < span; i++)
+ mip->parent_irqs[first + i] = args.args[1] + mip->msi_offset + i;
+ first += span;
+ }
+ mip->num_msis = first - mip->msi_offset;
+ return 0;
}
static int mip_msi_probe(struct platform_device *pdev, struct device_node *parent)
@@ -264,18 +290,24 @@ 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;
}
+ /*
+ * The bitmap is indexed by message data. Mark everything outside the
+ * outputs described in DT as allocated, so it is never handed out.
+ */
+ 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] 5+ messages in thread* [PATCH v2 3/3] arm64: dts: broadcom: bcm2712: Expose all 20 MIP1 outputs
2026-12-04 21:18 [PATCH v2 0/3] irqchip/bcm2712-mip: Expose all 20 MIP1 outputs Nicolai Buchwitz
2026-12-04 21:18 ` [PATCH v2 1/3] dt-bindings: interrupt-controller: brcm,bcm2712-msix: Allow multiple ranges Nicolai Buchwitz
2026-12-04 21:18 ` [PATCH v2 2/3] irqchip/bcm2712-mip: Support multiple MSI ranges Nicolai Buchwitz
@ 2026-12-04 21:18 ` Nicolai Buchwitz
2026-12-04 21:32 ` sashiko-bot
2 siblings, 1 reply; 5+ messages in thread
From: Nicolai Buchwitz @ 2026-12-04 21:18 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] 5+ messages in thread