Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/xe/madvise: Fix ioctl argument check

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>

authored by

Shuicheng Lin and committed by
Matt Roper
33fe111a 5959c4da

+2 -4
+2 -4
drivers/gpu/drm/xe/xe_vm_madvise.c
··· 124 124 vmas[i]->attr.atomic_access = op->atomic.val; 125 125 } 126 126 127 - vmas[i]->attr.atomic_access = op->atomic.val; 128 - 129 127 bo = xe_vma_bo(vmas[i]); 130 128 if (!bo || bo->attr.atomic_access == op->atomic.val) 131 129 continue; ··· 251 253 if (XE_IOCTL_DBG(xe, args->preferred_mem_loc.pad)) 252 254 return false; 253 255 254 - if (XE_IOCTL_DBG(xe, args->atomic.reserved)) 256 + if (XE_IOCTL_DBG(xe, args->preferred_mem_loc.reserved)) 255 257 return false; 256 258 break; 257 259 } ··· 405 407 } 406 408 407 409 if (madvise_range.has_svm_userptr_vmas) { 408 - err = down_read_interruptible(&vm->svm.gpusvm.notifier_lock); 410 + err = xe_svm_notifier_lock_interruptible(vm); 409 411 if (err) 410 412 goto err_fini; 411 413 }