mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
synced 2025-09-02 16:44:59 +00:00
drm/xe/oa: Assign hwe for OAM_SAG
Because OAM_SAG doesn't have an attached hwe, assign another hwe belonging to the same gt (and different OAM unit) to OAM_SAG. A hwe is needed for batch submissions to program OA HW. v2: Assign an engine with a valid OA unit for OAM_SAG (Umesh) Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com> Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com> Link: https://lore.kernel.org/r/20250606192618.4133817-5-ashutosh.dixit@intel.com
This commit is contained in:
parent
2d1fcec022
commit
10d42ef34b
@ -1923,37 +1923,48 @@ u16 xe_oa_unit_id(struct xe_hw_engine *hwe)
|
|||||||
hwe->oa_unit->oa_unit_id : U16_MAX;
|
hwe->oa_unit->oa_unit_id : U16_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* A hwe must be assigned to stream/oa_unit for batch submissions */
|
||||||
static int xe_oa_assign_hwe(struct xe_oa *oa, struct xe_oa_open_param *param)
|
static int xe_oa_assign_hwe(struct xe_oa *oa, struct xe_oa_open_param *param)
|
||||||
{
|
{
|
||||||
struct xe_gt *gt;
|
struct xe_hw_engine *hwe;
|
||||||
int i, ret = 0;
|
enum xe_hw_engine_id id;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
/* If not provided, OA unit defaults to OA unit 0 as per uapi */
|
||||||
|
if (!param->oa_unit)
|
||||||
|
param->oa_unit = &xe_device_get_gt(oa->xe, 0)->oa.oa_unit[0];
|
||||||
|
|
||||||
|
/* When we have an exec_q, get hwe from the exec_q */
|
||||||
if (param->exec_q) {
|
if (param->exec_q) {
|
||||||
/* When we have an exec_q, get hwe from the exec_q */
|
|
||||||
param->hwe = xe_gt_hw_engine(param->exec_q->gt, param->exec_q->class,
|
param->hwe = xe_gt_hw_engine(param->exec_q->gt, param->exec_q->class,
|
||||||
param->engine_instance, true);
|
param->engine_instance, true);
|
||||||
} else {
|
if (!param->hwe || param->hwe->oa_unit != param->oa_unit)
|
||||||
struct xe_hw_engine *hwe;
|
goto err;
|
||||||
enum xe_hw_engine_id id;
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
/* Else just get the first hwe attached to the oa unit */
|
/* Else just get the first hwe attached to the oa unit */
|
||||||
for_each_gt(gt, oa->xe, i) {
|
for_each_hw_engine(hwe, param->oa_unit->gt, id) {
|
||||||
for_each_hw_engine(hwe, gt, id) {
|
if (hwe->oa_unit == param->oa_unit) {
|
||||||
if (hwe->oa_unit == param->oa_unit) {
|
param->hwe = hwe;
|
||||||
param->hwe = hwe;
|
goto out;
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
out:
|
|
||||||
if (!param->hwe || param->hwe->oa_unit != param->oa_unit) {
|
|
||||||
drm_dbg(&oa->xe->drm, "Unable to find hwe (%d, %d) for OA unit ID %d\n",
|
|
||||||
param->exec_q ? param->exec_q->class : -1,
|
|
||||||
param->engine_instance, param->oa_unit->oa_unit_id);
|
|
||||||
ret = -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/* If we still didn't find a hwe, just get one with a valid oa_unit from the same gt */
|
||||||
|
for_each_hw_engine(hwe, param->oa_unit->gt, id) {
|
||||||
|
if (!hwe->oa_unit)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
param->hwe = hwe;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
err:
|
||||||
|
drm_dbg(&oa->xe->drm, "Unable to find hwe (%d, %d) for OA unit ID %d\n",
|
||||||
|
param->exec_q ? param->exec_q->class : -1,
|
||||||
|
param->engine_instance, param->oa_unit->oa_unit_id);
|
||||||
|
ret = -EINVAL;
|
||||||
|
out:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2578,6 +2589,8 @@ static void __xe_oa_init_oa_units(struct xe_gt *gt)
|
|||||||
DRM_XE_OA_UNIT_TYPE_OAM_SAG : DRM_XE_OA_UNIT_TYPE_OAM;
|
DRM_XE_OA_UNIT_TYPE_OAM_SAG : DRM_XE_OA_UNIT_TYPE_OAM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u->gt = gt;
|
||||||
|
|
||||||
xe_mmio_write32(>->mmio, u->regs.oa_ctrl, 0);
|
xe_mmio_write32(>->mmio, u->regs.oa_ctrl, 0);
|
||||||
|
|
||||||
/* Ensure MMIO trigger remains disabled till there is a stream */
|
/* Ensure MMIO trigger remains disabled till there is a stream */
|
||||||
|
@ -95,6 +95,9 @@ struct xe_oa_unit {
|
|||||||
/** @oa_unit_id: identifier for the OA unit */
|
/** @oa_unit_id: identifier for the OA unit */
|
||||||
u16 oa_unit_id;
|
u16 oa_unit_id;
|
||||||
|
|
||||||
|
/** @gt: gt associated with the OA unit */
|
||||||
|
struct xe_gt *gt;
|
||||||
|
|
||||||
/** @type: Type of OA unit - OAM, OAG etc. */
|
/** @type: Type of OA unit - OAM, OAG etc. */
|
||||||
enum drm_xe_oa_unit_type type;
|
enum drm_xe_oa_unit_type type;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user