PTL is a special feature for gfxv9.4.4, but the warning is
always appearing on other ASICs when rocprof is running, it
causes confusion, so move hw_supported check earlier to
avoid it.

Signed-off-by: Eric Huang <[email protected]>
---
 drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c 
b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
index 575b13b557af..ab9e53dc8deb 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
@@ -1783,9 +1783,6 @@ static int kfd_ptl_control(struct kfd_process_device 
*pdd, bool enable)
        uint32_t ptl_state = enable ? 1 : 0;
        int ret;
 
-       if (!ptl->hw_supported)
-               return -EOPNOTSUPP;
-
        if (!pdd->dev->kfd2kgd || !pdd->dev->kfd2kgd->ptl_ctrl)
                return -EOPNOTSUPP;
 
@@ -1804,6 +1801,9 @@ int kfd_ptl_disable_request(struct kfd_process_device 
*pdd,
        struct amdgpu_ptl *ptl = &adev->psp.ptl;
        int ret = 0;
 
+       if (!ptl->hw_supported)
+               return -EOPNOTSUPP;
+
        mutex_lock(&ptl->mutex);
 
        if (pdd->ptl_disable_req)
@@ -1833,6 +1833,9 @@ int kfd_ptl_disable_release(struct kfd_process_device 
*pdd,
        struct amdgpu_ptl *ptl = &adev->psp.ptl;
        int ret = 0;
 
+       if (!ptl->hw_supported)
+               return -EOPNOTSUPP;
+
        mutex_lock(&ptl->mutex);
 
        if (!pdd->ptl_disable_req)
-- 
2.34.1

Reply via email to