Commit 5b272bf7 authored by Dave Airlie's avatar Dave Airlie
Browse files

Merge tag 'drm-xe-fixes-2024-10-03' of https://gitlab.freedesktop.org/drm/xe/kernel into drm-fixes



Driver Changes:
- Restore pci state on resume (Rodrigo Vivi)
- Fix locking on submission, queue and vm (Matthew Auld, Matthew Brost)
- Fix UAF on queue destruction (Matthew Auld)
- Fix resource release on freq init error path (He Lugang)
- Use rw_semaphore to reduce contention on ASID->VM lookup (Matthew Brost)
- Fix steering for media on Xe2_HPM (Gustavo Sousa)
- Tuning updates to Xe2 (Gustavo Sousa)
- Resume TDR after GT reset to prevent jobs running forever (Matthew Brost)
- Move id allocation to avoid userspace using a guessed number
  to trigger UAF (Matthew Auld, Matthew Brost)
- Fix OA stream close preventing pbatch buffers to complete (José)
- Fix NPD when migrating memory on LNL (Zhanjun Dong)
- Fix memory leak when aborting binds (Matthew Brost)

Signed-off-by: default avatarDave Airlie <airlied@redhat.com>

From: Lucas De Marchi <lucas.demarchi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/2fiv63yanlal5mpw3mxtotte6yvkvtex74c7mkjxca4bazlyja@o4iejcfragxy
parents 240ebf1c a6f3b252
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -169,6 +169,8 @@
#define XEHP_SLICE_COMMON_ECO_CHICKEN1		XE_REG_MCR(0x731c, XE_REG_OPTION_MASKED)
#define   MSC_MSAA_REODER_BUF_BYPASS_DISABLE	REG_BIT(14)

#define XE2LPM_CCCHKNREG1			XE_REG(0x82a8)

#define VF_PREEMPTION				XE_REG(0x83a4, XE_REG_OPTION_MASKED)
#define   PREEMPTION_VERTEX_COUNT		REG_GENMASK(15, 0)

@@ -378,6 +380,9 @@
#define L3SQCREG3				XE_REG_MCR(0xb108)
#define   COMPPWOVERFETCHEN			REG_BIT(28)

#define SCRATCH3_LBCF				XE_REG_MCR(0xb154)
#define   RWFLUSHALLEN				REG_BIT(17)

#define XEHP_L3SQCREG5				XE_REG_MCR(0xb158)
#define   L3_PWM_TIMER_INIT_VAL_MASK		REG_GENMASK(9, 0)

@@ -391,6 +396,12 @@
#define SCRATCH1LPFC				XE_REG(0xb474)
#define   EN_L3_RW_CCS_CACHE_FLUSH		REG_BIT(0)

#define XE2LPM_L3SQCREG2			XE_REG_MCR(0xb604)

#define XE2LPM_L3SQCREG3			XE_REG_MCR(0xb608)

#define XE2LPM_SCRATCH3_LBCF			XE_REG_MCR(0xb654)

#define XE2LPM_L3SQCREG5			XE_REG_MCR(0xb658)

#define XE2_TDF_CTRL				XE_REG(0xb418)
+2 −2
Original line number Diff line number Diff line
@@ -680,8 +680,8 @@ static int xe_bo_move(struct ttm_buffer_object *ttm_bo, bool evict,
	tt_has_data = ttm && (ttm_tt_is_populated(ttm) ||
			      (ttm->page_flags & TTM_TT_FLAG_SWAPPED));

	move_lacks_source = handle_system_ccs ? (!bo->ccs_cleared)  :
						(!mem_type_is_vram(old_mem_type) && !tt_has_data);
	move_lacks_source = !old_mem || (handle_system_ccs ? (!bo->ccs_cleared) :
					 (!mem_type_is_vram(old_mem_type) && !tt_has_data));

	needs_clear = (ttm && ttm->page_flags & TTM_TT_FLAG_ZERO_ALLOC) ||
		(!ttm && ttm_bo->type == ttm_bo_type_device);
+6 −6
Original line number Diff line number Diff line
@@ -171,10 +171,8 @@ static void xe_file_close(struct drm_device *dev, struct drm_file *file)
		xe_exec_queue_kill(q);
		xe_exec_queue_put(q);
	}
	mutex_lock(&xef->vm.lock);
	xa_for_each(&xef->vm.xa, idx, vm)
		xe_vm_close_and_put(vm);
	mutex_unlock(&xef->vm.lock);

	xe_file_put(xef);

