Commit d55f9b87 authored by Huang Rui's avatar Huang Rui Committed by Alex Deucher

drm/ttm: clean up non-x86 definitions on ttm_page_alloc

All non-x86 definitions are moved to ttm_set_memory header, so remove it from
ttm_page_alloc.c.
Suggested-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarHuang Rui <ray.huang@amd.com>
Reviewed-by: default avatarBas Nieuwenhuizen <basni@chromium.org>
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent c7bb1e57
...@@ -47,13 +47,7 @@ ...@@ -47,13 +47,7 @@
#include <drm/ttm/ttm_bo_driver.h> #include <drm/ttm/ttm_bo_driver.h>
#include <drm/ttm/ttm_page_alloc.h> #include <drm/ttm/ttm_page_alloc.h>
#include <drm/ttm/ttm_set_memory.h>
#if IS_ENABLED(CONFIG_AGP)
#include <asm/agp.h>
#endif
#ifdef CONFIG_X86
#include <asm/set_memory.h>
#endif
#define NUM_PAGES_TO_ALLOC (PAGE_SIZE/sizeof(struct page *)) #define NUM_PAGES_TO_ALLOC (PAGE_SIZE/sizeof(struct page *))
#define SMALL_ALLOCATION 16 #define SMALL_ALLOCATION 16
...@@ -222,52 +216,6 @@ static struct kobj_type ttm_pool_kobj_type = { ...@@ -222,52 +216,6 @@ static struct kobj_type ttm_pool_kobj_type = {
static struct ttm_pool_manager *_manager; static struct ttm_pool_manager *_manager;
#ifndef CONFIG_X86
static int set_pages_wb(struct page *page, int numpages)
{
#if IS_ENABLED(CONFIG_AGP)
int i;
for (i = 0; i < numpages; i++)
unmap_page_from_agp(page++);
#endif
return 0;
}
static int set_pages_array_wb(struct page **pages, int addrinarray)
{
#if IS_ENABLED(CONFIG_AGP)
int i;
for (i = 0; i < addrinarray; i++)
unmap_page_from_agp(pages[i]);
#endif
return 0;
}
static int set_pages_array_wc(struct page **pages, int addrinarray)
{
#if IS_ENABLED(CONFIG_AGP)
int i;
for (i = 0; i < addrinarray; i++)
map_page_into_agp(pages[i]);
#endif
return 0;
}
static int set_pages_array_uc(struct page **pages, int addrinarray)
{
#if IS_ENABLED(CONFIG_AGP)
int i;
for (i = 0; i < addrinarray; i++)
map_page_into_agp(pages[i]);
#endif
return 0;
}
#endif
/** /**
* Select the right pool or requested caching state and ttm flags. */ * Select the right pool or requested caching state and ttm flags. */
static struct ttm_page_pool *ttm_get_pool(int flags, bool huge, static struct ttm_page_pool *ttm_get_pool(int flags, bool huge,
...@@ -302,13 +250,13 @@ static void ttm_pages_put(struct page *pages[], unsigned npages, ...@@ -302,13 +250,13 @@ static void ttm_pages_put(struct page *pages[], unsigned npages,
unsigned int i, pages_nr = (1 << order); unsigned int i, pages_nr = (1 << order);
if (order == 0) { if (order == 0) {
if (set_pages_array_wb(pages, npages)) if (ttm_set_pages_array_wb(pages, npages))
pr_err("Failed to set %d pages to wb!\n", npages); pr_err("Failed to set %d pages to wb!\n", npages);
} }
for (i = 0; i < npages; ++i) { for (i = 0; i < npages; ++i) {
if (order > 0) { if (order > 0) {
if (set_pages_wb(pages[i], pages_nr)) if (ttm_set_pages_wb(pages[i], pages_nr))
pr_err("Failed to set %d pages to wb!\n", pages_nr); pr_err("Failed to set %d pages to wb!\n", pages_nr);
} }
__free_pages(pages[i], order); __free_pages(pages[i], order);
...@@ -498,12 +446,12 @@ static int ttm_set_pages_caching(struct page **pages, ...@@ -498,12 +446,12 @@ static int ttm_set_pages_caching(struct page **pages,
/* Set page caching */ /* Set page caching */
switch (cstate) { switch (cstate) {
case tt_uncached: case tt_uncached:
r = set_pages_array_uc(pages, cpages); r = ttm_set_pages_array_uc(pages, cpages);
if (r) if (r)
pr_err("Failed to set %d pages to uc!\n", cpages); pr_err("Failed to set %d pages to uc!\n", cpages);
break; break;
case tt_wc: case tt_wc:
r = set_pages_array_wc(pages, cpages); r = ttm_set_pages_array_wc(pages, cpages);
if (r) if (r)
pr_err("Failed to set %d pages to wc!\n", cpages); pr_err("Failed to set %d pages to wc!\n", cpages);
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment