<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux.git/rust/kernel/drm/gem/shmem.rs, branch master</title>
<subtitle>Linux kernel source tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/'/>
<entry>
<title>rust: drm: gem: shmem: Add DRM shmem helper abstraction</title>
<updated>2026-03-27T20:38:40+00:00</updated>
<author>
<name>Asahi Lina</name>
<email>lina@asahilina.net</email>
</author>
<published>2026-03-16T21:16:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux.git/commit/?id=80df573af9ef3aa63e1bacb6e17d57a7cd69afe2'/>
<id>80df573af9ef3aa63e1bacb6e17d57a7cd69afe2</id>
<content type='text'>
The DRM shmem helper includes common code useful for drivers which
allocate GEM objects as anonymous shmem. Add a Rust abstraction for
this. Drivers can choose the raw GEM implementation or the shmem layer,
depending on their needs.

Signed-off-by: Asahi Lina &lt;lina@asahilina.net&gt;
Signed-off-by: Daniel Almeida &lt;daniel.almeida@collabora.com&gt;
Reviewed-by: Daniel Almeida &lt;daniel.almeida@collabora.com&gt;
Signed-off-by: Lyude Paul &lt;lyude@redhat.com&gt;
Reviewed-by: Janne Grunau &lt;j@jananu.net&gt;
Tested-by: Deborah Brouwer &lt;deborah.brouwer@collabora.com&gt;
Link: https://patch.msgid.link/20260316211646.650074-6-lyude@redhat.com
[ * DRM_GEM_SHMEM_HELPER is a tristate; when a module driver selects it,
    it becomes =m. The Rust kernel crate and its C helpers are always
    built into vmlinux and can't reference symbols from a module,
    causing link errors.

    Thus, add RUST_DRM_GEM_SHMEM_HELPER bool Kconfig that selects
    DRM_GEM_SHMEM_HELPER, forcing it built-in when Rust drivers need it;
    use cfg(CONFIG_RUST_DRM_GEM_SHMEM_HELPER) for the shmem module.

  * Add cfg_attr(not(CONFIG_RUST_DRM_GEM_SHMEM_HELPER), expect(unused))
    on pub(crate) use impl_aref_for_gem_obj and BaseObjectPrivate, so
    that unused warnings are suppressed when shmem is not enabled.

  * Enable const_refs_to_static (stabilized in 1.83) to prevent build
    errors with older compilers.

  * Use &amp;raw const for bindings::drm_gem_shmem_vm_ops and add
    #[allow(unused_unsafe, reason = "Safe since Rust 1.82.0")].

  * Fix incorrect C Header path and minor spelling and formatting
    issues.

  * Drop shmem::Object::sg_table() as the current implementation is
    unsound.

    - Danilo ]
Signed-off-by: Danilo Krummrich &lt;dakr@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The DRM shmem helper includes common code useful for drivers which
allocate GEM objects as anonymous shmem. Add a Rust abstraction for
this. Drivers can choose the raw GEM implementation or the shmem layer,
depending on their needs.

Signed-off-by: Asahi Lina &lt;lina@asahilina.net&gt;
Signed-off-by: Daniel Almeida &lt;daniel.almeida@collabora.com&gt;
Reviewed-by: Daniel Almeida &lt;daniel.almeida@collabora.com&gt;
Signed-off-by: Lyude Paul &lt;lyude@redhat.com&gt;
Reviewed-by: Janne Grunau &lt;j@jananu.net&gt;
Tested-by: Deborah Brouwer &lt;deborah.brouwer@collabora.com&gt;
Link: https://patch.msgid.link/20260316211646.650074-6-lyude@redhat.com
[ * DRM_GEM_SHMEM_HELPER is a tristate; when a module driver selects it,
    it becomes =m. The Rust kernel crate and its C helpers are always
    built into vmlinux and can't reference symbols from a module,
    causing link errors.

    Thus, add RUST_DRM_GEM_SHMEM_HELPER bool Kconfig that selects
    DRM_GEM_SHMEM_HELPER, forcing it built-in when Rust drivers need it;
    use cfg(CONFIG_RUST_DRM_GEM_SHMEM_HELPER) for the shmem module.

  * Add cfg_attr(not(CONFIG_RUST_DRM_GEM_SHMEM_HELPER), expect(unused))
    on pub(crate) use impl_aref_for_gem_obj and BaseObjectPrivate, so
    that unused warnings are suppressed when shmem is not enabled.

  * Enable const_refs_to_static (stabilized in 1.83) to prevent build
    errors with older compilers.

  * Use &amp;raw const for bindings::drm_gem_shmem_vm_ops and add
    #[allow(unused_unsafe, reason = "Safe since Rust 1.82.0")].

  * Fix incorrect C Header path and minor spelling and formatting
    issues.

  * Drop shmem::Object::sg_table() as the current implementation is
    unsound.

    - Danilo ]
Signed-off-by: Danilo Krummrich &lt;dakr@kernel.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
