On Thu, Mar 26, 2026 at 02:15:28AM +0100, Danilo Krummrich wrote:
On Mon Mar 16, 2026 at 10:16 PM CET, Lyude Paul wrote:
Lyude Paul (5): rust: drm: Add gem::impl_aref_for_gem_obj! rust: gem: Introduce DriverObject::Args
Applied to drm-rust-next, thanks!
Asahi Lina (2): rust: drm: gem: shmem: Add DRM shmem helper abstraction
I was about to pick this one up as well, but did run into quite some build errors and warnings. I fixed them all up, but I consider this too excessive to actually apply the patch. This is the changelog I came up with:
[ * 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 &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 ]Please always consider [1] and [2].
[1] https://drm.pages.freedesktop.org/maintainer-tools/committer/committer-drm-r... [2] https://rust-for-linux.com/contributing#submit-checklist-addendum
(@Deborah: I assume you were testing this with Tyr built-in?)
@Lyude, Alice, Miguel: Please have a look at what I came up with below.
Looks fine, asahi had the bool CONFIG_RUST_DRM_GEM_SHMEM_HELPER already in the asahi Kconfig so I never noticed that's missing. Same for configs which do not excercise gem shmem.
commit 2dc69d77944dbd1494d2b10a4b134b7fead1c8e7 Author: Asahi Lina lina+kernel@asahilina.net Date: Mon Mar 16 17:16:13 2026 -0400
rust: drm: gem: shmem: Add DRM shmem helper abstraction 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 <lina@asahilina.net> Signed-off-by: Daniel Almeida <daniel.almeida@collabora.com> Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com> Signed-off-by: Lyude Paul <lyude@redhat.com> Tested-by: Deborah Brouwer <deborah.brouwer@collabora.com> 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 &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 <dakr@kernel.org>
Reviewed-by: Janne Grunau j@jananu.net
Janne