Commit db78e27d authored by Francisco Jerez's avatar Francisco Jerez Committed by Dave Airlie

drm/ttm: Avoid conflicting reserve_memtype during ttm_tt_set_page_caching.

Fixes errors like:
> reserve_ram_pages_type failed 0x15b7a000-0x15b7b000, track 0x8, req 0x10
when a BO is moved between WC and UC areas.
Reported-by: default avatarXavier Chantry <shiningxc@gmail.com>
Signed-off-by: default avatarFrancisco Jerez <currojerez@riseup.net>
Acked-by: default avatarThomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent f28cf339
...@@ -198,17 +198,26 @@ EXPORT_SYMBOL(ttm_tt_populate); ...@@ -198,17 +198,26 @@ EXPORT_SYMBOL(ttm_tt_populate);
static inline int ttm_tt_set_page_caching(struct page *p, static inline int ttm_tt_set_page_caching(struct page *p,
enum ttm_caching_state c_state) enum ttm_caching_state c_state)
{ {
int ret = 0;
if (PageHighMem(p)) if (PageHighMem(p))
return 0; return 0;
switch (c_state) { if (get_page_memtype(p) != -1) {
case tt_cached: /* p isn't in the default caching state, set it to
return set_pages_wb(p, 1); * writeback first to free its current memtype. */
case tt_wc:
return set_memory_wc((unsigned long) page_address(p), 1); ret = set_pages_wb(p, 1);
default: if (ret)
return set_pages_uc(p, 1); return ret;
} }
if (c_state == tt_wc)
ret = set_memory_wc((unsigned long) page_address(p), 1);
else if (c_state == tt_uncached)
ret = set_pages_uc(p, 1);
return ret;
} }
#else /* CONFIG_X86 */ #else /* CONFIG_X86 */
static inline int ttm_tt_set_page_caching(struct page *p, static inline int ttm_tt_set_page_caching(struct page *p,
......
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