Skip to contentSkip to conversation

drm/amd/display: Fix __udivdi3 link error in DCN6 DML2

PATCH In review [email protected] 2 participants 2 messages Oct 28 – Nov 4

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amd/display: Fix __udivdi3 link error in DCN6 DML2

From: Ivan Lipski <[email protected]>

[Why&How] dchub_v2_get_sop_total_available_bandwidth_KBps() and dchub_v2_is_qos_bandwidth_supported_by_sop() divide 64-bit integers by 100. On 32-bit builds this emits a call to __udivdi3, which the kernel does not link.

Use double-cast division instead.

Fixes 04d9a88decbc ("drm/amd/display: Add new sources for DCN6")
Cc Linlin Yang <[email protected]>
Cc Mario Limonciello <[email protected]>
Cc Alex Deucher <[email protected]>
---
 .../bounding_boxes/utm_qos_model_dchub_v2.h   | 32 +++++++++----------
 .../bounding_boxes/utm_qos_model_dchub_v3.h   |  2 +-
 2 files changed, 17 insertions(+), 17 deletions(-)
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/inc/bounding_boxes/utm_qos_model_dchub_v2.h +16 -16
index ebca5ddda2848..32049c17c0802 100644
@@ -58,27 +58,27 @@ static inline void dchub_v2_get_sop_total_available_bandwidth_KBps(
 {
 	const struct utm_soc_operating_point *sop = &model->sops[sop_index];
 	const struct utm_qos_model_socbb *socbb = &model->socbb;
-	uint64_t dram_available_bandwidth_KBps_nominal;
-	uint64_t fabric_available_bandwidth_KBps_nominal;
-	uint64_t dram_available_bandwidth_KBps_urgent;
-	uint64_t fabric_available_bandwidth_KBps_urgent;
+	double dram_available_bandwidth_KBps_nominal;
+	double fabric_available_bandwidth_KBps_nominal;
+	double dram_available_bandwidth_KBps_urgent;
+	double fabric_available_bandwidth_KBps_urgent;
 
-	dram_available_bandwidth_KBps_nominal = (uint64_t) sop->uclk_khz
+	dram_available_bandwidth_KBps_nominal = (double) sop->uclk_khz
 			* socbb->dram_channel_count
 			* socbb->dram_channel_width_bytes
 			* socbb->dram_transactions_per_clock
-			* socbb->dram_derate_percent_nominal / 100;
-	dram_available_bandwidth_KBps_urgent = (uint64_t) sop->uclk_khz
+			* socbb->dram_derate_percent_nominal / 100.0;
+	dram_available_bandwidth_KBps_urgent = (double) sop->uclk_khz
 			* socbb->dram_channel_count
 			* socbb->dram_channel_width_bytes
 			* socbb->dram_transactions_per_clock
-			* socbb->dram_derate_percent_urgent / 100;
-	fabric_available_bandwidth_KBps_nominal = (uint64_t) sop->fclk_khz
+			* socbb->dram_derate_percent_urgent / 100.0;
+	fabric_available_bandwidth_KBps_nominal = (double) sop->fclk_khz
 			* socbb->fabric_datapath_to_dcn_data_return_bytes
-			* socbb->fabric_derate_percent_nominal / 100;
-	fabric_available_bandwidth_KBps_urgent = (uint64_t) sop->fclk_khz
+			* socbb->fabric_derate_percent_nominal / 100.0;
+	fabric_available_bandwidth_KBps_urgent = (double) sop->fclk_khz
 			* socbb->fabric_datapath_to_dcn_data_return_bytes
-			* socbb->fabric_derate_percent_urgent / 100;
+			* socbb->fabric_derate_percent_urgent / 100.0;
 
 	total_available_bandwidth->nominal_bandwidth_KBps =
 			dram_available_bandwidth_KBps_nominal < fabric_available_bandwidth_KBps_nominal ?
@@ -99,8 +99,8 @@ static inline bool dchub_v2_is_qos_bandwidth_supported_by_sop(
 {
 	struct utm_qos_model_dchub_memory_path_bandwidth_v2 available_bandwidth = {0};
 	const struct utm_qos_model_dchub_v2 *dchub = model->dchub_v2;
-	uint64_t nominal_available_bandwidth_KBps;
-	uint64_t urgent_available_bandwidth_KBps;
+	double nominal_available_bandwidth_KBps;
+	double urgent_available_bandwidth_KBps;
 
 	if (nominal_utm_budget_percent > dchub->max_nominal_utm_budget_percent ||
 			nominal_utm_budget_percent < dchub->min_nominal_utm_budget_percent ||
@@ -112,9 +112,9 @@ static inline bool dchub_v2_is_qos_bandwidth_supported_by_sop(
 	nominal_available_bandwidth_KBps = available_bandwidth.nominal_bandwidth_KBps;
 	urgent_available_bandwidth_KBps = available_bandwidth.urgent_bandwidth_KBps;
 
-	if ((nominal_available_bandwidth_KBps * nominal_utm_budget_percent / 100) < qos_bandwidth->nominal_bandwidth_KBps)
+	if ((nominal_available_bandwidth_KBps * nominal_utm_budget_percent / 100.0) < qos_bandwidth->nominal_bandwidth_KBps)
 		return false;
-	else if ((urgent_available_bandwidth_KBps * urgent_utm_budget_percent / 100) < qos_bandwidth->urgent_bandwidth_KBps)
+	else if ((urgent_available_bandwidth_KBps * urgent_utm_budget_percent / 100.0) < qos_bandwidth->urgent_bandwidth_KBps)
 		return false;
 	else
 		return true;
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/inc/bounding_boxes/utm_qos_model_dchub_v3.h +1 -1
index 9390cad316914..fef7b1dc3060b 100644
@@ -50,4 +50,4 @@ struct utm_qos_model_dchub_v3 {
 		sops[UTM_QOS_MODEL_V3_MAX_LOAD_LEVEL_COUNT][UTM_QOS_MODEL_V3_MAX_SOP_COUNT];
 };
 
-#endif /* #ifndef UTM_QOS_MODEL_DCHUB_V3_H */
\ No newline at end of file
+#endif /* #ifndef UTM_QOS_MODEL_DCHUB_V3_H */
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw

Some minor nitpick as below, but lgtm

Quoted 8 lines · On 10/28/26 09:11, [email protected] wrote:

From: Ivan Lipski <[email protected]>

[Why&How] dchub_v2_get_sop_total_available_bandwidth_KBps() and dchub_v2_is_qos_bandwidth_supported_by_sop() divide 64-bit integers by 100. On 32-bit builds this emits a call to __udivdi3, which the kernel does not link.

Quoted 4 lines

Use double-cast division instead.

Fixes 04d9a88decbc ("drm/amd/display: Add new sources for DCN6")

Please remove the new line.> Cc: Linlin Yang <[email protected]>

Quoted 4 lines
Cc Mario Limonciello <[email protected]>
Cc Alex Deucher <[email protected]>

Please remove the new line

Quoted 63 lines
---
  .../bounding_boxes/utm_qos_model_dchub_v2.h   | 32 +++++++++----------
  .../bounding_boxes/utm_qos_model_dchub_v3.h   |  2 +-
  2 files changed, 17 insertions(+), 17 deletions(-)
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/inc/bounding_boxes/utm_qos_model_dchub_v2.h +14 -14
index ebca5ddda2848..32049c17c0802 100644
@@ -58,27 +58,27 @@ static inline void dchub_v2_get_sop_total_available_bandwidth_KBps(
  {
  	const struct utm_soc_operating_point *sop = &model->sops[sop_index];
  	const struct utm_qos_model_socbb *socbb = &model->socbb;
-	uint64_t dram_available_bandwidth_KBps_nominal;
-	uint64_t fabric_available_bandwidth_KBps_nominal;
-	uint64_t dram_available_bandwidth_KBps_urgent;
-	uint64_t fabric_available_bandwidth_KBps_urgent;
+	double dram_available_bandwidth_KBps_nominal;
+	double fabric_available_bandwidth_KBps_nominal;
+	double dram_available_bandwidth_KBps_urgent;
+	double fabric_available_bandwidth_KBps_urgent;
 
-	dram_available_bandwidth_KBps_nominal = (uint64_t) sop->uclk_khz
+	dram_available_bandwidth_KBps_nominal = (double) sop->uclk_khz
  			* socbb->dram_channel_count
  			* socbb->dram_channel_width_bytes
  			* socbb->dram_transactions_per_clock
-			* socbb->dram_derate_percent_nominal / 100;
-	dram_available_bandwidth_KBps_urgent = (uint64_t) sop->uclk_khz
+			* socbb->dram_derate_percent_nominal / 100.0;
+	dram_available_bandwidth_KBps_urgent = (double) sop->uclk_khz
  			* socbb->dram_channel_count
  			* socbb->dram_channel_width_bytes
  			* socbb->dram_transactions_per_clock
-			* socbb->dram_derate_percent_urgent / 100;
-	fabric_available_bandwidth_KBps_nominal = (uint64_t) sop->fclk_khz
+			* socbb->dram_derate_percent_urgent / 100.0;
+	fabric_available_bandwidth_KBps_nominal = (double) sop->fclk_khz
  			* socbb->fabric_datapath_to_dcn_data_return_bytes
-			* socbb->fabric_derate_percent_nominal / 100;
-	fabric_available_bandwidth_KBps_urgent = (uint64_t) sop->fclk_khz
+			* socbb->fabric_derate_percent_nominal / 100.0;
+	fabric_available_bandwidth_KBps_urgent = (double) sop->fclk_khz
  			* socbb->fabric_datapath_to_dcn_data_return_bytes
-			* socbb->fabric_derate_percent_urgent / 100;
+			* socbb->fabric_derate_percent_urgent / 100.0;
 
  	total_available_bandwidth->nominal_bandwidth_KBps =
  			dram_available_bandwidth_KBps_nominal < fabric_available_bandwidth_KBps_nominal ?
@@ -99,8 +99,8 @@ static inline bool dchub_v2_is_qos_bandwidth_supported_by_sop(
  {
  	struct utm_qos_model_dchub_memory_path_bandwidth_v2 available_bandwidth = {0};
  	const struct utm_qos_model_dchub_v2 *dchub = model->dchub_v2;
-	uint64_t nominal_available_bandwidth_KBps;
-	uint64_t urgent_available_bandwidth_KBps;
+	double nominal_available_bandwidth_KBps;
+	double urgent_available_bandwidth_KBps;
 
  	if (nominal_utm_budget_percent > dchub->max_nominal_utm_budget_percent ||
  			nominal_utm_budget_percent < dchub->min_nominal_utm_budget_percent ||

drivers/gpu/drm/amd/display/dc/dml2_0/dml21/inc/bounding_boxes/utm_qos_model_dchub_v2.h static inline bool dchub_v2_is_qos_bandwidth_supported_by_sop( · line 117

Quoted 8 lines
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/inc/bounding_boxes/utm_qos_model_dchub_v2.h +2 -2
@@ -112,9 +112,9 @@ static inline bool dchub_v2_is_qos_bandwidth_supported_by_sop(
  	nominal_available_bandwidth_KBps = available_bandwidth.nominal_bandwidth_KBps;
  	urgent_available_bandwidth_KBps = available_bandwidth.urgent_bandwidth_KBps;
 
-	if ((nominal_available_bandwidth_KBps * nominal_utm_budget_percent / 100) < qos_bandwidth->nominal_bandwidth_KBps)
+	if ((nominal_available_bandwidth_KBps * nominal_utm_budget_percent / 100.0) < qos_bandwidth->nominal_bandwidth_KBps)
  		return false;
-	else if ((urgent_available_bandwidth_KBps * urgent_utm_budget_percent / 100) < qos_bandwidth->urgent_bandwidth_KBps)
+	else if ((urgent_available_bandwidth_KBps * urgent_utm_budget_percent / 100.0) < qos_bandwidth->urgent_bandwidth_KBps)

The changes from 100 to 100.0 aren't neceesary, but it doesn't hurt.

Quoted 14 lines
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/inc/bounding_boxes/utm_qos_model_dchub_v2.h +0 -0
  		return false;
  	else
  		return true;
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/inc/bounding_boxes/utm_qos_model_dchub_v3.h +1 -1
index 9390cad316914..fef7b1dc3060b 100644
@@ -50,4 +50,4 @@ struct utm_qos_model_dchub_v3 {
  		sops[UTM_QOS_MODEL_V3_MAX_LOAD_LEVEL_COUNT][UTM_QOS_MODEL_V3_MAX_SOP_COUNT];
  };
 
-#endif /* #ifndef UTM_QOS_MODEL_DCHUB_V3_H */
\ No newline at end of file
+#endif /* #ifndef UTM_QOS_MODEL_DCHUB_V3_H */