drm/amdgpu: initialize ttm for doorbells
authorShashank Sharma <shashank.sharma@amd.com>
Fri, 14 Jul 2023 13:15:01 +0000 (15:15 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 7 Aug 2023 21:14:06 +0000 (17:14 -0400)
This patch initialzes the ttm resource manager for doorbells.

V2: Do not round up doorbell size (Alex)

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Christian Koenig <christian.koenig@amd.com>
Reviewed-by: Christian Koenig <christian.koenig@amd.com>
Signed-off-by: Shashank Sharma <shashank.sharma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c

index 1703d21..f2cd255 100644 (file)
@@ -1938,6 +1938,13 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
        DRM_INFO("amdgpu: %uM of GTT memory ready.\n",
                 (unsigned int)(gtt_size / (1024 * 1024)));
 
+       /* Initiailize doorbell pool on PCI BAR */
+       r = amdgpu_ttm_init_on_chip(adev, AMDGPU_PL_DOORBELL, adev->doorbell.size / PAGE_SIZE);
+       if (r) {
+               DRM_ERROR("Failed initializing doorbell heap.\n");
+               return r;
+       }
+
        /* Initialize preemptible memory pool */
        r = amdgpu_preempt_mgr_init(adev);
        if (r) {