[igt-dev] [PATCH i-g-t 02/10] tools/intel_watermark: Don't do intel_register_access_fini() too early on hsw/bdw

Ville Syrjala
2023-01-25T04:55:28Z

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

The tool will segfault if we try to the WM_DBG read/write after
intel_register_access_fini(). So move intel_register_access_fini()
to the very end.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
tools/intel_watermark.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/intel_watermark.c b/tools/intel_watermark.c
index 1818d79d0bee..d61379c6dc7f 100644
--- a/tools/intel_watermark.c
+++ b/tools/intel_watermark.c
@@ -644,8 +644,6 @@ static void ilk_wm_dump(void)
if (IS_BROADWELL(devid) || IS_HASWELL(devid))
wm_misc = read_reg(0x45260);

- intel_register_access_fini(&mmio_data);
-
for (i = 0; i < num_pipes; i++)
printf(" WM_PIPE_%c = 0x%08x\n", pipe_name(i), wm_pipe[i]);
if (IS_BROADWELL(devid) || IS_HASWELL(devid)) {
@@ -765,6 +763,8 @@ static void ilk_wm_dump(void)
/* clear the sticky bits */
write_reg(0x45280, wm_dbg);
}
+
+ intel_register_access_fini(&mmio_data);
}

static void vlv_wm_dump(void)
--
2.39.1