aboutsummaryrefslogtreecommitdiff
path: root/rust (follow)
Commit message (Collapse)AuthorAgeFilesLines
* rust: kernel::platform: Adapt to anon union for remove()/remove_new()Janne Grunau2024-09-211-1/+1
| | | | | | Expected to be dropped once upstream removes `remove_new(). Signed-off-by: Janne Grunau <j@jannau.net>
* fixup! *RFL import: kernel::platformJanne Grunau2024-09-211-6/+4
|
* rust: kernel: net: phy: Fix Module::init() signatureJanne Grunau2024-09-211-1/+1
| | | | | | fixup! rust: Add `name` argument to Module::init() Signed-off-by: Janne Grunau <j@jannau.net>
* rust: drm: gem: shmem: Add share_dma_resv() functionAsahi Lina2024-09-161-1/+32
| | | | | | | | Allow a GEM object to share another object's DMA reservation, for use with drm_gpuvm. To keep memory safety, we hold a reference to the GEM object owning the resv, and drop it when the child object is freed. Signed-off-by: Asahi Lina <lina@asahilina.net>
* drm/asahi: Convert to GPUVM and implement more VM_BIND opsAsahi Lina2024-09-161-0/+2
| | | | Signed-off-by: Asahi Lina <lina@asahilina.net>
* rust: Enable clippy::undocumented_unsafe_blocks lintAsahi Lina2024-09-161-0/+1
| | | | Signed-off-by: Asahi Lina <lina@asahilina.net>
* rust: kernel: workqueue: Disable clippy::undocumented_unsafe_blocks lintAsahi Lina2024-09-161-0/+2
| | | | | | The missing SAFETY comments should be fixed later... Signed-off-by: Asahi Lina <lina@asahilina.net>
* rust: user_ptr: Disable clippy::undocumented_unsafe_blocks lintAsahi Lina2024-09-161-0/+2
| | | | | | The missing SAFETY comments should be fixed later... Signed-off-by: Asahi Lina <lina@asahilina.net>
* rust: sync: lock: Make clippy::undocumented_unsafe_blocks happyAsahi Lina2024-09-161-1/+1
| | | | Signed-off-by: Asahi Lina <lina@asahilina.net>
* rust: sync: condvar: Make clippy::undocumented_unsafe_blocks happyAsahi Lina2024-09-161-1/+1
| | | | Signed-off-by: Asahi Lina <lina@asahilina.net>
* kernel: str: Add/fix SAFETY commentsAsahi Lina2024-09-161-3/+4
| | | | Signed-off-by: Asahi Lina <lina@asahilina.net>
* rust: print: Disable clippy::undocumented_unsafe_blocks lintAsahi Lina2024-09-161-0/+2
| | | | | | The missing SAFETY comments should be fixed later... Signed-off-by: Asahi Lina <lina@asahilina.net>
* rust: module_param: Disable clippy::undocumented_unsafe_blocks lintAsahi Lina2024-09-163-1/+5
| | | | | | The missing SAFETY comments should be fixed later... Signed-off-by: Asahi Lina <lina@asahilina.net>
* rust: init: macros: Disable clippy::undocumented_unsafe_blocks lintAsahi Lina2024-09-161-0/+14
| | | | | | The missing SAFETY comments should be fixed later... Signed-off-by: Asahi Lina <lina@asahilina.net>
* rust: io_buffer: Disable clippy::undocumented_unsafe_blocks lintAsahi Lina2024-09-161-0/+2
| | | | | | The missing SAFETY comments should be fixed later... Signed-off-by: Asahi Lina <lina@asahilina.net>
* rust: init: Disable clippy::undocumented_unsafe_blocks lintAsahi Lina2024-09-161-0/+2
| | | | | | The missing SAFETY comments should be fixed later... Signed-off-by: Asahi Lina <lina@asahilina.net>
* rust: allocator: Disable clippy::undocumented_unsafe_blocks lintAsahi Lina2024-09-161-0/+2
| | | | | | The missing SAFETY comments should be fixed later... Signed-off-by: Asahi Lina <lina@asahilina.net>
* kernel/error: Make clippy::undocumented_unsafe_blocks happyAsahi Lina2024-09-161-2/+2
| | | | Signed-off-by: Asahi Lina <lina@asahilina.net>
* rust: init: Add default() utility functionAsahi Lina2024-09-161-0/+15
| | | | | | | Initializer for types with Default::default() implementations in init context. This, by nature, only works for types which are not pinned. Signed-off-by: Asahi Lina <lina@asahilina.net>
* rust: drm: Add GPUVM Manager abstractionAsahi Lina2024-09-165-0/+708
| | | | Signed-off-by: Asahi Lina <lina@asahilina.net>
* rust: Replace -fmin-function-alignment with -falign-functions for bindgenJanne Grunau2024-09-161-1/+7
| | | | | | | | | | | | | | | Commit 5270316c9fec ("kbuild: Use -fmin-function-alignment when available") introduces `-fmin-function-alignment` if supported to remove a workaround for gcc not respecting `-falign-functions` for cold functions. bindgen does not recognize `-fmin-function-alignment` but `-falign-functions` is sufficient as long as bindgen is LLVM backed. See c27cd083cfb9 ("Compiler attributes: GCC cold function alignment workarounds"). So replace `-fmin-function-alignment` with `-falign-functions` for bindgen's C flags. Fixes: 5270316c9fec ("kbuild: Use -fmin-function-alignment when available") Signed-off-by: Janne Grunau <j@jannau.net>
* Revert "rust: macros: fix soundness issue in `module!` macro"Janne Grunau2024-09-161-116/+76
| | | | | | This reverts commit 7044dcff8301b29269016ebd17df27c4736140d2. Signed-off-by: Janne Grunau <j@jannau.net>
* Revert "rust: remove `params` from `module` macro example"Janne Grunau2024-09-161-0/+12
| | | | | | This reverts commit 19843452dca40e28d6d3f4793d998b681d505c7f. Signed-off-by: Janne Grunau <j@jannau.net>
* Revert "rust: str: implement `Display` and `Debug` for `BStr`"Janne Grunau2024-09-161-178/+7
| | | | | | This reverts commit 4951ddd51b816b5e4095cd3cd3bd46fb73b96a65. Signed-off-by: Janne Grunau <j@jannau.net>
* *RFL fixup: kernel::driver: implement Send for RegistrationJanne Grunau2024-09-161-0/+4
| | | | | | | | required after ("rust: kernel: require `Send` for `Module` implementations") commit 323617f649c0966ad5e741e47e27e06d3a680d8f upstream. Fixes: 0d4917899844 ("*RFL import: kernel::driver") Signed-off-by: Janne Grunau <j@jannau.net>
* driver, of: Mangle the device ID machinery further to remove const_trait_implAsahi Lina2024-09-163-43/+82
| | | | | | | | | | | This unstable feature is broken/gone in 1.73. To work around this without breaking the API, turn IdArray::new() into a macro so that it can use concrete types (which can still have const associated functions) instead of a trait. This is quite ugly... Signed-off-by: Asahi Lina <lina@asahilina.net>
* rust: bindgen: Exclude list functions with unsupported ABIsAsahi Lina2024-09-161-0/+4
| | | | | | | | | | | | | | | | | | CONFIG_LIST_HARDENED causes certain list functions to use what bindgen considers an unsupported ABI: panicked at 'Invalid or unknown abi 14 for function "__list_del_entry_valid_or_report" (Function { name: "__list_del_entry_valid_or_report", mangled_name: Some("__list_del_entry_valid_or_report"), link_name: None, signature: TypeId(ItemId(38153)), kind: Function, linkage: External })', /usr/share/cargo/registry/bindgen-0.68.1/codegen/mod.rs:4195:17 Exclude these, since they are internal functions we don't use directly anyway. Signed-off-by: Asahi Lina <lina@asahilina.net>
* rust: Fix x86 build moreHector Martin2024-09-161-5/+39
| | | | Signed-off-by: Hector Martin <marcan@marcan.st>
* rust: Fix x86 buildHector Martin2024-09-162-0/+7
| | | | Signed-off-by: Hector Martin <marcan@marcan.st>
* drm/asahi: Add the Asahi driver for Apple AGX GPUsAsahi Lina2024-09-162-5/+6
| | | | Signed-off-by: Asahi Lina <lina@asahilina.net>
* rust: macros: Add versions macroAsahi Lina2024-09-162-0/+348
| | | | Signed-off-by: Asahi Lina <lina@asahilina.net>
* rust: bindings: Bind the Asahi DRM UAPIAsahi Lina2024-09-161-0/+1
| | | | Signed-off-by: Asahi Lina <lina@asahilina.net>
* rust: drm: gem: Add set_exportable() methodAsahi Lina2024-09-162-0/+17
| | | | | This allows drivers to control whether a given GEM object is allowed to be exported via PRIME to other drivers.
* rust: drm: sched: Add GPU scheduler abstractionAsahi Lina2024-09-164-0/+377
| | | | | | | | The GPU scheduler manages scheduling GPU jobs and dependencies between them. This Rust abstraction allows Rust DRM drivers to use this functionality. Signed-off-by: Asahi Lina <lina@asahilina.net>
* rust: drm: syncobj: Add DRM Sync Object abstractionAsahi Lina2024-09-164-0/+101
| | | | | | | | DRM Sync Objects are a container for a DMA fence, and can be waited on signaled, exported, and imported from userspace. Add a Rust abstraction so Rust DRM drivers can support this functionality. Signed-off-by: Asahi Lina <lina@asahilina.net>
* rust: drm: mm: Add DRM MM Range Allocator abstractionAsahi Lina2024-09-162-0/+311
| | | | | | | | drm_mm provides a simple range allocator, useful for managing virtual address ranges. Add a Rust abstraction to expose this module to Rust drivers. Signed-off-by: Asahi Lina <lina@asahilina.net>
* rust: drm: gem: Allow pinning GEM object driver dataAsahi Lina2024-09-161-10/+13
| | | | | | This requires type_alias_impl_trait. Signed-off-by: Asahi Lina <lina@asahilina.net>
* rust: drm: device: Convert Device to AlwaysRefCountedAsahi Lina2024-09-161-18/+21
| | | | | | | | Switch from being a refcount wrapper itself to a transparent wrapper around `bindings::drm_device`. The refcounted type then becomes ARef<Device<T>>. Signed-off-by: Asahi Lina <lina@asahilina.net>
* rust: drm: gem: shmem: Add DRM shmem helper abstractionAsahi Lina2024-09-164-5/+485
| | | | | | | | | 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>
* rust: drm: gem: Allow pinning GEM object driver dataAsahi Lina2024-09-161-13/+36
| | | | | | This requires type_alias_impl_trait. Signed-off-by: Asahi Lina <lina@asahilina.net>
* rust: drm: device: Convert Device to AlwaysRefCountedAsahi Lina2024-09-161-4/+6
| | | | | | | | Switch from being a refcount wrapper itself to a transparent wrapper around `bindings::drm_device`. The refcounted type then becomes ARef<Device<T>>. Signed-off-by: Asahi Lina <lina@asahilina.net>
* rust: drm: gem: Add GEM object abstractionAsahi Lina2024-09-165-2/+412
| | | | | | | | The DRM GEM subsystem is the DRM memory management subsystem used by most modern drivers. Add a Rust abstraction to allow Rust DRM driver implementations to use it. Signed-off-by: Asahi Lina <lina@asahilina.net>
* rust: drm: device: Convert Device to AlwaysRefCountedAsahi Lina2024-09-161-2/+2
| | | | | | | | Switch from being a refcount wrapper itself to a transparent wrapper around `bindings::drm_device`. The refcounted type then becomes ARef<Device<T>>. Signed-off-by: Asahi Lina <lina@asahilina.net>
* rust: drm: file: Add File abstractionAsahi Lina2024-09-164-2/+124
| | | | | | | | | A DRM File is the DRM counterpart to a kernel file structure, representing an open DRM file descriptor. Add a Rust abstraction to allow drivers to implement their own File types that implement the DriverFile trait. Signed-off-by: Asahi Lina <lina@asahilina.net>
* rust: drm: Add Device and Driver abstractionsAsahi Lina2024-09-165-6/+410
| | | | | | | | | | Add the initial abstractions for DRM drivers and devices. These go together in one commit since they are fairly tightly coupled types. A few things have been stubbed out, to be implemented as further bits of the DRM subsystem are introduced. Signed-off-by: Asahi Lina <lina@asahilina.net>
* rust: drm: ioctl: Add DRM ioctl abstractionAsahi Lina2024-09-165-0/+162
| | | | | | | | | | | | DRM drivers need to be able to declare which driver-specific ioctls they support. This abstraction adds the required types and a helper macro to generate the ioctl definition inside the DRM driver. Note that this macro is not usable until further bits of the abstraction are in place (but it will not fail to compile on its own, if not called). Signed-off-by: Asahi Lina <lina@asahilina.net>
* rust: helpers: Add bindings/wrappers for dma_resvAsahi Lina2024-09-162-0/+14
| | | | | | | This is just for basic usage in the DRM shmem abstractions for implied locking, not intended as a full DMA Reservation abstraction yet. Signed-off-by: Asahi Lina <lina@asahilina.net>
* rust: dma_fence: Add DMA Fence abstractionAsahi Lina2024-09-164-0/+586
| | | | | | | | | | | | DMA fences are the internal synchronization primitive used for DMA operations like GPU rendering, video en/decoding, etc. Add an abstraction to allow Rust drivers to interact with this subsystem. Note: This uses a raw spinlock living next to the fence, since we do not interact with it other than for initialization. TODO: Expose this to the user at some point with a safe abstraction. Signed-off-by: Asahi Lina <lina@asahilina.net>
* rust: io_pgtable: Add the Apple UAT format abstractionAsahi Lina2024-09-161-0/+6
| | | | Signed-off-by: Asahi Lina <lina@asahilina.net>
* *RFL import: kernel::KParamGuard & friendsAsahi Lina2024-09-161-0/+37
| | | | Commit reference: 3dfc5ebff103