Commit 11963006 authored by Jun Lei's avatar Jun Lei Committed by Alex Deucher
Browse files

drm/amd/display: remove hw access from dc_destroy



[why]
dc_destroy should only clean up SW, this is because GPUs may be
removed before driver unload, leading to HW to be unavailable.

[how]
remove GPIO close as part of GPIO destroy, this is unnecessary because
GPIO is not shared, and GPIOs are generally closed after being opened

Add tracking to HW access during destructor to make future issues
easier to pinpoint, and block access to prevent hangs.

Signed-off-by: default avatarJun Lei <Jun.Lei@amd.com>
Reviewed-by: default avatarYongqiang Sun <yongqiang.sun@amd.com>
Acked-by: default avatarBhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent ff344c8d
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -139,6 +139,9 @@ static void rv1_update_clocks(struct clk_mgr *clk_mgr_base,

	ASSERT(clk_mgr->pp_smu);

	if (dc->work_arounds.skip_clock_update)
		return;

	pp_smu = &clk_mgr->pp_smu->rv_funcs;

	display_count = clk_mgr_helper_get_active_display_cnt(dc, context);
+14 −6
Original line number Diff line number Diff line
@@ -1886,6 +1886,7 @@ static void commit_planes_do_stream_update(struct dc *dc,
		struct dc_state *context)
{
	int j;
	bool should_program_abm;

	// Stream updates
	for (j = 0; j < dc->res_pool->pipe_count; j++) {
@@ -1966,18 +1967,25 @@ static void commit_planes_do_stream_update(struct dc *dc,
			}

			if (stream_update->abm_level && pipe_ctx->stream_res.abm) {
				if (pipe_ctx->stream_res.tg->funcs->is_blanked) {
				should_program_abm = true;

				// if otg funcs defined check if blanked before programming
					if (!pipe_ctx->stream_res.tg->funcs->is_blanked(pipe_ctx->stream_res.tg))
						pipe_ctx->stream_res.abm->funcs->set_abm_level(
							pipe_ctx->stream_res.abm, stream->abm_level);
				} else
				if (pipe_ctx->stream_res.tg->funcs->is_blanked)
					if (pipe_ctx->stream_res.tg->funcs->is_blanked(pipe_ctx->stream_res.tg))
						should_program_abm = false;

				if (should_program_abm) {
					if (*stream_update->abm_level == ABM_LEVEL_IMMEDIATE_DISABLE) {
						pipe_ctx->stream_res.abm->funcs->set_abm_immediate_disable(pipe_ctx->stream_res.abm);
					} else {
						pipe_ctx->stream_res.abm->funcs->set_abm_level(
							pipe_ctx->stream_res.abm, stream->abm_level);
					}
				}
			}
		}
	}
}

static void commit_planes_for_stream(struct dc *dc,
		struct dc_surface_update *srf_updates,
+0 −1
Original line number Diff line number Diff line
@@ -79,7 +79,6 @@ static void destruct(struct dc_link *link)
	int i;

	if (link->hpd_gpio != NULL) {
		dal_gpio_close(link->hpd_gpio);
		dal_gpio_destroy_irq(&link->hpd_gpio);
		link->hpd_gpio = NULL;
	}
+2 −4
Original line number Diff line number Diff line
@@ -117,13 +117,13 @@ struct dc_caps {
	struct dc_plane_cap planes[MAX_PLANES];
};

#if defined(CONFIG_DRM_AMD_DC_DCN2_0)
struct dc_bug_wa {
#if defined(CONFIG_DRM_AMD_DC_DCN2_0)
	bool no_connect_phy_config;
	bool dedcn20_305_wa;
#endif
	bool skip_clock_update;
};
#endif

struct dc_dcc_surface_param {
	struct dc_size surface_size;
@@ -463,9 +463,7 @@ struct dc {
	struct dc_config config;
	struct dc_debug_options debug;
	struct dc_bounding_box_overrides bb_overrides;
#if defined(CONFIG_DRM_AMD_DC_DCN2_0)
	struct dc_bug_wa work_arounds;
#endif
	struct dc_context *ctx;
#ifdef CONFIG_DRM_AMD_DC_DCN2_0
	struct dc_phy_addr_space_config vm_pa_config;
+2 −0
Original line number Diff line number Diff line
@@ -232,6 +232,8 @@ struct dc_stream_state {
	union stream_update_flags update_flags;
};

#define ABM_LEVEL_IMMEDIATE_DISABLE 0xFFFFFFFF

struct dc_stream_update {
	struct dc_stream_state *stream;

Loading