drm/ttm/pool: Fix ttm_pool_alloc error path
authorThomas Hellström <thomas.hellstrom@linux.intel.com>
Tue, 4 Apr 2023 20:06:48 +0000 (22:06 +0200)
committerThomas Hellström <thomas.hellstrom@linux.intel.com>
Thu, 6 Apr 2023 07:55:57 +0000 (09:55 +0200)
commit379989e7cbdc7aa7496a00ee286ec146c7599cf0
tree6070143e89b5f9223d384b2b2e7acc9f072879bc
parent864b438085df0a9b93f264e3c8a0f68db1e93bdc
drm/ttm/pool: Fix ttm_pool_alloc error path

When hitting an error, the error path forgot to unmap dma mappings and
could call set_pages_wb() on already uncached pages.

Fix this by introducing a common ttm_pool_free_range() function that
does the right thing.

v2:
- Simplify that common function (Christian König)
v3:
- Rename that common function to ttm_pool_free_range() (Christian König)

Fixes: d099fc8f540a ("drm/ttm: new TT backend allocation pool v3")
Cc: Christian König <christian.koenig@amd.com>
Cc: Dave Airlie <airlied@redhat.com>
Cc: Christian Koenig <christian.koenig@amd.com>
Cc: Huang Rui <ray.huang@amd.com>
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230404200650.11043-2-thomas.hellstrom@linux.intel.com
drivers/gpu/drm/ttm/ttm_pool.c