From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=160.236.53.99 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796437167; b=dqm3cmORbCEfE+btHALp9MRzcEeM/l+rEkljheGo7llnMWqEEvd1q4EnewtN7XR9D/Bu neWgfoRZZ37dmmMJe9WO4NgZYiDu3Sb3IXFZ0r+nm/snqsxzJQgs2LjzM0d/dYPl4dZfC iOolxZQ/Dc8M3cF3/L+bS6sI+a33C9uiNQOPSahEqjiZe43dYROfJFd5s+CJodL+EzAq9 IbgcR7B4bVEvXCQ2YSD5UPTMFzkzjQpFmmoqez30EOgEd6KPaRbOqT3o1j2IAXYKbpk2U QUTboo7CC8bXrmUxEQvm9aLkk6d/53rQWeGMSk8QlyPaZkt3KI0Gwr1IsDFgm7oPuGg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796437167; h=DMARC-Filter:Received:Message-ID:Date:MIME-Version:User-Agent: Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding:X-HM-Tid:X-HM-MType: X-HM-Spam-Status:DKIM-Signature; bh=j+UwdBM8gYnju1/iVyDnGC23heGs9r1JBoonuAoC/OI=; b=iVmB3LlBF08j0h0MPBuQr3Y/hrYggxhwdz1fCqi6UyD3EPi5kPgmWpeZMdqScy+hewdc y+2fCf2CYy7FPrwI78o6N32hfc3kyw5ud8UaHFHRen0vEJhjlUKhWQu+/FuADlGhLYm8s JDKhSBB01MLEQMIjT+Nws/5v+Ji8tjSDmxYvbtUZmNHJErLqU8Cfc5UMTzNkUmUGecSa/ 7qxfNLDkg7lKFroGPlCLPQdTX6V81UZfo+XkXpalPQUAma9Qmd1bVXJA7wohunfNHpqW1 aVnw3kei1V1n5SkmxuSQuveq8Zq4Mlc8V6OtJAEjjiUih4Q0a40ARW4w7uXGJWuX60g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=rock-chips.com; spf=pass smtp.mailfrom=rock-chips.com; dkim=pass header.d=rock-chips.com header.i=@rock-chips.com header.a=rsa-sha256 header.s=default header.b=h56TofR5; arc=none smtp.remote-ip=160.236.53.99 Received: from mail-m1602365399.xmail.ntesmail.com (mail-m1602365399.xmail.ntesmail.com [160.236.53.99]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 30F97606A32C for ; Sat, 5 Dec 2026 02:19:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 30F97606A32C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rock-chips.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rock-chips.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=rock-chips.com header.i=@rock-chips.com header.a=rsa-sha256 header.s=default header.b=h56TofR5 Received: from [172.16.12.90] (unknown [61.154.14.86]) by smtp.qiye.163.com (Hmail) with ESMTP id 6fce62210; Sat, 5 Dec 2026 10:19:09 +0800 (GMT+08:00) Message-ID: <480259ce-4971-45d4-b34e-e8b5a8e6ee29@rock-chips.com> Date: Sat, 5 Dec 2026 10:19:07 +0800 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 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH v2 3/3] drm/rockchip: Map the reserved regions 1:1 in the DRM IOMMU domain To: Robin Murphy , Francesco Saverio Pavone Cc: Joerg Roedel , Will Deacon , Sandy Huang , Heiko Stuebner , Andy Yan , 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 References: <20261204153227.7794-1-pavone.lawyer@gmail.com> Content-Language: en-US From: Chaoyi Chen In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-HM-Tid: 0aa243ff87ec03a7kunmba5229301f6d88 X-HM-MType: 1 X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFITzdXWRgWCB1ZQUpXWS1ZQUlXWQ8JGhUIEh9ZQVlCTkwZVkkfTRlMGUpJSU9JTVYVFA kWGhdVEwETFhoSFyQUDg9ZV1kYEgtZQVlNSlVKTk9VSk9VQ01ZV1kWGg8SFR0UWUFZT0tIVUpLSE pKQk1VSktLVUpCWQY+ DKIM-Signature: a=rsa-sha256; b=h56TofR5Z8QAWLPISpQQeZGGMmPekI2RnJykBkFRyg/NJwBCO01h62iTtLV+bBzfWC5yxWgNY7Bm4HZG65FNwTYorR7YSbVS9v4v7fF372bkzaafe2CB+LoQKx99fOs31AN9K7kHq1H/IXqk+T2vSDgAaAADBt0CV9bFSZbK19E=; s=default; c=relaxed/relaxed; d=rock-chips.com; v=1; bh=j+UwdBM8gYnju1/iVyDnGC23heGs9r1JBoonuAoC/OI=; h=date:mime-version:subject:message-id:from; 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. > Cheers, > Robin. -- Best, Chaoyi