From: Shashank Sharma <contactshashanksharma@xxxxxxxxx>
This patch does the following:
- Initializes TTM range management for domain DOORBELL.
- Introduces a kernel bo for doorbell management in form of
mman.doorbell_kernel_bo.
This bo holds the kernel doorbell space now.
- Removes ioremapping of doorbell-kernel memory, as its not required
now.
V2:
- Addressed review comments from Christian:
- do not use kernel_create_at(0), use kernel_create() instead.
- do not use ttm_resource_manager, use range_manager instead.
- do not ioremap doorbell, TTM will do that.
- Split one big patch into 2
Cc: Alex Deucher <alexander.deucher@xxxxxxx>
Cc: Christian Koenig <christian.koenig@xxxxxxx>
Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx>
Signed-off-by: Shashank Sharma <shashank.sharma@xxxxxxx>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 22 ++++++++++++++++++++++
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h | 7 +++++++
2 files changed, 29 insertions(+)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index e9dc24191fc8..086e83c17c0f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -1879,12 +1879,32 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
return r;
}
+ r = amdgpu_ttm_init_on_chip(adev, AMDGPU_PL_DOORBELL,
adev->doorbell.doorbell_aper_size);
+ if (r) {
+ DRM_ERROR("Failed initializing oa heap.\n");
+ return r;
+ }
+
if (amdgpu_bo_create_kernel(adev, PAGE_SIZE, PAGE_SIZE,
AMDGPU_GEM_DOMAIN_GTT,
&adev->mman.sdma_access_bo, NULL,
&adev->mman.sdma_access_ptr))
DRM_WARN("Debug VRAM access will use slowpath MM access\n");
+ /* Create a doorbell BO for kernel usages */
+ r = amdgpu_bo_create_kernel(adev,
+ adev->mman.doorbell_kernel_bo_size,
+ PAGE_SIZE,
+ AMDGPU_GEM_DOMAIN_DOORBELL,
+ &adev->mman.doorbell_kernel_bo,
+ &adev->mman.doorbell_gpu_addr,
+ (void **)&adev->mman.doorbell_cpu_addr);
+
+ if (r) {
+ DRM_ERROR("Failed to create doorbell BO, err=%d\n", r);
+ return r;
+ }
+