summaryrefslogtreecommitdiff
path: root/rust/kernel/drm/gpuvm/mod.rs
diff options
context:
space:
mode:
authorAlice Ryhl <aliceryhl@google.com>2026-04-09 15:26:10 +0000
committerDanilo Krummrich <dakr@kernel.org>2026-05-05 12:52:49 +0200
commit0b715b1e382b3d2e15d71c03a23be5f4333e7894 (patch)
tree3f5419814ac3c97d4d9f55021a9916f42a33cb9c /rust/kernel/drm/gpuvm/mod.rs
parentdc3846045f694eef0606697e2304099cba403691 (diff)
rust: gpuvm: add GpuVmCore::sm_map()
Finally also add the operation for creating new mappings. Mapping operations need extra data in the context since they involve a vm_bo coming from the outside. Co-developed-by: Asahi Lina <lina+kernel@asahilina.net> Signed-off-by: Asahi Lina <lina+kernel@asahilina.net> Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com> Signed-off-by: Alice Ryhl <aliceryhl@google.com> Link: https://patch.msgid.link/20260409-gpuvm-rust-v6-5-b16e6ada7261@google.com Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Diffstat (limited to 'rust/kernel/drm/gpuvm/mod.rs')
-rw-r--r--rust/kernel/drm/gpuvm/mod.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/rust/kernel/drm/gpuvm/mod.rs b/rust/kernel/drm/gpuvm/mod.rs
index a6436abd0f9c..dc755f248143 100644
--- a/rust/kernel/drm/gpuvm/mod.rs
+++ b/rust/kernel/drm/gpuvm/mod.rs
@@ -108,7 +108,7 @@ impl<T: DriverGpuVm> GpuVm<T> {
vm_bo_alloc: GpuVmBo::<T>::ALLOC_FN,
vm_bo_free: GpuVmBo::<T>::FREE_FN,
vm_bo_validate: None,
- sm_step_map: None,
+ sm_step_map: Some(Self::sm_step_map),
sm_step_unmap: Some(Self::sm_step_unmap),
sm_step_remap: Some(Self::sm_step_remap),
}
@@ -266,6 +266,13 @@ pub trait DriverGpuVm: Sized + Send {
/// The private data passed to callbacks.
type SmContext<'ctx>;
+ /// Indicates that a new mapping should be created.
+ fn sm_step_map<'op, 'ctx>(
+ &mut self,
+ op: OpMap<'op, Self>,
+ context: &mut Self::SmContext<'ctx>,
+ ) -> Result<OpMapped<'op, Self>, Error>;
+
/// Indicates that an existing mapping should be removed.
fn sm_step_unmap<'op, 'ctx>(
&mut self,