Skip to contentSkip to conversation

drm/amd/pp: Implement get_max_high_clocks for CI/VI

PATCH In review Rex Zhu 2 participants 3 messages Jan 4, 2018 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Rex Zhu

author
#0 lore raw

PATCH v2 1/1 drm/amd/pp: Implement get_max_high_clocks for CI/VI

v2: add table length check.

DC component expect PP to give max engine clock and memory clock through pp_get_display_mode_validation_clocks on DGPU as well.

This patch can fix MultiGPU-Display blank
out with 1 IGPU-4k display and 2 DGPU-two 4K
displays.

Change-Id I20454060ebe01955c5653de037dd8c09a576026a
---
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +21 -0
index 444cc35..f4ada46 100644
@@ -4667,6 +4667,26 @@ static int smu7_notify_cac_buffer_info(struct pp_hwmgr *hwmgr,
 	return 0;
 }
 
+static int smu7_get_max_high_clocks(struct pp_hwmgr *hwmgr,
+					struct amd_pp_simple_clock_info *clocks)
+{
+	struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);
+	struct smu7_single_dpm_table *sclk_table = &(data->dpm_table.sclk_table);
+	struct smu7_single_dpm_table *mclk_table = &(data->dpm_table.mclk_table);
+
+	if (clocks == NULL)
+		return -EINVAL;
+
+	clocks->memory_max_clock = mclk_table->count > 1 ?
+				mclk_table->dpm_levels[mclk_table->count-1].value :
+				mclk_table->dpm_levels[0].value;
+	clocks->engine_max_clock = sclk_table->count > 1 ?
+				sclk_table->dpm_levels[sclk_table->count-1].value :
+				sclk_table->dpm_levels[0].value;
+
+	return 0;
+}
+
 static const struct pp_hwmgr_func smu7_hwmgr_funcs = {
 	.backend_init = &smu7_hwmgr_backend_init,
 	.backend_fini = &smu7_hwmgr_backend_fini,
@@ -4719,6 +4739,7 @@ static int smu7_notify_cac_buffer_info(struct pp_hwmgr *hwmgr,
 	.disable_smc_firmware_ctf = smu7_thermal_disable_alert,
 	.start_thermal_controller = smu7_start_thermal_controller,
 	.notify_cac_buffer_info = smu7_notify_cac_buffer_info,
+	.get_max_high_clocks = smu7_get_max_high_clocks,
 };
 
 uint8_t smu7_get_sleep_divider_id_from_clock(uint32_t clock,
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1515045702-18881-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#2 lore raw
Quoted 22 lines · Rex Zhu

v2: add table length check.

DC component expect PP to give max engine clock and memory clock through pp_get_display_mode_validation_clocks on DGPU as well.

This patch can fix MultiGPU-Display blank
out with 1 IGPU-4k display and 2 DGPU-two 4K
displays.

Change-Id I20454060ebe01955c5653de037dd8c09a576026a
---
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -0
index 444cc35..f4ada46 100644
@@ -4667,6 +4667,26 @@ static int smu7_notify_cac_buffer_info(struct pp_hwmgr *hwmgr,
        return 0;

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c static int smu7_notify_cac_buffer_info(struct pp_hwmgr *hwmgr, · line 4677

Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +8 -0
 }
 
+static int smu7_get_max_high_clocks(struct pp_hwmgr *hwmgr,
+                                       struct amd_pp_simple_clock_info *clocks)
+{
+       struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);
+       struct smu7_single_dpm_table *sclk_table = &(data->dpm_table.sclk_table);
+       struct smu7_single_dpm_table *mclk_table = &(data->dpm_table.mclk_table);
+
+       if (clocks == NULL)

Is it possible that data or sclk or mclk table could be null here? With that addressed:

Looks like vega10 is also missing this callback.

Alex

Quoted 26 lines
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +13 -1
+               return -EINVAL;
+
+       clocks->memory_max_clock = mclk_table->count > 1 ?
+                               mclk_table->dpm_levels[mclk_table->count-1].value :
+                               mclk_table->dpm_levels[0].value;
+       clocks->engine_max_clock = sclk_table->count > 1 ?
+                               sclk_table->dpm_levels[sclk_table->count-1].value :
+                               sclk_table->dpm_levels[0].value;
+
+       return 0;
+}
+
 static const struct pp_hwmgr_func smu7_hwmgr_funcs = {
        .backend_init = &smu7_hwmgr_backend_init,
        .backend_fini = &smu7_hwmgr_backend_fini,
@@ -4719,6 +4739,7 @@ static int smu7_notify_cac_buffer_info(struct pp_hwmgr *hwmgr,
        .disable_smc_firmware_ctf = smu7_thermal_disable_alert,
        .start_thermal_controller = smu7_start_thermal_controller,
        .notify_cac_buffer_info = smu7_notify_cac_buffer_info,
+       .get_max_high_clocks = smu7_get_max_high_clocks,
 };
 
 uint8_t smu7_get_sleep_divider_id_from_clock(uint32_t clock,
--

1.9.1

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): CADnq5_OA+iN=3j0_TOPSiso+GnFJTAC18sAXHHiB=LKCA7oYHA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

author Reviewed-by Alex Deucher
#4 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line

Is it possible that data or sclk or mclk table could be null here?

Only in one case: dpm was disabled. And hw backend not allocated. But in dpm disabled case, this function can't be called. all PP exported functions will return error immediately.

Best Regards
Rex

-----Original Message-----
From: Alex Deucher [mailto:[email protected]]
Sent: Thursday, January 04, 2018 2:58 PM
To: Zhu, Rex
Cc: amd-gfx list
Subject: Re: [PATCH v2] drm/amd/pp: Implement get_max_high_clocks for CI/VI

Quoted 24 lines · Rex Zhu

v2: add table length check.

DC component expect PP to give max engine clock and memory clock through pp_get_display_mode_validation_clocks
on DGPU as well.

This patch can fix MultiGPU-Display blank out with 1 IGPU-4k display and 2 DGPU-two 4K displays.

Change-Id I20454060ebe01955c5653de037dd8c09a576026a
---
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 21 
+++++++++++++++++++++
 1 file changed, 21 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +0 -0
index 444cc35..f4ada46 100644
@@ -4667,6 +4667,26 @@ static int smu7_notify_cac_buffer_info(struct pp_hwmgr *hwmgr,
        return 0;
 }

drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c static int smu7_notify_cac_buffer_info(struct pp_hwmgr *hwmgr, · line 4678

Quoted 10 lines
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +9 -0
 
+static int smu7_get_max_high_clocks(struct pp_hwmgr *hwmgr,
+                                       struct 
+amd_pp_simple_clock_info *clocks) {
+       struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);
+       struct smu7_single_dpm_table *sclk_table = &(data->dpm_table.sclk_table);
+       struct smu7_single_dpm_table *mclk_table = 
+&(data->dpm_table.mclk_table);
+
+       if (clocks == NULL)

Is it possible that data or sclk or mclk table could be null here? With that addressed:

Looks like vega10 is also missing this callback.

Alex

Quoted 22 lines
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +12 -0
+               return -EINVAL;
+
+       clocks->memory_max_clock = mclk_table->count > 1 ?
+                               mclk_table->dpm_levels[mclk_table->count-1].value :
+                               mclk_table->dpm_levels[0].value;
+       clocks->engine_max_clock = sclk_table->count > 1 ?
+                               sclk_table->dpm_levels[sclk_table->count-1].value :
+                               sclk_table->dpm_levels[0].value;
+
+       return 0;
+}
+
 static const struct pp_hwmgr_func smu7_hwmgr_funcs = {
        .backend_init = &smu7_hwmgr_backend_init,
        .backend_fini = &smu7_hwmgr_backend_fini, @@ -4719,6 +4739,7 

@@ static int smu7_notify_cac_buffer_info(struct pp_hwmgr *hwmgr,
.disable_smc_firmware_ctf = smu7_thermal_disable_alert, .start_thermal_controller = smu7_start_thermal_controller, .notify_cac_buffer_info = smu7_notify_cac_buffer_info,
+ .get_max_high_clocks = smu7_get_max_high_clocks,
};

Quoted 8 lines

uint8_t smu7_get_sleep_divider_id_from_clock(uint32_t clock,
--
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx