From: Francesco Saverio Pavone <pavone.lawyer@gmail.com>
To: Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
Robin Murphy <robin.murphy@arm.com>,
Sandy Huang <hjc@rock-chips.com>,
Heiko Stuebner <heiko@sntech.de>, Andy Yan <andyshrk@163.com>,
Chaoyi Chen <chaoyi.chen@rock-chips.com>
Cc: Damon Ding <damon.ding@rock-chips.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Jiaxing Hu <gahing@gahingwoo.com>,
iommu@lists.linux.dev, dri-devel@lists.freedesktop.org,
devicetree@vger.kernel.org, linux-rockchip@lists.infradead.org,
linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH 0/3] rockchip: keep the bootloader framebuffer mapped behind the VOP IOMMU
Date: Fri, 4 Dec 2026 07:24:07 +0100 [thread overview]
Message-ID: <cover.1796334467.git.pavone.lawyer@gmail.com> (raw)
Hi,
This is the series Chaoyi asked for in [1]. On a ROCK 5B+ (RK3588)
started from EDK2 the firmware leaves one VOP2 window scanning out of
its framebuffer, and the VOP MMU faults on it: first when the default
DMA domain is installed with an empty page table and, with the fbdev
client on, again when the VOP is moved to the private domain of the
DRM driver.
Patch 1 makes rockchip-iommu report the reserved regions from the
devicetree, so the core maps them 1:1 in the default domain. Patch 2
lets a VOP2 node carry memory-region. Patch 3 gives the same regions a
1:1 mapping in the DRM domain and keeps them out of the drm_mm.
Tested on v7.4-rc5 on the ROCK 5B+, with this node added to the board
DTS by hand (not part of the series):
reserved-memory {
fw_fb: framebuffer@e6810000 {
reg = <0x0 0xe6810000 0x0 0x00e10000>;
iommu-addresses = <&vop 0x0 0xe6810000 0x0 0x00e10000>;
};
};
&vop {
memory-region = <&fw_fb>;
};
Boots with rk_iommu errors in the log:
fbdev client off fbdev client on
v7.4-rc5 3 of 3 2 of 2
series, no node 2 of 2 2 of 2
series, node 0 of 4 0 of 4
The two "series" rows are the same kernel image with a different DTB.
With the client off the errors are the two "Enable stall request timed
out" lines at 0.2 s. With the client on the same two lines come back
when the compositor starts, in all four boots, and there are one to
three page faults on the firmware buffer (0xe6810000 and up), at 0.4 s
and in two of the four boots again at that point. With the node, the
VOP group lists the region 0xe6810000-0xe761ffff as direct in
reserved_regions and the log has no rk_iommu line at all.
I watched one boot with the series, the node and the client on: the
TV shows the firmware logo, then the kernel console, then the desktop,
and never loses the signal.
Robin, on the points you raised in [2]:
- rk_iommu_probe() does not touch the hardware. For the default
domain the page table is first loaded from the runtime resume, when
the VOP resumes through the device link, and by then the core has
already created the direct mappings. rk_iommu_enable() still does a
force reset first, with the window running; I have not changed
that.
- The switch to the DRM domain is different: it happens with the VOP
active, so rk_iommu_attach_device() turns paging off, resets and
loads the new table. Patch 3 has the region mapped in that table
before the attach. The logs above show no fault across it, but the
reset with a live window is still there.
- The IOMMU starts runtime suspended and I found nothing that resumes
it before the consumer link exists. On suspend the driver turns
paging off, which for a 1:1 region addresses the same memory, and
on resume it loads the same table again.
What this does not cover, and where I would like your opinion:
- Patch 1 uses of_iommu_get_resv_regions() directly, not
iommu_dma_get_resv_regions(), so that patch 3 can read the regions
on 32-bit ARM, where IOMMU_DMA is not there. On 32-bit ARM the core
maps nothing (the default domain is the identity domain) and the
ARM DMA mapping installed for the VOP is empty, so until the DRM
attach nothing is mapped there. Compile-tested only on 32-bit ARM.
- The region is reported as direct, so the core keeps it as a
required direct mapping for the life of the device. Is that
acceptable for a buffer that is only needed until the first frame?
- The IOVA space is 32 bits. A buffer above 4 GiB cannot be mapped
1:1; patch 3 skips it with a warning, patch 1 does not check.
- Patch 3 calls iommu_get_resv_regions() from a DRM driver, which no
other driver does. Should this be a helper in the iommu core?
- The mapping and the hole in the IOVA space stay until the domain is
freed, because the driver does not know when the old buffer is read
for the last time.
- The power domain of the VOP is switched off as unused when the DRM
driver binds late, as a module. The picture is lost then, whatever
is mapped. I saw that on v7.4-rc4; not retested with the series.
- Nothing in mainline writes the node. The address depends on the
mode the firmware picked, so the firmware has to add it, the way
the exynos7870 boards describe theirs for the decon.
- VOP1 resets itself and turns its windows off at bind, so I left
rockchip-vop.yaml alone. Not tested on VOP1 hardware.
dt_binding_check is clean for rockchip-vop2.yaml (dtschema 2026.9),
and so is CHECK_DTBS for the board DTB with the node added.
The patches were written with Claude (Anthropic). I ran the boots
above on my board and checked the logs.
[1] https://lore.kernel.org/all/2148a630-6aec-40ee-9c82-3541c65e87bc@rock-chips.com/
[2] https://lore.kernel.org/all/2ea06ad1-779d-47fd-aa7a-20aba129d14e@arm.com/
Francesco Saverio Pavone (3):
iommu/rockchip: Report the reserved regions from the devicetree
dt-bindings: display: vop2: Allow memory-region
drm/rockchip: Map the reserved regions 1:1 in the DRM IOMMU domain
.../display/rockchip/rockchip-vop2.yaml | 6 +
drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 121 ++++++++++++++++++
drivers/gpu/drm/rockchip/rockchip_drm_drv.h | 2 +
drivers/iommu/rockchip-iommu.c | 2 +
4 files changed, 131 insertions(+)
base-commit: fe6ff8d5d675c01793b9f051d16055dd4aa75244
--
2.54.0
next reply other threads:[~2026-12-04 6:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 6:24 Francesco Saverio Pavone [this message]
2026-12-04 6:24 ` [RFC PATCH 1/3] iommu/rockchip: Report the reserved regions from the devicetree Francesco Saverio Pavone
2026-12-04 6:32 ` Chaoyi Chen
2026-12-04 6:24 ` [RFC PATCH 2/3] dt-bindings: display: vop2: Allow memory-region Francesco Saverio Pavone
2026-12-04 6:24 ` [RFC PATCH 3/3] drm/rockchip: Map the reserved regions 1:1 in the DRM IOMMU domain Francesco Saverio Pavone
2026-12-04 7:14 ` Chaoyi Chen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1796334467.git.pavone.lawyer@gmail.com \
--to=pavone.lawyer@gmail.com \
--cc=airlied@gmail.com \
--cc=andyshrk@163.com \
--cc=chaoyi.chen@rock-chips.com \
--cc=conor+dt@kernel.org \
--cc=damon.ding@rock-chips.com \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=gahing@gahingwoo.com \
--cc=heiko@sntech.de \
--cc=hjc@rock-chips.com \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=robh@kernel.org \
--cc=robin.murphy@arm.com \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox