Devicetree
 help / color / mirror / Atom feed
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 v2 0/3] rockchip: keep the bootloader framebuffer mapped behind the VOP IOMMU
Date: Fri,  4 Dec 2026 11:27:50 +0100	[thread overview]
Message-ID: <20261204102757.47697-1-pavone.lawyer@gmail.com> (raw)

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


             reply	other threads:[~2026-12-04 10:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 10:27 Francesco Saverio Pavone [this message]
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

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=20261204102757.47697-1-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