[PATCH 23/76] drm/amd/dal: remove dal_adapter_service_get_integrated_info

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Tony Cheng <tony.cheng@xxxxxxx>

- cache integrated_info in bios.
- fix dGPU crash as dGPU does not have integrated_info

Signed-off-by: Tony Cheng <tony.cheng at amd.com>
Acked-by: Harry Wentland <harry.wentland at amd.com>
---
 .../gpu/drm/amd/dal/dc/adapter/adapter_service.c   | 32 ++++------------------
 drivers/gpu/drm/amd/dal/dc/bios/bios_parser.c      | 24 ++++------------
 drivers/gpu/drm/amd/dal/dc/core/dc_link.c          |  6 ++--
 drivers/gpu/drm/amd/dal/dc/dc_bios_types.h         |  7 -----
 .../amd/dal/dc/gpu/dce110/display_clock_dce110.c   |  6 ++--
 .../drm/amd/dal/dc/gpu/dce80/display_clock_dce80.c |  3 +-
 .../amd/dal/include/adapter_service_interface.h    |  7 -----
 7 files changed, 19 insertions(+), 66 deletions(-)

diff --git a/drivers/gpu/drm/amd/dal/dc/adapter/adapter_service.c b/drivers/gpu/drm/amd/dal/dc/adapter/adapter_service.c
index 328cc8a41770..f2e633e3ab74 100644
--- a/drivers/gpu/drm/amd/dal/dc/adapter/adapter_service.c
+++ b/drivers/gpu/drm/amd/dal/dc/adapter/adapter_service.c
@@ -599,8 +599,6 @@ static void adapter_service_destruct(
 
 	dal_i2caux_destroy(&as->i2caux);
 	dal_asic_capability_destroy(&as->asic_cap);
-
-	dcb->funcs->destroy_integrated_info(dcb, &as->integrated_info);
 }
 
 /*
@@ -669,10 +667,6 @@ static bool adapter_service_construct(
 		goto failed_to_create_i2caux;
 	}
 
-	/* Integrated info is not provided on discrete ASIC. NULL is allowed */
-	if (dcb->funcs->create_integrated_info)
-		as->integrated_info = dcb->funcs->create_integrated_info(dcb);
-
 	dcb->funcs->post_init(dcb, as);
 
 	/* Generate backlight translation table and initializes
@@ -881,23 +875,6 @@ bool dal_adapter_service_get_ss_info(
 }
 
 /*
- * dal_adapter_service_get_integrated_info
- *
- * Get integrated information on BIOS
- */
-bool dal_adapter_service_get_integrated_info(
-	struct adapter_service *as,
-	struct integrated_info *info)
-{
-	if (info == NULL || as->integrated_info == NULL)
-		return false;
-
-	memmove(info, as->integrated_info, sizeof(struct integrated_info));
-
-	return true;
-}
-
-/*
  * dal_adapter_service_is_dfs_bypass_enabled
  *
  * Check if DFS bypass is enabled
@@ -905,9 +882,11 @@ bool dal_adapter_service_get_integrated_info(
 bool dal_adapter_service_is_dfs_bypass_enabled(
 	struct adapter_service *as)
 {
-	if (as->integrated_info == NULL)
+	struct dc_bios *bp = as->ctx->dc_bios;
+
+	if (bp->integrated_info == NULL)
 		return false;
-	if ((as->integrated_info->gpu_cap_info & DFS_BYPASS_ENABLE) &&
+	if ((bp->integrated_info->gpu_cap_info & DFS_BYPASS_ENABLE) &&
 	    dal_adapter_service_is_feature_supported(as,
 			FEATURE_ENABLE_DFS_BYPASS))
 		return true;
@@ -1031,6 +1010,7 @@ bool dal_adapter_service_should_optimize(
 {
 	uint32_t supported_optimization = 0;
 	struct dal_asic_runtime_flags flags;
+	struct dc_bios *bp = as->ctx->dc_bios;
 
 	if (!dal_adapter_service_get_feature_value(as, FEATURE_OPTIMIZATION,
 			&supported_optimization, sizeof(uint32_t)))
@@ -1047,7 +1027,7 @@ bool dal_adapter_service_should_optimize(
 		break;
 
 	case OF_SKIP_RESET_OF_ALL_HW_ON_S3RESUME:
-		if (as->integrated_info == NULL ||
+		if (bp->integrated_info == NULL ||
 				!flags.flags.bits.SKIP_POWER_DOWN_ON_RESUME)
 			return false;
 		break;
diff --git a/drivers/gpu/drm/amd/dal/dc/bios/bios_parser.c b/drivers/gpu/drm/amd/dal/dc/bios/bios_parser.c
index eae92f53694f..41093c21ce30 100644
--- a/drivers/gpu/drm/amd/dal/dc/bios/bios_parser.c
+++ b/drivers/gpu/drm/amd/dal/dc/bios/bios_parser.c
@@ -135,6 +135,9 @@ static void destruct(struct bios_parser *bp)
 {
 	if (bp->base.bios_local_image)
 		dm_free(bp->base.bios_local_image);
+
+	if (bp->base.integrated_info)
+		dm_free(bp->base.integrated_info);
 }
 
 static void bios_parser_destroy(struct dc_bios **dcb)
@@ -4063,21 +4066,6 @@ static struct integrated_info *bios_parser_create_integrated_info(
 	return NULL;
 }
 
-static void bios_parser_destroy_integrated_info(
-	struct dc_bios *dcb,
-	struct integrated_info **info)
-{
-	if (info == NULL) {
-		ASSERT_CRITICAL(0);
-		return;
-	}
-
-	if (*info != NULL) {
-		dm_free(*info);
-		*info = NULL;
-	}
-}
-
 /******************************************************************************/
 
 static const struct dc_vbios_funcs vbios_funcs = {
@@ -4156,10 +4144,6 @@ static const struct dc_vbios_funcs vbios_funcs = {
 	/* SW init and patch */
 	.post_init = bios_parser_post_init,  /* patch vbios table for mxm module by reading i2c */
 
-	.create_integrated_info = bios_parser_create_integrated_info,
-
-	.destroy_integrated_info = bios_parser_destroy_integrated_info,
-
 	.bios_parser_destroy = bios_parser_destroy,
 };
 
@@ -4241,6 +4225,8 @@ static bool bios_parser_construct(
 	dal_bios_parser_init_cmd_tbl(bp);
 	dal_bios_parser_init_cmd_tbl_helper(&bp->cmd_helper, dce_version);
 
+	bp->base.integrated_info = bios_parser_create_integrated_info(&bp->base);
+
 	return true;
 }
 
diff --git a/drivers/gpu/drm/amd/dal/dc/core/dc_link.c b/drivers/gpu/drm/amd/dal/dc/core/dc_link.c
index d86817606f39..1eb1089a8288 100644
--- a/drivers/gpu/drm/amd/dal/dc/core/dc_link.c
+++ b/drivers/gpu/drm/amd/dal/dc/core/dc_link.c
@@ -1050,9 +1050,6 @@ static bool construct(
 
 	link->public.link_enc_hw_inst = link->link_enc->transmitter;
 
-	/* TODO: refactor dal_adapter_service_get_integrated_info(as, &info); */
-	memmove(&info, dc_ctx->dc_bios->integrated_info, sizeof(struct integrated_info));
-
 	for (i = 0; ; i++) {
 		if (BP_RESULT_OK !=
 				bp_funcs->get_device_tag(dc_ctx->dc_bios, link->link_id, i, &link->device_tag)) {
@@ -1077,6 +1074,9 @@ static bool construct(
 		break;
 	}
 
+	if (bios->integrated_info)
+		info = *bios->integrated_info;
+
 	/* Look for channel mapping corresponding to connector and device tag */
 	for (i = 0; i < MAX_NUMBER_OF_EXT_DISPLAY_PATH; i++) {
 		struct external_display_path *path =
diff --git a/drivers/gpu/drm/amd/dal/dc/dc_bios_types.h b/drivers/gpu/drm/amd/dal/dc/dc_bios_types.h
index 7c1f9d817f9c..4771e415e33e 100644
--- a/drivers/gpu/drm/amd/dal/dc/dc_bios_types.h
+++ b/drivers/gpu/drm/amd/dal/dc/dc_bios_types.h
@@ -202,13 +202,6 @@ struct dc_vbios_funcs {
 	void (*post_init)(struct dc_bios *bios,
 			  struct adapter_service *as);
 
-	struct integrated_info *(*create_integrated_info)(
-		struct dc_bios *bios);
-
-	void (*destroy_integrated_info)(
-		struct dc_bios *dcb,
-		struct integrated_info **info);
-
 	void (*bios_parser_destroy)(struct dc_bios **dcb);
 };
 
diff --git a/drivers/gpu/drm/amd/dal/dc/gpu/dce110/display_clock_dce110.c b/drivers/gpu/drm/amd/dal/dc/gpu/dce110/display_clock_dce110.c
index 8b9d984f3bb9..9aa9b8fc927f 100644
--- a/drivers/gpu/drm/amd/dal/dc/gpu/dce110/display_clock_dce110.c
+++ b/drivers/gpu/drm/amd/dal/dc/gpu/dce110/display_clock_dce110.c
@@ -675,12 +675,12 @@ static bool display_clock_integrated_info_construct(
 	struct firmware_info fw_info;
 	uint32_t i;
 	struct display_clock *base = &disp_clk->disp_clk_base;
-	bool res;
 
 	memset(&info, 0, sizeof(struct integrated_info));
 	memset(&fw_info, 0, sizeof(struct firmware_info));
 
-	res = dal_adapter_service_get_integrated_info(as, &info);
+	if (bp->integrated_info)
+		info = *bp->integrated_info;
 
 	disp_clk->dentist_vco_freq_khz = info.dentist_vco_freq;
 	if (disp_clk->dentist_vco_freq_khz == 0) {
@@ -694,7 +694,7 @@ static bool display_clock_integrated_info_construct(
 	base->min_display_clk_threshold_khz =
 		disp_clk->dentist_vco_freq_khz / 64;
 
-	if (!res)
+	if (bp->integrated_info == NULL)
 		return false;
 
 	/*update the maximum display clock for each power state*/
diff --git a/drivers/gpu/drm/amd/dal/dc/gpu/dce80/display_clock_dce80.c b/drivers/gpu/drm/amd/dal/dc/gpu/dce80/display_clock_dce80.c
index b69e40493e27..0741139db8b5 100644
--- a/drivers/gpu/drm/amd/dal/dc/gpu/dce80/display_clock_dce80.c
+++ b/drivers/gpu/drm/amd/dal/dc/gpu/dce80/display_clock_dce80.c
@@ -758,7 +758,8 @@ static bool display_clock_integrated_info_construct(
 	struct firmware_info fw_info = { { 0 } };
 	uint32_t i;
 
-	dal_adapter_service_get_integrated_info(as, &info);
+	if (bp->integrated_info)
+		info = *bp->integrated_info;
 
 	disp_clk->dentist_vco_freq_khz = info.dentist_vco_freq;
 	if (disp_clk->dentist_vco_freq_khz == 0) {
diff --git a/drivers/gpu/drm/amd/dal/include/adapter_service_interface.h b/drivers/gpu/drm/amd/dal/include/adapter_service_interface.h
index 9de495532eb1..7b001f0aa9db 100644
--- a/drivers/gpu/drm/amd/dal/include/adapter_service_interface.h
+++ b/drivers/gpu/drm/amd/dal/include/adapter_service_interface.h
@@ -298,7 +298,6 @@ struct adapter_service {
 	struct asic_capability *asic_cap;
 	enum dce_environment dce_environment;
 	struct i2caux *i2caux;
-	struct integrated_info *integrated_info;
 	uint32_t platform_methods_mask;
 	uint32_t ac_level_percentage;
 	uint32_t dc_level_percentage;
@@ -356,12 +355,6 @@ bool dal_adapter_service_is_dfs_bypass_enabled(struct adapter_service *as);
 uint32_t dal_adapter_service_get_asic_vram_bit_width(
 	struct adapter_service *as);
 
-
-/* Get integrated information on BIOS */
-bool dal_adapter_service_get_integrated_info(
-	struct adapter_service *as,
-	struct integrated_info *info);
-
 /* Return if a given feature is supported by the ASIC */
 bool dal_adapter_service_is_feature_supported(struct adapter_service *as,
 	enum adapter_feature_id feature_id);
-- 
2.10.1



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux