Commit 17c20e3b authored by Lucas De Marchi's avatar Lucas De Marchi

drm/xe/mocs: Move warn/assertion up

The warn-once in __init_mocs_table() to make sure there's an index set
for unused entries is more a sanity check that should be done as the
first thing in that function. The kunit test replicates the same check,
so also move it up and turn it into a failure condition for the test.
Reviewed-by: default avatarMatt Roper <matthew.d.roper@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240228061048.3661978-4-lucas.demarchi@intel.comSigned-off-by: default avatarLucas De Marchi <lucas.demarchi@intel.com>
parent d40c6c45
......@@ -79,11 +79,12 @@ static void read_mocs_table(struct xe_gt *gt,
struct kunit *test = xe_cur_kunit();
KUNIT_EXPECT_TRUE_MSG(test, info->unused_entries_index,
"Unused entries index should have been defined\n");
ret = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
KUNIT_ASSERT_EQ_MSG(test, ret, 0, "Forcewake Failed.\n");
mocs_dbg(&gt_to_xe(gt)->drm, "Global MOCS entries:%d\n", info->n_entries);
drm_WARN_ONCE(&xe->drm, !info->unused_entries_index,
"Unused entries index should have been defined\n");
for (i = 0; i < info->n_entries; i++) {
mocs = get_entry_control(info, i);
......
......@@ -470,9 +470,11 @@ static void __init_mocs_table(struct xe_gt *gt,
unsigned int i;
u32 mocs;
mocs_dbg(&gt_to_xe(gt)->drm, "mocs entries: %d\n", info->n_entries);
drm_WARN_ONCE(&xe->drm, !info->unused_entries_index,
"Unused entries index should have been defined\n");
mocs_dbg(&gt_to_xe(gt)->drm, "mocs entries: %d\n", info->n_entries);
for (i = 0; i < info->n_entries; i++) {
mocs = get_entry_control(info, i);
......
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