Re: [PATCH v2 01/10] drm/amdgpu: add skip_hw_access checks for sriov

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 28.05.24 um 19:23 schrieb Yunxiang Li:
Accessing registers via host is missing the check for skip_hw_access and
the lockdep check that comes with it.

Signed-off-by: Yunxiang Li <Yunxiang.Li@xxxxxxx>
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 9 +++++++++
  1 file changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
index 3d5f58e76f2d..3cf8416f8cb0 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
@@ -977,6 +977,9 @@ u32 amdgpu_virt_rlcg_reg_rw(struct amdgpu_device *adev, u32 offset, u32 v, u32 f
  		return 0;
  	}
+ if (amdgpu_device_skip_hw_access(adev))
+		return 0;
+

The only other caller of this function is amdgpu_device_xcc_rreg() and that one has the amdgpu_device_skip_hw_access() call already. So it could be that this one is duplicated.

On the other hand an extra check doesn't really hurt us.

So either way the patch is Reviewed-by: Christian König <christian.koenig@xxxxxxx>

Regards,
Christian.


  	reg_access_ctrl = &adev->gfx.rlc.reg_access_ctrl[xcc_id];
  	scratch_reg0 = (void __iomem *)adev->rmmio + 4 * reg_access_ctrl->scratch_reg0;
  	scratch_reg1 = (void __iomem *)adev->rmmio + 4 * reg_access_ctrl->scratch_reg1;
@@ -1047,6 +1050,9 @@ void amdgpu_sriov_wreg(struct amdgpu_device *adev,
  {
  	u32 rlcg_flag;
+ if (amdgpu_device_skip_hw_access(adev))
+		return;
+
  	if (!amdgpu_sriov_runtime(adev) &&
  		amdgpu_virt_get_rlcg_reg_access_flag(adev, acc_flags, hwip, true, &rlcg_flag)) {
  		amdgpu_virt_rlcg_reg_rw(adev, offset, value, rlcg_flag, xcc_id);
@@ -1064,6 +1070,9 @@ u32 amdgpu_sriov_rreg(struct amdgpu_device *adev,
  {
  	u32 rlcg_flag;
+ if (amdgpu_device_skip_hw_access(adev))
+		return 0;
+
  	if (!amdgpu_sriov_runtime(adev) &&
  		amdgpu_virt_get_rlcg_reg_access_flag(adev, acc_flags, hwip, false, &rlcg_flag))
  		return amdgpu_virt_rlcg_reg_rw(adev, offset, 0, rlcg_flag, xcc_id);




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux