drm/amd: Disable XNACK on SRIOV environment
authorSurbhi Kakarya <surbhi.kakarya@amd.com>
Mon, 25 Sep 2023 16:12:10 +0000 (12:12 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 7 Nov 2023 16:15:37 +0000 (11:15 -0500)
The purpose of this patch is to disable XNACK or set XNACK OFF mode
on SRIOV platform which doesn't support it.

This will prevent user-space application to fail or result into
unexpected behaviour whenever the application need to run test-case
in XNACK ON mode.

Signed-off-by: Surbhi Kakarya <surbhi.kakarya@amd.com>
Reviewed-by: Shaoyun Liu <shaoyun.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h
drivers/gpu/drm/amd/amdkfd/kfd_process.c

index 2dce338b0f1e7441bf0ab8fa6c8f71b06993e3c8..5f71414190e9ab5744d040cc906757c546a580bb 100644 (file)
@@ -826,7 +826,10 @@ void amdgpu_gmc_noretry_set(struct amdgpu_device *adev)
                                gc_ver == IP_VERSION(9, 4, 3) ||
                                gc_ver >= IP_VERSION(10, 3, 0));
 
-       gmc->noretry = (amdgpu_noretry == -1) ? noretry_default : amdgpu_noretry;
+       if (!amdgpu_sriov_xnack_support(adev))
+               gmc->noretry = 1;
+       else
+               gmc->noretry = (amdgpu_noretry == -1) ? noretry_default : amdgpu_noretry;
 }
 
 void amdgpu_gmc_set_vm_fault_masks(struct amdgpu_device *adev, int hub_type,
index a0aa624f5a923c1b5abfa18107adeba22ca144e9..f7d1d356ecdddcdf635c6fdf8b4ad3b1ab96e643 100644 (file)
@@ -1093,3 +1093,13 @@ u32 amdgpu_sriov_rreg(struct amdgpu_device *adev,
        else
                return RREG32(offset);
 }
+
+bool amdgpu_sriov_xnack_support(struct amdgpu_device *adev)
+{
+       bool xnack_mode = true;
+
+       if (amdgpu_sriov_vf(adev) && adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 2))
+               xnack_mode = false;
+
+       return xnack_mode;
+}
index 858ef21ae51596f27291e7a75fe16c0ed262713a..935ca736300e2a8e76055f9609c78741ee4eb3df 100644 (file)
@@ -365,4 +365,5 @@ u32 amdgpu_sriov_rreg(struct amdgpu_device *adev,
 bool amdgpu_virt_fw_load_skip_check(struct amdgpu_device *adev,
                        uint32_t ucode_id);
 void amdgpu_virt_post_reset(struct amdgpu_device *adev);
+bool amdgpu_sriov_xnack_support(struct amdgpu_device *adev);
 #endif
index fbf053001af9782abd03ed9f3707aa967610d43e..7a33e06f5c90093c775421927d45b2afce726957 100644 (file)
@@ -1416,8 +1416,13 @@ bool kfd_process_xnack_mode(struct kfd_process *p, bool supported)
                 * per-process XNACK mode selection. But let the dev->noretry
                 * setting still influence the default XNACK mode.
                 */
-               if (supported && KFD_SUPPORT_XNACK_PER_PROCESS(dev))
+               if (supported && KFD_SUPPORT_XNACK_PER_PROCESS(dev)) {
+                       if (!amdgpu_sriov_xnack_support(dev->kfd->adev)) {
+                               pr_debug("SRIOV platform xnack not supported\n");
+                               return false;
+                       }
                        continue;
+               }
 
                /* GFXv10 and later GPUs do not support shader preemption
                 * during page faults. This can lead to poor QoS for queue