Linux-Rockchip Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH v2 0/3] rockchip: keep the bootloader framebuffer mapped behind the VOP IOMMU
@ 2026-12-04 10:27 Francesco Saverio Pavone
  2026-12-04 10:27 ` [RFC PATCH v2 1/3] iommu/rockchip: Report the reserved regions from the devicetree Francesco Saverio Pavone
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Francesco Saverio Pavone @ 2026-12-04 10:27 UTC (permalink / raw)
  To: Joerg Roedel, Will Deacon, Robin Murphy, Sandy Huang,
	Heiko Stuebner, Andy Yan, Chaoyi Chen
  Cc: Damon Ding, Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie, Simona Vetter, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Jiaxing Hu, iommu, dri-devel, devicetree,
	linux-rockchip, linux-arm-kernel

Hi,

This series keeps the framebuffer that the firmware leaves on screen
mapped while the kernel takes the display over. Patch 1 makes
rockchip-iommu report the reserved regions from the devicetree. Patch 2
lets a VOP2 node carry memory-region. Patch 3 maps the same regions
1:1 in the DRM driver's IOMMU domain. Tested on a ROCK 5B+ (RK3588)
started from EDK2.

Changes since v1:

Patch 1:
 - Drop a direct region that does not fit in the 32-bit IOVA space,
   clip a reserved region that crosses 4 GiB and drop one above it.
   A dropped region is reported with a ratelimited warning
   (sashiko [2]).
   I did not add range checks to map/unmap/iova_to_phys: iommu-dma
   allocates below aperture_end, the DRM drm_mm covers only the
   aperture, and the core direct mappings now only see regions below
   4 GiB.
 - Shorter commit message (Chaoyi [1]).

Patch 2:
 - Commit message reworded, it overstated how long the mapping lasts.
   The binding text is unchanged.

Patch 3:
 - Keep IOMMU_RESV_RESERVED ranges out of the drm_mm without mapping
   them (sashiko [3]).
 - Round in one helper, with the smallest page of the domain, like the
   iommu core. A direct range is mapped as the core maps it, so the
   head page of an unaligned region is not mapped. Every range is kept
   out of the drm_mm rounded out (Chaoyi [4]).
 - Merge overlapping ranges, so the union is kept out of the drm_mm
   and each direct page is mapped once (Chaoyi [4]).
 - A direct range that overlaps one with a different prot is not
   mapped, with a warning; its hole stays reserved.
 - Drop the comment above the collect function and shorten the commit
   message (Chaoyi [4]).

Test, on v7.4-rc5 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>;
  };

With the node, v2 had no rk_iommu line in 2 of 2 boots with the fbdev
client off and 3 of 3 with it on. The VOP group lists
0xe6810000-0xe761ffff as direct in reserved_regions, and there are no
warnings. I watched one boot with
the client on: firmware logo, console, desktop, no lost picture. The
rows without the node were not rerun. In v1 they had errors in every
boot: v7.4-rc5 3 of 3 and 2 of 2, series without the node 2 of 2 and
2 of 2.

Not tested:
 - No devicetree exercised the new paths at run time (reserved-only
   region, region above 4 GiB, unaligned, overlapping). I checked the
   merge and rounding logic with a small userspace test and by reading
   the code.
 - 32-bit ARM is compile-tested only, with clang.
 - No 16K or 64K page build.
 - VOP1: only the VOP2 binding allows memory-region, so nothing is
   collected for VOP1.

Limits kept from v1:
 - The direct region stays required for the life of the device.
 - The mapping stays until the domain is freed.
 - A late bind as a module loses the power domain of the VOP.
 - Nothing in mainline writes the node.

The questions for Robin in v1 [5] still stand, except the 4 GiB one,
which patch 1 now handles.

Checks: W=1 builds of rockchip-iommu and drivers/gpu/drm/rockchip are
clean at each commit, on arm64 and on 32-bit ARM. dt_binding_check was
not rerun, the binding text is unchanged from v1.

The patches and this letter were written with Claude (Anthropic). I
ran the boots on my board and checked the logs.

Thanks for the review.

[1] https://lore.kernel.org/all/e725f663-43ab-4011-8635-f59eb016d148@rock-chips.com/
[2] https://lore.kernel.org/all/sashiko-outbox-249243@kernel.org/
[3] https://lore.kernel.org/all/sashiko-outbox-249247@kernel.org/
[4] https://lore.kernel.org/all/2e35a072-45ff-4438-a5d9-cd67cf8d1424@rock-chips.com/
[5] https://lore.kernel.org/all/cover.1796334467.git.pavone.lawyer@gmail.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   | 227 ++++++++++++++++++
 drivers/gpu/drm/rockchip/rockchip_drm_drv.h   |   6 +
 drivers/iommu/rockchip-iommu.c                |  32 +++
 4 files changed, 271 insertions(+)


base-commit: fe6ff8d5d675c01793b9f051d16055dd4aa75244
-- 
2.54.0


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-12-04 17:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04 10:27 [RFC PATCH v2 0/3] rockchip: keep the bootloader framebuffer mapped behind the VOP IOMMU Francesco Saverio Pavone
2026-12-04 10:27 ` [RFC PATCH v2 1/3] iommu/rockchip: Report the reserved regions from the devicetree Francesco Saverio Pavone
2026-12-04 10:27 ` [RFC PATCH v2 2/3] dt-bindings: display: vop2: Allow memory-region Francesco Saverio Pavone
2026-12-04 10:27 ` [RFC PATCH v2 3/3] drm/rockchip: Map the reserved regions 1:1 in the DRM IOMMU domain Francesco Saverio Pavone
2026-12-04 12:00   ` Robin Murphy
2026-12-04 15:32     ` Francesco Saverio Pavone
2026-12-04 17:14       ` Robin Murphy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox