Skip to contentSkip to conversation

Fix compilation issues when using i386

PATCH In review Rodrigo Siqueira 3 participants 7 messages Jun 30, 2022

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

cover Fix compilation issues when using i386

Fix compilation issues when using i386

We recently got feedback from Randy about issues in the x86-32 compilation.I was able to reproduce a very similar issue by using:

- gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
- make -j16 ARCH=i386
- amd-staging-drm-next

I'm able to see these issues:

ERROR: modpost: "__nedf2" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] undefined!
ERROR: modpost: "__muldf3" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] undefined!
ERROR: modpost: "__floatunsidf" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] undefined!
ERROR: modpost: "__umoddi3" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] undefined!

This patchset addresses each compilation issue in its own patch since I want to have an easy way to bisect display code in case of regressions. Please, let me know if you see any issue with these changes and if it fixes the 32-bit compilation. If you still see compilation issues, please, report:

- GCC version
- Config file
- Branch

Thanks
Siqueira

Rodrigo Siqueira (4):
drm/amd/display: Fix __umoddi3 undefined for 32 bit compilation drm/amd/display: Fix __floatunsidf undefined for 32 bit compilation drm/amd/display: Fix __muldf3 undefined for 32 bit compilation drm/amd/display: Fix __nedf2 undefined for 32 bit compilation

 .../amd/display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c  | 15 +++++++++------
 .../gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c    |  4 +++-
 drivers/gpu/drm/amd/display/dc/inc/hw/clk_mgr.h   |  2 +-
 3 files changed, 13 insertions(+), 8 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/4 drm/amd/display: Fix __umoddi3 undefined for 32 bit compilation

While we tried to build amdgpu on i386, we got this error:

ERROR: modpost: "__umoddi3" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] undefined!

This commit fixes this issue by replacing the standard module operator with div_u64_rem.

Cc Aurabindo Pillai <[email protected]>
Cc Harry Wentland <[email protected]>
Cc Alex Deucher <[email protected]>
Cc Randy Dunlap <[email protected]>
Fixes 9b0e0d433f74 ("drm/amd/display: Add dependant changes for DCN32/321")
---
 drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c +3 -1
