mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 14:53:58 -04:00
rust: gpu: Add GPU buddy allocator bindings
Add safe Rust abstractions over the Linux kernel's GPU buddy allocator for physical memory management. The GPU buddy allocator implements a binary buddy system useful for GPU physical memory allocation. nova-core will use it for physical memory allocation. Cc: Nikola Djukic <ndjukic@nvidia.com> Signed-off-by: Joel Fernandes <joelagnelf@nvidia.com> Reviewed-by: Alexandre Courbot <acourbot@nvidia.com> Link: https://patch.msgid.link/20260320045711.43494-2-joelagnelf@nvidia.com [ * Use doc-comments for GpuBuddyAllocMode methods and GpuBuddyGuard, * Fix comma splice in GpuBuddyParams::chunk_size doc-comment, * Remove redundant summary in GpuBuddy::new doc-comment, * Drop Rust helper for gpu_buddy_block_size(). - Danilo ] Signed-off-by: Danilo Krummrich <dakr@kernel.org>
This commit is contained in:
committed by
Danilo Krummrich
parent
f9f0b4a1f3
commit
b9616d9721
17
rust/helpers/gpu.c
Normal file
17
rust/helpers/gpu.c
Normal file
@@ -0,0 +1,17 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
#include <linux/gpu_buddy.h>
|
||||
|
||||
#ifdef CONFIG_GPU_BUDDY
|
||||
|
||||
__rust_helper u64 rust_helper_gpu_buddy_block_offset(const struct gpu_buddy_block *block)
|
||||
{
|
||||
return gpu_buddy_block_offset(block);
|
||||
}
|
||||
|
||||
__rust_helper unsigned int rust_helper_gpu_buddy_block_order(struct gpu_buddy_block *block)
|
||||
{
|
||||
return gpu_buddy_block_order(block);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_GPU_BUDDY */
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "err.c"
|
||||
#include "irq.c"
|
||||
#include "fs.c"
|
||||
#include "gpu.c"
|
||||
#include "io.c"
|
||||
#include "jump_label.c"
|
||||
#include "kunit.c"
|
||||
|
||||
Reference in New Issue
Block a user