drm/amdgpu: Change nbio v7.9 xcp status definition
authorLijo Lazar <lijo.lazar@amd.com>
Tue, 13 Jun 2023 07:20:02 +0000 (12:50 +0530)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 15 Jun 2023 15:06:59 +0000 (11:06 -0400)
PARTITION_MODE field in PARTITION_COMPUTE_STATUS register is defined as
below by firmware.

SPX = 0, DPX = 1, TPX = 2, QPX = 3, CPX = 4

Change driver definition accordingly.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Le Ma <le.ma@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/nbio_v7_9.c

index d193254..b033935 100644 (file)
@@ -390,7 +390,7 @@ static int nbio_v7_9_get_compute_partition_mode(struct amdgpu_device *adev)
        px = REG_GET_FIELD(tmp, BIF_BX_PF0_PARTITION_COMPUTE_STATUS,
                           PARTITION_MODE);
 
-       return ffs(px);
+       return px;
 }
 
 static void nbio_v7_9_set_compute_partition_mode(struct amdgpu_device *adev,
@@ -398,12 +398,10 @@ static void nbio_v7_9_set_compute_partition_mode(struct amdgpu_device *adev,
 {
        u32 tmp;
 
-       /* Each bit represents DPX,TPX,QPX,CPX mode. No bit set means default
-        * SPX mode.
-        */
+       /* SPX=0, DPX=1, TPX=2, QPX=3, CPX=4 */
        tmp = RREG32_SOC15(NBIO, 0, regBIF_BX_PF0_PARTITION_COMPUTE_STATUS);
        tmp = REG_SET_FIELD(tmp, BIF_BX_PF0_PARTITION_COMPUTE_STATUS,
-                           PARTITION_MODE, mode ? BIT(mode - 1) : mode);
+                           PARTITION_MODE, mode);
 
        WREG32_SOC15(NBIO, 0, regBIF_BX_PF0_PARTITION_COMPUTE_STATUS, tmp);
 }