Place the RS64 context-size query buffer's allocation with software
initialization, outside reset-time hardware initialization and its
firmware locks. Hardware initialization only consumes the buffer.

Signed-off-by: Prike Liang <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c 
b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c
index 51bfb672bed7..2f62214ab24f 100644
--- a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c
@@ -1746,6 +1746,7 @@ static int mes_v11_0_sw_init(struct amdgpu_ip_block 
*ip_block)
        struct amdgpu_device *adev = ip_block->adev;
        int pipe, r, bo_size;
 
+       adev->mes.use_rs64mem = false;
        adev->mes.funcs = &mes_v11_0_funcs;
        adev->mes.kiq_hw_init = &mes_v11_0_kiq_hw_init;
        adev->mes.kiq_hw_fini = &mes_v11_0_kiq_hw_fini;
@@ -1796,6 +1797,14 @@ static int mes_v11_0_sw_init(struct amdgpu_ip_block 
*ip_block)
                return r;
        }
 
+       /* Allocate GPU buffer for array size query results */
+       r = amdgpu_mes_rs64mem_init(&adev->mes);
+       if (r) {
+               dev_warn(adev->dev,
+                        "RS64 memory init failed (%d), using system memory\n", 
r);
+               adev->mes.use_rs64mem = false;
+       }
+
        return 0;
 }
 
@@ -1973,8 +1982,6 @@ static int mes_v11_0_hw_init(struct amdgpu_ip_block 
*ip_block)
        if (adev->mes.ring[0].sched.ready)
                goto out;
 
-       adev->mes.use_rs64mem = false;
-
        if (!adev->enable_mes_kiq) {
                if (adev->firmware.load_type == AMDGPU_FW_LOAD_DIRECT) {
                        r = mes_v11_0_load_microcode(adev,
@@ -1992,14 +1999,6 @@ static int mes_v11_0_hw_init(struct amdgpu_ip_block 
*ip_block)
        if (r)
                goto failure;
 
-       /* Allocate GPU buffer for array size query results */
-       r = amdgpu_mes_rs64mem_init(&adev->mes);
-       if (r) {
-               dev_warn(adev->dev,
-                        "RS64 local memory init failed (%d),"
-                        "falling back to system memory path\n", r);
-               adev->mes.use_rs64mem = false;
-       }
        r = mes_v11_0_set_hw_resources(&adev->mes);
 
        if (r)
-- 
2.34.1

Reply via email to