Commit 1a6bbc4d authored by Dave Airlie's avatar Dave Airlie
Browse files

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



Driver Changes:
- Fix ccs_mode setting for Xe2 and later (Balasubramani)
- Synchronize ccs_mode setting with client creation (Balasubramani)
- Apply scheduling WA for LNL in additional places as needed
  (Nirmoy)
- Fix leak and lock handling in error paths of xe_exec ioctl
  (Matthew Brost)
- Fix GGTT allocation leak leading to eventual crash in SR-IOV
  (Michal Wajdeczko)
- Move run_ticks update out of job handling to avoid synchronization
  with reader (Lucas)

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

From: Lucas De Marchi <lucas.demarchi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/4ffcebtluaaaohquxfyf5babpihmtscxwad3jjmt5nggwh2xpm@ztw67ucywttg
parents 9b984a71 514447a1
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -517,7 +517,7 @@
 *   [4-6]     RSVD
 *   [7]       Disabled
 */
#define CCS_MODE				XE_REG(0x14804)
#define CCS_MODE				XE_REG(0x14804, XE_REG_OPTION_MASKED)
#define   CCS_MODE_CSLICE_0_3_MASK		REG_GENMASK(11, 0) /* 3 bits per cslice */
#define   CCS_MODE_CSLICE_MASK			0x7 /* CCS0-3 + rsvd */
#define   CCS_MODE_CSLICE_WIDTH			ilog2(CCS_MODE_CSLICE_MASK + 1)
+0 −10
Original line number Diff line number Diff line
@@ -87,10 +87,6 @@ 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;
	kref_init(&xef->refcount);

@@ -107,17 +103,12 @@ static int xe_file_open(struct drm_device *dev, struct drm_file *file)
static void xe_file_destroy(struct kref *ref)
{
	struct xe_file *xef = container_of(ref, struct xe_file, refcount);
	struct xe_device *xe = xef->xe;

	xa_destroy(&xef->exec_queue.xa);
	mutex_destroy(&xef->exec_queue.lock);
	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->process_name);
	kfree(xef);
@@ -333,7 +324,6 @@ 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);

+14 −0
Original line number Diff line number Diff line
@@ -178,4 +178,18 @@ void xe_device_declare_wedged(struct xe_device *xe);
struct xe_file *xe_file_get(struct xe_file *xef);
void xe_file_put(struct xe_file *xef);

/*
 * Occasionally it is seen that the G2H worker starts running after a delay of more than
 * a second even after being queued and activated by the Linux workqueue subsystem. This
 * leads to G2H timeout error. The root cause of issue lies with scheduling latency of
 * Lunarlake Hybrid CPU. Issue disappears if we disable Lunarlake atom cores from BIOS
 * and this is beyond xe kmd.
 *
 * TODO: Drop this change once workqueue scheduling delay issue is fixed on LNL Hybrid CPU.
 */
#define LNL_FLUSH_WORKQUEUE(wq__) \
	flush_workqueue(wq__)
#define LNL_FLUSH_WORK(wrk__) \
	flush_work(wrk__)

#endif
+0 −9
Original line number Diff line number Diff line
@@ -353,15 +353,6 @@ struct xe_device {
		struct workqueue_struct *wq;
	} sriov;

	/** @clients: drm clients info */
	struct {
		/** @clients.lock: Protects drm clients info */
		spinlock_t lock;

		/** @clients.count: number of drm clients */
		u64 count;
	} clients;

	/** @usm: unified memory state */
	struct {
		/** @usm.asid: convert a ASID to VM */
+9 −4
Original line number Diff line number Diff line
@@ -132,12 +132,16 @@ int xe_exec_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
	if (XE_IOCTL_DBG(xe, !q))
		return -ENOENT;

	if (XE_IOCTL_DBG(xe, q->flags & EXEC_QUEUE_FLAG_VM))
		return -EINVAL;
	if (XE_IOCTL_DBG(xe, q->flags & EXEC_QUEUE_FLAG_VM)) {
		err = -EINVAL;
		goto err_exec_queue;
	}

	if (XE_IOCTL_DBG(xe, args->num_batch_buffer &&
			 q->width != args->num_batch_buffer))
		return -EINVAL;
			 q->width != args->num_batch_buffer)) {
		err = -EINVAL;
		goto err_exec_queue;
	}

	if (XE_IOCTL_DBG(xe, q->ops->reset_status(q))) {
		err = -ECANCELED;
@@ -220,6 +224,7 @@ int xe_exec_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
			fence = xe_sync_in_fence_get(syncs, num_syncs, q, vm);
			if (IS_ERR(fence)) {
				err = PTR_ERR(fence);
				xe_vm_unlock(vm);
				goto err_unlock_list;
			}
			for (i = 0; i < num_syncs; i++)
Loading