if (hwe->exl_port)
xe_execlist_port_destroy(hwe->exl_port);
hwe->gt = NULL;
}
/** * xe_hw_engine_mmio_write32() - Write engine register * @hwe: engine * @reg: register to write into * @val: desired 32-bit value to write * * This function will write val into an engine specific register. * Forcewake must be held by the caller. *
*/ void xe_hw_engine_mmio_write32(struct xe_hw_engine *hwe, struct xe_reg reg, u32 val)
{
xe_gt_assert(hwe->gt, !(reg.addr & hwe->mmio_base));
xe_force_wake_assert_held(gt_to_fw(hwe->gt), hwe->domain);
reg.addr += hwe->mmio_base;
xe_mmio_write32(&hwe->gt->mmio, reg, val);
}
/** * xe_hw_engine_mmio_read32() - Read engine register * @hwe: engine * @reg: register to read from * * This function will read from an engine specific register. * Forcewake must be held by the caller. * * Return: value of the 32-bit register.
*/
u32 xe_hw_engine_mmio_read32(struct xe_hw_engine *hwe, struct xe_reg reg)
{
xe_gt_assert(hwe->gt, !(reg.addr & hwe->mmio_base));
xe_force_wake_assert_held(gt_to_fw(hwe->gt), hwe->domain);
staticvoid
hw_engine_setup_default_state(struct xe_hw_engine *hwe)
{ struct xe_gt *gt = hwe->gt; struct xe_device *xe = gt_to_xe(gt); /* * RING_CMD_CCTL specifies the default MOCS entry that will be * used by the command streamer when executing commands that * don't have a way to explicitly specify a MOCS setting. * The default should usually reference whichever MOCS entry * corresponds to uncached behavior, although use of a WB cached * entry is recommended by the spec in certain circumstances on * specific platforms. * Bspec: 72161
*/ const u8 mocs_write_idx = gt->mocs.uc_index; const u8 mocs_read_idx = hwe->class == XE_ENGINE_CLASS_COMPUTE && IS_DGFX(xe) &&
(GRAPHICS_VER(xe) >= 20 || xe->info.platform == XE_PVC) ?
gt->mocs.wb_index : gt->mocs.uc_index;
u32 ring_cmd_cctl_val = REG_FIELD_PREP(CMD_CCTL_WRITE_OVERRIDE_MASK, mocs_write_idx) |
REG_FIELD_PREP(CMD_CCTL_READ_OVERRIDE_MASK, mocs_read_idx); struct xe_rtp_process_ctx ctx = XE_RTP_PROCESS_CTX_INITIALIZER(hwe); conststruct xe_rtp_entry_sr engine_entries[] = {
{ XE_RTP_NAME("RING_CMD_CCTL_default_MOCS"),
XE_RTP_RULES(GRAPHICS_VERSION_RANGE(1200, XE_RTP_END_VERSION_UNDEFINED)),
XE_RTP_ACTIONS(FIELD_SET(RING_CMD_CCTL(0),
CMD_CCTL_WRITE_OVERRIDE_MASK |
CMD_CCTL_READ_OVERRIDE_MASK,
ring_cmd_cctl_val,
XE_RTP_ACTION_FLAG(ENGINE_BASE)))
}, /* * To allow the GSC engine to go idle on MTL we need to enable * idle messaging and set the hysteresis value (we use 0xA=5us * as recommended in spec). On platforms after MTL this is * enabled by default.
*/
{ XE_RTP_NAME("MTL GSCCS IDLE MSG enable"),
XE_RTP_RULES(MEDIA_VERSION(1300), ENGINE_CLASS(OTHER)),
XE_RTP_ACTIONS(CLR(RING_PSMI_CTL(0),
IDLE_MSG_DISABLE,
XE_RTP_ACTION_FLAG(ENGINE_BASE)),
FIELD_SET(RING_PWRCTX_MAXCNT(0),
IDLE_WAIT_TIME,
0xA,
XE_RTP_ACTION_FLAG(ENGINE_BASE)))
}, /* Enable Priority Mem Read */
{ XE_RTP_NAME("Priority_Mem_Read"),
XE_RTP_RULES(GRAPHICS_VERSION_RANGE(2001, XE_RTP_END_VERSION_UNDEFINED)),
XE_RTP_ACTIONS(SET(CSFE_CHICKEN1(0), CS_PRIORITY_MEM_READ,
XE_RTP_ACTION_FLAG(ENGINE_BASE)))
}, /* Use Fixed slice CCS mode */
{ XE_RTP_NAME("RCU_MODE_FIXED_SLICE_CCS_MODE"),
XE_RTP_RULES(FUNC(xe_hw_engine_match_fixed_cslice_mode)),
XE_RTP_ACTIONS(FIELD_SET(RCU_MODE, RCU_MODE_FIXED_SLICE_CCS_MODE,
RCU_MODE_FIXED_SLICE_CCS_MODE))
},
};
/* * The GSC engine can accept submissions while the GSC shim is * being reset, during which time the submission is stalled. In * the worst case, the shim reset can take up to the maximum GSC * command execution time (250ms), so the request start can be * delayed by that much; the request itself can take that long * without being preemptible, which means worst case it can * theoretically take up to 500ms for a preemption to go through * on the GSC engine. Adding to that an extra 100ms as a safety * margin, we get a minimum recommended timeout of 600ms. * The preempt_timeout value can't be tuned for OTHER_CLASS * because the class is reserved for kernel usage, so we just * need to make sure that the starting value is above that * threshold; since our default value (640ms) is greater than * 600ms, the only way we can go below is via a kconfig setting. * If that happens, log it in dmesg and update the value.
*/ if (hwe->class == XE_ENGINE_CLASS_OTHER) { const u32 min_preempt_timeout = 600 * 1000; if (hwe->eclass->sched_props.preempt_timeout_us < min_preempt_timeout) {
hwe->eclass->sched_props.preempt_timeout_us = min_preempt_timeout;
xe_gt_notice(gt, "Increasing preempt_timeout for GSC to 600ms\n");
}
}
/* Record default props */
hwe->eclass->defaults = hwe->eclass->sched_props;
}
if (!xe_device_uc_enabled(xe)) {
hwe->exl_port = xe_execlist_port_create(xe, hwe); if (IS_ERR(hwe->exl_port)) {
err = PTR_ERR(hwe->exl_port); goto err_hwsp;
}
} else { /* GSCCS has a special interrupt for reset */ if (hwe->class == XE_ENGINE_CLASS_OTHER)
hwe->irq_handler = xe_gsc_hwe_irq_handler;
if (!IS_SRIOV_VF(xe))
xe_hw_engine_enable_ring(hwe);
}
/* We reserve the highest BCS instance for USM */ if (xe->info.has_usm && hwe->class == XE_ENGINE_CLASS_COPY)
gt->usm.reserved_bcs_instance = hwe->instance;
/* Ensure IDLEDLY is lower than MAXCNT */
adjust_idledly(hwe);
/* FIXME: Doing a simple logical mapping that works for most hardware */ for (class = 0; class < XE_ENGINE_CLASS_MAX; ++class) { struct xe_hw_engine *hwe; enum xe_hw_engine_id id; int logical_instance = 0;
/* * Pre-Xe_HP platforms had register bits representing absent engines, * whereas Xe_HP and beyond have bits representing present engines. * Invert the polarity on old platforms so that we can use common * handling below.
*/ if (GRAPHICS_VERx100(xe) < 1250)
media_fuse = ~media_fuse;
/* BCS0 is always present; only BCS1-BCS8 may be fused off */ for (int i = XE_HW_ENGINE_BCS1, j = 0; i <= XE_HW_ENGINE_BCS8; ++i, ++j) { if (!(gt->info.engine_mask & BIT(i))) continue;
staticvoid read_compute_fuses_from_dss(struct xe_gt *gt)
{ /* * CCS fusing based on DSS masks only applies to platforms that can * have more than one CCS.
*/ if (hweight64(gt->info.engine_mask &
GENMASK_ULL(XE_HW_ENGINE_CCS3, XE_HW_ENGINE_CCS0)) <= 1) return;
/* * CCS availability on Xe_HP is inferred from the presence of DSS in * each quadrant.
*/ for (int i = XE_HW_ENGINE_CCS0, j = 0; i <= XE_HW_ENGINE_CCS3; ++i, ++j) { if (!(gt->info.engine_mask & BIT(i))) continue;
staticvoid check_gsc_availability(struct xe_gt *gt)
{ if (!(gt->info.engine_mask & BIT(XE_HW_ENGINE_GSCCS0))) return;
/* * The GSCCS is only used to communicate with the GSC FW, so if we don't * have the FW there is nothing we need the engine for and can therefore * skip its initialization.
*/ if (!xe_uc_fw_is_available(>->uc.gsc.fw)) {
gt->info.engine_mask &= ~BIT(XE_HW_ENGINE_GSCCS0);
/* interrupts where previously enabled, so turn them off */
xe_mmio_write32(>->mmio, GUNIT_GSC_INTR_ENABLE, 0);
xe_mmio_write32(>->mmio, GUNIT_GSC_INTR_MASK, ~0);
xe_gt_dbg(gt, "GSC FW not used, disabling gsccs\n");
}
}
if (hwe->irq_handler)
hwe->irq_handler(hwe, intr_vec);
if (intr_vec & GT_RENDER_USER_INTERRUPT)
xe_hw_fence_irq_run(hwe->fence_irq);
}
/** * xe_hw_engine_snapshot_capture - Take a quick snapshot of the HW Engine. * @hwe: Xe HW Engine. * @q: The exec queue object. * * This can be printed out in a later stage like during dev_coredump * analysis. * * Returns: a Xe HW Engine snapshot object that must be freed by the * caller, using `xe_hw_engine_snapshot_free`.
*/ struct xe_hw_engine_snapshot *
xe_hw_engine_snapshot_capture(struct xe_hw_engine *hwe, struct xe_exec_queue *q)
{ struct xe_hw_engine_snapshot *snapshot; struct __guc_capture_parsed_output *node;
/* otherwise, do manual capture */
xe_engine_manual_capture(hwe, snapshot);
xe_gt_dbg(hwe->gt, "Proceeding with manual engine snapshot");
return snapshot;
}
/** * xe_hw_engine_snapshot_free - Free all allocated objects for a given snapshot. * @snapshot: Xe HW Engine snapshot object. * * This function free all the memory that needed to be allocated at capture * time.
*/ void xe_hw_engine_snapshot_free(struct xe_hw_engine_snapshot *snapshot)
{ struct xe_gt *gt; if (!snapshot) return;
gt = snapshot->hwe->gt; /* * xe_guc_capture_put_matched_nodes is called here and from * xe_devcoredump_snapshot_free, to cover the 2 calling paths * of hw_engines - debugfs and devcoredump free.
*/
xe_guc_capture_put_matched_nodes(>->uc.guc);
kfree(snapshot->name);
kfree(snapshot);
}
/** * xe_hw_engine_print - Xe HW Engine Print. * @hwe: Hardware Engine. * @p: drm_printer. * * This function quickly capture a snapshot and immediately print it out.
*/ void xe_hw_engine_print(struct xe_hw_engine *hwe, struct drm_printer *p)
{ struct xe_hw_engine_snapshot *snapshot;
constchar *xe_hw_engine_class_to_str(enum xe_engine_class class)
{ switch (class) { case XE_ENGINE_CLASS_RENDER: return"rcs"; case XE_ENGINE_CLASS_VIDEO_DECODE: return"vcs"; case XE_ENGINE_CLASS_VIDEO_ENHANCE: return"vecs"; case XE_ENGINE_CLASS_COPY: return"bcs"; case XE_ENGINE_CLASS_OTHER: return"other"; case XE_ENGINE_CLASS_COMPUTE: return"ccs"; case XE_ENGINE_CLASS_MAX: break;
}
/** * xe_hw_engine_lookup() - Lookup hardware engine for class:instance * @xe: xe device * @eci: engine class and instance * * This function will find a hardware engine for given engine * class and instance. * * Return: If found xe_hw_engine pointer, NULL otherwise.
*/ struct xe_hw_engine *
xe_hw_engine_lookup(struct xe_device *xe, struct drm_xe_engine_class_instance eci)
{ struct xe_gt *gt = xe_device_get_gt(xe, eci.gt_id); unsignedint idx;
if (eci.engine_class >= ARRAY_SIZE(user_to_xe_engine_class)) return NULL;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.