[Intel-xe] [PATCH v11 05/12] drm/xe: ensure correct access_put ordering
Matthew Brost
matthew.brost at intel.com
Mon Jun 12 18:16:35 UTC 2023
On Mon, Jun 12, 2023 at 06:12:18PM +0100, Matthew Auld wrote:
> Only call access_put after dropping the forcewake. In theory the device
> could suspend, but really we want to start asserting that we have a
> mem_access.ref when touching mmio.
>
> Signed-off-by: Matthew Auld <matthew.auld at intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi at intel.com>
Same with the previous patch, this wouldn't be needed if the force wake
functions get / put memmory refs.
Again if you leave it as this patch itself LGTM.
With that:
Reviewed-by: Matthew Brost <matthew.brost at intel.com>
> ---
> drivers/gpu/drm/xe/xe_gt.c | 8 ++++----
> drivers/gpu/drm/xe/xe_gt_debugfs.c | 2 +-
> drivers/gpu/drm/xe/xe_guc_pc.c | 2 +-
> 3 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_gt.c b/drivers/gpu/drm/xe/xe_gt.c
> index 2458397ce8af..2b8a5b29d281 100644
> --- a/drivers/gpu/drm/xe/xe_gt.c
> +++ b/drivers/gpu/drm/xe/xe_gt.c
> @@ -530,8 +530,8 @@ static int gt_reset(struct xe_gt *gt)
> if (err)
> goto err_out;
>
> - xe_device_mem_access_put(gt_to_xe(gt));
> err = xe_force_wake_put(gt_to_fw(gt), XE_FORCEWAKE_ALL);
> + xe_device_mem_access_put(gt_to_xe(gt));
> XE_WARN_ON(err);
>
> xe_gt_info(gt, "reset done\n");
> @@ -574,8 +574,8 @@ void xe_gt_suspend_prepare(struct xe_gt *gt)
>
> xe_uc_stop_prepare(>->uc);
>
> - xe_device_mem_access_put(gt_to_xe(gt));
> XE_WARN_ON(xe_force_wake_put(gt_to_fw(gt), XE_FORCEWAKE_ALL));
> + xe_device_mem_access_put(gt_to_xe(gt));
> }
>
> int xe_gt_suspend(struct xe_gt *gt)
> @@ -597,8 +597,8 @@ int xe_gt_suspend(struct xe_gt *gt)
> if (err)
> goto err_force_wake;
>
> - xe_device_mem_access_put(gt_to_xe(gt));
> XE_WARN_ON(xe_force_wake_put(gt_to_fw(gt), XE_FORCEWAKE_ALL));
> + xe_device_mem_access_put(gt_to_xe(gt));
> xe_gt_info(gt, "suspended\n");
>
> return 0;
> @@ -625,8 +625,8 @@ int xe_gt_resume(struct xe_gt *gt)
> if (err)
> goto err_force_wake;
>
> - xe_device_mem_access_put(gt_to_xe(gt));
> XE_WARN_ON(xe_force_wake_put(gt_to_fw(gt), XE_FORCEWAKE_ALL));
> + xe_device_mem_access_put(gt_to_xe(gt));
> xe_gt_info(gt, "resumed\n");
>
> return 0;
> diff --git a/drivers/gpu/drm/xe/xe_gt_debugfs.c b/drivers/gpu/drm/xe/xe_gt_debugfs.c
> index b5a5538ae630..98dd3b2506b1 100644
> --- a/drivers/gpu/drm/xe/xe_gt_debugfs.c
> +++ b/drivers/gpu/drm/xe/xe_gt_debugfs.c
> @@ -45,8 +45,8 @@ static int hw_engines(struct seq_file *m, void *data)
> for_each_hw_engine(hwe, gt, id)
> xe_hw_engine_print(hwe, &p);
>
> - xe_device_mem_access_put(xe);
> err = xe_force_wake_put(gt_to_fw(gt), XE_FORCEWAKE_ALL);
> + xe_device_mem_access_put(xe);
> if (err)
> return err;
>
> diff --git a/drivers/gpu/drm/xe/xe_guc_pc.c b/drivers/gpu/drm/xe/xe_guc_pc.c
> index 67faa9ee0006..0991a3c49480 100644
> --- a/drivers/gpu/drm/xe/xe_guc_pc.c
> +++ b/drivers/gpu/drm/xe/xe_guc_pc.c
> @@ -835,8 +835,8 @@ int xe_guc_pc_start(struct xe_guc_pc *pc)
> ret = pc_action_setup_gucrc(pc, XE_GUCRC_FIRMWARE_CONTROL);
>
> out:
> - xe_device_mem_access_put(pc_to_xe(pc));
> XE_WARN_ON(xe_force_wake_put(gt_to_fw(gt), XE_FORCEWAKE_ALL));
> + xe_device_mem_access_put(pc_to_xe(pc));
> return ret;
> }
>
> --
> 2.40.1
>
More information about the Intel-xe
mailing list