This commit implements amdgpu_mqd->set_mqd_perfcount
for GFX12.1, which helps setting mqd->compute_perfcount_enable
from amdgpu_mqd_prop->perfcount_enable.

Signed-off-by: Zhu Lingshan <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c
index b19a4956c222..ab70a77cfffb 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v12_1.c
@@ -2170,6 +2170,7 @@ static int gfx_v12_1_compute_mqd_init(struct 
amdgpu_device *adev, void *m,
 
        mqd->header = 0xC0310800;
        mqd->compute_pipelinestat_enable = 0x00000001;
+       mqd->compute_perfcount_enable = prop->perfcount_enable;
        mqd->compute_static_thread_mgmt_se0 = 0xffffffff;
        mqd->compute_static_thread_mgmt_se1 = 0xffffffff;
        mqd->compute_static_thread_mgmt_se2 = 0xffffffff;
@@ -2298,6 +2299,14 @@ static int gfx_v12_1_compute_mqd_init(struct 
amdgpu_device *adev, void *m,
        return 0;
 }
 
+static void gfx_v12_1_compute_mqd_set_perfcount(void *m,
+                                               struct amdgpu_mqd_prop *prop)
+{
+       struct v12_1_compute_mqd *mqd = m;
+
+       mqd->compute_perfcount_enable = prop->perfcount_enable;
+}
+
 static int gfx_v12_1_xcc_kiq_init_register(struct amdgpu_ring *ring,
                                           int xcc_id)
 {
@@ -4041,6 +4050,8 @@ static void gfx_v12_1_set_mqd_funcs(struct amdgpu_device 
*adev)
                sizeof(struct v12_1_compute_mqd);
        adev->mqds[AMDGPU_HW_IP_COMPUTE].init_mqd =
                gfx_v12_1_compute_mqd_init;
+       adev->mqds[AMDGPU_HW_IP_COMPUTE].set_mqd_perfcount =
+               gfx_v12_1_compute_mqd_set_perfcount;
 }
 
 static void gfx_v12_1_set_user_cu_inactive_bitmap_per_sh(struct amdgpu_device 
*adev,
-- 
2.55.0

Reply via email to