Commit 6647e2fe authored by Lucas De Marchi's avatar Lucas De Marchi Committed by Rodrigo Vivi

drm/xe/debugfs: Dump register save-restore tables

Add debugfs entry to dump the final tables with register save-restore
information.

For the workarounds, this has a format a little bit different than when the
values are applied because we don't want to read the values from the HW
when dumping via debugfs. For whitelist it just re-uses the print
function added for when the whitelist is being built.
Signed-off-by: default avatarLucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: default avatarMatt Roper <matthew.d.roper@intel.com>
Link: https://lore.kernel.org/r/20230314003012.2600353-5-lucas.demarchi@intel.comSigned-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
parent d855d224
......@@ -16,6 +16,8 @@
#include "xe_gt_topology.h"
#include "xe_hw_engine.h"
#include "xe_macros.h"
#include "xe_reg_sr.h"
#include "xe_reg_whitelist.h"
#include "xe_uc_debugfs.h"
static struct xe_gt *node_to_gt(struct drm_info_node *node)
......@@ -98,6 +100,33 @@ static int ggtt(struct seq_file *m, void *data)
return xe_ggtt_dump(gt->mem.ggtt, &p);
}
static int register_save_restore(struct seq_file *m, void *data)
{
struct xe_gt *gt = node_to_gt(m->private);
struct drm_printer p = drm_seq_file_printer(m);
struct xe_hw_engine *hwe;
enum xe_hw_engine_id id;
xe_reg_sr_dump(&gt->reg_sr, &p);
drm_printf(&p, "\n");
drm_printf(&p, "Engine\n");
for_each_hw_engine(hwe, gt, id)
xe_reg_sr_dump(&hwe->reg_sr, &p);
drm_printf(&p, "\n");
drm_printf(&p, "LRC\n");
for_each_hw_engine(hwe, gt, id)
xe_reg_sr_dump(&hwe->reg_lrc, &p);
drm_printf(&p, "\n");
drm_printf(&p, "Whitelist\n");
for_each_hw_engine(hwe, gt, id)
xe_reg_whitelist_dump(&hwe->reg_whitelist, &p);
return 0;
}
static const struct drm_info_list debugfs_list[] = {
{"hw_engines", hw_engines, 0},
{"force_reset", force_reset, 0},
......@@ -105,6 +134,7 @@ static const struct drm_info_list debugfs_list[] = {
{"topology", topology, 0},
{"steering", steering, 0},
{"ggtt", ggtt, 0},
{"register-save-restore", register_save_restore, 0},
};
void xe_gt_debugfs_register(struct xe_gt *gt)
......
......@@ -229,3 +229,24 @@ void xe_reg_sr_apply_whitelist(struct xe_reg_sr *sr, u32 mmio_base,
err_force_wake:
drm_err(&xe->drm, "Failed to apply, err=%d\n", err);
}
/**
* xe_reg_sr_dump - print all save/restore entries
* @sr: Save/restore entries
* @p: DRM printer
*/
void xe_reg_sr_dump(struct xe_reg_sr *sr, struct drm_printer *p)
{
struct xe_reg_sr_entry *entry;
unsigned long reg;
if (!sr->name || xa_empty(&sr->xa))
return;
drm_printf(p, "%s\n", sr->name);
xa_for_each(&sr->xa, reg, entry)
drm_printf(p, "\tREG[0x%lx] clr=0x%08x set=0x%08x masked=%s mcr=%s\n",
reg, entry->clr_bits, entry->set_bits,
str_yes_no(entry->masked_reg),
str_yes_no(entry->reg_type == XE_RTP_REG_MCR));
}
......@@ -14,8 +14,10 @@
struct xe_device;
struct xe_gt;
struct drm_printer;
int xe_reg_sr_init(struct xe_reg_sr *sr, const char *name, struct xe_device *xe);
void xe_reg_sr_dump(struct xe_reg_sr *sr, struct drm_printer *p);
int xe_reg_sr_add(struct xe_reg_sr *sr, u32 reg,
const struct xe_reg_sr_entry *e);
......
......@@ -108,3 +108,21 @@ void xe_reg_whitelist_print_entry(struct drm_printer *p, unsigned int indent,
deny ? "deny" : "allow",
access_str);
}
/**
* xe_reg_whitelist_dump - print all whitelist entries
* @sr: Save/restore entries
* @p: DRM printer
*/
void xe_reg_whitelist_dump(struct xe_reg_sr *sr, struct drm_printer *p)
{
struct xe_reg_sr_entry *entry;
unsigned long reg;
if (!sr->name || xa_empty(&sr->xa))
return;
drm_printf(p, "%s\n", sr->name);
xa_for_each(&sr->xa, reg, entry)
xe_reg_whitelist_print_entry(p, 1, reg, entry);
}
......@@ -10,6 +10,7 @@
struct drm_printer;
struct xe_hw_engine;
struct xe_reg_sr;
struct xe_reg_sr_entry;
void xe_reg_whitelist_process_engine(struct xe_hw_engine *hwe);
......@@ -17,4 +18,6 @@ void xe_reg_whitelist_process_engine(struct xe_hw_engine *hwe);
void xe_reg_whitelist_print_entry(struct drm_printer *p, unsigned int indent,
u32 reg, struct xe_reg_sr_entry *entry);
void xe_reg_whitelist_dump(struct xe_reg_sr *sr, struct drm_printer *p);
#endif
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