The RAS core derives the bad page threshold from
con->reserved_pages_in_bytes when amdgpu_ras_mgr_sw_init() builds the
EEPROM configuration. That field is still zero at this point, so the
threshold falls back to the 16MB default and ends up at 128 pages on
ASICs that reserve 32MB.

Set the reserved vram size before RAS core sw init so the threshold is
computed from the per-ASIC value.

Signed-off-by: Xiang Liu <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
index becad704113c..0d39b1872b4c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
@@ -3628,6 +3628,9 @@ int amdgpu_ras_init(struct amdgpu_device *adev)
 
        amdgpu_ras_check_supported(adev);
 
+       /* The RAS core derives the bad page threshold from this value. */
+       amdgpu_ras_init_reserved_vram_size(adev);
+
        param.ras_feature_enable = amdgpu_ras_enable;
        param.ras_feature_mask = amdgpu_ras_mask;
        param.ras_bad_page_threshold = amdgpu_bad_page_threshold;
@@ -3725,8 +3728,6 @@ int amdgpu_ras_init(struct amdgpu_device *adev)
        /* Get RAS schema for particular SOC */
        con->schema = amdgpu_get_ras_schema(adev);
 
-       amdgpu_ras_init_reserved_vram_size(adev);
-
        if (amdgpu_ras_fs_init(adev)) {
                r = -EINVAL;
                goto release_con;
-- 
2.34.1

Reply via email to