xe_hw_engine_print is called by debugfs to do an immediate raw dump of the engine registers. It depends on hw_engine_snapshot_capture that assumes a prior capture with a matching job is ready for printing. However, for the debugfs case, there is no prior job so ensure hw_engine_snapshot_capture can also invoke GuC-Err-Capture for an immediate jobless snapshot.
Signed-off-by: Alan Previn <alan.previn.teres.ale...@intel.com> --- drivers/gpu/drm/xe/xe_guc_capture.c | 26 ++++++++++++++++++++++++++ drivers/gpu/drm/xe/xe_guc_capture.h | 2 ++ drivers/gpu/drm/xe/xe_hw_engine.c | 15 +++++++++++++-- 3 files changed, 41 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/xe/xe_guc_capture.c b/drivers/gpu/drm/xe/xe_guc_capture.c index 6f40aad7e212..92ea8cb681bb 100644 --- a/drivers/gpu/drm/xe/xe_guc_capture.c +++ b/drivers/gpu/drm/xe/xe_guc_capture.c @@ -1583,6 +1583,32 @@ guc_capture_get_manual_snapshot(struct xe_guc *guc, struct xe_hw_engine *hwe) return new; } +/** + * xe_guc_capture_snapshot_store_and_get_manual_hwe - Generate and get manual engine register dump + * @guc: Target GuC for manual capture + * @hwe: The engine instance to capture from + * + * Generate a manual GuC-Error-Capture snapshot of engine instance + engine class registers + * without any queue association. This capture node is not stored in outlist or cachelist, + * Returns: New capture node and caller must "put" + */ +struct xe_guc_capture_snapshot * +xe_guc_capture_snapshot_manual_hwe(struct xe_guc *guc, struct xe_hw_engine *hwe) +{ + struct xe_guc_capture_snapshot *new; + + new = guc_capture_get_manual_snapshot(guc, hwe); + if (!new) + return NULL; + + new->guc_id = 0; + new->lrca = 0; + new->is_partial = 0; + new->source = XE_ENGINE_CAPTURE_SOURCE_MANUAL; + + return new; +} + /** * xe_guc_capture_snapshot_store_manual_job - Generate and store a manual engine register dump * @guc: Target GuC for manual capture diff --git a/drivers/gpu/drm/xe/xe_guc_capture.h b/drivers/gpu/drm/xe/xe_guc_capture.h index 77ee35a3f205..5df4b5579d2b 100644 --- a/drivers/gpu/drm/xe/xe_guc_capture.h +++ b/drivers/gpu/drm/xe/xe_guc_capture.h @@ -54,6 +54,8 @@ struct xe_guc_capture_snapshot * xe_guc_capture_get_matching_and_lock(struct xe_exec_queue *q, enum xe_guc_capture_snapshot_source srctype); void xe_guc_capture_snapshot_store_manual_job(struct xe_guc *guc, struct xe_exec_queue *q); +struct xe_guc_capture_snapshot * +xe_guc_capture_snapshot_manual_hwe(struct xe_guc *guc, struct xe_hw_engine *hwe); void xe_guc_capture_snapshot_print(struct xe_guc *guc, struct xe_guc_capture_snapshot *node, struct drm_printer *p); void xe_guc_capture_steered_list_init(struct xe_guc *guc); diff --git a/drivers/gpu/drm/xe/xe_hw_engine.c b/drivers/gpu/drm/xe/xe_hw_engine.c index 40c1f9814177..94a1d5dd2030 100644 --- a/drivers/gpu/drm/xe/xe_hw_engine.c +++ b/drivers/gpu/drm/xe/xe_hw_engine.c @@ -832,7 +832,7 @@ void xe_hw_engine_handle_irq(struct xe_hw_engine *hwe, u16 intr_vec) /** * hw_engine_snapshot_capture - Take a quick snapshot of the HW Engine. * @hwe: Xe HW Engine. - * @q: The exec queue object. + * @q: The exec queue object. (can be NULL for debugfs engine-register dump) * * This can be printed out in a later stage like during dev_coredump * analysis. @@ -845,9 +845,11 @@ hw_engine_snapshot_capture(struct xe_hw_engine *hwe, struct xe_exec_queue *q) { struct xe_hw_engine_snapshot *snapshot; struct xe_guc_capture_snapshot *node; + struct xe_guc *guc; if (!xe_hw_engine_is_valid(hwe)) return NULL; + guc = &hwe->gt->uc.guc; snapshot = kzalloc(sizeof(*snapshot), GFP_ATOMIC); @@ -876,12 +878,21 @@ hw_engine_snapshot_capture(struct xe_hw_engine *hwe, struct xe_exec_queue *q) xe_gt_dbg(hwe->gt, "No fw sourced GuC-Err-Capture for queue %s", q->name); snapshot->matched_node = node; } else if (node) { - xe_guc_capture_put_matched_nodes(&hwe->gt->uc.guc, node); + xe_guc_capture_put_matched_nodes(guc, node); } if (!snapshot->matched_node) xe_gt_warn(hwe->gt, "Can't retrieve any GuC-Err-Capture node"); } + if (!snapshot->matched_node) { + /* + * Fallback path - do an immediate jobless manual engine capture. + * This will happen when debugfs is triggered to force an engine dump. + */ + snapshot->matched_node = xe_guc_capture_snapshot_manual_hwe(guc, hwe); + xe_gt_dbg(hwe->gt, "Fallback to jobless-manual-err-capture node"); + } + return snapshot; } -- 2.34.1