Skip to content

Commit 811ee9d

Browse files
drm/ttm: make sure pool pages are cleared
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: d099fc8 ("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
1 parent 1926a05 commit 811ee9d

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

drivers/gpu/drm/ttm/ttm_pool.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
#include <linux/module.h>
3535
#include <linux/dma-mapping.h>
36+
#include <linux/highmem.h>
3637

3738
#ifdef CONFIG_X86
3839
#include <asm/set_memory.h>
@@ -218,6 +219,15 @@ static void ttm_pool_unmap(struct ttm_pool *pool, dma_addr_t dma_addr,
218219
/* Give pages into a specific pool_type */
219220
static void ttm_pool_type_give(struct ttm_pool_type *pt, struct page *p)
220221
{
222+
unsigned int i, num_pages = 1 << pt->order;
223+
224+
for (i = 0; i < num_pages; ++i) {
225+
if (PageHighMem(p))
226+
clear_highpage(p + i);
227+
else
228+
clear_page(page_address(p + i));
229+
}
230+
221231
spin_lock(&pt->lock);
222232
list_add(&p->lru, &pt->pages);
223233
spin_unlock(&pt->lock);

0 commit comments

Comments
 (0)