@@ -298,6 +296,9 @@ static void xe_device_destroy(struct drm_device *dev, void *dummy)
	if (xe->unordered_wq)
		destroy_workqueue(xe->unordered_wq);

	if (xe->destroy_wq)
		destroy_workqueue(xe->destroy_wq);

	ttm_device_fini(&xe->ttm);
}

@@ -336,9 +337,7 @@ struct xe_device *xe_device_create(struct pci_dev *pdev,

	init_waitqueue_head(&xe->ufence_wq);

	err = drmm_mutex_init(&xe->drm, &xe->usm.lock);
	if (err)
		goto err;
	init_rwsem(&xe->usm.lock);

	xa_init_flags(&xe->usm.asid_to_vm, XA_FLAGS_ALLOC);

@@ -363,8 +362,9 @@ struct xe_device *xe_device_create(struct pci_dev *pdev,
	xe->preempt_fence_wq = alloc_ordered_workqueue("xe-preempt-fence-wq", 0);
	xe->ordered_wq = alloc_ordered_workqueue("xe-ordered-wq", 0);
	xe->unordered_wq = alloc_workqueue("xe-unordered-wq", 0, 0);
	xe->destroy_wq = alloc_workqueue("xe-destroy-wq", 0, 0);
	if (!xe->ordered_wq || !xe->unordered_wq ||
	    !xe->preempt_fence_wq) {
	    !xe->preempt_fence_wq || !xe->destroy_wq) {
		/*
		 * Cleanup done in xe_device_destroy via
		 * drmm_add_action_or_reset register above
+15 −4
Original line number Diff line number Diff line
@@ -369,7 +369,7 @@ struct xe_device {
		/** @usm.next_asid: next ASID, used to cyclical alloc asids */
		u32 next_asid;
		/** @usm.lock: protects UM state */
		struct mutex lock;
		struct rw_semaphore lock;
	} usm;

	/** @pinned: pinned BO state */
@@ -396,6 +396,9 @@ struct xe_device {
	/** @unordered_wq: used to serialize unordered work, mostly display */
	struct workqueue_struct *unordered_wq;

	/** @destroy_wq: used to serialize user destroy work, like queue */
	struct workqueue_struct *destroy_wq;

	/** @tiles: device tiles */
	struct xe_tile tiles[XE_MAX_TILES_PER_DEVICE];

@@ -567,15 +570,23 @@ struct xe_file {
	struct {
		/** @vm.xe: xarray to store VMs */
		struct xarray xa;
		/** @vm.lock: protects file VM state */
		/**
		 * @vm.lock: Protects VM lookup + reference and removal a from
		 * file xarray. Not an intended to be an outer lock which does
		 * thing while being held.
		 */
		struct mutex lock;
	} vm;

	/** @exec_queue: Submission exec queue state for file */
	struct {
		/** @exec_queue.xe: xarray to store engines */
		/** @exec_queue.xa: xarray to store exece queues */
		struct xarray xa;
		/** @exec_queue.lock: protects file engine state */
		/**
		 * @exec_queue.lock: Protects exec queue lookup + reference and
		 * removal a frommfile xarray. Not an intended to be an outer
		 * lock which does thing while being held.
		 */
		struct mutex lock;
	} exec_queue;

+8 −1
Original line number Diff line number Diff line
@@ -283,8 +283,15 @@ static void show_run_ticks(struct drm_printer *p, struct drm_file *file)

	/* Accumulate all the exec queues from this client */
	mutex_lock(&xef->exec_queue.lock);
	xa_for_each(&xef->exec_queue.xa, i, q)
	xa_for_each(&xef->exec_queue.xa, i, q) {
		xe_exec_queue_get(q);
		mutex_unlock(&xef->exec_queue.lock);

		xe_exec_queue_update_run_ticks(q);

		mutex_lock(&xef->exec_queue.lock);
		xe_exec_queue_put(q);
	}
	mutex_unlock(&xef->exec_queue.lock);

	/* Get the total GPU cycles */
Loading