Re: [PATCH-resent-to-correct-ml 2/8] drm/xe/gt: Unify xe_hw_fence_irq_finish() calls.

Lucas De Marchi
2025-02-04T15:20:48Z

On Tue, Feb 04, 2025 at 02:22:31PM +0100, Maarten Lankhorst wrote:
>Those calls should be from xe_gt_init, not the diverse amount of places
>they are called.
>
>Signed-off-by: Maarten Lankhorst <dev@lankhorst.se>
>---
> drivers/gpu/drm/xe/xe_gt.c | 31 ++++++++++++++-----------------
> 1 file changed, 14 insertions(+), 17 deletions(-)
>
>diff --git a/drivers/gpu/drm/xe/xe_gt.c b/drivers/gpu/drm/xe/xe_gt.c
>index 01a4a852b8f43..943bab94119fa 100644
>--- a/drivers/gpu/drm/xe/xe_gt.c
>+++ b/drivers/gpu/drm/xe/xe_gt.c
>@@ -408,13 +408,11 @@ static void dump_pat_on_error(struct xe_gt *gt)
> static int gt_fw_domain_init(struct xe_gt *gt)
> {
> unsigned int fw_ref;
>- int err, i;
>+ int err;
>
> fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FW_GT);
>- if (!fw_ref) {
>- err = -ETIMEDOUT;
>- goto err_hw_fence_irq;
>- }
>+ if (!fw_ref)
>+ return -ETIMEDOUT;
>
> if (!xe_gt_is_media_type(gt)) {
> err = xe_ggtt_init(gt_to_tile(gt)->mem.ggtt);
>@@ -455,9 +453,6 @@ static int gt_fw_domain_init(struct xe_gt *gt)
> err_force_wake:
> dump_pat_on_error(gt);
> xe_force_wake_put(gt_to_fw(gt), fw_ref);
>-err_hw_fence_irq:
>- for (i = 0; i < XE_ENGINE_CLASS_MAX; ++i)
>- xe_hw_fence_irq_finish(&gt->fence_irq[i]);
>
> return err;
> }
>@@ -465,7 +460,7 @@ static int gt_fw_domain_init(struct xe_gt *gt)
> static int all_fw_domain_init(struct xe_gt *gt)
> {
> unsigned int fw_ref;
>- int err, i;
>+ int err;
>
> fw_ref = xe_force_wake_get(gt_to_fw(gt), XE_FORCEWAKE_ALL);
> if (!xe_force_wake_ref_has_domain(fw_ref, XE_FORCEWAKE_ALL)) {
>@@ -543,8 +538,6 @@ static int all_fw_domain_init(struct xe_gt *gt)
>
> err_force_wake:
> xe_force_wake_put(gt_to_fw(gt), fw_ref);
>- for (i = 0; i < XE_ENGINE_CLASS_MAX; ++i)
>- xe_hw_fence_irq_finish(&gt->fence_irq[i]);
>
> return err;
> }

the two parts above should be fine and is similar to what I've sent on
my probe cleanup:

https://lore.kernel.org/intel-xe/20250131223140.4144292-7-lucas.demarchi@intel.com/

>@@ -596,35 +589,39 @@ int xe_gt_init(struct xe_gt *gt)
>
> err = xe_gt_pagefault_init(gt);
> if (err)
>- return err;
>+ goto err;
>
> xe_mocs_init_early(gt);
>
> err = xe_gt_sysfs_init(gt);
> if (err)
>- return err;
>+ goto err;
>
> err = gt_fw_domain_init(gt);
> if (err)
>- return err;
>+ goto err;
>
> err = xe_gt_idle_init(&gt->gtidle);
> if (err)
>- return err;
>+ goto err;
>
> err = xe_gt_freq_init(gt);
> if (err)
>- return err;
>+ goto err;
>
> xe_force_wake_init_engines(gt, gt_to_fw(gt));
>
> err = all_fw_domain_init(gt);
> if (err)
>- return err;
>+ goto err;
>
> xe_gt_record_user_engines(gt);
>
> return 0;
>+err:
>+ for (i = 0; i < XE_ENGINE_CLASS_MAX; ++i)
>+ xe_hw_fence_irq_finish(&gt->fence_irq[i]);
>+ return err;

this however is moving to the opposite direction from

https://lore.kernel.org/intel-xe/20250131223140.4144292-6-lucas.demarchi@intel.com/

Lucas De Marchi

> }
>
> /**
>--
>2.47.1
>