Re: [PATCH v2 2/3] drm/tyr: use pin-init self-referential support

From: Gary Guo

Date: Thu Dec 03 2026 - 07:25:10 EST


On Mon Nov 30, 2026 at 11:19 PM GMT, Danilo Krummrich wrote:
> Now that pin-init supports self-referential structs, Arc is no longer
> needed just to share resources whose lifetimes are bounded by their
> owners.
>
> Use pin-init's self-referential support to share the MMIO mapping, MMU
> and firmware VM through borrows instead of Arc, avoiding their separate
> allocations and reference counts.
>
> Hide the invariant resource lifetime shared by the VM and its sections
> behind an existential lifetime that outlives 'mmu, so Firmware only needs
> a single lifetime parameter.
>
> Cc: Gary Guo <gary@xxxxxxxxxxx>
> Signed-off-by: Danilo Krummrich <dakr@xxxxxxxxxx>

Reviewed-by: Gary Guo <gary@xxxxxxxxxxx>

> ---
> drivers/gpu/drm/tyr/driver.rs | 38 +++---
> drivers/gpu/drm/tyr/fw.rs | 152 ++++++++++++-----------
> drivers/gpu/drm/tyr/gem.rs | 15 +--
> drivers/gpu/drm/tyr/mmu.rs | 36 +++---
> drivers/gpu/drm/tyr/mmu/address_space.rs | 14 +--
> drivers/gpu/drm/tyr/tyr.rs | 5 +
> drivers/gpu/drm/tyr/vm.rs | 93 +++++++-------
> 7 files changed, 179 insertions(+), 174 deletions(-)
>
> diff --git a/drivers/gpu/drm/tyr/driver.rs b/drivers/gpu/drm/tyr/driver.rs
> index 557f2ec0a767..a2fa7350f144 100644
> --- a/drivers/gpu/drm/tyr/driver.rs
> +++ b/drivers/gpu/drm/tyr/driver.rs
> @@ -29,7 +29,7 @@
> regulator::Regulator,
> sizes::SZ_2M,
> sync::{
> - Arc,
> + aref::ARef,
> Mutex, //
> },
> time, //
> @@ -71,7 +71,14 @@ pub(crate) struct TyrDrmRegistrationData<'drm> {
> pub(crate) pdev: &'drm platform::Device<Bound>,
>
> /// Firmware sections.
> - pub(crate) fw: Firmware<'drm>,
> + #[pin]
> + #[uses('mmu: invariant)]
> + pub(crate) fw: Firmware<'mmu>,
> +
> + /// MMU shared by the firmware and its buffer objects.
> + #[pin]
> + #[uses('iomem: invariant)]
> + mmu: Mmu<'iomem>,
>
> #[pin]
> clks: Mutex<Clocks>,
> @@ -80,7 +87,7 @@ pub(crate) struct TyrDrmRegistrationData<'drm> {

This isn't renamed because it's top-level I suppose?

Best,
Gary

> regulators: Mutex<Regulators>,
>
> /// GPU MMIO register mapping.
> - pub(crate) iomem: Arc<IoMem<'drm>>,
> + pub(crate) iomem: IoMem<'drm>,
>
> /// GPU information read from hardware during probe.
> pub(crate) gpu_info: GpuInfo,