]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/ttm: make sure pool pages are cleared
authorChristian König <christian.koenig@amd.com>
Wed, 10 Feb 2021 13:24:27 +0000 (14:24 +0100)
committerChristian König <christian.koenig@amd.com>
Thu, 11 Feb 2021 08:35:19 +0000 (09:35 +0100)
The old implementation wasn't consistend on this.

But it looks like we depend on this so better bring it back.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reported-and-tested-by: Mike Galbraith <efault@gmx.de>
Fixes: 7201121c7743 ("drm/ttm: new TT backend allocation pool v3")
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20210210160549.1462-1-christian.koenig@amd.com
drivers/gpu/drm/ttm/ttm_pool.c

index 74bf1c84b63742065c546a8442e973169c31db8f..6e27cb1bf48b2effb0d9f14eac0d21483f712d49 100644 (file)
@@ -33,6 +33,7 @@
 
 #include <linux/module.h>
 #include <linux/dma-mapping.h>
+#include <linux/highmem.h>
 
 #ifdef CONFIG_X86
 #include <asm/set_memory.h>
@@ -218,6 +219,15 @@ static void ttm_pool_unmap(struct ttm_pool *pool, dma_addr_t dma_addr,
 /* Give pages into a specific pool_type */
 static void ttm_pool_type_give(struct ttm_pool_type *pt, struct page *p)
 {
+       unsigned int i, num_pages = 1 << pt->order;
+
+       for (i = 0; i < num_pages; ++i) {
+               if (PageHighMem(p))
+                       clear_highpage(p + i);
+               else
+                       clear_page(page_address(p + i));
+       }
+
        spin_lock(&pt->lock);
        list_add(&p->lru, &pt->pages);
        spin_unlock(&pt->lock);