* [PATCH] bus: mhi: host: pci_generic: Disable doorbell burst mode for Quectel RM500Q-AE
@ 2026-10-13 14:14 Steve Meek via B4 Relay
2026-11-05 13:35 ` Steve Meek
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Steve Meek via B4 Relay @ 2026-10-13 14:14 UTC (permalink / raw)
To: Manivannan Sadhasivam, Jeff Hugo
Cc: Manivannan Sadhasivam, mhi, linux-arm-msm, linux-kernel, Steve Meek
From: Steve Meek <stevemeek82@gmail.com>
With burst mode enabled on the IP_HW0_MBIM hardware channels, the
RM500Q-AE downlink stops under sustained multi-stream load. The MHI
state stays M0 and uplink keeps working, but the downlink event ring
stops interrupting, and after a while the MBIM control channel times
out as well. Only a reboot recovers it.
At the stall, the last doorbell the host rang on channel 101 covered a
single buffer. The host then refilled the ring without ringing again,
as db_mode had been cleared, and the device never signalled doorbell
mode again, so it never saw the new buffers. Writing the channel 101
doorbell by hand with the current ring write pointer restores the
downlink immediately.
It is load dependent: it reproduces within a 25 second 16-stream TCP
download when the wwan0 receive work runs on the same CPU as the
modem's MSI, and was not seen with that work moved to another CPU.
PCIe runtime PM is not involved, as it reproduces with PCIe port PM
disabled.
Give the RM500Q-AE its own channel table with burst mode disabled on
the two hardware channels, so the host rings the doorbell on every
transfer. Other modems sharing the em1xx table are left unchanged.
Tested on a Xunison Exigo Hub D50 5G (IPQ5018, RM500Q-AE firmware
RM500QAEAAR13A03M4G, 6.18 with this driver): with the receive work on
the modem's CPU at up to 100% load, about 200 seconds of multi-stream
downloads at up to 135 Mbps, no stall and no MHI errors, where the
unpatched driver stalled within the first 25 second run.
Fixes: f6985f512f82 ("bus: mhi: host: pci_generic: Add Quectel RM500Q-AE support")
Assisted-by: LLM
Signed-off-by: Steve Meek <stevemeek82@gmail.com>
---
Hi Mani,
A follow-up to the RM500Q-AE support you applied on 11 Oct. Under heavy
multi-stream download the modem's downlink stalls with burst mode on,
and a manual doorbell write on channel 101 brings it straight back, so
this turns burst mode off for the RM500Q-AE's two hardware channels
only.
The stall looks like a lost doorbell-mode handshake rather than
anything board-specific, so it may affect other modems on the shared
em1xx table under the same load. I've only got the RM500Q-AE to test
on, so I've kept the change to that device. If you'd rather it were
fixed in the core, I'm happy to send the traces from the stall.
---
drivers/bus/mhi/host/pci_generic.c | 49 +++++++++++++++++++++++++++++++++++++-
1 file changed, 48 insertions(+), 1 deletion(-)
diff --git a/drivers/bus/mhi/host/pci_generic.c b/drivers/bus/mhi/host/pci_generic.c
index 7193a384c..f6672f1cc 100644
--- a/drivers/bus/mhi/host/pci_generic.c
+++ b/drivers/bus/mhi/host/pci_generic.c
@@ -490,10 +490,57 @@ static const struct mhi_pci_dev_info mhi_quectel_rm5xx_info = {
.sideband_wake = true,
};
+/*
+ * The RM500Q-AE stalls its downlink when the host refills the hardware
+ * channel in burst mode: the last doorbell covers one buffer, the host
+ * then queues the rest without ringing, and the device never signals
+ * doorbell mode again. Ring the doorbell on every transfer instead.
+ */
+#define MHI_CHANNEL_CONFIG_HW_NOBRST(ch_num, ch_name, el_count, ev_ring, d) \
+ { \
+ .num = ch_num, \
+ .name = ch_name, \
+ .num_elements = el_count, \
+ .event_ring = ev_ring, \
+ .dir = d, \
+ .ee_mask = BIT(MHI_EE_AMSS), \
+ .pollcfg = 0, \
+ .doorbell = MHI_DB_BRST_DISABLE, \
+ .lpm_notify = false, \
+ .offload_channel = false, \
+ .doorbell_mode_switch = false, \
+ }
+
+static const struct mhi_channel_config mhi_quectel_rm500q_channels[] = {
+ MHI_CHANNEL_CONFIG_UL(0, "NMEA", 32, 0),
+ MHI_CHANNEL_CONFIG_DL(1, "NMEA", 32, 0),
+ MHI_CHANNEL_CONFIG_UL_SBL(2, "SAHARA", 32, 0),
+ MHI_CHANNEL_CONFIG_DL_SBL(3, "SAHARA", 32, 0),
+ MHI_CHANNEL_CONFIG_UL(4, "DIAG", 32, 1),
+ MHI_CHANNEL_CONFIG_DL(5, "DIAG", 32, 1),
+ MHI_CHANNEL_CONFIG_UL(12, "MBIM", 32, 0),
+ MHI_CHANNEL_CONFIG_DL(13, "MBIM", 32, 0),
+ MHI_CHANNEL_CONFIG_UL(32, "DUN", 32, 0),
+ MHI_CHANNEL_CONFIG_DL(33, "DUN", 32, 0),
+ MHI_CHANNEL_CONFIG_UL_FP(34, "FIREHOSE", 32, 0),
+ MHI_CHANNEL_CONFIG_DL_FP(35, "FIREHOSE", 32, 0),
+ MHI_CHANNEL_CONFIG_HW_NOBRST(100, "IP_HW0_MBIM", 128, 2, DMA_TO_DEVICE),
+ MHI_CHANNEL_CONFIG_HW_NOBRST(101, "IP_HW0_MBIM", 128, 3, DMA_FROM_DEVICE),
+};
+
+static const struct mhi_controller_config modem_quectel_rm500q_config = {
+ .max_channels = 128,
+ .timeout_ms = 20000,
+ .num_channels = ARRAY_SIZE(mhi_quectel_rm500q_channels),
+ .ch_cfg = mhi_quectel_rm500q_channels,
+ .num_events = ARRAY_SIZE(mhi_quectel_em1xx_events),
+ .event_cfg = mhi_quectel_em1xx_events,
+};
+
static const struct mhi_pci_dev_info mhi_quectel_rm500q_info = {
.name = "quectel-rm500q",
.edl = "qcom/sdx55m/edl.mbn",
- .config = &modem_quectel_em1xx_config,
+ .config = &modem_quectel_rm500q_config,
.bar_num = MHI_PCI_DEFAULT_BAR_NUM,
.dma_data_width = 32,
.mru_default = 32768,
---
base-commit: 0b1883ca75c0005ab5ca52c7bc1a26329bc39746
change-id: 20261013-rm500q-db-burst-ec580ca88331
Best regards,
--
Steve Meek <stevemeek82@gmail.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] bus: mhi: host: pci_generic: Disable doorbell burst mode for Quectel RM500Q-AE
2026-10-13 14:14 [PATCH] bus: mhi: host: pci_generic: Disable doorbell burst mode for Quectel RM500Q-AE Steve Meek via B4 Relay
@ 2026-11-05 13:35 ` Steve Meek
2026-12-02 4:44 ` Manivannan Sadhasivam
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Steve Meek @ 2026-11-05 13:35 UTC (permalink / raw)
To: mhi; +Cc: linux-arm-msm, linux-kernel
Hi Mani,
Gentle ping on this one. Happy to resend or rework it if you'd prefer a
different approach, or to send the traces from the stall if a core fix
would be better.
Thanks,
Steve
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] bus: mhi: host: pci_generic: Disable doorbell burst mode for Quectel RM500Q-AE
2026-10-13 14:14 [PATCH] bus: mhi: host: pci_generic: Disable doorbell burst mode for Quectel RM500Q-AE Steve Meek via B4 Relay
2026-11-05 13:35 ` Steve Meek
@ 2026-12-02 4:44 ` Manivannan Sadhasivam
2026-12-05 23:25 ` Muhammad Huda Nugroho
2026-12-05 23:32 ` Muhammad Huda Nugroho
3 siblings, 0 replies; 7+ messages in thread
From: Manivannan Sadhasivam @ 2026-12-02 4:44 UTC (permalink / raw)
To: Jeff Hugo, Steve Meek
Cc: Manivannan Sadhasivam, mhi, linux-arm-msm, linux-kernel
On Tue, 13 Oct 2026 15:14:34 +0100, Steve Meek wrote:
> With burst mode enabled on the IP_HW0_MBIM hardware channels, the
> RM500Q-AE downlink stops under sustained multi-stream load. The MHI
> state stays M0 and uplink keeps working, but the downlink event ring
> stops interrupting, and after a while the MBIM control channel times
> out as well. Only a reboot recovers it.
>
> At the stall, the last doorbell the host rang on channel 101 covered a
> single buffer. The host then refilled the ring without ringing again,
> as db_mode had been cleared, and the device never signalled doorbell
> mode again, so it never saw the new buffers. Writing the channel 101
> doorbell by hand with the current ring write pointer restores the
> downlink immediately.
>
> [...]
Applied, thanks!
[1/1] bus: mhi: host: pci_generic: Disable doorbell burst mode for Quectel RM500Q-AE
commit: c466430c21f8f51adabd30c00963226dc094db3f
Best regards,
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] bus: mhi: host: pci_generic: Disable doorbell burst mode for Quectel RM500Q-AE
@ 2026-12-05 23:25 ` Muhammad Huda Nugroho
2026-12-06 12:06 ` Steve Meek
2026-12-06 12:19 ` Steve Meek
0 siblings, 2 replies; 7+ messages in thread
From: Muhammad Huda Nugroho @ 2026-12-05 23:25 UTC (permalink / raw)
To: stevemeek82
Cc: manivannan.sadhasivam, jeff.hugo, mhi, linux-arm-msm, linux-kernel
Hi Steve,
A datapoint from another IPQ5018 board with a different Quectel modem,
because the signature you describe is the one I spent a while chasing.
The board is a whitelabel IPQ5018 CPE (QDM530) with a Quectel RG520N-EB
(SDX6x) on PCIe/MHI. It enumerates as the plain 17cb:0308, so it falls
through to the generic modem_qcom_v1 table rather than em1xx, and it runs
mhi_net + rmnet/QMAP on 6.18.60 (OpenWrt/ImmortalWrt), two Cortex-A53 at
1 GHz doing NAT, routing and Wi-Fi at the same time.
The failure reads the same as yours: under sustained downlink the rmnet
rx counter freezes mid-transfer while tx keeps rising, the link and the
registration stay up, the MHI state stays M0, nothing appears in the log,
and only a modem reset or a reboot brings the downlink back. It wedged
after 30-43k rmnet packets, a few tens of MB.
Where my evidence differs from yours is the doorbell. At the stall,
debugfs showed that the host's doorbell had been rung and did cover the
queued buffers: on IP_HW0(101) the write pointer was ~56 elements ahead
of the read pointer with db >= wp, while the dedicated DL event ring had
its read pointer caught up to its write pointer and the MSI for it had
gone silent. That does not match a cleared db_mode the device never asked
to leave - unless the doorbell I was looking at was written after the
device had already stopped. It is a single sample taken after the fact, so
I cannot time the two against each other, and I would not claim it rules
your mechanism out.
What fixed it here was ring depth: IP_HW0 UL/DL 128 -> 512 in
modem_qcom_v1, which Mani applied as cc3a63ee69b3. With doorbell burst
mode left enabled, that alone carried 648 MB of sustained downlink,
450,768 rmnet packets at ~2.0k packets/s, with rx_err, rx_drop and
rx_fifo all zero, where the unpatched driver wedged an order of magnitude
earlier.
I also ran your knob, since I had suspected the same thing you found:
burst mode disabled on the two hardware channels, on top of the 512-entry
ring, same load script. 648 MB and zero freeze as well - indistinguishable
from the ring change on its own. With the deeper ring I was never able to
reproduce the wedge with burst mode either on or off, so this board cannot
separate the two mechanisms. It only says the deeper ring was sufficient at
the rate I can reach.
That rate is the caveat. This cell gives me 25-35 Mbps, with QMAP
aggregating ~13 rmnet packets per MHI transfer. Your 16-stream, 135 Mbps
regime is well past anything I have measured, so if the lost handshake is
driven by how fast the ring drains, my runs would not have seen it.
If it would help decide whether the generic modem_qcom_v1 table wants
burst mode off as well, I am happy to run whatever you would like on this
board: burst on/off against a 128 or 512 ring in any combination, plus the
debugfs snapshot at the stall. The combination I never tried is the
interesting one - 128-entry ring with burst mode disabled - because that is
what would show whether turning burst mode off is enough on its own, or
whether the two are the same window seen from different sides.
Thanks,
Muhammad Huda Nugroho
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] bus: mhi: host: pci_generic: Disable doorbell burst mode for Quectel RM500Q-AE
2026-10-13 14:14 [PATCH] bus: mhi: host: pci_generic: Disable doorbell burst mode for Quectel RM500Q-AE Steve Meek via B4 Relay
` (2 preceding siblings ...)
2026-12-05 23:25 ` Muhammad Huda Nugroho
@ 2026-12-05 23:32 ` Muhammad Huda Nugroho
3 siblings, 0 replies; 7+ messages in thread
From: Muhammad Huda Nugroho @ 2026-12-05 23:32 UTC (permalink / raw)
To: Steve Meek
Cc: Manivannan Sadhasivam, Jeffrey Hugo, mhi, linux-arm-msm, linux-kernel
A reply I sent a couple of hours ago left my mailer without In-Reply-To,
so it reached the list outside this thread. For the archive, it is at:
Message-ID: <20261205232510.MxJpT%mhudan21@gmail.com>
https://lore.kernel.org/mhi/20261205232510.MxJpT%25mhudan21@gmail.com/
In short: the same downlink stall signature on a second IPQ5018 board, an
RG520N-EB on the generic modem_qcom_v1 table, where enlarging the IP_HW0
rings to 512 removed it with burst mode left enabled - and where debugfs
at the stall showed the doorbell had been rung and did cover the queued
buffers (wp ahead of rp, db >= wp), which does not match a cleared
db_mode. I could not reproduce the stall with the deeper ring either way,
so that board cannot separate the two mechanisms, and its link only ever
reached 25-35 Mbps. The untried combination, if you want it run, is a
128-entry ring with burst mode disabled.
Sorry for the stray mail.
Thanks,
Muhammad Huda Nugroho
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] bus: mhi: host: pci_generic: Disable doorbell burst mode for Quectel RM500Q-AE
2026-12-05 23:25 ` Muhammad Huda Nugroho
@ 2026-12-06 12:06 ` Steve Meek
2026-12-06 12:19 ` Steve Meek
1 sibling, 0 replies; 7+ messages in thread
From: Steve Meek @ 2026-12-06 12:06 UTC (permalink / raw)
To: Muhammad Huda Nugroho
Cc: Manivannan Sadhasivam, manivannan.sadhasivam, jeff.hugo, mhi,
linux-arm-msm, linux-kernel
Hi Muhammad,
Thanks for the data, that's really useful. Mani applied this one on
2 Dec.
The combination you didn't try is actually what I've been running: the
RM500Q-AE keeps the 128-entry ring and only has burst mode off. That ran
about 200 seconds of multi-stream downloads at up to 135 Mbps with no
stall, where it stalled in the first 25 seconds with burst on. So on
this modem burst off alone was enough, at a rate well above what your
cell gives you. It's a different modem and a different channel table
though, so I wouldn't read too much into it for modem_qcom_v1.
I didn't try the 512 ring on the RM500Q-AE, so I can't say if that would
have fixed it on its own as well.
Thanks,
Steve
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] bus: mhi: host: pci_generic: Disable doorbell burst mode for Quectel RM500Q-AE
2026-12-05 23:25 ` Muhammad Huda Nugroho
2026-12-06 12:06 ` Steve Meek
@ 2026-12-06 12:19 ` Steve Meek
1 sibling, 0 replies; 7+ messages in thread
From: Steve Meek @ 2026-12-06 12:19 UTC (permalink / raw)
To: Muhammad Huda Nugroho
Cc: Manivannan Sadhasivam, manivannan.sadhasivam, jeff.hugo, mhi,
linux-arm-msm, linux-kernel
Hi Muhammad,
If you're up for running it, the test that proved it on the D50 was
ringing the doorbell by hand at the stall, without resetting anything.
If the downlink comes straight back, the device missed or ignored a
doorbell. If it doesn't, the device has stopped on its own side, which
would fit what your debugfs showed.
What I did, on a 128-entry ring build so it actually stalls:
1. Read CHDBOFF from BAR0 + 0x18. On the RM500Q-AE it was 0x300, so
channel 101's doorbell is CHDBOFF + 8 * 101 = 0x628.
2. At the stall, take the channel 101 context wp from
/sys/kernel/debug/mhi/<dev>/channels (the bus address, not the local
pointer).
3. Write 0 to the high word (doorbell + 4) first, then the wp to the
doorbell. I used a small mmio tool on resource0 of the modem's PCI
device.
On the D50 the downlink came back immediately every time.
If that doesn't bring yours back, it might be worth doing the same for
the downlink event ring: ERDBOFF from BAR0 + 0x20, the ring's doorbell
at ERDBOFF + 8 * ring number, written with the event ring wp from the
events file. If that's what brings it back, the device had run out of
room to post completions rather than missing a channel doorbell.
And the 128-entry ring with burst mode off would still be good to run.
If that never stalls either, it points to modem_qcom_v1 wanting the
same change.
Thanks,
Steve
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-12-06 12:19 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-13 14:14 [PATCH] bus: mhi: host: pci_generic: Disable doorbell burst mode for Quectel RM500Q-AE Steve Meek via B4 Relay
2026-11-05 13:35 ` Steve Meek
2026-12-02 4:44 ` Manivannan Sadhasivam
2026-12-05 23:25 ` Muhammad Huda Nugroho
2026-12-06 12:06 ` Steve Meek
2026-12-06 12:19 ` Steve Meek
2026-12-05 23:32 ` Muhammad Huda Nugroho
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®