rk3588: VOP IOMMU faults at boot while the firmware window is on
Jiaxing Hu
gahing at gahingwoo.com
Sun Nov 29 18:04:31 PST 2026
Hi Chaoyi,
On 11/30/2026 9:49 AM, Chaoyi Chen wrote:
> For clk_ignore_unused and pd_ignore_unused, see this series:
>
> https://lore.kernel.org/linux-clk/20260626-clk-sync-state-v1-0-4156d8196dc8@redhat.com/
Thanks, that explains why the module case only stays clean by luck of
timing.
> This looks more like some kind of hack.
> Why not just use iommu_map() to establish a 1:1 mapping?
That is actually what I ended up doing in my Windows display driver on
RK3576 [1]. Before enabling translation in the VOP's IOMMU, it maps the
firmware framebuffer pages 1:1 at their own physical addresses so the
active scanout window keeps hitting valid memory once paging turns on.
I've had this enabled by default since Nov 21.
Here is the relevant snippet from scanout.c [2]:
/* at load: the firmware framebuffer at its own address */
for (ULONG64 p = fb & ~0xFFFull; p < fb + A->FbSize; p += PAGE_SIZE)
if (!Enter(A, (ULONG)p, p))
goto fail;
/* later, with the window still scanning: tables in, paging on */
ULONG dte = Entry((ULONG64)A->ScanTablesPa.QuadPart, 1);
for (ULONG m = VOP_MMU0; m <= VOP_MMU1; m += VOP_MMU1 - VOP_MMU0) {
W(A, m + VMMU_DTE_ADDR, dte);
W(A, m + VMMU_COMMAND, VMMU_CMD_ZAP_CACHE);
W(A, m + VMMU_INT_MASK, 0);
W(A, m + VMMU_AUTO_GATING,
R(A, m + VMMU_AUTO_GATING) | 0x80000000u);
}
W(A, VOP_MMU0 + VMMU_COMMAND, VMMU_CMD_ENABLE_PAGING);
W(A, VOP_MMU1 + VMMU_COMMAND, VMMU_CMD_ENABLE_PAGING);
Looking at rockchip_drm_drv.c, the domain gets allocated in
rockchip_drm_init_iommu() and the VOP attaches to it during bind.
Calling iommu_map() for a 1:1 mapping of the firmware framebuffer right
before that first attach should keep the live window happy. On EFI
boots the address would have to come from screen_info, since there is
no simple-framebuffer node, and it would need checking against the
window the VOP is actually scanning before it is trusted.
One gotcha I ran into on the Windows side: the 1:1 mapping has to
outlive the initial modeset. The VOP keeps scanning out from the old
address until the next frame start, so tearing down the entries right
after programming the flip triggered the exact same 0x40b fault. Any
unmap on Linux would need to wait until the next vblank after the
window actually switches over; in my driver, I just leave the entries
mapped. Here is the note I left myself when debugging it [3]:
/* The entries stay. The window moves at the next frame start, and
* until then the VOP2 is still reading this primary: with the entries
* cleared it faulted (IOMMU status 0x40b, seen when dwm.exe was ended
* a dozen times in a row). */
Francesco, thanks for running those module tests. Good to confirm it's
the power domain rather than the clocks.
In the meantime, I'll go ahead and quiesce the HDMI path in my firmware
the same way I did for DSI until a proper kernel-side fix lands.
Thanks,
Jiaxing
[1] https://github.com/gahingwoo/wddm-mali-g52
[2] https://github.com/gahingwoo/wddm-mali-g52/blob/906abc21eda0/drivers/maliwddm/scanout.c#L213-L216
https://github.com/gahingwoo/wddm-mali-g52/blob/906abc21eda0/drivers/maliwddm/scanout.c#L636-L648
[3] https://github.com/gahingwoo/wddm-mali-g52/blob/906abc21eda0/drivers/maliwddm/scanout.c#L607-L612
More information about the Linux-rockchip
mailing list