From db9c1734ad69c0ba5e5e420ba31ebc1048976be6 Mon Sep 17 00:00:00 2001 From: Christian König Date: Fri, 18 Sep 2020 16:34:49 +0200 Subject: drm/ttm: stop dangerous caching attribute change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Alex Deucher Link: https://patchwork.freedesktop.org/patch/391293/ --- include/drm/ttm/ttm_set_memory.h | 22 ---------------------- 1 file changed, 22 deletions(-) (limited to 'include') diff --git a/include/drm/ttm/ttm_set_memory.h b/include/drm/ttm/ttm_set_memory.h index 3966655b72f1..2343c18a6133 100644 --- a/include/drm/ttm/ttm_set_memory.h +++ b/include/drm/ttm/ttm_set_memory.h @@ -57,18 +57,6 @@ static inline int ttm_set_pages_wb(struct page *page, int numpages) return set_pages_wb(page, numpages); } -static inline int ttm_set_pages_wc(struct page *page, int numpages) -{ - unsigned long addr = (unsigned long)page_address(page); - - return set_memory_wc(addr, numpages); -} - -static inline int ttm_set_pages_uc(struct page *page, int numpages) -{ - return set_pages_uc(page, numpages); -} - #else /* for CONFIG_X86 */ static inline int ttm_set_pages_array_wb(struct page **pages, int addrinarray) @@ -91,16 +79,6 @@ static inline int ttm_set_pages_wb(struct page *page, int numpages) return 0; } -static inline int ttm_set_pages_wc(struct page *page, int numpages) -{ - return 0; -} - -static inline int ttm_set_pages_uc(struct page *page, int numpages) -{ - return 0; -} - #endif /* for CONFIG_X86 */ #endif -- cgit v1.2.3