From: "Eliot Courtney" <ecourtney@nvidia.com>
To: "Danilo Krummrich" <dakr@kernel.org>, <aliceryhl@google.com>,
<daniel.almeida@collabora.com>, <boris.brezillon@collabora.com>,
<deborah.brouwer@collabora.com>, <gary@garyguo.net>
Cc: <dri-devel@lists.freedesktop.org>,
<rust-for-linux@vger.kernel.org>,
"dri-devel" <dri-devel-bounces@lists.freedesktop.org>
Subject: Re: [PATCH 2/2] gpu: drm: tyr: use IoMem directly instead of Devres
Date: Tue, 26 May 2026 11:43:38 +0900 [thread overview]
Message-ID: <DIS9H75POYGW.EBC1MLW466RG@nvidia.com> (raw)
In-Reply-To: <20260525230152.277820-3-dakr@kernel.org>
On Tue May 26, 2026 at 8:01 AM JST, Danilo Krummrich wrote:
> Now that IoMem is lifetime-parameterized, use it directly in probe
> rather than wrapping it in Devres and Arc. The I/O memory mapping is
> only used during probe and not stored in driver data, so device-managed
> revocation is unnecessary.
>
> This removes the Devres access(dev) pattern from issue_soft_reset(),
> GpuInfo::new(), and l2_power_on(), simplifying register access.
>
> Signed-off-by: Danilo Krummrich <dakr@kernel.org>
> ---
> drivers/gpu/drm/tyr/driver.rs | 19 ++++++-------------
> drivers/gpu/drm/tyr/gpu.rs | 13 +++----------
> 2 files changed, 9 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/gpu/drm/tyr/driver.rs b/drivers/gpu/drm/tyr/driver.rs
> index 5f4c484f671f..b9a5cc5fc678 100644
> --- a/drivers/gpu/drm/tyr/driver.rs
> +++ b/drivers/gpu/drm/tyr/driver.rs
> @@ -6,11 +6,9 @@
> OptionalClk, //
> },
> device::{
> - Bound,
> Core,
> Device, //
> },
> - devres::Devres,
> dma::{
> Device as DmaDevice,
> DmaMask, //
> @@ -30,7 +28,6 @@
> sizes::SZ_2M,
> sync::{
> aref::ARef,
> - Arc,
> Mutex, //
> },
> time, //
> @@ -44,7 +41,7 @@
> regs::gpu_control::*, //
> };
>
> -pub(crate) type IoMem = kernel::io::mem::IoMem<'static, SZ_2M>;
> +pub(crate) type IoMem<'a> = kernel::io::mem::IoMem<'a, SZ_2M>;
>
> pub(crate) struct TyrDrmDriver;
>
> @@ -74,15 +71,11 @@ pub(crate) struct TyrDrmDeviceData {
> pub(crate) gpu_info: GpuInfo,
> }
>
> -fn issue_soft_reset(dev: &Device<Bound>, iomem: &Devres<IoMem>) -> Result {
> - let io = (*iomem).access(dev)?;
> - io.write_reg(GPU_COMMAND::reset(ResetMode::SoftReset));
> +fn issue_soft_reset(dev: &Device, iomem: &IoMem<'_>) -> Result {
> + iomem.write_reg(GPU_COMMAND::reset(ResetMode::SoftReset));
>
> poll::read_poll_timeout(
> - || {
> - let io = (*iomem).access(dev)?;
> - Ok(io.read(GPU_IRQ_RAWSTAT))
> - },
> + || Ok(iomem.read(GPU_IRQ_RAWSTAT)),
> |status| status.reset_completed(),
> time::Delta::from_millis(1),
> time::Delta::from_millis(100),
> @@ -123,12 +116,12 @@ fn probe<'bound>(
> let sram_regulator = Regulator::<regulator::Enabled>::get(pdev.as_ref(), c"sram")?;
>
> let request = pdev.io_request_by_index(0).ok_or(ENODEV)?;
> - let iomem = Arc::new(request.iomap_sized::<SZ_2M>()?.into_devres()?, GFP_KERNEL)?;
> + let iomem = request.iomap_sized::<SZ_2M>()?;
>
> issue_soft_reset(pdev.as_ref(), &iomem)?;
> gpu::l2_power_on(pdev.as_ref(), &iomem)?;
>
> - let gpu_info = GpuInfo::new(pdev.as_ref(), &iomem)?;
> + let gpu_info = GpuInfo::new(&iomem)?;
> gpu_info.log(pdev.as_ref());
>
> let pa_bits = MMU_FEATURES::from_raw(gpu_info.mmu_features)
> diff --git a/drivers/gpu/drm/tyr/gpu.rs b/drivers/gpu/drm/tyr/gpu.rs
> index 652556026f50..3acffefaf210 100644
> --- a/drivers/gpu/drm/tyr/gpu.rs
> +++ b/drivers/gpu/drm/tyr/gpu.rs
> @@ -9,7 +9,6 @@
> Bound,
> Device, //
> },
> - devres::Devres,
> io::{
> poll,
> register::Array,
> @@ -40,9 +39,7 @@
> pub(crate) struct GpuInfo(pub(crate) uapi::drm_panthor_gpu_info);
>
> impl GpuInfo {
> - pub(crate) fn new(dev: &Device<Bound>, iomem: &Devres<IoMem>) -> Result<Self> {
> - let io = (*iomem).access(dev)?;
> -
> + pub(crate) fn new(io: &IoMem<'_>) -> Result<Self> {
Perhaps a future patch can remove this now unnecessary looking Result in
the return type.
Reviewed-by: Eliot Courtney <ecourtney@nvidia.com>
prev parent reply other threads:[~2026-05-26 2:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-25 23:01 [PATCH 0/2] drm: tyr: use lifetime-bound IoMem Danilo Krummrich
2026-05-25 23:01 ` [PATCH 1/2] gpu: drm: tyr: separate driver type from driver data Danilo Krummrich
2026-05-26 1:17 ` Eliot Courtney
2026-05-26 6:43 ` Boris Brezillon
2026-05-25 23:01 ` [PATCH 2/2] gpu: drm: tyr: use IoMem directly instead of Devres Danilo Krummrich
2026-05-26 1:30 ` Alexandre Courbot
2026-05-26 2:43 ` Eliot Courtney [this message]
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=DIS9H75POYGW.EBC1MLW466RG@nvidia.com \
--to=ecourtney@nvidia.com \
--cc=aliceryhl@google.com \
--cc=boris.brezillon@collabora.com \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=deborah.brouwer@collabora.com \
--cc=dri-devel-bounces@lists.freedesktop.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=gary@garyguo.net \
--cc=rust-for-linux@vger.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