drm/ttm: stop dangerous caching attribute change
authorChristian König <christian.koenig@amd.com>
Fri, 18 Sep 2020 14:34:49 +0000 (16:34 +0200)
committerChristian König <christian.koenig@amd.com>
Wed, 23 Sep 2020 13:21:05 +0000 (15:21 +0200)
commitdb9c1734ad69c0ba5e5e420ba31ebc1048976be6
treeae0486c7a4a0bf6245468e2a4cf4cbb84f9238b9
parent4127a6204970b3d7cb140117472eb3dd99bd1a0d
drm/ttm: stop dangerous caching attribute change

When we swapout/in a BO we try to change the caching
attributes of the pages before/after doing the copy.

On x86 this is done by calling set_pages_uc(),
set_memory_wc() or set_pages_wb() for not highmem pages
to update the linear mapping of the page.

On all other platforms we do exactly nothing.

Now on x86 this is unnecessary because copy_highpage() will
either create a temporary mapping of the page which is wb
anyway and destroyed immediately again or use the linear
mapping with the correct caching attributes.

So stop this nonsense and just keep the caching as it is and
return an error when a driver tries to change the caching of
an already populated TT object.

This is much more defensive since changing caching
attributes is platform and driver specific and usually
doesn't work after the page was initially allocated.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Link: https://patchwork.freedesktop.org/patch/391293/
drivers/gpu/drm/ttm/ttm_bo.c
drivers/gpu/drm/ttm/ttm_tt.c
include/drm/ttm/ttm_set_memory.h