Skip to content

Commit 8b3f09f

Browse files
committed
drm/xe: Fix xe_display_fini() calls
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 65e366a ("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 <[email protected]> Cc: Rodrigo Vivi <[email protected]> Reviewed-by: Rodrigo Vivi <[email protected]> Reviewed-by: Himal Prasad Ghimiray <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Lucas De Marchi <[email protected]>
1 parent 776e3b5 commit 8b3f09f

File tree

3 files changed

+23
-22
lines changed

3 files changed

+23
-22
lines changed

drivers/gpu/drm/xe/display/xe_display.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -162,27 +162,29 @@ int xe_display_init_early(struct xe_device *xe)
162162
return err;
163163
}
164164

165-
int xe_display_init(struct xe_device *xe)
165+
static void xe_display_fini(void *arg)
166166
{
167+
struct xe_device *xe = arg;
167168
struct intel_display *display = &xe->display;
168169

169-
if (!xe->info.probe_display)
170-
return 0;
171-
172-
return intel_display_driver_probe(display);
170+
intel_hpd_poll_fini(xe);
171+
intel_hdcp_component_fini(display);
172+
intel_audio_deinit(xe);
173173
}
174174

175-
void xe_display_fini(struct xe_device *xe)
175+
int xe_display_init(struct xe_device *xe)
176176
{
177177
struct intel_display *display = &xe->display;
178+
int err;
178179

179180
if (!xe->info.probe_display)
180-
return;
181+
return 0;
181182

182-
intel_hpd_poll_fini(xe);
183+
err = intel_display_driver_probe(display);
184+
if (err)
185+
return err;
183186

184-
intel_hdcp_component_fini(display);
185-
intel_audio_deinit(xe);
187+
return xe_device_add_action_or_reset(xe, xe_display_fini, xe);
186188
}
187189

188190
void xe_display_register(struct xe_device *xe)

drivers/gpu/drm/xe/display/xe_display.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ int xe_display_probe(struct xe_device *xe);
2222

2323
int xe_display_init_early(struct xe_device *xe);
2424
int xe_display_init(struct xe_device *xe);
25-
void xe_display_fini(struct xe_device *xe);
2625

2726
void xe_display_register(struct xe_device *xe);
2827
void xe_display_unregister(struct xe_device *xe);
@@ -54,7 +53,6 @@ static inline int xe_display_probe(struct xe_device *xe) { return 0; }
5453

5554
static inline int xe_display_init_early(struct xe_device *xe) { return 0; }
5655
static inline int xe_display_init(struct xe_device *xe) { return 0; }
57-
static inline void xe_display_fini(struct xe_device *xe) {}
5856

5957
static inline void xe_display_register(struct xe_device *xe) {}
6058
static inline void xe_display_unregister(struct xe_device *xe) {}

drivers/gpu/drm/xe/xe_device.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,7 @@ static int probe_has_flat_ccs(struct xe_device *xe)
741741
"Flat CCS has been disabled in bios, May lead to performance impact");
742742

743743
xe_force_wake_put(gt_to_fw(gt), fw_ref);
744+
744745
return 0;
745746
}
746747

@@ -812,22 +813,26 @@ int xe_device_probe(struct xe_device *xe)
812813
err = xe_devcoredump_init(xe);
813814
if (err)
814815
return err;
816+
817+
/*
818+
* From here on, if a step fails, make sure a Driver-FLR is triggereed
819+
*/
815820
err = devm_add_action_or_reset(xe->drm.dev, xe_driver_flr_fini, xe);
816821
if (err)
817822
return err;
818823

819824
err = probe_has_flat_ccs(xe);
820825
if (err)
821-
goto err;
826+
return err;
822827

823828
err = xe_vram_probe(xe);
824829
if (err)
825-
goto err;
830+
return err;
826831

827832
for_each_tile(tile, xe, id) {
828833
err = xe_tile_init_noalloc(tile);
829834
if (err)
830-
goto err;
835+
return err;
831836
}
832837

833838
/* Allocate and map stolen after potential VRAM resize */
@@ -841,17 +846,17 @@ int xe_device_probe(struct xe_device *xe)
841846
*/
842847
err = xe_display_init_early(xe);
843848
if (err)
844-
goto err;
849+
return err;
845850

846851
for_each_tile(tile, xe, id) {
847852
err = xe_tile_init(tile);
848853
if (err)
849-
goto err;
854+
return err;
850855
}
851856

852857
err = xe_irq_install(xe);
853858
if (err)
854-
goto err;
859+
return err;
855860

856861
for_each_gt(gt, xe, id) {
857862
last_gt = id;
@@ -913,8 +918,6 @@ int xe_device_probe(struct xe_device *xe)
913918
break;
914919
}
915920

916-
err:
917-
xe_display_fini(xe);
918921
return err;
919922
}
920923

@@ -990,8 +993,6 @@ void xe_device_remove(struct xe_device *xe)
990993

991994
xe_device_remove_display(xe);
992995

993-
xe_display_fini(xe);
994-
995996
xe_oa_fini(xe);
996997

997998
xe_heci_gsc_fini(xe);

0 commit comments

Comments
 (0)