From: Deborah Brouwer <deborah.brouwer@collabora.com>
To: Alice Ryhl <aliceryhl@google.com>
Cc: Danilo Krummrich <dakr@kernel.org>,
daniel.almeida@collabora.com, boris.brezillon@collabora.com,
gary@garyguo.net, dri-devel@lists.freedesktop.org,
rust-for-linux@vger.kernel.org,
Eliot Courtney <ecourtney@nvidia.com>,
Alexandre Courbot <acourbot@nvidia.com>
Subject: Re: [PATCH v2 2/2] drm/tyr: use IoMem directly instead of Devres
Date: Mon, 1 Jun 2026 18:12:16 -0700 [thread overview]
Message-ID: <ah4t8IPo1L6XZMy_@um790> (raw)
In-Reply-To: <ah1SSN8_dCEA4Osz@google.com>
On Mon, Jun 01, 2026 at 09:35:04AM +0000, Alice Ryhl wrote:
> On Fri, May 29, 2026 at 02:00:54AM +0200, 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.
> >
> > Reviewed-by: Eliot Courtney <ecourtney@nvidia.com>
> > Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
> > Signed-off-by: Danilo Krummrich <dakr@kernel.org>
>
> > -pub(crate) type IoMem = kernel::io::mem::IoMem<'static, SZ_2M>;
> > +pub(crate) type IoMem<'a> = kernel::io::mem::IoMem<'a, SZ_2M>;
>
> It'd make more sense for me to put 'b or 'bound here.
>
> > 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);
>
>
> While this change is fine, I notice that we don't actually keep the
> iomem alive past the probe method. I assume we're going to need that,
> which leads to the question of whether we can store the iomem in the
> places we need it.
>
> As far as I can tell, we can store it in TyrPlatformDriverData but not
> in TyrDrmDeviceData, is that right?
I'm still getting my head around how this applies to tyr's firmware
series, but yes we stop storing iomem in TyrDrmDeviceData, but we won't
store it in TyrPlatformDriverData.
Instead there is a new struct "RegistrationData" that will store the iomem
like this:
#[vtable]
impl drm::Driver for TyrDrmDriver {
type Data = TyrDrmDeviceData;
type RegistrationData = TyrDrmRegistrationData<'static>;
And then in probe something like:
let reg_data = try_pin_init!(TyrDrmRegistrationData {
pdev: platform.clone(),
fw: firmware,
clks <- new_mutex!(Clocks {
core: core_clk,
stacks: stacks_clk,
coregroup: coregroup_clk,
}),
regulators <- new_mutex!(Regulators {
_mali: mali_regulator,
_sram: sram_regulator,
}),
iomem,
gpu_info,
});
drm::driver::Registration::new_foreign_owned(ddev, pdev.as_ref(), reg_data, 0)?;
>
> I guess it does make sense because the io memory goes away if the
> underlying platform device (the bus) goes away, even if the drm device
> still exists due to open fds from userspace.
>
> Alice
next prev parent reply other threads:[~2026-06-02 1:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-29 0:00 [PATCH 0/2] drm: tyr: use lifetime-bound IoMem Danilo Krummrich
2026-05-29 0:00 ` [PATCH v2 1/2] drm/tyr: separate driver type from driver data Danilo Krummrich
2026-05-29 1:57 ` Alexandre Courbot
2026-05-29 0:00 ` [PATCH v2 2/2] drm/tyr: use IoMem directly instead of Devres Danilo Krummrich
2026-06-01 9:35 ` Alice Ryhl
2026-06-01 9:54 ` Danilo Krummrich
2026-06-02 1:12 ` Deborah Brouwer [this message]
2026-06-02 0:50 ` Deborah Brouwer
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=ah4t8IPo1L6XZMy_@um790 \
--to=deborah.brouwer@collabora.com \
--cc=acourbot@nvidia.com \
--cc=aliceryhl@google.com \
--cc=boris.brezillon@collabora.com \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=ecourtney@nvidia.com \
--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