drm/amdgpu: add skip_hw_access checks for sriov
authorjsg <jsg@openbsd.org>
Mon, 9 Sep 2024 09:46:24 +0000 (09:46 +0000)
committerjsg <jsg@openbsd.org>
Mon, 9 Sep 2024 09:46:24 +0000 (09:46 +0000)
From Yunxiang Li
494b42f35fc2a858941757dbbf5619f6ff405562 in linux-6.6.y/6.6.50
b3948ad1ac582f560e1f3aeaecf384619921c48d in mainline linux

sys/dev/pci/drm/amd/amdgpu/amdgpu_virt.c

index abc7bdc..6852de8 100644 (file)
@@ -999,6 +999,9 @@ static u32 amdgpu_virt_rlcg_reg_rw(struct amdgpu_device *adev, u32 offset, u32 v
                return 0;
        }
 
+       if (amdgpu_device_skip_hw_access(adev))
+               return 0;
+
        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;
@@ -1074,6 +1077,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);
@@ -1091,6 +1097,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);