index a10ec5919194..790aa2b3952c 100644
@@ -208,12 +208,14 @@ static uint32_t dcn32_cache_lines_for_surface(struct dc *dc, uint32_t surface_si
 	uint32_t num_cached_bytes = 0;
 	uint32_t remaining_size = 0;
 	uint32_t cache_line_size = dc->caps.cache_line_size;
+	uint32_t remainder = 0;
 
 	/* 1. Calculate surface size minus the number of bytes stored
 	 * in the first cache line (all bytes in first cache line might
 	 * not be fully used).
 	 */
-	num_cached_bytes = cache_line_size - (start_address % cache_line_size);
+	div_u64_rem(start_address, cache_line_size, &remainder);
+	num_cached_bytes = cache_line_size - remainder;
 	remaining_size = surface_size - num_cached_bytes;
 
 	/* 2. Calculate number of cache lines that will be fully used with
Signature · 1 line
2.25.1
#2 lore raw

PATCH 2/4 drm/amd/display: Fix __floatunsidf undefined for 32 bit compilation

In reply to Rodrigo Siqueira

When we tried to compile DCN32/321 for 32-bit architecture, we got this error message:

ERROR: modpost: "__floatunsidf" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] undefined!

This was caused because we were trying to assign an unsigned int to a double value which causes issues for 32-bit architecture. This issue can be fixed by changing the value type.

Cc Aurabindo Pillai <[email protected]>
Cc Harry Wentland <[email protected]>
Cc Alex Deucher <[email protected]>
Cc Randy Dunlap <[email protected]>
Fixes 9b79abf79c414 ("drm/amd/display: add CLKMGR changes for DCN32/321")
---
 drivers/gpu/drm/amd/display/dc/inc/hw/clk_mgr.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/inc/hw/clk_mgr.h +1 -1
index 9ae9439c8f7b..5d2b028e5dad 100644
@@ -208,7 +208,7 @@ struct wm_table {
 
 struct dummy_pstate_entry {
 	unsigned int dram_speed_mts;
-	unsigned int dummy_pstate_latency_us;
+	double dummy_pstate_latency_us;
 };
 
 struct clk_bw_params {
Signature · 1 line
2.25.1
#3 lore raw

PATCH 3/4 drm/amd/display: Fix __muldf3 undefined for 32 bit compilation

In reply to Rodrigo Siqueira

Sometimes when trying to enable some feature, we have to define some values with educated guesses, but we mark those values as TBD, which means "To Be Determined". However, the correct way to approach it is by loading that information from the firmware. Anyway, some of the values that we were experimenting with caused this issue:

ERROR: modpost: "__muldf3" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] undefined!

This commit fixes this issue by removing the division by two since it is harmless in this case.

Cc Aurabindo Pillai <[email protected]>
Cc Harry Wentland <[email protected]>
Cc Alex Deucher <[email protected]>
Cc Randy Dunlap <[email protected]>
Fixes 9b79abf79c414 ("drm/amd/display: add CLKMGR changes for DCN32/321")
---
 drivers/gpu/drm/amd/display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c +2 -2
index 4e8059f20007..b49a4e34d39b 100644
@@ -213,8 +213,8 @@ static void dcn32_build_wm_range_table(struct clk_mgr_internal *clk_mgr)
 	clk_mgr->base.bw_params->wm_table.nv_entries[WM_D].valid = true;
 	clk_mgr->base.bw_params->wm_table.nv_entries[WM_D].dml_input.pstate_latency_us = clk_mgr->base.bw_params->dummy_pstate_table[3].dummy_pstate_latency_us;
 	clk_mgr->base.bw_params->wm_table.nv_entries[WM_D].dml_input.fclk_change_latency_us = fclk_change_latency_us;
-	clk_mgr->base.bw_params->wm_table.nv_entries[WM_D].dml_input.sr_exit_time_us = sr_exit_time_us / 2; // TBD
-	clk_mgr->base.bw_params->wm_table.nv_entries[WM_D].dml_input.sr_enter_plus_exit_time_us = sr_enter_plus_exit_time_us / 2; // TBD
+	clk_mgr->base.bw_params->wm_table.nv_entries[WM_D].dml_input.sr_exit_time_us = sr_exit_time_us; // TBD
+	clk_mgr->base.bw_params->wm_table.nv_entries[WM_D].dml_input.sr_enter_plus_exit_time_us = sr_enter_plus_exit_time_us; // TBD
 	clk_mgr->base.bw_params->wm_table.nv_entries[WM_D].pmfw_breakdown.wm_type = WATERMARKS_MALL;
 	clk_mgr->base.bw_params->wm_table.nv_entries[WM_D].pmfw_breakdown.min_dcfclk = min_dcfclk_mhz;
 	clk_mgr->base.bw_params->wm_table.nv_entries[WM_D].pmfw_breakdown.max_dcfclk = 0xFFFF;
Signature · 1 line
2.25.1
#4 lore raw

PATCH 4/4 drm/amd/display: Fix __nedf2 undefined for 32 bit compilation

In reply to Rodrigo Siqueira

When we tried to compile DCN32/321 for 32-bit architecture, we got this error message:

ERROR: modpost: "__nedf2" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] undefined!

This commit fixes this issue by rewriting a small part of the dcn32_build_wm_range_table.

Cc Aurabindo Pillai <[email protected]>
Cc Harry Wentland <[email protected]>
Cc Alex Deucher <[email protected]>
Cc Randy Dunlap <[email protected]>
Fixes 9b79abf79c414 ("drm/amd/display: add CLKMGR changes for DCN32/321")
---
 .../drm/amd/display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c  | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c +7 -4
index b49a4e34d39b..1edb5aab8990 100644
@@ -155,10 +155,14 @@ static void dcn32_build_wm_range_table(struct clk_mgr_internal *clk_mgr)
 	uint16_t min_uclk_mhz			= clk_mgr->base.bw_params->clk_table.entries[0].memclk_mhz;
 	uint16_t min_dcfclk_mhz			= clk_mgr->base.bw_params->clk_table.entries[0].dcfclk_mhz;
 	uint16_t setb_min_uclk_mhz		= min_uclk_mhz;
-	uint16_t setb_min_dcfclk_mhz	= min_dcfclk_mhz;
+	uint16_t dcfclk_mhz_for_the_second_state = clk_mgr->base.ctx->dc->dml.soc.clock_limits[2].dcfclk_mhz;
+
 	/* For Set B ranges use min clocks state 2 when available, and report those to PM FW */
-	if (clk_mgr->base.ctx->dc->dml.soc.clock_limits[2].dcfclk_mhz)
-		setb_min_dcfclk_mhz = clk_mgr->base.ctx->dc->dml.soc.clock_limits[2].dcfclk_mhz;
+	if (dcfclk_mhz_for_the_second_state)
+		clk_mgr->base.bw_params->wm_table.nv_entries[WM_B].pmfw_breakdown.min_dcfclk = dcfclk_mhz_for_the_second_state;
+	else
+		clk_mgr->base.bw_params->wm_table.nv_entries[WM_B].pmfw_breakdown.min_dcfclk = clk_mgr->base.bw_params->clk_table.entries[0].dcfclk_mhz;
+
 	if (clk_mgr->base.bw_params->clk_table.entries[2].memclk_mhz)
 		setb_min_uclk_mhz = clk_mgr->base.bw_params->clk_table.entries[2].memclk_mhz;
 
@@ -181,7 +185,6 @@ static void dcn32_build_wm_range_table(struct clk_mgr_internal *clk_mgr)
 	clk_mgr->base.bw_params->wm_table.nv_entries[WM_B].dml_input.sr_exit_time_us = sr_exit_time_us;
 	clk_mgr->base.bw_params->wm_table.nv_entries[WM_B].dml_input.sr_enter_plus_exit_time_us = sr_enter_plus_exit_time_us;
 	clk_mgr->base.bw_params->wm_table.nv_entries[WM_B].pmfw_breakdown.wm_type = WATERMARKS_CLOCK_RANGE;
-	clk_mgr->base.bw_params->wm_table.nv_entries[WM_B].pmfw_breakdown.min_dcfclk = setb_min_dcfclk_mhz;
 	clk_mgr->base.bw_params->wm_table.nv_entries[WM_B].pmfw_breakdown.max_dcfclk = 0xFFFF;
 	clk_mgr->base.bw_params->wm_table.nv_entries[WM_B].pmfw_breakdown.min_uclk = setb_min_uclk_mhz;
 	clk_mgr->base.bw_params->wm_table.nv_entries[WM_B].pmfw_breakdown.max_uclk = 0xFFFF;
Signature · 1 line
2.25.1
Reviewed-by on the v1 series
#5 lore raw
In reply to Rodrigo Siqueira
Quoted 27 lines · Rodrigo Siqueira

Fix compilation issues when using i386

We recently got feedback from Randy about issues in the x86-32 compilation.I was able to reproduce a very similar issue by using:

- gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
- make -j16 ARCH=i386
- amd-staging-drm-next

I'm able to see these issues:

ERROR: modpost: "__nedf2" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] undefined!
ERROR: modpost: "__muldf3" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] undefined!
ERROR: modpost: "__floatunsidf" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] undefined!
ERROR: modpost: "__umoddi3" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] undefined!

This patchset addresses each compilation issue in its own patch since I want to have an easy way to bisect display code in case of regressions. Please, let me know if you see any issue with these changes and if it fixes the 32-bit compilation. If you still see compilation issues, please, report:

- GCC version
- Config file
- Branch

Quoted 8 lines

Thanks
Siqueira

Rodrigo Siqueira (4):
drm/amd/display: Fix __umoddi3 undefined for 32 bit compilation drm/amd/display: Fix __floatunsidf undefined for 32 bit compilation drm/amd/display: Fix __muldf3 undefined for 32 bit compilation drm/amd/display: Fix __nedf2 undefined for 32 bit compilation

Series is:

I think this patch is also relevant, if someone can review it as well:
https://patchwork.freedesktop.org/patch/491429/

Alex

Quoted 9 lines
 .../amd/display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c  | 15 +++++++++------
 .../gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c    |  4 +++-
 drivers/gpu/drm/amd/display/dc/inc/hw/clk_mgr.h   |  2 +-
 3 files changed, 13 insertions(+), 8 deletions(-)

--
2.25.1

Acked-by Tested-by
#6 lore raw

Hi--

Quoted 32 lines · Alex Deucher
Quoted 30 lines · Rodrigo Siqueira

Fix compilation issues when using i386

We recently got feedback from Randy about issues in the x86-32 compilation.I was able to reproduce a very similar issue by using:

- gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
- make -j16 ARCH=i386
- amd-staging-drm-next

I'm able to see these issues:

ERROR: modpost: "__nedf2" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] undefined!
ERROR: modpost: "__muldf3" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] undefined!
ERROR: modpost: "__floatunsidf" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] undefined!
ERROR: modpost: "__umoddi3" [drivers/gpu/drm/amd/amdgpu/amdgpu.ko] undefined!

This patchset addresses each compilation issue in its own patch since I want to have an easy way to bisect display code in case of regressions. Please, let me know if you see any issue with these changes and if it fixes the 32-bit compilation. If you still see compilation issues, please, report:

- GCC version
- Config file
- Branch

Thanks
Siqueira

Quoted 8 lines
Quoted 5 lines

Rodrigo Siqueira (4):
drm/amd/display: Fix __umoddi3 undefined for 32 bit compilation drm/amd/display: Fix __floatunsidf undefined for 32 bit compilation drm/amd/display: Fix __muldf3 undefined for 32 bit compilation drm/amd/display: Fix __nedf2 undefined for 32 bit compilation

Series is:

Series is:

Thanks.

Quoted 15 lines

I think this patch is also relevant, if someone can review it as well:
https://patchwork.freedesktop.org/patch/491429/

Alex

Quoted 9 lines
 .../amd/display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c  | 15 +++++++++------
 .../gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c    |  4 +++-
 drivers/gpu/drm/amd/display/dc/inc/hw/clk_mgr.h   |  2 +-
 3 files changed, 13 insertions(+), 8 deletions(-)

--
2.25.1

Signature · 1 line
~Randy