drm/amdgpu: track MQD size for gfx and compute
authorAlex Deucher <alexander.deucher@amd.com>
Tue, 21 Mar 2023 17:28:33 +0000 (13:28 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 24 Apr 2023 22:36:45 +0000 (18:36 -0400)
It varies by generation and we need to know the size
to expose this via debugfs.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h

index 465ad0b..60bb4bb 100644 (file)
@@ -420,6 +420,7 @@ int amdgpu_gfx_mqd_sw_init(struct amdgpu_device *adev,
                                        return r;
                                }
 
+                               ring->mqd_size = mqd_size;
                                /* prepare MQD backup */
                                adev->gfx.me.mqd_backup[i] = kmalloc(mqd_size, GFP_KERNEL);
                                if (!adev->gfx.me.mqd_backup[i])
@@ -440,6 +441,7 @@ int amdgpu_gfx_mqd_sw_init(struct amdgpu_device *adev,
                                return r;
                        }
 
+                       ring->mqd_size = mqd_size;
                        /* prepare MQD backup */
                        adev->gfx.mec.mqd_backup[i + xcc_id * adev->gfx.num_compute_rings] = kmalloc(mqd_size, GFP_KERNEL);
                        if (!adev->gfx.mec.mqd_backup[i])
index 2aa6cc1..b0dc0a0 100644 (file)
@@ -258,6 +258,7 @@ struct amdgpu_ring {
        struct amdgpu_bo        *mqd_obj;
        uint64_t                mqd_gpu_addr;
        void                    *mqd_ptr;
+       unsigned                mqd_size;
        uint64_t                eop_gpu_addr;
        u32                     doorbell_index;
        bool                    use_doorbell;