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

Govindapillai, Vinod
2023-02-06T08:14:36Z

On Wed, 2023-01-25 at 06:55 +0200, Ville Syrjala wrote:
> 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(-)

Reviewed-by: Vinod Govindapillai <vinod.govindapillai@intel.com>

>
> 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)