diff options
author | Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com> | 2023-11-01 19:02:53 +0000 |
---|---|---|
committer | Rodrigo Vivi <rodrigo.vivi@intel.com> | 2023-12-21 11:45:27 -0500 |
commit | 78e2701a2614720d8c47b3a8490bf61c29718e8a (patch) | |
tree | 4b99b32833c5fce2f858cc1aa80c99e790ee5915 /drivers/gpu/drm/xe/xe_device.c | |
parent | f3bc5bb4d53d2091f03cf43f19e7c9b41db90367 (diff) |
drm/xe: Avoid any races around ccs_mode update
Ensure that there are no drm clients when changing CCS mode.
Allow exec_queue creation only with enabled CCS engines.
v2: Rebase
Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
Signed-off-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Diffstat (limited to 'drivers/gpu/drm/xe/xe_device.c')
-rw-r--r-- | drivers/gpu/drm/xe/xe_device.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c index 8423c817111b..2e0b2e40d8f3 100644 --- a/drivers/gpu/drm/xe/xe_device.c +++ b/drivers/gpu/drm/xe/xe_device.c @@ -73,6 +73,10 @@ static int xe_file_open(struct drm_device *dev, struct drm_file *file) mutex_init(&xef->exec_queue.lock); xa_init_flags(&xef->exec_queue.xa, XA_FLAGS_ALLOC1); + spin_lock(&xe->clients.lock); + xe->clients.count++; + spin_unlock(&xe->clients.lock); + file->driver_priv = xef; return 0; } @@ -105,6 +109,10 @@ static void xe_file_close(struct drm_device *dev, struct drm_file *file) xa_destroy(&xef->vm.xa); mutex_destroy(&xef->vm.lock); + spin_lock(&xe->clients.lock); + xe->clients.count--; + spin_unlock(&xe->clients.lock); + xe_drm_client_put(xef->client); kfree(xef); } @@ -225,6 +233,7 @@ struct xe_device *xe_device_create(struct pci_dev *pdev, xe->info.force_execlist = xe_modparam.force_execlist; spin_lock_init(&xe->irq.lock); + spin_lock_init(&xe->clients.lock); init_waitqueue_head(&xe->ufence_wq); |