drm/amd/sriov skip vcn powergating and dec_ring_test
Subsystems (2)
PATCH 5/5 drm/amd/sriov skip vcn powergating and dec_ring_test
1.Skip decode_ring test in VF, because VCN in SRIOV does not support direct register read/write.
2.Skip powergating configuration in hw fini because VCN3.0 SRIOV doesn't support powergating.
V2: delete unneccessary white lines and refine implementation.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 4 ++++ drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c | 21 ++++++++++++++++----- 2 files changed, 20 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +4 -0
@@ -421,6 +421,10 @@ int amdgpu_vcn_dec_ring_test_ring(struct amdgpu_ring *ring)unsigned i;int r; +/* VCN in SRIOV does not support direct register read/write */ +if (amdgpu_sriov_vf (adev)) +return 0 ; +WREG32 (adev->vcn.inst[ring->me].external.scratch9,0xCAFEDEAD ); r =amdgpu_ring_alloc (ring,3 );if (r)
drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c +16 -5
@@ -354,11 +354,13 @@ static int vcn_v3_0_hw_fini(void *handle) ring = &adev->vcn.inst[i].ring_dec; -if ((adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG ) || - (adev->vcn.cur_state !=AMD_PG_STATE_GATE && -RREG32_SOC15 (VCN , i, mmUVD_STATUS))) -vcn_v3_0_set_powergating_state (adev,AMD_PG_STATE_GATE ); - +if (!amdgpu_sriov_vf (adev)) { +if ((adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG ) || + (adev->vcn.cur_state !=AMD_PG_STATE_GATE && +RREG32_SOC15 (VCN , i, mmUVD_STATUS))) { +vcn_v3_0_set_powergating_state (adev,AMD_PG_STATE_GATE ); + } + } ring->sched.ready = false;for (j =0 ; j < adev->vcn.num_enc_rings; ++j) {
@@ -1861,6 +1863,15 @@ static int vcn_v3_0_set_powergating_state(void *handle,struct amdgpu_device *adev = (struct amdgpu_device *)handle;int ret; +/* for SRIOV, guest should not control VCN Power-gating +* MMSCH FW should control Power-gating and clock-gating +* guest should avoid touching CGC and PG +*/ +if (amdgpu_sriov_vf (adev)) { + adev->vcn.cur_state =AMD_PG_STATE_UNGATE ; +return 0 ; + } +if (state == adev->vcn.cur_state)return 0 ;
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
-----Original Message-----
From: Jack Zhang <[email protected]>
Sent: July 15, 2020 1:50 AM
To: [email protected]
Cc: Zhang, Jack (Jian) <[email protected]>; Zhang, Hawking <[email protected]>; Liu, Leo <[email protected]>
Subject: [PATCH 5/5] drm/amd/sriov skip vcn powergating and dec_ring_test
1.Skip decode_ring test in VF, because VCN in SRIOV does not support direct register read/write.
2.Skip powergating configuration in hw fini because VCN3.0 SRIOV doesn't support powergating.
V2: delete unneccessary white lines and refine implementation.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 4 ++++ drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c | 21 ++++++++++++++++----- 2 files changed, 20 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +4 -0
@@ -421,6 +421,10 @@ int amdgpu_vcn_dec_ring_test_ring(struct amdgpu_ring *ring)unsigned i;int r; +/* VCN in SRIOV does not support direct register read/write */ +if (amdgpu_sriov_vf (adev)) +return 0 ; +WREG32 (adev->vcn.inst[ring->me].external.scratch9,0xCAFEDEAD ); r =amdgpu_ring_alloc (ring,3 );if (r)
drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c +7 -5
@@ -354,11 +354,13 @@ static int vcn_v3_0_hw_fini(void *handle) ring = &adev->vcn.inst[i].ring_dec; -if ((adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG ) || - (adev->vcn.cur_state !=AMD_PG_STATE_GATE && -RREG32_SOC15 (VCN , i, mmUVD_STATUS))) -vcn_v3_0_set_powergating_state (adev,AMD_PG_STATE_GATE ); - +if (!amdgpu_sriov_vf (adev)) { +if ((adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG ) || + (adev->vcn.cur_state !=AMD_PG_STATE_GATE && +RREG32_SOC15 (VCN , i, mmUVD_STATUS))) { +vcn_v3_0_set_powergating_state (adev,AMD_PG_STATE_GATE ); + } + } ring->sched.ready = false; for (j = 0; j < adev->vcn.num_enc_rings; ++j) { @@ -1861,6 +1863,15 @@ static int vcn_v3_0_set_powergating_state(void *handle,
struct amdgpu_device *adev = (struct amdgpu_device *)handle; int ret;
+ /* for SRIOV, guest should not control VCN Power-gating
+ * MMSCH FW should control Power-gating and clock-gating
+ * guest should avoid touching CGC and PG
+ */
+ if (amdgpu_sriov_vf(adev)) {
+ adev->vcn.cur_state = AMD_PG_STATE_UNGATE;
+ return 0;
+ }
+
if(state == adev->vcn.cur_state)
return 0;
--
2.17.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx