drm/amdgpu: Keep non-psp path for partition switch
authorLijo Lazar <lijo.lazar@amd.com>
Thu, 22 Jun 2023 06:05:10 +0000 (11:35 +0530)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 30 Jun 2023 17:12:15 +0000 (13:12 -0400)
When PSP block is not present, use direct programming.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Acked-by: Mangesh Gadre <Mangesh.Gadre@amd.com>
Tested-by: Mangesh Gadre <Mangesh.Gadre@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c

index 76b189b..9e3b835 100644 (file)
@@ -623,12 +623,28 @@ static void gfx_v9_4_3_select_me_pipe_q(struct amdgpu_device *adev,
 static int gfx_v9_4_3_switch_compute_partition(struct amdgpu_device *adev,
                                                int num_xccs_per_xcp)
 {
-       int ret;
-
-       ret = psp_spatial_partition(&adev->psp, NUM_XCC(adev->gfx.xcc_mask) /
-                                                       num_xccs_per_xcp);
-       if (ret)
-               return ret;
+       int ret, i, num_xcc;
+       u32 tmp = 0;
+
+       if (adev->psp.funcs) {
+               ret = psp_spatial_partition(&adev->psp,
+                                           NUM_XCC(adev->gfx.xcc_mask) /
+                                                   num_xccs_per_xcp);
+               if (ret)
+                       return ret;
+       } else {
+               num_xcc = NUM_XCC(adev->gfx.xcc_mask);
+
+               for (i = 0; i < num_xcc; i++) {
+                       tmp = REG_SET_FIELD(tmp, CP_HYP_XCP_CTL, NUM_XCC_IN_XCP,
+                                           num_xccs_per_xcp);
+                       tmp = REG_SET_FIELD(tmp, CP_HYP_XCP_CTL, VIRTUAL_XCC_ID,
+                                           i % num_xccs_per_xcp);
+                       WREG32_SOC15(GC, GET_INST(GC, i), regCP_HYP_XCP_CTL,
+                                    tmp);
+               }
+               ret = 0;
+       }
 
        adev->gfx.num_xcc_per_xcp = num_xccs_per_xcp;