Hi Francesco, On 11/30/2026 7:13 PM, Francesco Saverio Pavone wrote: > Hi Chaoyi, Jiaxing, > > Chaoyi wrote: >> Why not just use iommu_map() to establish a 1:1 mapping? > > I tried that on the ROCK 5B+ with v7.4-rc4. It gets rid of the errors > here, but it takes two mappings. > > The stall timeouts at 0.23 s come before the DRM driver has a domain. > The VOP is in the default DMA domain by then. So there are two changes: > > 1. rockchip-iommu: .get_resv_regions = iommu_dma_get_resv_regions, so > the core maps into the default domain a reserved-memory region that > the VOP points at with memory-region and that names the VOP in > iommu-addresses; > 2. rockchip_drm_init_iommu(): map the same direct regions 1:1 in the > DRM domain and reserve them in the drm_mm, before the first attach. >
The rockchip drm use its private domain, and when you enable the vop, rockchip_drm_dma_attach_device() will make vop iommu switch to its private domain and then enable the iommu. The client off/on here essentially advances/delays the timing of DRM's first commit, so in my view it is of little significance. I think you could send three patches: 1. Add .get_resv_regions to rockchip-iommu 2. Add memory-region to the VOP binding 3. Reserve the memory-region in rockchip_drm_init_iommu() > To test them I added a node for the EDK2 buffer to the board DTS by > hand (0xe6810000, 2560x1440x4). Boots with rk_iommu errors: > > fbdev client off fbdev client on > plain v7.4-rc4 10 of 10 - > 1+2, node removed 7 of 8 - > 1 only, node 0 of 2 2 of 2 > 1+2, node 0 of 6 0 of 2 > > "Client off" is drm_client_lib.active=, where the first modeset is the > compositor's. With the client on and only patch 1, the timeouts at > 0.23 s are gone, but the VOP faults on the firmware buffer at the fbdev > modeset, 0.39 to 0.40 s: > > rk_iommu fdd97e00.iommu: Page fault at 0x00000000e6810400 of type read > > and again at 14 to 15 s, together with the two timeouts. So the second > mapping is needed, and the window is still being read long after the > first modeset. I have not looked at why patch 1 alone is enough with > the client off, and I do not know why one of the eight boots without > the node was clean. With the node and both patches the picture stayed > on the TV through the boot, with no black screen. > > Jiaxing wrote: >> On EFI boots the address would have to come from screen_info > > As far as I can tell there is none to read on this board. It boots > EDK2, then GRUB with a DTB loaded by GRUB, and no efifb or simpledrm > comes up, with the TV on or off. I have not found out why. So here the > node would have to be written by the firmware, and I only know the > address for this one mode. > >> the 1:1 mapping has to outlive the initial modeset > > I keep it until the domain is freed. > > Still open: the VOP bindings do not allow memory-region; with > IOMMU_DMA=n (32-bit ARM) both changes do nothing; and only the first > VOP is asked for its regions, which is wrong for RK3399. If this is the > direction you want, I can fix those and send the two as an RFC with a > binding patch. I have not tested with the clk sync_state series. > > The two patches were written with Claude (Anthropic). I ran the boots > above on my board and checked the logs quoted here. > > Francesco -- Best, Chaoyi
