On 2026-09-09 11:57:37 -0400, Alex Deucher wrote:
> Adding a few people.  Alternative patch at:
> https://lists.freedesktop.org/archives/amd-gfx/2026-September/152673.html
> 
> Alex
> 
> On Wed, Sep 9, 2026 at 5:47 AM Mike Lothian <[email protected]> wrote:
> >
> > Both OBJECT_FUNCS and the shmem VTABLE initialise every member of
> > drm_gem_object_funcs explicitly, so adding a field to the C struct
> > breaks the Rust build:
> >
> >   error[E0063]: missing field `handle_free` in initializer of
> >   `drm_gem_object_funcs`
> >
> > The callback is optional and the Rust abstraction has no equivalent
> > DriverObject method, so leave it unset.
> >
> > The shmem copy is only built with CONFIG_RUST_DRM_GEM_SHMEM_HELPER,
> > which DRM_TYR selects.

Sorry, I missed you when sending my v2. It's at
https://lore.kernel.org/lkml/[email protected]/T/#u
if you want to have a look.

Regards,
Klara Modin

> >
> > Fixes: b67d2d039f64 ("drm/gem: Add callback for when handle count goes to 
> > 0")
> > Signed-off-by: Mike Lothian <[email protected]>
> > Assisted-by: Claude:Opus-5 [Claude Code]
> > ---
> >
> > b67d2d039f64 is only in agd5f/drm-next, so this can be squashed into it
> > instead if you would rather keep that branch bisectable.
> >
> > The shmem hunk is by inspection - CONFIG_RUST_DRM_GEM_SHMEM_HELPER is
> > not set in my config, so only the mod.rs copy is compile-tested.
> >
> >  rust/kernel/drm/gem/mod.rs   | 1 +
> >  rust/kernel/drm/gem/shmem.rs | 1 +
> >  2 files changed, 2 insertions(+)
> >
> > diff --git a/rust/kernel/drm/gem/mod.rs b/rust/kernel/drm/gem/mod.rs
> > index 80d8f524f9d5..ae61ca7e1246 100644
> > --- a/rust/kernel/drm/gem/mod.rs
> > +++ b/rust/kernel/drm/gem/mod.rs
> > @@ -278,6 +278,7 @@ impl<T: DriverObject, Ctx: DeviceContext> Object<T, 
> > Ctx> {
> >          vm_ops: core::ptr::null_mut(),
> >          evict: None,
> >          rss: None,
> > +        handle_free: None,
> >      };
> >
> >      /// Returns the `Device` that owns this GEM object.
> > diff --git a/rust/kernel/drm/gem/shmem.rs b/rust/kernel/drm/gem/shmem.rs
> > index a687d46d170d..d08a03cb7a13 100644
> > --- a/rust/kernel/drm/gem/shmem.rs
> > +++ b/rust/kernel/drm/gem/shmem.rs
> > @@ -145,6 +145,7 @@ impl<T: DriverObject> Object<T> {
> >          // SAFETY: `drm_gem_shmem_vm_ops` is a valid, static const on the 
> > C side.
> >          vm_ops: unsafe { &raw const bindings::drm_gem_shmem_vm_ops },
> >          evict: None,
> > +        handle_free: None,
> >      };
> >
> >      /// Return a raw pointer to the embedded drm_gem_shmem_object.
> > --
> > 2.55.0
> >

Reply via email to