Skip to content

bcm2712: Use all 20 MIP1 outputs - #7729

Open
nbuchwitz wants to merge 5 commits into
raspberrypi:rpi-7.4.yfrom
nbuchwitz:devel/pcie-mip1-bump
Open

nbuchwitz wants to merge 5 commits into
raspberrypi:rpi-7.4.yfrom
nbuchwitz:devel/pcie-mip1-bump

Conversation

@nbuchwitz

Copy link
Copy Markdown
Contributor

I've been experimenting with more MSI vectors on MIP1, as our RevPi Connect 5 has 3x LAN7430s on pcie1. They don't fit into the 8 MIP1 outputs (each tries to claim 6 outputs), so our DT uses the rc MSI controller instead. Unfortunately it can't pin IRQs, which is not great in most industrial fieldbus setups.

The patches seem to work for my limited PCIe knowledge, but I'd really value @P33M's (and others) feedback on it. If this can work, I'd try to upstream the patches as usual.

@nbuchwitz nbuchwitz changed the title Devel/pcie mip1 bump bcm2712: Use all 20 MIP1 outputs Oct 31, 2026
@nbuchwitz
nbuchwitz force-pushed the devel/pcie-mip1-bump branch from 55e66be to b789b8b Compare October 31, 2026 21:28
@nbuchwitz
nbuchwitz force-pushed the devel/pcie-mip1-bump branch from b789b8b to ba5b936 Compare November 2, 2026 15:34
@P33M

P33M commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

From the incomplete Broadcom documentation that I have, the MIP to SPI mappings look correct. There was a register bit on 2712C1 that the firmware always sets to enable this (expanded but discontiguous) mapping, I believe it's hardcoded to a 1 in 2712D0.

@nbuchwitz

Copy link
Copy Markdown
Contributor Author

Thanks! Has the firmware always set that bit on C1, or is there a minimum version?

@P33M

P33M commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

All rpi-eeprom releases supporting Pi 5 set this bit on C1.

@nbuchwitz
nbuchwitz force-pushed the devel/pcie-mip1-bump branch from ba5b936 to 9c77be0 Compare November 7, 2026 10:41
@nbuchwitz
nbuchwitz changed the base branch from rpi-7.3.y to rpi-7.4.y November 7, 2026 10:43
MIP1, the MSI controller behind pcie1 on BCM2712, only describes 8
outputs. I measured the wiring on a CM5 and found 20, routed to GIC
SPIs that are not contiguous.

Patch 1 documents multiple msi-ranges entries. Patch 2 fixes multi-MSI
blocks for non-power-of-two counts and is meant for stable. Patch 3
lets the driver take several ranges. Patch 4 adds the outputs and
depends on patch 3.

Tested on rpi-7.3.y on a Revolution Pi Connect 5 (CM5) with three
LAN7430 NICs behind a PCIe switch, 6 MSI-X vectors each. DPC on the
switch ports uses 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

Industrial Ethernet setups often pin each NIC's interrupts to its own
CPU. That only works on MIP1. The RC MSI target keeps everything on
CPU0. Two NVMe drives behind a switch or an FPGA design [1] hit the
same limit.

A test module requesting 3 MSI vectors per NIC gets aligned blocks with
the series. Without patch 2 the block is misaligned, its last vector
lands outside the described outputs and the device's own MSI never
arrives. The old single-range node still works.

[1] https://forums.raspberrypi.com/viewtopic.php?t=398134

Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>

--- b4-submit-tracking ---
# This section is used internally by b4 prep for tracking purposes.
{
  "series": {
    "revision": 1,
    "change-id": "20261030-investigate-bcm2712-mip1-v2-4ff97c32b04a",
    "prefixes": [],
    "presubject": ""
  }
}
…msi-ranges

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, and limit the legacy brcm,msi-offset to a
single entry, the only case the driver has ever handled.

Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
…unts

Multi-message MSI needs a naturally aligned block of message data, but
ilog2() rounds the request size down. A request for three vectors
reserves two slots and maps the third onto the next slot, which may
already belong to another device.

Reserve exactly the requested number of slots at a start aligned to the
next power of two.

Fixes: 32c6c05 ("irqchip: Add Broadcom BCM2712 MSI-X interrupt controller")
Cc: stable@vger.kernel.org
Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
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>
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.

The remaining wiring was measured on a CM5 by raising each MIP output
and checking which SPI became pending. 20 outputs are wired, the others
showed no route. The wiring is assumed to be the same on all BCM2712
steppings but has only been verified on CM5.

  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>
@nbuchwitz
nbuchwitz force-pushed the devel/pcie-mip1-bump branch from 9c77be0 to bd378e6 Compare November 12, 2026 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants