Commit 43154713 authored by Matt Roper's avatar Matt Roper

drm/xe/mocs: Clarify which GT is being operated on

Switch the MOCS-related debug messages to use a GT-specific logging
function and add ID/type output to the beginning of the MOCS kunit test
to assist with debug when problems arise.

Cc: Lucas De Marchi <lucas.demarchi@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/20240314195825.3226856-4-matthew.d.roper@intel.com
parent 00e9062e
......@@ -29,6 +29,8 @@ static int live_mocs_init(struct live_mocs *arg, struct xe_gt *gt)
flags = get_mocs_settings(gt_to_xe(gt), &arg->table);
kunit_info(test, "gt %d", gt->info.id);
kunit_info(test, "gt type %d", gt->info.type);
kunit_info(test, "table size %d", arg->table.size);
kunit_info(test, "table uc_index %d", arg->table.uc_index);
kunit_info(test, "table n_entries %d", arg->table.n_entries);
......@@ -40,7 +42,6 @@ static void read_l3cc_table(struct xe_gt *gt,
const struct xe_mocs_info *info)
{
struct kunit *test = xe_cur_kunit();
struct xe_device *xe = gt_to_xe(gt);
u32 l3cc, l3cc_expected;
unsigned int i;
u32 reg_val;
......@@ -56,7 +57,7 @@ static void read_l3cc_table(struct xe_gt *gt,
else
reg_val = xe_mmio_read32(gt, XELP_LNCFCMOCS(i >> 1));
mocs_dbg(&xe->drm, "reg_val=0x%x\n", reg_val);
mocs_dbg(gt, "reg_val=0x%x\n", reg_val);
} else {
/* Just re-use value read on previous iteration */
reg_val >>= 16;
......@@ -65,7 +66,7 @@ static void read_l3cc_table(struct xe_gt *gt,
l3cc_expected = get_entry_l3cc(info, i);
l3cc = reg_val & 0xffff;
mocs_dbg(&xe->drm, "[%u] expected=0x%x actual=0x%x\n",
mocs_dbg(gt, "[%u] expected=0x%x actual=0x%x\n",
i, l3cc_expected, l3cc);
KUNIT_EXPECT_EQ_MSG(test, l3cc_expected, l3cc,
......@@ -78,7 +79,6 @@ static void read_mocs_table(struct xe_gt *gt,
const struct xe_mocs_info *info)
{
struct kunit *test = xe_cur_kunit();
struct xe_device *xe = gt_to_xe(gt);
u32 mocs, mocs_expected;
unsigned int i;
u32 reg_val;
......@@ -99,7 +99,7 @@ static void read_mocs_table(struct xe_gt *gt,
mocs_expected = get_entry_control(info, i);
mocs = reg_val;
mocs_dbg(&xe->drm, "[%u] expected=0x%x actual=0x%x\n",
mocs_dbg(gt, "[%u] expected=0x%x actual=0x%x\n",
i, mocs_expected, mocs);
KUNIT_EXPECT_EQ_MSG(test, mocs_expected, mocs,
......
......@@ -17,10 +17,10 @@
#include "xe_step_types.h"
#if IS_ENABLED(CONFIG_DRM_XE_DEBUG)
#define mocs_dbg drm_dbg
#define mocs_dbg xe_gt_dbg
#else
__printf(2, 3)
static inline void mocs_dbg(const struct drm_device *dev,
static inline void mocs_dbg(const struct xe_gt *gt,
const char *format, ...)
{ /* noop */ }
#endif
......@@ -479,20 +479,18 @@ static bool regs_are_mcr(struct xe_gt *gt)
static void __init_mocs_table(struct xe_gt *gt,
const struct xe_mocs_info *info)
{
struct xe_device *xe = gt_to_xe(gt);
unsigned int i;
u32 mocs;
drm_WARN_ONCE(&xe->drm, !info->unused_entries_index,
"Unused entries index should have been defined\n");
xe_gt_WARN_ONCE(gt, !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);
mocs_dbg(gt, "mocs entries: %d\n", info->n_entries);
for (i = 0; i < info->n_entries; i++) {
mocs = get_entry_control(info, i);
mocs_dbg(&gt_to_xe(gt)->drm, "GLOB_MOCS[%d] 0x%x 0x%x\n", i,
mocs_dbg(gt, "GLOB_MOCS[%d] 0x%x 0x%x\n", i,
XELP_GLOBAL_MOCS(i).addr, mocs);
if (regs_are_mcr(gt))
......@@ -526,13 +524,13 @@ static void init_l3cc_table(struct xe_gt *gt,
unsigned int i;
u32 l3cc;
mocs_dbg(&gt_to_xe(gt)->drm, "l3cc entries: %d\n", info->n_entries);
mocs_dbg(gt, "l3cc entries: %d\n", info->n_entries);
for (i = 0; i < (info->n_entries + 1) / 2; i++) {
l3cc = l3cc_combine(get_entry_l3cc(info, 2 * i),
get_entry_l3cc(info, 2 * i + 1));
mocs_dbg(&gt_to_xe(gt)->drm, "LNCFCMOCS[%d] 0x%x 0x%x\n", i,
mocs_dbg(gt, "LNCFCMOCS[%d] 0x%x 0x%x\n", i,
XELP_LNCFCMOCS(i).addr, l3cc);
if (regs_are_mcr(gt))
......@@ -568,7 +566,7 @@ void xe_mocs_init(struct xe_gt *gt)
* performed by the GuC.
*/
flags = get_mocs_settings(gt_to_xe(gt), &table);
mocs_dbg(&gt_to_xe(gt)->drm, "flag:0x%x\n", flags);
mocs_dbg(gt, "flag:0x%x\n", flags);
if (flags & HAS_GLOBAL_MOCS)
__init_mocs_table(gt, &table);
......
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