/* * struct __guc_capture_bufstate * * Book-keeping structure used to track read and write pointers * as we extract error capture data from the GuC-log-buffer's * error-capture region as a stream of dwords.
*/ struct __guc_capture_bufstate {
u32 size;
u32 data_offset;
u32 rd;
u32 wr;
};
/* * struct __guc_capture_parsed_output - extracted error capture node * * A single unit of extracted error-capture output data grouped together * at an engine-instance level. We keep these nodes in a linked list. * See cachelist and outlist below.
*/ struct __guc_capture_parsed_output { /* * A single set of 3 capture lists: a global-list * an engine-class-list and an engine-instance list. * outlist in __guc_capture_parsed_output will keep * a linked list of these nodes that will eventually * be detached from outlist and attached into to * xe_codedump in response to a context reset
*/ struct list_head link; bool is_partial;
u32 eng_class;
u32 eng_inst;
u32 guc_id;
u32 lrca;
u32 type; bool locked; enum xe_hw_engine_snapshot_source_id source; struct gcap_reg_list_info {
u32 vfid;
u32 num_regs; struct guc_mmio_reg *regs;
} reginfo[GUC_STATE_CAPTURE_TYPE_MAX]; #define GCAP_PARSED_REGLIST_INDEX_GLOBAL BIT(GUC_STATE_CAPTURE_TYPE_GLOBAL) #define GCAP_PARSED_REGLIST_INDEX_ENGCLASS BIT(GUC_STATE_CAPTURE_TYPE_ENGINE_CLASS)
};
/* * Define all device tables of GuC error capture register lists * NOTE: * For engine-registers, GuC only needs the register offsets * from the engine-mmio-base * * 64 bit registers need 2 entries for low 32 bit register and high 32 bit * register, for example: * Register data_type flags mask Register name * { XXX_REG_LO(0), REG_64BIT_LOW_DW, 0, 0, NULL}, * { XXX_REG_HI(0), REG_64BIT_HI_DW,, 0, 0, "XXX_REG"}, * 1. data_type: Indicate is hi/low 32 bit for a 64 bit register * A 64 bit register define requires 2 consecutive entries, * with low dword first and hi dword the second. * 2. Register name: null for incompleted define * 3. Incorrect order will trigger XE_WARN.
*/ #define COMMON_XELP_BASE_GLOBAL \
{ FORCEWAKE_GT, REG_32BIT, 0, 0, 0, "FORCEWAKE_GT"}
/* * Empty list to prevent warnings about unknown class/instance types * as not all class/instance types have entries on all platforms.
*/ staticconststruct __guc_mmio_reg_descr empty_regs_list[] = {
};
/* * If GT has no rcs/ccs, no need to alloc steered list. * Currently, only rcs/ccs has steering register, if in the future, * other engine types has steering register, this condition check need * to be extended
*/
for_each_hw_engine(hwe, gt, id) { if (xe_engine_class_to_guc_capture_class(hwe->class) ==
GUC_CAPTURE_LIST_CLASS_RENDER_COMPUTE) {
has_rcs_ccs = true; break;
}
}
if (!has_rcs_ccs) return;
/* steered registers currently only exist for the render-class */
list = guc_capture_get_one_list(lists, GUC_CAPTURE_LIST_INDEX_PF,
GUC_STATE_CAPTURE_TYPE_ENGINE_CLASS,
GUC_CAPTURE_LIST_CLASS_RENDER_COMPUTE); /* * Skip if this platform has no engine class registers or if extlists * was previously allocated
*/ if (!list || guc->capture->extlists) return;
total = bitmap_weight(gt->fuse_topo.g_dss_mask, sizeof(gt->fuse_topo.g_dss_mask) * 8) *
guc_capture_get_steer_reg_num(guc_to_xe(guc));
if (!total) return;
/* allocate an extra for an end marker */
extlists = drmm_kzalloc(drm, 2 * sizeof(struct __guc_mmio_reg_descr_group), GFP_KERNEL); if (!extlists) return;
if (__alloc_ext_regs(drm, &extlists[0], list, total)) {
drmm_kfree(drm, extlists); return;
}
/* For steering registers, the list is generated at run-time */
extarray = (struct __guc_mmio_reg_descr *)extlists[0].list;
for_each_dss_steering(dss, gt, slice, subslice) { for (i = 0; i < ARRAY_SIZE(xe_extregs); ++i) {
__fill_ext_reg(extarray, &xe_extregs[i], dss, slice, subslice);
++extarray;
}
if (has_xehpg_extregs) for (i = 0; i < ARRAY_SIZE(xehpg_extregs); ++i) {
__fill_ext_reg(extarray, &xehpg_extregs[i], dss, slice, subslice);
++extarray;
}
}
extlists[0].num_regs = total;
xe_gt_dbg(guc_to_gt(guc), "capture found %d ext-regs.\n", total);
guc->capture->extlists = extlists;
}
match = guc_capture_get_one_list(guc->capture->reglists, owner, type, capture_class); if (match)
num_regs = match->num_regs;
match = guc_capture_get_one_list(guc->capture->extlists, owner, type, capture_class); if (match)
num_regs += match->num_regs; else /* * If a caller wants the full register dump size but we have * not yet got the hw-config, which is before max_mmio_per_node * is initialized, then provide a worst-case number for * extlists based on max dss fuse bits, but only ever for * render/compute
*/ if (owner == GUC_CAPTURE_LIST_INDEX_PF &&
type == GUC_STATE_CAPTURE_TYPE_ENGINE_CLASS &&
capture_class == GUC_CAPTURE_LIST_CLASS_RENDER_COMPUTE &&
!guc->capture->max_mmio_per_node)
num_regs += guc_capture_get_steer_reg_num(guc_to_xe(guc)) *
XE_MAX_DSS_FUSE_BITS;
/** * xe_guc_capture_getlistsize - Get list size for owner/type/class combination * @guc: The GuC object * @owner: PF/VF owner * @type: GuC capture register type * @capture_class: GuC capture engine class id * @size: Point to the size * * This function will get the list for the owner/type/class combination, and * return the page aligned list size. * * Returns: 0 on success or a negative error code on failure.
*/ int
xe_guc_capture_getlistsize(struct xe_guc *guc, u32 owner, u32 type, enum guc_capture_list_class_type capture_class, size_t *size)
{ return guc_capture_getlistsize(guc, owner, type, capture_class, size, false);
}
/** * xe_guc_capture_getlist - Get register capture list for owner/type/class * combination * @guc: The GuC object * @owner: PF/VF owner * @type: GuC capture register type * @capture_class: GuC capture engine class id * @outptr: Point to cached register capture list * * This function will get the register capture list for the owner/type/class * combination. * * Returns: 0 on success or a negative error code on failure.
*/ int
xe_guc_capture_getlist(struct xe_guc *guc, u32 owner, u32 type, enum guc_capture_list_class_type capture_class, void **outptr)
{ struct xe_guc_state_capture *gc = guc->capture; struct __guc_capture_ads_cache *cache = &gc->ads_cache[owner][type][capture_class]; struct guc_debug_capture_list *listnode; int ret, num_regs;
u8 *caplist, *tmp;
size_t size = 0;
if (!gc->reglists) return -ENODEV;
if (cache->is_valid) {
*outptr = cache->ptr; return cache->status;
}
/* populate list of register descriptor */
tmp += sizeof(struct guc_debug_capture_list);
guc_capture_list_init(guc, owner, type, capture_class,
(struct guc_mmio_reg *)tmp, num_regs);
/* cache this list */
cache->is_valid = true;
cache->ptr = caplist;
cache->size = size;
cache->status = 0;
*outptr = caplist;
return 0;
}
/** * xe_guc_capture_getnullheader - Get a null list for register capture * @guc: The GuC object * @outptr: Point to cached register capture list * @size: Point to the size * * This function will alloc for a null list for register capture. * * Returns: 0 on success or a negative error code on failure.
*/ int
xe_guc_capture_getnullheader(struct xe_guc *guc, void **outptr, size_t *size)
{ struct xe_guc_state_capture *gc = guc->capture; int tmp = sizeof(u32) * 4; void *null_header;
/** * xe_guc_capture_ads_input_worst_size - Calculate the worst size for GuC register capture * @guc: point to xe_guc structure * * Calculate the worst size for GuC register capture by including all possible engines classes. * * Returns: Calculated size
*/
size_t xe_guc_capture_ads_input_worst_size(struct xe_guc *guc)
{
size_t total_size, class_size, instance_size, global_size; int i, j;
/* * This function calculates the worst case register lists size by * including all possible engines classes. It is called during the * first of a two-phase GuC (and ADS-population) initialization * sequence, that is, during the pre-hwconfig phase before we have * the exact engine fusing info.
*/
total_size = PAGE_SIZE; /* Pad a page in front for empty lists */ for (i = 0; i < GUC_CAPTURE_LIST_INDEX_MAX; i++) { for (j = 0; j < GUC_CAPTURE_LIST_CLASS_MAX; j++) { if (xe_guc_capture_getlistsize(guc, i,
GUC_STATE_CAPTURE_TYPE_ENGINE_CLASS,
j, &class_size) < 0)
class_size = 0; if (xe_guc_capture_getlistsize(guc, i,
GUC_STATE_CAPTURE_TYPE_ENGINE_INSTANCE,
j, &instance_size) < 0)
instance_size = 0;
total_size += class_size + instance_size;
} if (xe_guc_capture_getlistsize(guc, i,
GUC_STATE_CAPTURE_TYPE_GLOBAL,
0, &global_size) < 0)
global_size = 0;
total_size += global_size;
}
/* * If every single engine-instance suffered a failure in quick succession but * were all unrelated, then a burst of multiple error-capture events would dump * registers for every one engine instance, one at a time. In this case, GuC * would even dump the global-registers repeatedly. * * For each engine instance, there would be 1 x guc_state_capture_group_t output * followed by 3 x guc_state_capture_t lists. The latter is how the register * dumps are split across different register types (where the '3' are global vs class * vs instance).
*/
for_each_hw_engine(hwe, gt, id) { enum guc_capture_list_class_type capture_class;
/* * Add on a 3x multiplier to allow for multiple back-to-back captures occurring * before the Xe can read the data out and process it
*/ #define GUC_CAPTURE_OVERBUFFER_MULTIPLIER 3
staticvoid check_guc_capture_size(struct xe_guc *guc)
{ int capture_size = guc_capture_output_size_est(guc); int spare_size = capture_size * GUC_CAPTURE_OVERBUFFER_MULTIPLIER;
u32 buffer_size = xe_guc_log_section_size_capture(&guc->log);
/* * NOTE: capture_size is much smaller than the capture region * allocation (DG2: <80K vs 1MB). * Additionally, its based on space needed to fit all engines getting * reset at once within the same G2H handler task slot. This is very * unlikely. However, if GuC really does run out of space for whatever * reason, we will see an separate warning message when processing the * G2H event capture-notification, search for: * xe_guc_STATE_CAPTURE_EVENT_STATUS_NOSPACE.
*/ if (capture_size < 0)
xe_gt_dbg(guc_to_gt(guc), "Failed to calculate error state capture buffer minimum size: %d!\n",
capture_size); if (capture_size > buffer_size)
xe_gt_dbg(guc_to_gt(guc), "Error state capture buffer maybe small: %d < %d\n",
buffer_size, capture_size); elseif (spare_size > buffer_size)
xe_gt_dbg(guc_to_gt(guc), "Error state capture buffer lacks spare size: %d < %d (min = %d)\n",
buffer_size, spare_size, capture_size);
}
for (i = 0; i < GUC_STATE_CAPTURE_TYPE_MAX; ++i) {
tmp[i] = node->reginfo[i].regs;
memset(tmp[i], 0, sizeof(struct guc_mmio_reg) *
guc->capture->max_mmio_per_node);
}
memset(node, 0, sizeof(*node)); for (i = 0; i < GUC_STATE_CAPTURE_TYPE_MAX; ++i)
node->reginfo[i].regs = tmp[i];
INIT_LIST_HEAD(&node->link);
}
/** * DOC: Init, G2H-event and reporting flows for GuC-error-capture * * KMD Init time flows: * -------------------- * --> alloc A: GuC input capture regs lists (registered to GuC via ADS). * xe_guc_ads acquires the register lists by calling * xe_guc_capture_getlistsize and xe_guc_capture_getlist 'n' times, * where n = 1 for global-reg-list + * num_engine_classes for class-reg-list + * num_engine_classes for instance-reg-list * (since all instances of the same engine-class type * have an identical engine-instance register-list). * ADS module also calls separately for PF vs VF. * * --> alloc B: GuC output capture buf (registered via guc_init_params(log_param)) * Size = #define CAPTURE_BUFFER_SIZE (warns if on too-small) * Note2: 'x 3' to hold multiple capture groups * * GUC Runtime notify capture: * -------------------------- * --> G2H STATE_CAPTURE_NOTIFICATION * L--> xe_guc_capture_process * L--> Loop through B (head..tail) and for each engine instance's * err-state-captured register-list we find, we alloc 'C': * --> alloc C: A capture-output-node structure that includes misc capture info along * with 3 register list dumps (global, engine-class and engine-instance) * This node is created from a pre-allocated list of blank nodes in * guc->capture->cachelist and populated with the error-capture * data from GuC and then it's added into guc->capture->outlist linked * list. This list is used for matchup and printout by xe_devcoredump_read * and xe_engine_snapshot_print, (when user invokes the devcoredump sysfs). * * GUC --> notify context reset: * ----------------------------- * --> guc_exec_queue_timedout_job * L--> xe_devcoredump * L--> devcoredump_snapshot * --> xe_hw_engine_snapshot_capture * --> xe_engine_manual_capture(For manual capture) * * User Sysfs / Debugfs * -------------------- * --> xe_devcoredump_read-> * L--> xxx_snapshot_print * L--> xe_engine_snapshot_print * Print register lists values saved at * guc->capture->outlist *
*/
/* * GuC's error-capture output is a ring buffer populated in a byte-stream fashion: * * The GuC Log buffer region for error-capture is managed like a ring buffer. * The GuC firmware dumps error capture logs into this ring in a byte-stream flow. * Additionally, as per the current and foreseeable future, all packed error- * capture output structures are dword aligned. * * That said, if the GuC firmware is in the midst of writing a structure that is larger * than one dword but the tail end of the err-capture buffer-region has lesser space left, * we would need to extract that structure one dword at a time straddled across the end, * onto the start of the ring. * * Below function, guc_capture_log_remove_bytes is a helper for that. All callers of this * function would typically do a straight-up memcpy from the ring contents and will only * call this helper if their structure-extraction is straddling across the end of the * ring. GuC firmware does not add any padding. The reason for the no-padding is to ease * scalability for future expansion of output data types without requiring a redesign * of the flow controls.
*/ staticint
guc_capture_log_remove_bytes(struct xe_guc *guc, struct __guc_capture_bufstate *buf, void *out, int bytes_needed)
{ #define GUC_CAPTURE_LOG_BUF_COPY_RETRY_MAX 3
int fill_size = 0, tries = GUC_CAPTURE_LOG_BUF_COPY_RETRY_MAX; int copy_size, avail;
if (!list_empty(&guc->capture->cachelist)) { struct __guc_capture_parsed_output *n, *ntmp;
/* get first avail node from the cache list */
list_for_each_entry_safe(n, ntmp, &guc->capture->cachelist, link) {
found = n; break;
}
} else { struct __guc_capture_parsed_output *n, *ntmp;
/* * traverse reversed and steal back the oldest node already * allocated
*/
list_for_each_entry_safe_reverse(n, ntmp, &guc->capture->outlist, link) { if (!n->locked)
found = n;
}
} if (found) {
list_del(&found->link);
guc_capture_init_node(guc, found);
}
new = guc_capture_get_prealloc_node(guc); if (!new) return NULL; if (!original) returnnew;
new->is_partial = original->is_partial;
/* copy reg-lists that we want to clone */ for (i = 0; i < GUC_STATE_CAPTURE_TYPE_MAX; ++i) { if (keep_reglist_mask & BIT(i)) {
XE_WARN_ON(original->reginfo[i].num_regs >
guc->capture->max_mmio_per_node);
while (numlists--) { if (guc_capture_log_get_data_hdr(guc, buf, &hdr)) {
ret = -EIO; break;
}
datatype = FIELD_GET(GUC_STATE_CAPTURE_HEADER_CAPTURE_TYPE, hdr.info); if (datatype > GUC_STATE_CAPTURE_TYPE_ENGINE_INSTANCE) { /* unknown capture type - skip over to next capture set */
numregs = FIELD_GET(GUC_STATE_CAPTURE_HEADER_NUM_MMIO_ENTRIES,
hdr.num_mmio_entries); while (numregs--) { if (guc_capture_log_get_register(guc, buf, &tmp)) {
ret = -EIO; break;
}
} continue;
} elseif (node) { /* * Based on the current capture type and what we have so far, * decide if we should add the current node into the internal * linked list for match-up when xe_devcoredump calls later * (and alloc a blank node for the next set of reglists) * or continue with the same node or clone the current node * but only retain the global or class registers (such as the * case of dependent engine resets).
*/ if (datatype == GUC_STATE_CAPTURE_TYPE_GLOBAL) {
guc_capture_add_node_to_outlist(guc->capture, node);
node = NULL;
} elseif (datatype == GUC_STATE_CAPTURE_TYPE_ENGINE_CLASS &&
node->reginfo[GUC_STATE_CAPTURE_TYPE_ENGINE_CLASS].num_regs) { /* Add to list, clone node and duplicate global list */
guc_capture_add_node_to_outlist(guc->capture, node);
node = guc_capture_clone_node(guc, node,
GCAP_PARSED_REGLIST_INDEX_GLOBAL);
} elseif (datatype == GUC_STATE_CAPTURE_TYPE_ENGINE_INSTANCE &&
node->reginfo[GUC_STATE_CAPTURE_TYPE_ENGINE_INSTANCE].num_regs) { /* Add to list, clone node and duplicate global + class lists */
guc_capture_add_node_to_outlist(guc->capture, node);
node = guc_capture_clone_node(guc, node,
(GCAP_PARSED_REGLIST_INDEX_GLOBAL |
GCAP_PARSED_REGLIST_INDEX_ENGCLASS));
}
}
if (!node) {
node = guc_capture_get_prealloc_node(guc); if (!node) {
ret = -ENOMEM; break;
} if (datatype != GUC_STATE_CAPTURE_TYPE_GLOBAL)
xe_gt_dbg(gt, "Register capture missing global dump: %08x!\n",
datatype);
}
node->is_partial = is_partial;
node->reginfo[datatype].vfid = FIELD_GET(GUC_STATE_CAPTURE_HEADER_VFID, hdr.owner);
node->source = XE_ENGINE_CAPTURE_SOURCE_GUC;
node->type = datatype;
numregs = FIELD_GET(GUC_STATE_CAPTURE_HEADER_NUM_MMIO_ENTRIES,
hdr.num_mmio_entries); if (numregs > guc->capture->max_mmio_per_node) {
xe_gt_dbg(gt, "Register capture list extraction clipped by prealloc!\n");
numregs = guc->capture->max_mmio_per_node;
}
node->reginfo[datatype].num_regs = numregs;
regs = node->reginfo[datatype].regs;
i = 0; while (numregs--) { if (guc_capture_log_get_register(guc, buf, ®s[i++])) {
ret = -EIO; break;
}
}
}
bailout: if (node) { /* If we have data, add to linked list for match-up when xe_devcoredump calls */ for (i = GUC_STATE_CAPTURE_TYPE_GLOBAL; i < GUC_STATE_CAPTURE_TYPE_MAX; ++i) { if (node->reginfo[i].regs) {
guc_capture_add_node_to_outlist(guc->capture, node);
node = NULL; break;
}
} if (node) /* else return it back to cache list */
guc_capture_add_node_to_cachelist(guc->capture, node);
} return ret;
}
/* * Make a copy of the state structure, inside GuC log buffer * (which is uncached mapped), on the stack to avoid reading * from it multiple times.
*/
xe_map_memcpy_from(guc_to_xe(guc), &log_buf_state_local, &guc->log.bo->vmap,
log_buf_state_offset, sizeof(struct guc_log_buffer_state));
if (!xe_guc_read_stopped(guc)) { do {
ret = guc_capture_extract_reglists(guc, &buf); if (ret && ret != -ENODATA)
xe_gt_dbg(guc_to_gt(guc), "Capture extraction failed:%d\n", ret);
} while (ret >= 0);
}
/* Update the state of log buffer err-cap state */
xe_map_wr(guc_to_xe(guc), &guc->log.bo->vmap,
log_buf_state_offset + offsetof(struct guc_log_buffer_state, read_ptr), u32,
write_offset);
/* * Clear the flush_to_file from local first, the local was loaded by above * xe_map_memcpy_from, then write out the "updated local" through * xe_map_wr()
*/
log_buf_state_local.flags &= ~GUC_LOG_BUFFER_STATE_FLUSH_TO_FILE;
xe_map_wr(guc_to_xe(guc), &guc->log.bo->vmap,
log_buf_state_offset + offsetof(struct guc_log_buffer_state, flags), u32,
log_buf_state_local.flags);
__guc_capture_flushlog_complete(guc);
}
/* * xe_guc_capture_process - Process GuC register captured data * @guc: The GuC object * * When GuC captured data is ready, GuC will send message * XE_GUC_ACTION_STATE_CAPTURE_NOTIFICATION to host, this function will be * called to process the data comes with the message. * * Returns: None
*/ void xe_guc_capture_process(struct xe_guc *guc)
{ if (guc->capture)
__guc_capture_process_output(guc);
}
for (i = 0; i < PREALLOC_NODES_MAX_COUNT; ++i) {
node = guc_capture_alloc_one_node(guc); if (!node) {
xe_gt_warn(guc_to_gt(guc), "Register capture pre-alloc-cache failure\n"); /* dont free the priors, use what we got and cleanup at shutdown */ return;
}
guc_capture_add_node_to_cachelist(guc->capture, node);
}
}
staticint
guc_get_max_reglist_count(struct xe_guc *guc)
{ int i, j, k, tmp, maxregcount = 0;
for (i = 0; i < GUC_CAPTURE_LIST_INDEX_MAX; ++i) { for (j = 0; j < GUC_STATE_CAPTURE_TYPE_MAX; ++j) { for (k = 0; k < GUC_CAPTURE_LIST_CLASS_MAX; ++k) { conststruct __guc_mmio_reg_descr_group *match;
if (j == GUC_STATE_CAPTURE_TYPE_GLOBAL && k > 0) continue;
tmp = 0;
match = guc_capture_get_one_list(guc->capture->reglists, i, j, k); if (match)
tmp = match->num_regs;
match = guc_capture_get_one_list(guc->capture->extlists, i, j, k); if (match)
tmp += match->num_regs;
if (tmp > maxregcount)
maxregcount = tmp;
}
}
} if (!maxregcount)
maxregcount = PREALLOC_NODES_DEFAULT_NUMREGS;
return maxregcount;
}
staticvoid
guc_capture_create_prealloc_nodes(struct xe_guc *guc)
{ /* skip if we've already done the pre-alloc */ if (guc->capture->max_mmio_per_node) return;
new = guc_capture_get_prealloc_node(guc); if (!new) return;
capture_class = xe_engine_class_to_guc_capture_class(hwe->class); for (type = GUC_STATE_CAPTURE_TYPE_GLOBAL; type < GUC_STATE_CAPTURE_TYPE_MAX; type++) { struct gcap_reg_list_info *reginfo = &new->reginfo[type]; /* * regsinfo->regs is allocated based on guc->capture->max_mmio_per_node * which is based on the descriptor list driving the population so * should not overflow
*/
/* Get register list for the type/class */
list = xe_guc_capture_get_reg_desc_list(gt, GUC_CAPTURE_LIST_INDEX_PF, type,
capture_class, false); if (!list) {
xe_gt_dbg(gt, "Empty GuC capture register descriptor for %s",
hwe->name); continue;
}
/* * loop through descriptor first and find the register in the node * this is more scalable for developer maintenance as it will ensure * the printout matched the ordering of the static descriptor * table-of-lists
*/ for (i = 0; i < list->num_regs; i++) { conststruct __guc_mmio_reg_descr *reg_desc = &list->list[i]; struct guc_mmio_reg *reg;
u32 value;
reg = guc_capture_find_reg(reginfo, reg_desc->reg.addr, reg_desc->flags); if (!reg) continue;
value = reg->value; switch (reg_desc->data_type) { case REG_64BIT_LOW_DW:
last_value = value;
/* * A 64 bit register define requires 2 consecutive * entries in register list, with low dword first * and hi dword the second, like: * { XXX_REG_LO(0), REG_64BIT_LOW_DW, 0, 0, NULL}, * { XXX_REG_HI(0), REG_64BIT_HI_DW, 0, 0, "XXX_REG"}, * * Incorrect order will trigger XE_WARN. * * Possible double low here, for example: * { XXX_REG_LO(0), REG_64BIT_LOW_DW, 0, 0, NULL}, * { XXX_REG_LO(0), REG_64BIT_LOW_DW, 0, 0, NULL},
*/
XE_WARN_ON(low32_ready);
low32_ready = true; /* Low 32 bit dword saved, continue for high 32 bit */ break;
/* * Incorrect 64bit register order. Possible missing high. * for example: * { XXX_REG_LO(0), REG_64BIT_LOW_DW, 0, 0, NULL}, * } // <- Register list end
*/
XE_WARN_ON(low32_ready);
}
/** * xe_engine_snapshot_print - Print out a given Xe HW Engine snapshot. * @snapshot: Xe HW Engine snapshot object. * @p: drm_printer where it will be printed out. * * This function prints out a given Xe HW Engine snapshot object.
*/ void xe_engine_snapshot_print(struct xe_hw_engine_snapshot *snapshot, struct drm_printer *p)
{ constchar *grptype[GUC_STATE_CAPTURE_GROUP_TYPE_MAX] = { "full-capture", "partial-capture"
}; int type; conststruct __guc_mmio_reg_descr_group *list; enum guc_capture_list_class_type capture_class;
for (type = GUC_STATE_CAPTURE_TYPE_GLOBAL; type < GUC_STATE_CAPTURE_TYPE_MAX; type++) { /* * FIXME: During devcoredump print we should avoid accessing the * driver pointers for gt or engine. Printing should be done only * using the snapshot captured. Here we are accessing the gt * pointer. It should be fixed.
*/
list = xe_guc_capture_get_reg_desc_list(gt, GUC_CAPTURE_LIST_INDEX_PF, type,
capture_class, false);
snapshot_print_by_list_order(snapshot, p, type, list);
}
if (capture_class == GUC_CAPTURE_LIST_CLASS_RENDER_COMPUTE) {
list = xe_guc_capture_get_reg_desc_list(gt, GUC_CAPTURE_LIST_INDEX_PF,
GUC_STATE_CAPTURE_TYPE_ENGINE_CLASS,
capture_class, true);
snapshot_print_by_list_order(snapshot, p, GUC_STATE_CAPTURE_TYPE_ENGINE_CLASS,
list);
}
drm_puts(p, "\n");
}
/** * xe_guc_capture_get_matching_and_lock - Matching GuC capture for the queue. * @q: The exec queue object * * Search within the capture outlist for the queue, could be used for check if * GuC capture is ready for the queue. * If found, the locked boolean of the node will be flagged. * * Returns: found guc-capture node ptr else NULL
*/ struct __guc_capture_parsed_output *
xe_guc_capture_get_matching_and_lock(struct xe_exec_queue *q)
{ struct xe_hw_engine *hwe; enum xe_hw_engine_id id; struct xe_device *xe;
u16 guc_class = GUC_LAST_ENGINE_CLASS + 1; struct xe_devcoredump_snapshot *ss;
new = xe_guc_capture_get_matching_and_lock(q); if (new) { struct xe_guc *guc = &q->gt->uc.guc;
/* * If we are in here, it means we found a fresh * GuC-err-capture node for this engine after * previously failing to find a match in the * early part of guc_exec_queue_timedout_job. * Thus we must free the manually captured node
*/
guc_capture_free_outlist_node(guc->capture,
coredump->snapshot.matched_node);
coredump->snapshot.matched_node = new;
}
}
break;
}
}
/* * xe_guc_capture_put_matched_nodes - Cleanup matched nodes * @guc: The GuC object * * Free matched node and all nodes with the equal guc_id from * GuC captured outlist
*/ void xe_guc_capture_put_matched_nodes(struct xe_guc *guc)
{ struct xe_device *xe = guc_to_xe(guc); struct xe_devcoredump *devcoredump = &xe->devcoredump; struct __guc_capture_parsed_output *n = devcoredump->snapshot.matched_node;
/* * xe_guc_capture_steered_list_init - Init steering register list * @guc: The GuC object * * Init steering register list for GuC register capture, create pre-alloc node
*/ void xe_guc_capture_steered_list_init(struct xe_guc *guc)
{ /* * For certain engine classes, there are slice and subslice * level registers requiring steering. We allocate and populate * these based on hw config and add it as an extension list at * the end of the pre-populated render list.
*/
guc_capture_alloc_steered_lists(guc);
check_guc_capture_size(guc);
guc_capture_create_prealloc_nodes(guc);
}
/* * xe_guc_capture_init - Init for GuC register capture * @guc: The GuC object * * Init for GuC register capture, alloc memory for capture data structure. * * Returns: 0 if success. * -ENOMEM if out of memory
*/ int xe_guc_capture_init(struct xe_guc *guc)
{
guc->capture = drmm_kzalloc(guc_to_drm(guc), sizeof(*guc->capture), GFP_KERNEL); if (!guc->capture) return -ENOMEM;
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.