Skip to content

Commit 400ce61

Browse files
committed
rust: drm: gem: Support locking gpuva.lock
Signed-off-by: Janne Grunau <j@jannau.net>
1 parent 611dc3b commit 400ce61

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
@@ -257,6 +257,20 @@ pub trait BaseObject: IntoGEMObject {
257257
// SAFETY: The arguments are valid per the type invariant.
258258
Ok(unsafe { bindings::drm_vma_node_offset_addr(&raw mut (*self.as_raw()).vma_node) })
259259
}
260+
261+
/// Lock the gpuva lock
262+
fn lock_gpuva(&self) {
263+
unsafe {
264+
bindings::mutex_lock(&raw mut (*self.as_raw()).gpuva.lock);
265+
}
266+
}
267+
268+
/// Lock the gpuva lock
269+
fn unlock_gpuva(&self) {
270+
unsafe {
271+
bindings::mutex_unlock(&raw mut (*self.as_raw()).gpuva.lock);
272+
}
273+
}
260274
}
261275

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

0 commit comments

Comments
 (0)