Skip to contentSkip to conversation

rk3588: VOP IOMMU faults at boot while the firmware window is on

DISCUSSION Francesco Saverio Pavone 2 participants 2 messages Nov 29 Arm Rockchip

lore
Share & tools
lore
#0 lore raw

Hi,

On a ROCK 5B+ (RK3588) booted from EDK2 with the display on, plain v7.4-rc4 logs this around the VOP bind:

platform fdd90000.vop: Adding to iommu group 7
...
rk_iommu fdd97e00.iommu: Enable stall request timed out, status: 0x00001d rk_iommu fdd97e00.iommu: Enable stall request timed out, status: 0x00030b rockchip-drm display-subsystem: bound fdd90000.vop (ops vop2_component_ops) rk_iommu fdd97e00.iommu: Page fault at 0x00000000e6810000 of type read

Bank 0 stalls. Bank 1 is paging with a page fault active, bus id 0xc, and never stalls. The stall lines and a page fault come once more about 13 s into the boot.

This looks like what Jagan Teki reported for RK3328 in 2023 [1], where Robin pointed out that resetting the IOMMU while bootloader framebuffer traffic is still going through is a problem of its own. Lucas Tanure's PX30 patch from 14 Nov [2] deals with the same kind of master at reboot.

What I traced here: the firmware leaves one window enabled (Esmart2 on VP2) and it keeps reading its framebuffer. Paging is first enabled from the IOMMU's runtime resume, the read faults because that address is not mapped, and the stall times out. b10d5920cafa acks the stale fault, but the window is still running and faults again at once. A 7.2-rc5 tree without that commit logs the same two lines. Jiaxing Hu's patch from 23 Nov [3] does not change them either: both banks report paging enabled, so its check does not trigger.

As an experiment, on a tree with Collabora's rockchip-devel on top, I disabled that window, put VP2 in standby and waited for it before letting the IOMMU enable paging. That took 22 and 31 ms in two boots and the two lines were gone in both. The hack does it from rockchip-iommu.c by writing VOP registers, so it is not a patch. I can post it for reference.

Where should this be handled? The driver has no get_resv_regions, so iommu-addresses on a firmware framebuffer node would not help today. The reset that Collabora's tree does in vop2_bind() comes after the first paging enable: with it the page fault line is gone, the two stall lines stay. Or is the firmware expected to turn the display off?

One board, one firmware (EDK2 v1.1.1 for the ROCK 5B+). The plain v7.4-rc4 log is from a single boot; the Collabora-based tree shows the two stall lines on every boot.

LLM agents (OpenAI Codex and Hermes) wrote the instrumentation and ran the boots on my board, and Claude helped write this mail. I went through the traces quoted here.

Francesco

[1] https://lore.kernel.org/all/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/
[3] https://lore.kernel.org/all/[email protected]/

#1 lore raw

Hi Francesco,

I am seeing the same behavior on RK3576 with my EDK2 port (edk2-rk3576, https://github.com/gahingwoo/edk2-rk3576). When booting Armbian 7.3.4-edge (with rockchipdrm built in) on a TaishanPi 3M, the firmware hands over control while Esmart0 on VP0 is still scanning out the HDMI framebuffer at 0xff190000. Shortly after the VOP binds, when it is first enabled, the kernel logs:

rk_iommu 27d07e00.iommu: Enable stall request timed out, status: 0x00040b rk_iommu 27d07e00.iommu: Enable stall request timed out, status: 0x00001d rockchip-drm display-subsystem: [drm] *ERROR* POST_BUF_EMPTY irq err at vp0

This happened in 2 out of 3 HDMI boots where the VOP managed to bind. The 0x40b status matches your 0x30b (just with bus ID 0x10), meaning paging is enabled with an active page fault. On a DSI boot before my fix, the same pair of timeouts came on every DRM enable, and later a BUS_ERROR.

To work around this on the DSI path, I added a quirk at ExitBootServices when booting Linux: it turns off the window, puts the VP into standby, and waits for DSP_HOLD_VALID. Essentially, it is your experiment implemented in the firmware. Across 32 DSI Linux boots since that change, I haven't seen a single rk_iommu error. Take that with a grain of salt, though, as most of those runs only captured partial serial logs. The HDMI path still hands over a live window for now, and I plan to quiesce it the same way.

Regarding my IOMMU patch from Nov 23 [1]: that originated from an RK3576 NPU issue, where one bank kept paging after a core reset while the other didn't, causing the all-banks guards to skip the stall and breaking the force reset. You're right that it doesn't help here when both banks are paging.

One data point from the OS side: my Windows display driver takes over the live window without tearing it down first. It avoids faulting by identity-mapping the firmware framebuffer in the VOP IOMMU right before enabling paging. Getting that seamless handover on Linux would need something like get_resv_regions in rockchip-iommu, so that iommu-addresses on the framebuffer node is honored. Quiescing in firmware works today without kernel changes, at the cost of blanking the screen until KMS sets a mode.

A CM5-IO running Fedora (where rockchipdrm is built as a module) showed none of these faults across 16 boots in September (7.3.0-rc3-next). I suspect clk_disable_unused gates the VOP clocks before the module gets a chance to load, though I haven't verified that yet.

Thanks,
Jiaxing

[1] https://lore.kernel.org/all/[email protected]/