Commit 25b1f6cb authored by Matt Roper's avatar Matt Roper

drm/xe/mocs: Update MOCS assertions and remove redundant checks

Rely more heavily on assertions to describe the MOCS programming
invariants.  CI checks these assertions and will ensure no violations
sneak in due to programmer error, so we can remove some of the redundant
WARN and silent return checks from non-debug builds.

Also tweak/augment some of the existing assertions: there's no reason
we'd ever want a platform not to have a MOCS 'ops' structure hooked up
so ensure info->ops is non-NULL.  Likewise, we should never have a case
where the bspec-defined MOCS setting table is larger than the number of
MOCS registers exposed by the hardware, so add an extra assert on those
sizes as well.

Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Signed-off-by: default avatarMatt Roper <matthew.d.roper@intel.com>
Reviewed-by: default avatarLucas De Marchi <lucas.demarchi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240627203741.2042752-3-matthew.d.roper@intel.com
parent 0f54a192
...@@ -642,12 +642,8 @@ static unsigned int get_mocs_settings(struct xe_device *xe, ...@@ -642,12 +642,8 @@ static unsigned int get_mocs_settings(struct xe_device *xe,
*/ */
xe_assert(xe, info->unused_entries_index != 0); xe_assert(xe, info->unused_entries_index != 0);
xe_assert(xe, !info->ops || info->ops->dump); xe_assert(xe, info->ops && info->ops->dump);
xe_assert(xe, info->size <= info->n_entries);
if (XE_WARN_ON(info->size > info->n_entries)) {
info->table = NULL;
return 0;
}
if (!IS_DGFX(xe) || GRAPHICS_VER(xe) >= 20) if (!IS_DGFX(xe) || GRAPHICS_VER(xe) >= 20)
flags |= HAS_GLOBAL_MOCS; flags |= HAS_GLOBAL_MOCS;
...@@ -675,9 +671,6 @@ static void __init_mocs_table(struct xe_gt *gt, ...@@ -675,9 +671,6 @@ static void __init_mocs_table(struct xe_gt *gt,
unsigned int i; unsigned int i;
u32 mocs; u32 mocs;
xe_gt_WARN_ONCE(gt, !info->unused_entries_index,
"Unused entries index should have been defined\n");
mocs_dbg(gt, "mocs entries: %d\n", info->n_entries); mocs_dbg(gt, "mocs entries: %d\n", info->n_entries);
for (i = 0; i < info->n_entries; i++) { for (i = 0; i < info->n_entries; i++) {
...@@ -779,9 +772,6 @@ void xe_mocs_dump(struct xe_gt *gt, struct drm_printer *p) ...@@ -779,9 +772,6 @@ void xe_mocs_dump(struct xe_gt *gt, struct drm_printer *p)
flags = get_mocs_settings(xe, &table); flags = get_mocs_settings(xe, &table);
if (!table.ops->dump)
return;
xe_pm_runtime_get_noresume(xe); xe_pm_runtime_get_noresume(xe);
ret = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT); ret = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment