Skip to contentSkip to conversation

drm/amd/ras: Fix the error of undefined reference to `__udivdi3'

PATCH In review YiPeng Chai 2 participants 2 messages Oct 29, 2025

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

PATCH 1/1 drm/amd/ras: Fix the error of undefined reference to `__udivdi3'

Fix the error:
drivers/gpu/drm/amd/amdgpu/../ras/ras_mgr/amdgpu_ras_mgr.c:132:undefined reference to `__udivdi3'

Fixs:b5bae0f01786d("drm/amd/ras: Add amdgpu ras management function")

---
 drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +2 -2
index 8007e49951d8..d09c4a75a7f4 100644
@@ -37,7 +37,7 @@
 #define MAX_XCD_NUM_PER_AID			2
 
 /* typical ECC bad page rate is 1 bad page per 100MB VRAM */
-#define ESTIMATE_BAD_PAGE_THRESHOLD(size)         ((size)/(100 * 1024 * 1024ULL))
+#define TYPICAL_ECC_BAD_PAGE_RATE (100 * 1024 * 1024ULL)
 
 #define COUNT_BAD_PAGE_THRESHOLD(size) (((size) >> 21) << 4)
 
@@ -129,7 +129,7 @@ static int amdgpu_ras_mgr_init_eeprom_config(struct amdgpu_device *adev,
 	 */
 	if (amdgpu_bad_page_threshold == NONSTOP_OVER_THRESHOLD)
 		eeprom_cfg->eeprom_record_threshold_count =
-				ESTIMATE_BAD_PAGE_THRESHOLD(adev->gmc.mc_vram_size);
+			div64_u64(adev->gmc.mc_vram_size, TYPICAL_ECC_BAD_PAGE_RATE);
 	else if (amdgpu_bad_page_threshold == WARN_NONSTOP_OVER_THRESHOLD)
 		eeprom_cfg->eeprom_record_threshold_count =
 				COUNT_BAD_PAGE_THRESHOLD(RAS_RESERVED_VRAM_SIZE_DEFAULT);
Signature · 1 line
2.34.1
Reviewed-by Tao Zhou on v1 1/1
#1 lore raw

[AMD Official Use Only - AMD Internal Distribution Only]

-----Original Message-----
From: Chai, Thomas <[email protected]>
Sent: Wednesday, October 29, 2025 10:43 AM
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Zhou1, Tao <[email protected]>; Li, Candice <[email protected]>; Wang, Yang(Kevin) <[email protected]>; Yang, Stanley <[email protected]>; Su, Joe <[email protected]>; Chai, Thomas <[email protected]>; kernel test robot <[email protected]>; Zhou1, Tao <[email protected]>
Subject: [PATCH] drm/amd/ras: Fix the error of undefined reference to `__udivdi3'

Fix the error:
drivers/gpu/drm/amd/amdgpu/../ras/ras_mgr/amdgpu_ras_mgr.c:132:undefined reference to `__udivdi3'

Fixs:b5bae0f01786d("drm/amd/ras: Add amdgpu ras management function")

---
 drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/ras/ras_mgr/amdgpu_ras_mgr.c +1 -1
index 8007e49951d8..d09c4a75a7f4 100644
@@ -37,7 +37,7 @@
 #define MAX_XCD_NUM_PER_AID                    2
 
 /* typical ECC bad page rate is 1 bad page per 100MB VRAM */
-#define ESTIMATE_BAD_PAGE_THRESHOLD(size)         ((size)/(100 * 1024 * 1024ULL))
+#define TYPICAL_ECC_BAD_PAGE_RATE (100 * 1024 * 1024ULL)
 

[kevin]:
Please use Linux SZ_* macros instead of hardcoded value to make code more readable. e.g: 100ULL * SZ_1M

The patch is Reviewed-by: Yang Wang <[email protected]>

Best Regards,
Kevin

#define COUNT_BAD_PAGE_THRESHOLD(size) (((size) >> 21) << 4)

@@ -129,7 +129,7 @@ static int amdgpu_ras_mgr_init_eeprom_config(struct amdgpu_device *adev,

         */
        if (amdgpu_bad_page_threshold == NONSTOP_OVER_THRESHOLD)
                eeprom_cfg->eeprom_record_threshold_count =
-                               ESTIMATE_BAD_PAGE_THRESHOLD(adev->gmc.mc_vram_size);
+                       div64_u64(adev->gmc.mc_vram_size, TYPICAL_ECC_BAD_PAGE_RATE);
        else if (amdgpu_bad_page_threshold == WARN_NONSTOP_OVER_THRESHOLD)
                eeprom_cfg->eeprom_record_threshold_count =
                                COUNT_BAD_PAGE_THRESHOLD(RAS_RESERVED_VRAM_SIZE_DEFAULT);

--
2.34.1