]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/xe/madvise: Fix ioctl argument check
authorShuicheng Lin <shuicheng.lin@intel.com>
Thu, 11 Sep 2025 17:31:40 +0000 (17:31 +0000)
committerMatt Roper <matthew.d.roper@intel.com>
Wed, 17 Sep 2025 17:09:34 +0000 (10:09 -0700)
It is "preferred_mem_loc" instead of "atomic" for the ATTR_PREFERRED_LOC
path.

Also include 2 minor changes with no functional impact.
1. Remove the redundant "attr.atomic_access" assignment.
2. Replace down_read_interruptible() with
   xe_svm_notifier_lock_interruptible() to pair with
   xe_svm_notifier_unlock().

Fixes: ada7486c5668 ("drm/xe: Implement madvise ioctl for xe")
Cc: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Signed-off-by: Shuicheng Lin <shuicheng.lin@intel.com>
Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Link: https://lore.kernel.org/r/20250911173139.1405878-2-shuicheng.lin@intel.com
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
drivers/gpu/drm/xe/xe_vm_madvise.c

index 1537007435457bf20ca5fc2712126375d58bdf42..cad3cf627c3f2ff21e88c40c90bf92a6a7a6573d 100644 (file)
@@ -124,8 +124,6 @@ static void madvise_atomic(struct xe_device *xe, struct xe_vm *vm,
                        vmas[i]->attr.atomic_access = op->atomic.val;
                }
 
-               vmas[i]->attr.atomic_access = op->atomic.val;
-
                bo = xe_vma_bo(vmas[i]);
                if (!bo || bo->attr.atomic_access == op->atomic.val)
                        continue;
@@ -253,7 +251,7 @@ static bool madvise_args_are_sane(struct xe_device *xe, const struct drm_xe_madv
                if (XE_IOCTL_DBG(xe, args->preferred_mem_loc.pad))
                        return false;
 
-               if (XE_IOCTL_DBG(xe, args->atomic.reserved))
+               if (XE_IOCTL_DBG(xe, args->preferred_mem_loc.reserved))
                        return false;
                break;
        }
@@ -407,7 +405,7 @@ int xe_vm_madvise_ioctl(struct drm_device *dev, void *data, struct drm_file *fil
        }
 
        if (madvise_range.has_svm_userptr_vmas) {
-               err = down_read_interruptible(&vm->svm.gpusvm.notifier_lock);
+               err = xe_svm_notifier_lock_interruptible(vm);
                if (err)
                        goto err_fini;
        }