mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-25 21:46:14 -04:00
drm/amdgpu: Respect placement requirements in amdgpu_gtt_mgr functions
When testing intersection and compatibility, respect
the actual placement requirements. This is a pre-requisite
for ensuring that UVD CS BOs do not cross 256M segments.
Fixes: ded910f368 ("drm/amdgpu: Implement intersect/compatible functions")
Suggested-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
committed by
Alex Deucher
parent
1eedf2c84b
commit
bc06579ca2
@@ -272,7 +272,20 @@ static bool amdgpu_gtt_mgr_intersects(struct ttm_resource_manager *man,
|
||||
const struct ttm_place *place,
|
||||
size_t size)
|
||||
{
|
||||
return !place->lpfn || amdgpu_gtt_mgr_has_gart_addr(res);
|
||||
const struct drm_mm_node *const node = &to_ttm_range_mgr_node(res)->mm_nodes[0];
|
||||
const u32 num_pages = PFN_UP(size);
|
||||
|
||||
if (!place->lpfn)
|
||||
return true;
|
||||
|
||||
if (!amdgpu_gtt_mgr_has_gart_addr(res))
|
||||
return false;
|
||||
|
||||
if (place->fpfn >= (node->start + num_pages) ||
|
||||
(place->lpfn && place->lpfn <= node->start))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -290,7 +303,20 @@ static bool amdgpu_gtt_mgr_compatible(struct ttm_resource_manager *man,
|
||||
const struct ttm_place *place,
|
||||
size_t size)
|
||||
{
|
||||
return !place->lpfn || amdgpu_gtt_mgr_has_gart_addr(res);
|
||||
const struct drm_mm_node *const node = &to_ttm_range_mgr_node(res)->mm_nodes[0];
|
||||
const u32 num_pages = PFN_UP(size);
|
||||
|
||||
if (!place->lpfn)
|
||||
return true;
|
||||
|
||||
if (!amdgpu_gtt_mgr_has_gart_addr(res))
|
||||
return false;
|
||||
|
||||
if (node->start < place->fpfn ||
|
||||
(place->lpfn && (node->start + num_pages) > place->lpfn))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user