]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/xe: Add xe_bo_vm_access
authorMatthew Brost <matthew.brost@intel.com>
Tue, 26 Nov 2024 17:46:08 +0000 (09:46 -0800)
committerMatthew Brost <matthew.brost@intel.com>
Thu, 28 Nov 2024 00:38:49 +0000 (16:38 -0800)
Add xe_bo_vm_access which is wrapper around ttm_bo_vm_access which takes
rpm refs for device access.

Suggested-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20241126174615.2665852-2-matthew.brost@intel.com
drivers/gpu/drm/xe/xe_bo.c

index ec070af12662891d372e825d9f5f53bd3ce2ee4d..aaf54131c89e402673a96d4f72dd8e1447f33548 100644 (file)
@@ -1249,11 +1249,26 @@ out:
        return ret;
 }
 
+static int xe_bo_vm_access(struct vm_area_struct *vma, unsigned long addr,
+                          void *buf, int len, int write)
+{
+       struct ttm_buffer_object *ttm_bo = vma->vm_private_data;
+       struct xe_bo *bo = ttm_to_xe_bo(ttm_bo);
+       struct xe_device *xe = xe_bo_device(bo);
+       int ret;
+
+       xe_pm_runtime_get(xe);
+       ret = ttm_bo_vm_access(vma, addr, buf, len, write);
+       xe_pm_runtime_put(xe);
+
+       return ret;
+}
+
 static const struct vm_operations_struct xe_gem_vm_ops = {
        .fault = xe_gem_fault,
        .open = ttm_bo_vm_open,
        .close = ttm_bo_vm_close,
-       .access = ttm_bo_vm_access
+       .access = xe_bo_vm_access,
 };
 
 static const struct drm_gem_object_funcs xe_gem_object_funcs = {