From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.45 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796380087; b=aZNvmdDXy0bXqTeWkzuAR34hO5IyWymJ+JtEsSpxMLcN2MsyW4oPe9Bp7Qh6h+ZsoPPg ht0Yc9IhrvzkrnORS+tQQ88ZHn7WGo+/SWltKZI+RBcbdkVOB4nlftVp1w+m2lyU2uTmS y7YtNPAEcIb4nC7tJhLS+X1Mt42LJeithMFUEhSWJ0N1GrgHT6TcNzXtgS/3IhcofW7eW 5QJMJZShGL953qwVc7u2WD9C4v0+7GiZs8KdU7V5THBLpjPmgit8dSVrQgtejE1t02KQf 6kEF+uPfgg7TBX+LcVzyv43g6gY0EHJm/7OOkY4pYHcyimlS8VZJLHNl+KF5JubPttg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796380087; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:MIME-Version: Content-Transfer-Encoding; bh=9tE7w3e0IX69WfEplQpC1wty5DDKgYPfmAS8C8JQP94=; b=VwtleTWdEujM7FJECsnSiVCoZRcnRWhAbd2sXR8FXudkoKGdoumcILtAUxKRqTt/D4EZ 9lsC8IVJ5dC/k0A1bZw2sIALHEfxK4GvTInsLwQPUYwsrfWDg/aUr/FlTW3mrXMZxR8xx WodB3QprCo5D4eqpMY3Z+JcxAYFLfhSzUfCnxrP+vQQzlRyyZenB/SsS1ZLepwAI6QTeb +EIknVwEtc7gJRfRpXTLFzfJ1PpgFeBk8h88fqQDseolqu52yDxLJ+2H4Brbi8bHbpDrF bxNMTGB8aYRQVihn+qn0ROi0BokD9ySjU2SLIJ31H/quYnQl0TBll5mXrbWrZKZ2u6A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=VdH8zTOh; arc=none smtp.remote-ip=209.85.128.45 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 31B50606A32D for ; Fri, 4 Dec 2026 10:28:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 31B50606A32D Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=VdH8zTOh Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-4a3517554f7so6188265e9.2 for ; Fri, 04 Dec 2026 02:28:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796380086; x=1796984886; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=9tE7w3e0IX69WfEplQpC1wty5DDKgYPfmAS8C8JQP94=; b=VdH8zTOhwr+wCvILKS6YwwAP0c1uXcM7UcVg90qmMn/U4YmThBbNIpS6VnFhjkOGaZ GoYDo16IpSTbgJdoNhcvjjPS19voQs2Ccv+P1fAd+sjcHUoMbxutKvb1LUsFg8fKs+4W qJ8882tZp/sJ43nQcnlvfOS3Q3fHYVtNGNstPOiHKIkobKcDR/xqBVoyAZMI/jUDLvdk TQCuZ+KcT4TTGnM51qrpqaxkatXCpkLe21x6M6r4C2fvXrzHr1rHyd3n6jb+3931T7H0 HSau6aimRmdxM+7jbHqg0IAlAWEdCFawbAu+nNkX6WKK3ZY0p1mDjsZAan1ej2TNbOn4 IckQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796380086; x=1796984886; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=9tE7w3e0IX69WfEplQpC1wty5DDKgYPfmAS8C8JQP94=; b=LEaQjZFNmR/IFHeGgNi1SWoKi08TuaNHKnlZcyVhBitYUmNFYYGKEdvIjorGodH535 XY7UIRb7ZuJ2N/f53ZJPlSL4YNq9BeWDzEj4D/poRnCJifHoVG8WNBDUD5M0RgSNanNq Sg+2VkcKAcwuMQfbMy7hXsSqxU1K5v+Hfw9Tpjxzzg7JCYjqBJnWnvcbYxOs4m34x5pL 9PCfxSZLnqRja83e0BiMfCmU8MH9MLuG0N47Do1b9XyNbeK4C4DOYq1RDTuWyuk8oWCE VM2pxbWAnAFZ5SvDF4V4rKaTA36ddfi65vUQaU7IvJWretbGy4dmRyNbpvqQpnBGVWi+ PQtQ== X-Forwarded-Encrypted: i=1; AL+hErH87dxGQKcsvFQPGrgLbXP+uauUTs35YpLptlvcNTPD/tYK1FGKc1WE0wr9raGKpgC8o4yhKd7yhlsw@vger.kernel.org X-Gm-Message-State: APuU4Z/HVTQtJURhMmTM21DNdqO8lpRTe/pkUBzhdNN890JAxl/kxswW V8dWwDrxaTBaGNlDh9eUjRs6QAU877ta+M87FLNtfdIwYeji+Pvtyy0= X-Gm-Gg: AZFdTZeRwLCVfz9ZzyhwXTvwxkN4UmjTW30leD2aRDzXwYyfVfmqFE93bQCjM0UZyms PxKpctPXCAm6JHyxfO9yDpshm6DK+3xUPfhi5UvtB1rlUT08zg0gAmlJnWgQ2Qrn7pkLBxorTbn iYB8JB8TN7xe5OPwedEXZqvYFaoeUU2G+OBYLnbqWYwP94pXACB6J140MuU26yV03UdoGBDsHMk T+66+nGcl2Qko2/wg88d6n4xT7ilKJng4zy0UoqGjsmLmYLWDXSrBlSlXpmcFfKh2Z845t4E1XE KIypZSz1uEevEBykISnG/89KAEisGqR7zPt3xHWDv1p3w5LvAO2TRxZ70fDu23hlFIhKgO+Osz5 AfbPliwwn77QP27wJgn4L2ZEr5DJ1ipaYp7ftq8JTZ1nkz+xsKH7egHDoIevOqHQXH7YqaBPuUn FtfF0djZGmGLVPyq6/Ko2qiiP6Bx2jD/5NXxOCtTXhXvMCse4WCoyaj3pFn8xP4NpKhu8wvmdeM 7qrDeKWUOwRRjLLy6wSFWDqeAB3I9GPTUwOnKoacHDnn5lKBjOJd5uJkldFchRsrruFX1gno1v2 TYlLCwkoybadSx0125XdvOk7deqsdGoGwzVhP3iKDSPnZG7Pc12kqn7JW7JlgxQblVwY0e94+lu 9RfJPA6Kr8mQIt8/T X-Received: by 2002:a05:600c:8b4c:b0:4a1:df52:3e36 with SMTP id 5b1f17b1804b1-4bbeb8cf4eemr28408735e9.27.1796380085367; Fri, 04 Dec 2026 02:28:05 -0800 (PST) Received: from localhost.localdomain ([151.57.87.193]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bbe00df154sm157625515e9.14.2026.12.04.02.28.03 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 04 Dec 2026 02:28:04 -0800 (PST) From: Francesco Saverio Pavone 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@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 Message-ID: <20261204102757.47697-1-pavone.lawyer@gmail.com> X-Mailer: git-send-email 2.56.1 X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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