Skip to content

Commit 104e15a

Browse files
committed
rust: drm: gem: Support locking gpuva.lock
Signed-off-by: Janne Grunau <j@jannau.net>
1 parent baae9ea commit 104e15a

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

rust/kernel/drm/gem/mod.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,20 @@ pub trait BaseObject: IntoGEMObject {
251251
// SAFETY: The arguments are valid per the type invariant.
252252
Ok(unsafe { bindings::drm_vma_node_offset_addr(&raw mut (*self.as_raw()).vma_node) })
253253
}
254+
255+
/// Lock the gpuva lock
256+
fn lock_gpuva(&self) {
257+
unsafe {
258+
bindings::mutex_lock(&raw mut (*self.as_raw()).gpuva.lock);
259+
}
260+
}
261+
262+
/// Lock the gpuva lock
263+
fn unlock_gpuva(&self) {
264+
unsafe {
265+
bindings::mutex_unlock(&raw mut (*self.as_raw()).gpuva.lock);
266+
}
267+
}
254268
}
255269

256270
impl<T: IntoGEMObject> BaseObject for T {}

0 commit comments

Comments
 (0)