Commit b55caa69 authored by Dave Airlie's avatar Dave Airlie
Browse files

Merge tag 'drm-xe-fixes-2025-09-18' of https://gitlab.freedesktop.org/drm/xe/kernel into drm-fixes



- Release kobject for the failure path (Shuicheng)
- SRIOV PF: Drop rounddown_pow_of_two fair (Michal)
- Remove type casting on hwmon (Mallesh)
- Defer free of NVM auxiliary container to device release (Nitin)
- Fix a NULL vs IS_ERR (Dan)
- Add cleanup action in xe_device_sysfs_init (Zongyao)
- Fix error handling if PXP fails to start (Daniele)
- Set GuC RCS/CCS yield policy (Daniele)

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

From: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://lore.kernel.org/r/aMwL7vxFP1L94IML@intel.com
parents f5a9c2b4 26caeae9
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -117,6 +117,7 @@ enum xe_guc_action {
	XE_GUC_ACTION_ENTER_S_STATE = 0x501,
	XE_GUC_ACTION_EXIT_S_STATE = 0x502,
	XE_GUC_ACTION_GLOBAL_SCHED_POLICY_CHANGE = 0x506,
	XE_GUC_ACTION_UPDATE_SCHEDULING_POLICIES_KLV = 0x509,
	XE_GUC_ACTION_SCHED_CONTEXT = 0x1000,
	XE_GUC_ACTION_SCHED_CONTEXT_MODE_SET = 0x1001,
	XE_GUC_ACTION_SCHED_CONTEXT_MODE_DONE = 0x1002,
+25 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
 *  | 0 | 31:16 | **KEY** - KLV key identifier                                 |
 *  |   |       |   - `GuC Self Config KLVs`_                                  |
 *  |   |       |   - `GuC Opt In Feature KLVs`_                               |
 *  |   |       |   - `GuC Scheduling Policies KLVs`_                          |
 *  |   |       |   - `GuC VGT Policy KLVs`_                                   |
 *  |   |       |   - `GuC VF Configuration KLVs`_                             |
 *  |   |       |                                                              |
@@ -152,6 +153,30 @@ enum {
#define GUC_KLV_OPT_IN_FEATURE_DYNAMIC_INHIBIT_CONTEXT_SWITCH_KEY 0x4003
#define GUC_KLV_OPT_IN_FEATURE_DYNAMIC_INHIBIT_CONTEXT_SWITCH_LEN 0u

/**
 * DOC: GuC Scheduling Policies KLVs
 *
 * `GuC KLV`_ keys available for use with UPDATE_SCHEDULING_POLICIES_KLV.
 *
 * _`GUC_KLV_SCHEDULING_POLICIES_RENDER_COMPUTE_YIELD` : 0x1001
 *      Some platforms do not allow concurrent execution of RCS and CCS
 *      workloads from different address spaces. By default, the GuC prioritizes
 *      RCS submissions over CCS ones, which can lead to CCS workloads being
 *      significantly (or completely) starved of execution time. This KLV allows
 *      the driver to specify a quantum (in ms) and a ratio (percentage value
 *      between 0 and 100), and the GuC will prioritize the CCS for that
 *      percentage of each quantum. For example, specifying 100ms and 30% will
 *      make the GuC prioritize the CCS for 30ms of every 100ms.
 *      Note that this does not necessarly mean that RCS and CCS engines will
 *      only be active for their percentage of the quantum, as the restriction
 *      only kicks in if both classes are fully busy with non-compatible address
 *      spaces; i.e., if one engine is idle or running the same address space,
 *      a pending job on the other engine will still be submitted to the HW no
 *      matter what the ratio is
 */
#define GUC_KLV_SCHEDULING_POLICIES_RENDER_COMPUTE_YIELD_KEY	0x1001
#define GUC_KLV_SCHEDULING_POLICIES_RENDER_COMPUTE_YIELD_LEN	2u

/**
 * DOC: GuC VGT Policy KLVs
 *
+6 −2
Original line number Diff line number Diff line
@@ -311,12 +311,16 @@ int xe_device_sysfs_init(struct xe_device *xe)
	if (xe->info.platform == XE_BATTLEMAGE) {
		ret = sysfs_create_files(&dev->kobj, auto_link_downgrade_attrs);
		if (ret)
			return ret;
			goto cleanup;

		ret = late_bind_create_files(dev);
		if (ret)
			return ret;
			goto cleanup;
	}

	return devm_add_action_or_reset(dev, xe_device_sysfs_fini, xe);

cleanup:
	xe_device_sysfs_fini(xe);
	return ret;
}
+15 −7
Original line number Diff line number Diff line
@@ -151,6 +151,16 @@ static int __xe_exec_queue_init(struct xe_exec_queue *q)
	return err;
}

static void __xe_exec_queue_fini(struct xe_exec_queue *q)
{
	int i;

	q->ops->fini(q);

	for (i = 0; i < q->width; ++i)
		xe_lrc_put(q->lrc[i]);
}

struct xe_exec_queue *xe_exec_queue_create(struct xe_device *xe, struct xe_vm *vm,
					   u32 logical_mask, u16 width,
					   struct xe_hw_engine *hwe, u32 flags,
@@ -181,11 +191,13 @@ struct xe_exec_queue *xe_exec_queue_create(struct xe_device *xe, struct xe_vm *v
	if (xe_exec_queue_uses_pxp(q)) {
		err = xe_pxp_exec_queue_add(xe->pxp, q);
		if (err)
			goto err_post_alloc;
			goto err_post_init;
	}

	return q;

err_post_init:
	__xe_exec_queue_fini(q);
err_post_alloc:
	__xe_exec_queue_free(q);
	return ERR_PTR(err);
@@ -283,13 +295,11 @@ void xe_exec_queue_destroy(struct kref *ref)
			xe_exec_queue_put(eq);
	}

	q->ops->fini(q);
	q->ops->destroy(q);
}

void xe_exec_queue_fini(struct xe_exec_queue *q)
{
	int i;

	/*
	 * Before releasing our ref to lrc and xef, accumulate our run ticks
	 * and wakeup any waiters.
@@ -298,9 +308,7 @@ void xe_exec_queue_fini(struct xe_exec_queue *q)
	if (q->xef && atomic_dec_and_test(&q->xef->exec_queue.pending_removal))
		wake_up_var(&q->xef->exec_queue.pending_removal);

	for (i = 0; i < q->width; ++i)
		xe_lrc_put(q->lrc[i]);

	__xe_exec_queue_fini(q);
	__xe_exec_queue_free(q);
}

+7 −1
Original line number Diff line number Diff line
@@ -166,8 +166,14 @@ struct xe_exec_queue_ops {
	int (*init)(struct xe_exec_queue *q);
	/** @kill: Kill inflight submissions for backend */
	void (*kill)(struct xe_exec_queue *q);
	/** @fini: Fini exec queue for submission backend */
	/** @fini: Undoes the init() for submission backend */
	void (*fini)(struct xe_exec_queue *q);
	/**
	 * @destroy: Destroy exec queue for submission backend. The backend
	 * function must call xe_exec_queue_fini() (which will in turn call the
	 * fini() backend function) to ensure the queue is properly cleaned up.
	 */
	void (*destroy)(struct xe_exec_queue *q);
	/** @set_priority: Set priority for exec queue */
	int (*set_priority)(struct xe_exec_queue *q,
			    enum xe_exec_queue_priority priority);
Loading