OSDN Git Service

drm/amd/amdgpu: Add rev_id workaround logic for SRIOV setup
authorBokun Zhang <Bokun.Zhang@amd.com>
Mon, 9 Nov 2020 19:09:03 +0000 (14:09 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 10 Nov 2020 19:26:31 +0000 (14:26 -0500)
- When we are under SRIOV setup, the rev_id cannot be read
  properly. Therefore, we will return default value for it

Signed-off-by: Bokun Zhang <Bokun.Zhang@amd.com>
Reviewed-by: Monk Liu <monk.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c

index e004880..b5c3db1 100644 (file)
@@ -53,8 +53,17 @@ static void nbio_v2_3_remap_hdp_registers(struct amdgpu_device *adev)
 
 static u32 nbio_v2_3_get_rev_id(struct amdgpu_device *adev)
 {
-       u32 tmp = RREG32_SOC15(NBIO, 0, mmRCC_DEV0_EPF0_STRAP0);
+       u32 tmp;
 
+       /*
+        * guest vm gets 0xffffffff when reading RCC_DEV0_EPF0_STRAP0,
+        * therefore we force rev_id to 0 (which is the default value)
+        */
+       if (amdgpu_sriov_vf(adev)) {
+               return 0;
+       }
+
+       tmp = RREG32_SOC15(NBIO, 0, mmRCC_DEV0_EPF0_STRAP0);
        tmp &= RCC_DEV0_EPF0_STRAP0__STRAP_ATI_REV_ID_DEV0_F0_MASK;
        tmp >>= RCC_DEV0_EPF0_STRAP0__STRAP_ATI_REV_ID_DEV0_F0__SHIFT;