The interop/list module provides Rust abstractions for iterating over C list_head-based linked lists. The primary use-case right now is iterating over GPU buddy allocator blocks.
This series provides the interop/list module required for GPU buddy bindings, which is inturn required for nova-core memory memory management. This patch is being sent separately from the rest of the preparatory patches (DRM buddy movement, GPU buddy bindings, etc.) as it can go in independently. The git tree with the patch can be found at: git://git.kernel.org/pub/scm/linux/kernel/git/jfern/linux.git (tag: interop-v12-20260306) Change log: Changes from v11 to v12: - Renamed module from ffi/clist to interop/list, reflecting community feedback that 'interop' better describes the purpose than 'ffi' (credit to Boqun for starting this idea.) - Updated MAINTAINERS entry from "RUST [FFI HELPER]" to "RUST [INTEROP]" and updated git tree reference. - Added Acked-by from Miguel. Changes from v10 to v11: - Sending only the ffi/clist patches separately from the rest of the preparatory series, as these can go in independently. - MAINTAINERS entry: Renamed from "RUST TO C LIST INTERFACES" to "RUST [FFI HELPER]" with (CLIST) scope annotations for maintainers, following Danilo's suggestion. Note: There is still an ongoing discussion about the MAINTAINER file entry naming between Miguel and Danilo: https://lore.kernel.org/all/[email protected]/ - Updated clist.rs module documentation per Danilo's review: generalized the FFI usage description and added explicit note directing Rust-only users to kernel::list::List instead. - Implemented suggestions from Alice related to safety of CList wrt concurrent modifications. - Removed unnecessary trailing comment markers from example imports. - Added feature guard for offset_of_nested (Eliot). Changes from v9 to v10: - Combined clist/ffi patches into the larger "Preparatory patches for nova-core memory management" series (8 patches total). - Added new ffi module patch: Convert pub use to pub mod and create rust/kernel/ffi/mod.rs to host clist as a sub-module. - Moved clist from rust/kernel/clist.rs to rust/kernel/ffi/clist.rs. - Added Reviewed-by and Acked-by tags from Gary and Daniel. Changes from v8 to v9: - Added nova-core Kconfig change to select GPU_BUDDY. - Minor fixups. Changes from v7 to v8: - Various changes suggested by Danilo, Gary, Daniel. Added tags. Changes from v6 to v7: - Extracted clist and GPU buddy patches from the larger RFC v6 nova-core memory management series into a standalone series. - Changes based on suggestions by Gary and Dave. Changes from v5 to v6: - Part of the larger RFC v6 nova-core memory management series (26 patches). Changes from v4 to v5: - Part of the larger RFC v5 nova-core memory management series (6 patches). Changes from v3 to v4: - Combined the clist and DRM buddy series back together. - Added Rust bindings for the GPU buddy allocator. - Moved DRM buddy allocator one level up to drivers/gpu/ so it can be used by GPU drivers (e.g. nova-core) that have non-DRM usecases. Changes from v2 to v3: - Consolidated 3 patches into a single patch. Changes from v1 to v2: - Dropped the DRM buddy allocator patches. Series now focuses solely on the clist module. - Dropped samples and added doctests. - Added proper lifetime management similar to scatterlist. Link to v11: https://lore.kernel.org/all/[email protected]/ Link to v10: https://lore.kernel.org/all/[email protected]/ Link to v9: https://lore.kernel.org/all/[email protected]/ Link to v8: https://lore.kernel.org/all/[email protected]/ Link to v7: https://lore.kernel.org/all/[email protected]/ Joel Fernandes (1): rust: interop: Add list module for C linked list interface MAINTAINERS | 8 + rust/helpers/helpers.c | 1 + rust/helpers/list.c | 17 ++ rust/kernel/interop/list.rs | 338 ++++++++++++++++++++++++++++++++++++ rust/kernel/interop/mod.rs | 9 + rust/kernel/lib.rs | 2 + 6 files changed, 375 insertions(+) create mode 100644 rust/helpers/list.c create mode 100644 rust/kernel/interop/list.rs create mode 100644 rust/kernel/interop/mod.rs base-commit: 877552aa875839314afad7154b5a561889e87ea9 -- 2.34.1
