PTL (Peak TOPS Limiter) functionality is only available starting
from firmware 0x0036081a.  Add the same firmware version gate in both
places that already verify PTL hardware capability:

v2 change:
* move psp and gc version check into psp_performance_monitor_hw()

Signed-off-by: Perry Yuan <[email protected]>
Reviewed-by: Lijo Lazar <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 4 ++++
 drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c | 3 ---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
index 9cb30f3e21be..a5f101ef51ef 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
@@ -1252,6 +1252,10 @@ int psp_performance_monitor_hw(struct psp_context *psp, 
u32 req_code,
        if (amdgpu_sriov_vf(psp->adev))
                return 0;
 
+       if (amdgpu_ip_version(psp->adev, GC_HWIP, 0) != IP_VERSION(9, 4, 4) ||
+                       psp->sos.fw_version < 0x0036081a)
+               return -EOPNOTSUPP;
+
        if (psp_ptl_fmt_verify(psp, *fmt1, &ptl_fmt1) ||
                        psp_ptl_fmt_verify(psp, *fmt2, &ptl_fmt2))
                return -EINVAL;
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
index a970913ec66c..d94bf21db281 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
@@ -2376,9 +2376,6 @@ static int gfx_v9_4_3_perf_monitor_ptl_init(struct 
amdgpu_device *adev, bool sta
        uint32_t ptl_state = state ? 1 : 0;
        int r;
 
-       if (amdgpu_ip_version(adev, GC_HWIP, 0) != IP_VERSION(9, 4, 4))
-               return -ENOTSUPP;
-
        if (!adev->psp.funcs)
                return -EOPNOTSUPP;
 
-- 
2.34.1

Reply via email to