mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 14:53:58 -04:00
drm/amdgpu: accommodate DOMAIN/PL_DOORBELL
This patch adds changes:
- to accommodate the new GEM domain for DOORBELLs
- to accommodate the new TTM PL for DOORBELLs
in order to manage doorbell pages as GEM object.
V2: Addressed reviwe comments from Christian
- drop the doorbell changes for pinning/unpinning
- drop the doorbell changes for dma-buf map
- drop the doorbell changes for sgt
- no need to handle TTM_PL_FLAG_CONTIGUOUS for doorbell
- add caching type for doorbell
V3: - Removed unrelated empty line (Christian)
- Add PL_DOORBELL in mem_type_to_domain() as well (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: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Shashank Sharma <shashank.sharma@amd.com>
This commit is contained in:
@@ -127,6 +127,7 @@ static void amdgpu_evict_flags(struct ttm_buffer_object *bo,
|
||||
case AMDGPU_PL_GDS:
|
||||
case AMDGPU_PL_GWS:
|
||||
case AMDGPU_PL_OA:
|
||||
case AMDGPU_PL_DOORBELL:
|
||||
placement->num_placement = 0;
|
||||
placement->num_busy_placement = 0;
|
||||
return;
|
||||
@@ -496,9 +497,11 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict,
|
||||
if (old_mem->mem_type == AMDGPU_PL_GDS ||
|
||||
old_mem->mem_type == AMDGPU_PL_GWS ||
|
||||
old_mem->mem_type == AMDGPU_PL_OA ||
|
||||
old_mem->mem_type == AMDGPU_PL_DOORBELL ||
|
||||
new_mem->mem_type == AMDGPU_PL_GDS ||
|
||||
new_mem->mem_type == AMDGPU_PL_GWS ||
|
||||
new_mem->mem_type == AMDGPU_PL_OA) {
|
||||
new_mem->mem_type == AMDGPU_PL_OA ||
|
||||
new_mem->mem_type == AMDGPU_PL_DOORBELL) {
|
||||
/* Nothing to save here */
|
||||
ttm_bo_move_null(bo, new_mem);
|
||||
goto out;
|
||||
@@ -582,6 +585,12 @@ static int amdgpu_ttm_io_mem_reserve(struct ttm_device *bdev,
|
||||
mem->bus.offset += adev->gmc.aper_base;
|
||||
mem->bus.is_iomem = true;
|
||||
break;
|
||||
case AMDGPU_PL_DOORBELL:
|
||||
mem->bus.offset = mem->start << PAGE_SHIFT;
|
||||
mem->bus.offset += adev->doorbell.base;
|
||||
mem->bus.is_iomem = true;
|
||||
mem->bus.caching = ttm_uncached;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -596,6 +605,10 @@ static unsigned long amdgpu_ttm_io_mem_pfn(struct ttm_buffer_object *bo,
|
||||
|
||||
amdgpu_res_first(bo->resource, (u64)page_offset << PAGE_SHIFT, 0,
|
||||
&cursor);
|
||||
|
||||
if (bo->resource->mem_type == AMDGPU_PL_DOORBELL)
|
||||
return ((uint64_t)(adev->doorbell.base + cursor.start)) >> PAGE_SHIFT;
|
||||
|
||||
return (adev->gmc.aper_base + cursor.start) >> PAGE_SHIFT;
|
||||
}
|
||||
|
||||
@@ -1305,6 +1318,7 @@ uint64_t amdgpu_ttm_tt_pde_flags(struct ttm_tt *ttm, struct ttm_resource *mem)
|
||||
flags |= AMDGPU_PTE_VALID;
|
||||
|
||||
if (mem && (mem->mem_type == TTM_PL_TT ||
|
||||
mem->mem_type == AMDGPU_PL_DOORBELL ||
|
||||
mem->mem_type == AMDGPU_PL_PREEMPT)) {
|
||||
flags |= AMDGPU_PTE_SYSTEM;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user