Reviewed-by: Monk Liu <monk....@amd.com>

_____________________________________
Monk Liu|GPU Virtualization Team |AMD


-----Original Message-----
From: Christian König <ckoenig.leichtzumer...@gmail.com> 
Sent: Tuesday, April 21, 2020 10:23 PM
To: Liu, Monk <monk....@amd.com>; He, Jacob <jacob...@amd.com>; Tao, Yintian 
<yintian....@amd.com>; amd-gfx@lists.freedesktop.org
Subject: [PATCH] drm/amdgpu: change how we update mmRLC_SPM_MC_CNTL

In pp_one_vf mode avoid the extra overhead and read/write the registers without 
the KIQ.

Signed-off-by: Christian König <christian.koe...@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 13 ++++++++++---  
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c  | 10 ++++++++--  
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c  | 13 ++++++++++---
 3 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
index 0a03e2ad5d95..560ec1c29977 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
@@ -7030,14 +7030,21 @@ static int gfx_v10_0_update_gfx_clock_gating(struct 
amdgpu_device *adev,
 
 static void gfx_v10_0_update_spm_vmid(struct amdgpu_device *adev, unsigned 
vmid)  {
-       u32 data;
+       u32 reg, data;
 
-       data = RREG32_SOC15(GC, 0, mmRLC_SPM_MC_CNTL);
+       reg = SOC15_REG_OFFSET(GC, 0, mmRLC_SPM_MC_CNTL);
+       if (amdgpu_sriov_is_pp_one_vf(adev))
+               data = RREG32_NO_KIQ(reg);
+       else
+               data = RREG32(reg);
 
        data &= ~RLC_SPM_MC_CNTL__RLC_SPM_VMID_MASK;
        data |= (vmid & RLC_SPM_MC_CNTL__RLC_SPM_VMID_MASK) << 
RLC_SPM_MC_CNTL__RLC_SPM_VMID__SHIFT;
 
-       WREG32_SOC15(GC, 0, mmRLC_SPM_MC_CNTL, data);
+       if (amdgpu_sriov_is_pp_one_vf(adev))
+               WREG32_SOC15_NO_KIQ(GC, 0, mmRLC_SPM_MC_CNTL, data);
+       else
+               WREG32_SOC15(GC, 0, mmRLC_SPM_MC_CNTL, data);
 }
 
 static bool gfx_v10_0_check_rlcg_range(struct amdgpu_device *adev, diff --git 
a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index fc6c2f2bc76c..a9bcc00f4348 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
@@ -5615,12 +5615,18 @@ static void gfx_v8_0_update_spm_vmid(struct 
amdgpu_device *adev, unsigned vmid)  {
        u32 data;
 
-       data = RREG32(mmRLC_SPM_VMID);
+       if (amdgpu_sriov_is_pp_one_vf(adev))
+               data = RREG32_NO_KIQ(mmRLC_SPM_VMID);
+       else
+               data = RREG32(mmRLC_SPM_VMID);
 
        data &= ~RLC_SPM_VMID__RLC_SPM_VMID_MASK;
        data |= (vmid & RLC_SPM_VMID__RLC_SPM_VMID_MASK) << 
RLC_SPM_VMID__RLC_SPM_VMID__SHIFT;
 
-       WREG32(mmRLC_SPM_VMID, data);
+       if (amdgpu_sriov_is_pp_one_vf(adev))
+               WREG32_NO_KIQ(mmRLC_SPM_VMID, data);
+       else
+               WREG32(mmRLC_SPM_VMID, data);
 }
 
 static const struct amdgpu_rlc_funcs iceland_rlc_funcs = { diff --git 
a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
index 54eded9a6ac5..c7de10869c81 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
@@ -4950,14 +4950,21 @@ static int gfx_v9_0_update_gfx_clock_gating(struct 
amdgpu_device *adev,
 
 static void gfx_v9_0_update_spm_vmid(struct amdgpu_device *adev, unsigned 
vmid)  {
-       u32 data;
+       u32 reg, data;
 
-       data = RREG32_SOC15(GC, 0, mmRLC_SPM_MC_CNTL);
+       reg = SOC15_REG_OFFSET(GC, 0, mmRLC_SPM_MC_CNTL);
+       if (amdgpu_sriov_is_pp_one_vf(adev))
+               data = RREG32_NO_KIQ(reg);
+       else
+               data = RREG32(reg);
 
        data &= ~RLC_SPM_MC_CNTL__RLC_SPM_VMID_MASK;
        data |= (vmid & RLC_SPM_MC_CNTL__RLC_SPM_VMID_MASK) << 
RLC_SPM_MC_CNTL__RLC_SPM_VMID__SHIFT;
 
-       WREG32_SOC15(GC, 0, mmRLC_SPM_MC_CNTL, data);
+       if (amdgpu_sriov_is_pp_one_vf(adev))
+               WREG32_SOC15_NO_KIQ(GC, 0, mmRLC_SPM_MC_CNTL, data);
+       else
+               WREG32_SOC15(GC, 0, mmRLC_SPM_MC_CNTL, data);
 }
 
 static bool gfx_v9_0_check_rlcg_range(struct amdgpu_device *adev,
--
2.17.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to