drm: Disable XNACK on SRIOV environment
Subsystems (3)
A message that is not in the archive (sent off-list or not yet received): [email protected]
[AMD Official Use Only - General]
Ping..
-----Original Message-----
From: Surbhi Kakarya <[email protected]>
Sent: Monday, October 30, 2023 9:54 PM
To: [email protected]; Yang, Philip <[email protected]>
Cc: Kakarya, Surbhi <[email protected]>
Subject: [PATCH] drm: Disable XNACK on SRIOV environment
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.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 5 ++++- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 9 +++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h | 1 + drivers/gpu/drm/amd/amdkfd/kfd_process.c | 10 ++++++++-- 4 files changed, 22 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +5 -1
@@ -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->norety =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, diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
index a0aa624f5a92..41c77d5c5a79 100644
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +8 -0
@@ -1093,3 +1093,12 @@ u32 amdgpu_sriov_rreg(struct amdgpu_device *adev,else return RREG32 (offset); } +bool amdgpu_sriov_xnack_support (struct amdgpu_device *adev) { +bool xnack_mode =1 ; + +if (amdgpu_sriov_vf (adev) && (adev->ip_versions[GC_HWIP ][0 ] ==IP_VERSION (9 ,4 ,2 ))) + xnack_mode =0 ; + +return xnack_mode; +}
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h +1 -0
@@ -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
drivers/gpu/drm/amd/amdkfd/kfd_process.c +8 -2
@@ -1416,8 +1416,14 @@ 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)) -continue ; +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; + } +else +continue ; + }/* GFXv10 and later GPUs do not support shader preemption * during page faults. This can lead to poor QoS for queue
--
2.25.1
Liu, Shaoyun
Reviewed-by[AMD Official Use Only - General]
Looks ok to me .
-----Original Message-----
From: Kakarya, Surbhi <[email protected]>
Sent: Thursday, November 2, 2023 12:10 PM
To: Kakarya, Surbhi <[email protected]>; [email protected]; Yang, Philip <[email protected]>; Liu, Shaoyun <[email protected]>
Subject: RE: [PATCH] drm: Disable XNACK on SRIOV environment
[AMD Official Use Only - General]
Ping..
-----Original Message-----
From: Surbhi Kakarya <[email protected]>
Sent: Monday, October 30, 2023 9:54 PM
To: [email protected]; Yang, Philip <[email protected]>
Cc: Kakarya, Surbhi <[email protected]>
Subject: [PATCH] drm: Disable XNACK on SRIOV environment
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.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 5 ++++- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 9 +++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h | 1 + drivers/gpu/drm/amd/amdkfd/kfd_process.c | 10 ++++++++-- 4 files changed, 22 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +5 -1
@@ -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->norety =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, diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
index a0aa624f5a92..41c77d5c5a79 100644
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +8 -0
@@ -1093,3 +1093,12 @@ u32 amdgpu_sriov_rreg(struct amdgpu_device *adev,else return RREG32 (offset); } +bool amdgpu_sriov_xnack_support (struct amdgpu_device *adev) { +bool xnack_mode =1 ; + +if (amdgpu_sriov_vf (adev) && (adev->ip_versions[GC_HWIP ][0 ] ==IP_VERSION (9 ,4 ,2 ))) + xnack_mode =0 ; + +return xnack_mode; +}
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h +1 -0
@@ -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
drivers/gpu/drm/amd/amdkfd/kfd_process.c +8 -2
@@ -1416,8 +1416,14 @@ 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)) -continue ; +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; + } +else +continue ; + }/* GFXv10 and later GPUs do not support shader preemption * during page faults. This can lead to poor QoS for queue
--
2.25.1