return r;
}
+static int gfx_v9_4_3_perf_monitor_ptl_init(struct amdgpu_device *adev, bool enable)
+{
+ struct amdgpu_ptl *ptl = &adev->psp.ptl;
+ uint32_t ptl_state = enable ? 1 : 0;
+ uint32_t fmt1, fmt2;
+ int r;
+
+ if (!adev->psp.funcs)
+ return -EOPNOTSUPP;
+
+ if (!ptl->hw_supported) {
+ fmt1 = GFX_FTYPE_I8;
+ fmt2 = GFX_FTYPE_BF16;
+ } else {
+ fmt1 = ptl->fmt1;
+ fmt2 = ptl->fmt2;
+ }
+
+ /* initialize PTL with default formats: GFX_FTYPE_I8 & GFX_FTYPE_BF16 */
+ r = amdgpu_ptl_perf_monitor_ctrl(adev, PSP_PTL_PERF_MON_SET, &ptl_state,
+ &fmt1, &fmt2);
+ if (r)
+ return r;
+
+ ptl->hw_supported = true;
+
+ return 0;
+}
+
static int gfx_v9_4_3_hw_fini(struct amdgpu_ip_block *ip_block)
{
struct amdgpu_device *adev = ip_block->adev;
int i, num_xcc;
+ if (adev->psp.ptl.hw_supported)
+ gfx_v9_4_3_perf_monitor_ptl_init(adev, false);
+
amdgpu_irq_put(adev, &adev->gfx.priv_reg_irq, 0);
amdgpu_irq_put(adev, &adev->gfx.priv_inst_irq, 0);
amdgpu_irq_put(adev, &adev->gfx.bad_op_irq, 0);
adev->gfx.ras->enable_watchdog_timer)
adev->gfx.ras->enable_watchdog_timer(adev);
+ gfx_v9_4_3_perf_monitor_ptl_init(adev, true);
+
return 0;
}