Re: [PATCH v10 3/7] drm/tyr: add Memory Management Unit (MMU) support
From: Danilo Krummrich
Date: Tue Jul 28 2026 - 17:21:37 EST
On Tue Jul 28, 2026 at 10:35 PM CEST, Deborah Brouwer wrote:
> On Tue, Jul 28, 2026 at 09:31:50PM +0200, Danilo Krummrich wrote:
>> On Tue Jul 28, 2026 at 8:39 PM CEST, Deborah Brouwer wrote:
>> > +/// Locked wrapper for carrying out virtual memory (VM) operations on the MMU.
>> > +#[pin_data]
>> > +pub(crate) struct Mmu<'drm> {
>>
>> This shouldn't be 'drm, but 'mmu or just something generic like 'a.
>>
>> The rationale is that Mmu might be shorter lived than 'drm once we have
>> self-referencial pin-init. Currently it is straight forward, such as in
>>
>> struct Foo<'foo> {
>> dev: &'foo platform::Device<Bound>,
>> }
>>
>> struct Data<'bound> {
>> foo: Foo<'bound>,
>> }
>>
>> where the lifetime of `dev` really ties back to 'bound. However, with
>> self-referencial pin-init it could looks like this:
>>
>> struct Foo<'foo> {
>> dev: &'foo platform::Device<Bound>,
>> io: &'foo IoMem<'foo>,
>> }
>>
>> struct Data<'bound> {
>> foo: Foo<'io>,
>> io: IoMem<'bound>,
>> }
>>
>> Now Foo is not constrained to 'bound anymore, as this would be longer lived than
>> `io`, so it has to capture 'io instead in order to still compile.
>
> Danilo, would you be ok with renaming this lifetime as a follow up
> patch?
Sure; note that I also said that I'm happy for this to be a follow-up in the
previous version. :)
> Currently, if I understand this correctly, the mmu lifetime is still tied to
> the DRM registration data, so the name is not inaccurate for Tyr at least as
> it stands right now.
With the current implementation, the Mmu lifetime technically ties back to
'bound; the DRM registration data itself is shorter lived (it is dropped before
'bound ends).
The reason I mentioned not to use the 'bound lifetime name in the first place is
that we agreed to not use the 'bound lifetime name on structs that may be
shorter lived than the device being bound, which is true for anything other than
the bus device private data struct.