drm/amdgpu: Fix VRAM BO swap issue
authorArunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
Tue, 4 Oct 2022 14:33:39 +0000 (07:33 -0700)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 6 Oct 2022 16:07:37 +0000 (12:07 -0400)
commit312b4dc11d4f74bfe03ea25ffe04c1f2fdd13cb9
tree9eb4fe8bd531019100a25ab8298057972c2caea3
parent7e4ab9fb2b9449ef01977e79157d06c8900f73fd
drm/amdgpu: Fix VRAM BO swap issue

DRM buddy manager allocates the contiguous memory requests in
a single block or multiple blocks. So for the ttm move operation
(incase of low vram memory) we should consider all the blocks to
compute the total memory size which compared with the struct
ttm_resource num_pages in order to verify that the blocks are
contiguous for the eviction process.

v2: Added a Fixes tag
v3: Rewrite the code to save a bit of calculations and
    variables (Christian)

Fixes: c9cad937c0c5 ("drm/amdgpu: add drm buddy support to amdgpu")
Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c