All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Reichel <sebastian.reichel@collabora.com>
To: Chaoyi Chen <chaoyi.chen@rock-chips.com>
Cc: Robin Murphy <robin.murphy@arm.com>,
	 Francesco Saverio Pavone <pavone.lawyer@gmail.com>,
	Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
	 Sandy Huang <hjc@rock-chips.com>,
	Heiko Stuebner <heiko@sntech.de>, Andy Yan <andyshrk@163.com>,
	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: Re: [RFC PATCH v2 3/3] drm/rockchip: Map the reserved regions 1:1 in the DRM IOMMU domain
Date: Sat, 5 Dec 2026 05:06:00 +0100	[thread overview]
Message-ID: <axOLv-dNDUzEM3Ps@venus> (raw)
In-Reply-To: <480259ce-4971-45d4-b34e-e8b5a8e6ee29@rock-chips.com>

[-- Attachment #1: Type: text/plain, Size: 3592 bytes --]

Hi,

On Sat, Dec 05, 2026 at 10:19:07AM +0800, Chaoyi Chen wrote:
> Hi,
> 
> On 12/5/2026 1:14 AM, Robin Murphy wrote:
> > On 04/12/2026 3:32 pm, Francesco Saverio Pavone wrote:
> >> Hi Robin,
> >>
> >> On 2026-12-04 12:00, Robin Murphy wrote:
> >>> If you reach the point of creating private abstractions of entire
> >>> IOMMU API concepts inside a DRM driver, you should probably stop and
> >>> think "Why aren't other drivers doing this?"
> >>
> >> Thank you. That was blunt, and it was right. I went and looked: no
> >> driver outside drivers/iommu walks the reserved regions the way my
> >> patch does.
> > 
> > Heh, sometimes it's hard to see the wood for the trees when you're working backwards from one very specific symptom of a larger issue.
> > 
> >> I am withdrawing the series.
> >>
> >> The driver already does the standard takeover. I think the real gap
> >> is smaller: the VOP2 is not stopped before it is attached to the
> >> IOMMU domain, while the older VOP driver resets itself first. I will
> >> look at that instead, and only send something if it removes the
> >> faults on my board.
> > 
> > I don't doubt that both the IOMMU driver and the VOP drivers might need a bit of smoothing out to make this properly work, it's just one of those scenarios where I'm almost certain that taking a step back to do things the "right" way will end up being easier.
> > 
> > And that's not to say that this "minimal glitch" approach of pre-mapping the initial framebuffer prior to attaching the domain (and ideally unmapping it again as soon as we're sure it's out of use) isn't still potentially worth exploring, just that I'd hope we could pull the relevant config straight out of the VOP registers, or at worst add a DRM-appropriate way to query any existing sysfb aperture. But yeah, if just stopping the thing for the duration of driver registration is good enough for now, even simpler!
> >
> 
> Yes, this depends largely on what we are trying to achieve. 
> 
> If we merely want to eliminate the IOMMU warnings, then resetting the
> hardware before attach, or stopping the DMA, would easily accomplish that.
> 
> But if we want the display to remain completely continuous throughout the
> entire boot process and to transition smoothly from IOMMU disabled to
> IOMMU enabled, then it may require more effort.
> 
> I saw some interesting examples:
> 
> - Exynos uses a default domain. 
> - Msm mdp4/mdp5 disable display before attaching IOMMU.
> - i915 wraps the reserved region as a GEM object (DRM framebuffer)
>   and displays it.
> 
> If we adopt an i915-style takeover, perhaps we need to do the following:
> 
> {
>   rockchip_gem_alloc_object() /* alloc object */
>   drm_mm_reserve_node() /* optional? reserve old iova */
>   iommu_map_sgtable() /* map old iova to new GEM */
>   /* copy old fb data to new GEM */
> }
> 
> /* Now iova is in private domain */
> 
> rockchip_drm_dma_attach_device() /* IOMMU take over! */
> 
> /* after userspace take over */
> {
>   iommu_unmap();
>   drm_mm_remove_node();
>   drm_gem_object_put();
> }
> 
> This looks more like something done in the DRM world. 
> Robin, what do you think of this? Thank you.

FYI there is some ongoing work for generic DRM helpers regarding DRM
state readout from prior boot stages (I haven't found the time to
look at this closer myself, so not sure how much they help with the
IOMMU specifically):

https://lore.kernel.org/dri-devel/20261127-drm-state-readout-v10-0-0259582d45a8@kernel.org/

Greetings,

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Sebastian Reichel <sebastian.reichel@collabora.com>
To: Chaoyi Chen <chaoyi.chen@rock-chips.com>
Cc: Robin Murphy <robin.murphy@arm.com>,
	 Francesco Saverio Pavone <pavone.lawyer@gmail.com>,
	Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>,
	 Sandy Huang <hjc@rock-chips.com>,
	Heiko Stuebner <heiko@sntech.de>, Andy Yan <andyshrk@163.com>,
	 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: Re: [RFC PATCH v2 3/3] drm/rockchip: Map the reserved regions 1:1 in the DRM IOMMU domain
Date: Sat, 5 Dec 2026 05:06:00 +0100	[thread overview]
Message-ID: <axOLv-dNDUzEM3Ps@venus> (raw)
In-Reply-To: <480259ce-4971-45d4-b34e-e8b5a8e6ee29@rock-chips.com>


[-- Attachment #1.1: Type: text/plain, Size: 3592 bytes --]

Hi,

On Sat, Dec 05, 2026 at 10:19:07AM +0800, Chaoyi Chen wrote:
> Hi,
> 
> On 12/5/2026 1:14 AM, Robin Murphy wrote:
> > On 04/12/2026 3:32 pm, Francesco Saverio Pavone wrote:
> >> Hi Robin,
> >>
> >> On 2026-12-04 12:00, Robin Murphy wrote:
> >>> If you reach the point of creating private abstractions of entire
> >>> IOMMU API concepts inside a DRM driver, you should probably stop and
> >>> think "Why aren't other drivers doing this?"
> >>
> >> Thank you. That was blunt, and it was right. I went and looked: no
> >> driver outside drivers/iommu walks the reserved regions the way my
> >> patch does.
> > 
> > Heh, sometimes it's hard to see the wood for the trees when you're working backwards from one very specific symptom of a larger issue.
> > 
> >> I am withdrawing the series.
> >>
> >> The driver already does the standard takeover. I think the real gap
> >> is smaller: the VOP2 is not stopped before it is attached to the
> >> IOMMU domain, while the older VOP driver resets itself first. I will
> >> look at that instead, and only send something if it removes the
> >> faults on my board.
> > 
> > I don't doubt that both the IOMMU driver and the VOP drivers might need a bit of smoothing out to make this properly work, it's just one of those scenarios where I'm almost certain that taking a step back to do things the "right" way will end up being easier.
> > 
> > And that's not to say that this "minimal glitch" approach of pre-mapping the initial framebuffer prior to attaching the domain (and ideally unmapping it again as soon as we're sure it's out of use) isn't still potentially worth exploring, just that I'd hope we could pull the relevant config straight out of the VOP registers, or at worst add a DRM-appropriate way to query any existing sysfb aperture. But yeah, if just stopping the thing for the duration of driver registration is good enough for now, even simpler!
> >
> 
> Yes, this depends largely on what we are trying to achieve. 
> 
> If we merely want to eliminate the IOMMU warnings, then resetting the
> hardware before attach, or stopping the DMA, would easily accomplish that.
> 
> But if we want the display to remain completely continuous throughout the
> entire boot process and to transition smoothly from IOMMU disabled to
> IOMMU enabled, then it may require more effort.
> 
> I saw some interesting examples:
> 
> - Exynos uses a default domain. 
> - Msm mdp4/mdp5 disable display before attaching IOMMU.
> - i915 wraps the reserved region as a GEM object (DRM framebuffer)
>   and displays it.
> 
> If we adopt an i915-style takeover, perhaps we need to do the following:
> 
> {
>   rockchip_gem_alloc_object() /* alloc object */
>   drm_mm_reserve_node() /* optional? reserve old iova */
>   iommu_map_sgtable() /* map old iova to new GEM */
>   /* copy old fb data to new GEM */
> }
> 
> /* Now iova is in private domain */
> 
> rockchip_drm_dma_attach_device() /* IOMMU take over! */
> 
> /* after userspace take over */
> {
>   iommu_unmap();
>   drm_mm_remove_node();
>   drm_gem_object_put();
> }
> 
> This looks more like something done in the DRM world. 
> Robin, what do you think of this? Thank you.

FYI there is some ongoing work for generic DRM helpers regarding DRM
state readout from prior boot stages (I haven't found the time to
look at this closer myself, so not sure how much they help with the
IOMMU specifically):

https://lore.kernel.org/dri-devel/20261127-drm-state-readout-v10-0-0259582d45a8@kernel.org/

Greetings,

-- Sebastian

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

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

  reply	other threads:[~2026-12-05  4:06 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` 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   ` 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   ` 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 10:27   ` Francesco Saverio Pavone
2026-12-04 12:00   ` Robin Murphy
2026-12-04 12:00     ` Robin Murphy
2026-12-04 15:32     ` Francesco Saverio Pavone
2026-12-04 15:32       ` Francesco Saverio Pavone
2026-12-04 17:14       ` Robin Murphy
2026-12-04 17:14         ` Robin Murphy
2026-12-05  2:19         ` Chaoyi Chen
2026-12-05  2:19           ` Chaoyi Chen
2026-12-05  4:06           ` Sebastian Reichel [this message]
2026-12-05  4:06             ` Sebastian Reichel
2026-12-05  4:40             ` Chaoyi Chen
2026-12-05  4:40               ` 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=axOLv-dNDUzEM3Ps@venus \
    --to=sebastian.reichel@collabora.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=pavone.lawyer@gmail.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.