/** * DOC: Register Table Processing * * Internal infrastructure to define how registers should be updated based on * rules and actions. This can be used to define tables with multiple entries * (one per register) that will be walked over at some point in time to apply * the values to the registers that have matching rules.
*/
for (r = rules, i = 0; i < n_rules; r = &rules[++i]) { switch (r->match_type) { case XE_RTP_MATCH_OR: /* * This is only reached if a complete set of * rules passed or none were evaluated. For both cases, * shortcut the other rules and return the proper value.
*/ goto done; case XE_RTP_MATCH_PLATFORM:
match = xe->info.platform == r->platform; break; case XE_RTP_MATCH_SUBPLATFORM:
match = xe->info.platform == r->platform &&
xe->info.subplatform == r->subplatform; break; case XE_RTP_MATCH_GRAPHICS_VERSION: if (drm_WARN_ON(&xe->drm, !gt)) returnfalse;
match = xe->info.graphics_verx100 == r->ver_start &&
(!has_samedia(xe) || !xe_gt_is_media_type(gt)); break; case XE_RTP_MATCH_GRAPHICS_VERSION_RANGE: if (drm_WARN_ON(&xe->drm, !gt)) returnfalse;
match = xe->info.graphics_verx100 >= r->ver_start &&
xe->info.graphics_verx100 <= r->ver_end &&
(!has_samedia(xe) || !xe_gt_is_media_type(gt)); break; case XE_RTP_MATCH_GRAPHICS_VERSION_ANY_GT: if (drm_WARN_ON(&xe->drm, !gt)) returnfalse;
match = xe->info.graphics_verx100 == r->ver_start; break; case XE_RTP_MATCH_GRAPHICS_STEP: if (drm_WARN_ON(&xe->drm, !gt)) returnfalse;
match = xe->info.step.graphics >= r->step_start &&
xe->info.step.graphics < r->step_end &&
(!has_samedia(xe) || !xe_gt_is_media_type(gt)); break; case XE_RTP_MATCH_MEDIA_VERSION: if (drm_WARN_ON(&xe->drm, !gt)) returnfalse;
match = xe->info.media_verx100 == r->ver_start &&
(!has_samedia(xe) || xe_gt_is_media_type(gt)); break; case XE_RTP_MATCH_MEDIA_VERSION_RANGE: if (drm_WARN_ON(&xe->drm, !gt)) returnfalse;
match = xe->info.media_verx100 >= r->ver_start &&
xe->info.media_verx100 <= r->ver_end &&
(!has_samedia(xe) || xe_gt_is_media_type(gt)); break; case XE_RTP_MATCH_MEDIA_STEP: if (drm_WARN_ON(&xe->drm, !gt)) returnfalse;
match = xe->info.step.media >= r->step_start &&
xe->info.step.media < r->step_end &&
(!has_samedia(xe) || xe_gt_is_media_type(gt)); break; case XE_RTP_MATCH_MEDIA_VERSION_ANY_GT: if (drm_WARN_ON(&xe->drm, !gt)) returnfalse;
match = xe->info.media_verx100 == r->ver_start; break; case XE_RTP_MATCH_INTEGRATED:
match = !xe->info.is_dgfx; break; case XE_RTP_MATCH_DISCRETE:
match = xe->info.is_dgfx; break; case XE_RTP_MATCH_ENGINE_CLASS: if (drm_WARN_ON(&xe->drm, !hwe)) returnfalse;
match = hwe->class == r->engine_class; break; case XE_RTP_MATCH_NOT_ENGINE_CLASS: if (drm_WARN_ON(&xe->drm, !hwe)) returnfalse;
match = hwe->class != r->engine_class; break; case XE_RTP_MATCH_FUNC: if (drm_WARN_ON(&xe->drm, !gt)) returnfalse;
match = r->match_func(gt, hwe); break; default:
drm_warn(&xe->drm, "Invalid RTP match %u\n",
r->match_type);
match = false;
}
if (!match) { /* * Advance rules until we find XE_RTP_MATCH_OR to check * if there's another set of conditions to check
*/ while (++i < n_rules && rules[i].match_type != XE_RTP_MATCH_OR)
;
if (i >= n_rules) returnfalse;
rcount = 0;
} else {
rcount++;
}
}
done: if (drm_WARN_ON(&xe->drm, !rcount)) returnfalse;
/** * xe_rtp_process_ctx_enable_active_tracking - Enable tracking of active entries * * Set additional metadata to track what entries are considered "active", i.e. * their rules match the condition. Bits are never cleared: entries with * matching rules set the corresponding bit in the bitmap. * * @ctx: The context for processing the table * @active_entries: bitmap to store the active entries * @n_entries: number of entries to be processed
*/ void xe_rtp_process_ctx_enable_active_tracking(struct xe_rtp_process_ctx *ctx, unsignedlong *active_entries,
size_t n_entries)
{
ctx->active_entries = active_entries;
ctx->n_entries = n_entries;
}
EXPORT_SYMBOL_IF_KUNIT(xe_rtp_process_ctx_enable_active_tracking);
if (drm_WARN_ON(&xe->drm, idx >= ctx->n_entries)) return;
bitmap_set(ctx->active_entries, idx, 1);
}
/** * xe_rtp_process_to_sr - Process all rtp @entries, adding the matching ones to * the save-restore argument. * @ctx: The context for processing the table, with one of device, gt or hwe * @entries: Table with RTP definitions * @n_entries: Number of entries to process, usually ARRAY_SIZE(entries) * @sr: Save-restore struct where matching rules execute the action. This can be * viewed as the "coalesced view" of multiple the tables. The bits for each * register set are expected not to collide with previously added entries * * Walk the table pointed by @entries (with an empty sentinel) and add all * entries with matching rules to @sr. If @hwe is not NULL, its mmio_base is * used to calculate the right register offset
*/ void xe_rtp_process_to_sr(struct xe_rtp_process_ctx *ctx, conststruct xe_rtp_entry_sr *entries,
size_t n_entries, struct xe_reg_sr *sr)
{ conststruct xe_rtp_entry_sr *entry; struct xe_hw_engine *hwe = NULL; struct xe_gt *gt = NULL; struct xe_device *xe = NULL;
rtp_get_context(ctx, &hwe, >, &xe);
xe_assert(xe, entries);
for (entry = entries; entry - entries < n_entries; entry++) { bool match = false;
if (match)
rtp_mark_active(xe, ctx, entry - entries);
}
}
EXPORT_SYMBOL_IF_KUNIT(xe_rtp_process_to_sr);
/** * xe_rtp_process - Process all rtp @entries, without running any action * @ctx: The context for processing the table, with one of device, gt or hwe * @entries: Table with RTP definitions * * Walk the table pointed by @entries (with an empty sentinel), executing the * rules. One difference from xe_rtp_process_to_sr(): there is no action * associated with each entry since this uses struct xe_rtp_entry. Its main use * is for marking active workarounds via * xe_rtp_process_ctx_enable_active_tracking().
*/ void xe_rtp_process(struct xe_rtp_process_ctx *ctx, conststruct xe_rtp_entry *entries)
{ conststruct xe_rtp_entry *entry; struct xe_hw_engine *hwe; struct xe_gt *gt; struct xe_device *xe;
rtp_get_context(ctx, &hwe, >, &xe);
for (entry = entries; entry && entry->rules; entry++) { if (!rule_matches(xe, gt, hwe, entry->rules, entry->n_rules)) continue;
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.