From: "Ghimiray, Himal Prasad" <himal.prasad.ghimiray@intel.com>
To: Lucas De Marchi <lucas.demarchi@intel.com>,
<intel-xe@lists.freedesktop.org>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>,
Francois Dugast <francois.dugast@intel.com>,
Matthew Auld <matthew.auld@intel.com>,
"Daniele Ceraolo Spurio" <daniele.ceraolospurio@intel.com>,
Maarten Lankhorst <dev@lankhorst.se>
Subject: Re: [PATCH v3 01/13] drm/xe: Fix xe_display_fini() calls
Date: Mon, 10 Feb 2025 23:26:27 +0530 [thread overview]
Message-ID: <7c0bfb21-ead6-472b-b68d-62eece414472@intel.com> (raw)
In-Reply-To: <20250207221945.2878241-2-lucas.demarchi@intel.com>
On 08-02-2025 03:49, Lucas De Marchi wrote:
> xe_display_fini() undoes things from xe_display_init() (technically from
> intel_display_driver_probe()). Those `goto err` in xe_device_probe()
> were wrong and being accumulated over time.
>
> Commit 65e366ace5ee ("drm/xe/display: Use a single early init call for
> display") made it easier to fix now that we don't have xe_display_* init
> calls spread on xe_device_probe(). Change xe_display_init() to use
> devm_add_action_or_reset() that will finalize display in the right
> order.
>
> While at it, also add a newline and comment about calling
> xe_driver_flr_fini.
>
> Cc: Maarten Lankhorst <dev@lankhorst.se>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> ---
> drivers/gpu/drm/xe/display/xe_display.c | 22 ++++++++++++----------
> drivers/gpu/drm/xe/display/xe_display.h | 2 --
> drivers/gpu/drm/xe/xe_device.c | 21 +++++++++++----------
> 3 files changed, 23 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/display/xe_display.c b/drivers/gpu/drm/xe/display/xe_display.c
> index 651799c946ace..302f533af037d 100644
> --- a/drivers/gpu/drm/xe/display/xe_display.c
> +++ b/drivers/gpu/drm/xe/display/xe_display.c
> @@ -161,27 +161,29 @@ int xe_display_init_early(struct xe_device *xe)
> return err;
> }
>
> -int xe_display_init(struct xe_device *xe)
> +static void xe_display_fini(void *arg)
> {
> + struct xe_device *xe = arg;
> struct intel_display *display = &xe->display;
>
> - if (!xe->info.probe_display)
> - return 0;
> -
> - return intel_display_driver_probe(display);
> + intel_hpd_poll_fini(xe);
> + intel_hdcp_component_fini(display);
> + intel_audio_deinit(display);
> }
>
> -void xe_display_fini(struct xe_device *xe)
> +int xe_display_init(struct xe_device *xe)
> {
> struct intel_display *display = &xe->display;
> + int err;
>
> if (!xe->info.probe_display)
> - return;
> + return 0;
>
> - intel_hpd_poll_fini(xe);
> + err = intel_display_driver_probe(display);
> + if (err)
> + return err;
>
> - intel_hdcp_component_fini(display);
> - intel_audio_deinit(display);
> + return devm_add_action_or_reset(xe->drm.dev, xe_display_fini, xe);
> }
>
> void xe_display_register(struct xe_device *xe)
> diff --git a/drivers/gpu/drm/xe/display/xe_display.h b/drivers/gpu/drm/xe/display/xe_display.h
> index e2a99624f7064..685dc74402fb8 100644
> --- a/drivers/gpu/drm/xe/display/xe_display.h
> +++ b/drivers/gpu/drm/xe/display/xe_display.h
> @@ -22,7 +22,6 @@ int xe_display_probe(struct xe_device *xe);
>
> int xe_display_init_early(struct xe_device *xe);
> int xe_display_init(struct xe_device *xe);
> -void xe_display_fini(struct xe_device *xe);
>
> void xe_display_register(struct xe_device *xe);
> void xe_display_unregister(struct xe_device *xe);
> @@ -54,7 +53,6 @@ static inline int xe_display_probe(struct xe_device *xe) { return 0; }
>
> static inline int xe_display_init_early(struct xe_device *xe) { return 0; }
> static inline int xe_display_init(struct xe_device *xe) { return 0; }
> -static inline void xe_display_fini(struct xe_device *xe) {}
>
> static inline void xe_display_register(struct xe_device *xe) {}
> static inline void xe_display_unregister(struct xe_device *xe) {}
> diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
> index 36d7ffb3b4d90..ac3e344fe04ec 100644
> --- a/drivers/gpu/drm/xe/xe_device.c
> +++ b/drivers/gpu/drm/xe/xe_device.c
> @@ -735,6 +735,7 @@ static int probe_has_flat_ccs(struct xe_device *xe)
> "Flat CCS has been disabled in bios, May lead to performance impact");
>
> xe_force_wake_put(gt_to_fw(gt), fw_ref);
> +
> return 0;
> }
>
> @@ -803,22 +804,26 @@ int xe_device_probe(struct xe_device *xe)
> err = xe_devcoredump_init(xe);
> if (err)
> return err;
> +
> + /*
> + * From here on, if a step fails, make sure a Driver-FLR is triggereed
> + */
> err = devm_add_action_or_reset(xe->drm.dev, xe_driver_flr_fini, xe);
> if (err)
> return err;
>
> err = probe_has_flat_ccs(xe);
> if (err)
> - goto err;
> + return err;
>
> err = xe_vram_probe(xe);
> if (err)
> - goto err;
> + return err;
>
> for_each_tile(tile, xe, id) {
> err = xe_tile_init_noalloc(tile);
> if (err)
> - goto err;
> + return err;
> }
>
> /* Allocate and map stolen after potential VRAM resize */
> @@ -832,17 +837,17 @@ int xe_device_probe(struct xe_device *xe)
> */
> err = xe_display_init_early(xe);
> if (err)
> - goto err;
> + return err;
Currently, xe_oa_fini and xe_heci_gsc_fini won't be called in case of an
error. This is incomplete without also moving xe_oa_fini and
xe_heci_gsc_fini under devm_add_action_or_reset.
>
> for_each_tile(tile, xe, id) {
> err = xe_tile_init(tile);
> if (err)
> - goto err;
> + return err;
> }
>
> err = xe_irq_install(xe);
> if (err)
> - goto err;
> + return err;
>
> for_each_gt(gt, xe, id) {
> last_gt = id;
> @@ -902,8 +907,6 @@ int xe_device_probe(struct xe_device *xe)
> break;
> }
>
> -err:
> - xe_display_fini(xe);
> return err;
> }
>
> @@ -924,8 +927,6 @@ void xe_device_remove(struct xe_device *xe)
>
> xe_device_remove_display(xe);
>
> - xe_display_fini(xe);
> -
> xe_oa_fini(xe);
>
> xe_heci_gsc_fini(xe);
next prev parent reply other threads:[~2025-02-10 17:56 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-07 22:19 [PATCH v3 00/13] Cleanup error handling on probe Lucas De Marchi
2025-02-07 22:19 ` [PATCH v3 01/13] drm/xe: Fix xe_display_fini() calls Lucas De Marchi
2025-02-10 17:56 ` Ghimiray, Himal Prasad [this message]
2025-02-10 19:08 ` Ghimiray, Himal Prasad
2025-02-07 22:19 ` [PATCH v3 02/13] drm/xe: Fix error handling in xe_irq_install() Lucas De Marchi
2025-02-10 17:58 ` Ghimiray, Himal Prasad
2025-02-07 22:19 ` [PATCH v3 03/13] drm/xe: Fix xe_tile_init_noalloc() error propagation Lucas De Marchi
2025-02-10 5:52 ` Upadhyay, Tejas
2025-02-10 17:59 ` Ghimiray, Himal Prasad
2025-02-07 22:19 ` [PATCH v3 04/13] drm/xe: Stop ignoring errors from xe_ttm_stolen_mgr_init() Lucas De Marchi
2025-02-10 18:05 ` Ghimiray, Himal Prasad
2025-02-07 22:19 ` [PATCH v3 05/13] drm/xe: Remove leftover pxp comment Lucas De Marchi
2025-02-07 22:19 ` [PATCH v3 06/13] drm/xe: Add callback support for driver remove Lucas De Marchi
2025-02-10 17:41 ` Rodrigo Vivi
2025-02-12 5:45 ` Lucas De Marchi
2025-02-07 22:19 ` [PATCH v3 07/13] drm/xe: Cleanup unwind of gt initialization Lucas De Marchi
2025-02-10 18:54 ` Ghimiray, Himal Prasad
2025-02-07 22:19 ` [PATCH v3 08/13] drm/xe: Cleanup extra calls to xe_hw_fence_irq_finish() Lucas De Marchi
2025-02-10 18:56 ` Ghimiray, Himal Prasad
2025-02-07 22:19 ` [PATCH v3 09/13] drm/xe/oa: Move fini to xe_oa Lucas De Marchi
2025-02-07 22:19 ` [PATCH v3 10/13] drm/xe: Move drm_dev_unplug() out of display function Lucas De Marchi
2025-02-10 5:44 ` Upadhyay, Tejas
2025-02-07 22:19 ` [PATCH v3 11/13] drm/xe/oa: Handle errors in xe_oa_register() Lucas De Marchi
2025-02-07 22:19 ` [PATCH v3 12/13] drm/xe/pmu: Fail probe if xe_pmu_register() fails Lucas De Marchi
2025-02-10 11:17 ` Upadhyay, Tejas
2025-02-10 19:00 ` Ghimiray, Himal Prasad
2025-02-07 22:19 ` [PATCH v3 13/13] drm/xe/hwmon: Stop ignoring errors on probe Lucas De Marchi
2025-02-07 22:31 ` Raag Jadav
2025-02-10 5:31 ` Nilawar, Badal
2025-02-10 15:15 ` Lucas De Marchi
2025-02-10 16:54 ` Nilawar, Badal
2025-02-07 23:42 ` ✓ CI.Patch_applied: success for Cleanup error handling on probe (rev3) Patchwork
2025-02-07 23:42 ` ✗ CI.checkpatch: warning " Patchwork
2025-02-07 23:43 ` ✓ CI.KUnit: success " Patchwork
2025-02-08 0:00 ` ✓ CI.Build: " Patchwork
2025-02-08 0:02 ` ✓ CI.Hooks: " Patchwork
2025-02-08 0:03 ` ✓ CI.checksparse: " Patchwork
2025-02-10 6:05 ` ✓ Xe.CI.BAT: " Patchwork
2025-02-10 6:55 ` ✗ Xe.CI.Full: failure " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7c0bfb21-ead6-472b-b68d-62eece414472@intel.com \
--to=himal.prasad.ghimiray@intel.com \
--cc=daniele.ceraolospurio@intel.com \
--cc=dev@lankhorst.se \
--cc=francois.dugast@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=lucas.demarchi@intel.com \
--cc=matthew.auld@intel.com \
--cc=rodrigo.vivi@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox