Skip to content

Commit 5d6788d

Browse files
committed
rust: drm: gem: Support locking gpuva.lock
Signed-off-by: Janne Grunau <j@jannau.net>
1 parent 46f5f1c commit 5d6788d

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
@@ -250,6 +250,20 @@ pub trait BaseObject: IntoGEMObject {
250250
// SAFETY: The arguments are valid per the type invariant.
251251
Ok(unsafe { bindings::drm_vma_node_offset_addr(&raw mut (*self.as_raw()).vma_node) })
252252
}
253+
254+
/// Lock the gpuva lock
255+
fn lock_gpuva(&self) {
256+
unsafe {
257+
bindings::mutex_lock(&raw mut (*self.as_raw()).gpuva.lock);
258+
}
259+
}
260+
261+
/// Lock the gpuva lock
262+
fn unlock_gpuva(&self) {
263+
unsafe {
264+
bindings::mutex_unlock(&raw mut (*self.as_raw()).gpuva.lock);
265+
}
266+
}
253267
}
254268

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

0 commit comments

Comments
 (0)