]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
drm/xe: Assign ioctl xe file handler to vm in xe_vm_create
authorPiotr Piórkowski <piotr.piorkowski@intel.com>
Mon, 11 Aug 2025 10:43:57 +0000 (12:43 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Aug 2025 14:34:47 +0000 (16:34 +0200)
commitd5b6f0cbb787439db7ec0c575e4c239ec6b5ba5f
tree54e06fca3f274d034f129627827025a6a3e9234a
parent6efb0265ac590e7d85690045561bc70036543ce3
drm/xe: Assign ioctl xe file handler to vm in xe_vm_create

[ Upstream commit 658a1c8e0a66d0777e0e37a11ba19f27a81e77f4 ]

In several code paths, such as xe_pt_create(), the vm->xef field is used
to determine whether a VM originates from userspace or the kernel.

Previously, this handler was only assigned in xe_vm_create_ioctl(),
after the VM was created by xe_vm_create(). However, xe_vm_create()
triggers page table creation, and that function assumes vm->xef should
be already set. This could lead to incorrect origin detection.

To fix this problem and ensure consistency in the initialization of
the VM object, let's move the assignment of this handler to
xe_vm_create.

v2:
 - take reference to the xe file object only when xef is not NULL
 - release the reference to the xe file object on the error path (Matthew)

Fixes: 7f387e6012b6 ("drm/xe: add XE_BO_FLAG_PINNED_LATE_RESTORE")
Signed-off-by: Piotr Piórkowski <piotr.piorkowski@intel.com>
Cc: Matthew Auld <matthew.auld@intel.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Link: https://lore.kernel.org/r/20250811104358.2064150-2-piotr.piorkowski@intel.com
Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
(cherry picked from commit 9337166fa1d80f7bb7c7d3a8f901f21c348c0f2a)
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/xe/xe_migrate.c
drivers/gpu/drm/xe/xe_pxp_submit.c
drivers/gpu/drm/xe/xe_vm.c
drivers/gpu/drm/xe/xe_vm.h