This commit implements amdgpu_mqd->set_mqd_perfcount
for GFX12, 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_0.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
index e26c56b4216f..fe9d7feb42fc 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
@@ -3160,6 +3160,7 @@ static int gfx_v12_0_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;
@@ -3313,6 +3314,14 @@ static int gfx_v12_0_compute_mqd_init(struct 
amdgpu_device *adev, void *m,
        return 0;
 }
 
+static void gfx_v12_0_compute_mqd_set_perfcount(void *m,
+                                               struct amdgpu_mqd_prop *prop)
+{
+       struct v12_compute_mqd *mqd = m;
+
+       mqd->compute_perfcount_enable = prop->perfcount_enable;
+}
+
 static int gfx_v12_0_kiq_init_register(struct amdgpu_ring *ring)
 {
        struct amdgpu_device *adev = ring->adev;
@@ -5542,6 +5551,8 @@ static void gfx_v12_0_set_mqd_funcs(struct amdgpu_device 
*adev)
                sizeof(struct v12_compute_mqd);
        adev->mqds[AMDGPU_HW_IP_COMPUTE].init_mqd =
                gfx_v12_0_compute_mqd_init;
+       adev->mqds[AMDGPU_HW_IP_COMPUTE].set_mqd_perfcount =
+               gfx_v12_0_compute_mqd_set_perfcount;
 }
 
 static void gfx_v12_0_set_user_wgp_inactive_bitmap_per_sh(struct amdgpu_device 
*adev,
-- 
2.55.0

Reply via email to