@@ -304,7 +304,7 @@ static int radeon_move_vram_ram(struct ttm_buffer_object *bo,
return r;
}
- r = ttm_tt_set_placement_caching(bo->ttm, tmp_mem.placement);
+ r = ttm_tt_set_placement_caching(bo->ttm, &tmp_mem.placement);
if (unlikely(r)) {
goto out_cleanup;
}
@@ -305,7 +305,7 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo,
goto out_err;
}
- ret = ttm_tt_set_placement_caching(bo->ttm, mem->placement);
+ ret = ttm_tt_set_placement_caching(bo->ttm, &mem->placement);
if (ret)
goto out_err;
@@ -59,7 +59,7 @@ int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
old_mem->mem_type = TTM_PL_SYSTEM;
}
- ret = ttm_tt_set_placement_caching(ttm, new_mem->placement);
+ ret = ttm_tt_set_placement_caching(ttm, &new_mem->placement);
if (unlikely(ret != 0))
return ret;
@@ -89,14 +89,6 @@ static inline int ttm_tt_set_page_caching(struct page *p,
return ret;
}
-#else /* CONFIG_X86 */
-static inline int ttm_tt_set_page_caching(struct page *p,
- enum ttm_caching_state c_old,
- enum ttm_caching_state c_new)
-{
- return 0;
-}
-#endif /* CONFIG_X86 */
/*
* Change caching policy for the linear kernel map
@@ -149,19 +141,37 @@ out_err:
return ret;
}
-int ttm_tt_set_placement_caching(struct ttm_tt *ttm, uint32_t placement)
+int ttm_tt_set_placement_caching(struct ttm_tt *ttm, uint32_t *placement)
{
enum ttm_caching_state state;
- if (placement & TTM_PL_FLAG_WC)
+ if (*placement & TTM_PL_FLAG_WC)
state = tt_wc;
- else if (placement & TTM_PL_FLAG_UNCACHED)
+ else if (*placement & TTM_PL_FLAG_UNCACHED)
state = tt_uncached;
else
state = tt_cached;
return ttm_tt_set_caching(ttm, state);
}
+#else /* CONFIG_X86 */
+int ttm_tt_set_placement_caching(struct ttm_tt *ttm, uint32_t *placement)
+{
+ if (*placement & (TTM_PL_TT | TTM_PL_FLAG_SYSTEM)) {
+ ttm->caching_state = tt_cached;
+ *placement &= ~TTM_PL_MASK_CACHING;
+ *placement |= TTM_PL_FLAG_CACHED;
+ } else {
+ if (*placement & TTM_PL_FLAG_WC)
+ ttm->caching_state = tt_wc;
+ else if (*placement & TTM_PL_FLAG_UNCACHED)
+ ttm->caching_state = tt_uncached;
+ else
+ ttm->caching_state = tt_cached;
+ }
+ return 0;
+}
+#endif /* CONFIG_X86 */
EXPORT_SYMBOL(ttm_tt_set_placement_caching);
void ttm_tt_destroy(struct ttm_tt *ttm)
@@ -669,7 +669,7 @@ extern int ttm_tt_swapin(struct ttm_tt *ttm);
* hit RAM. This function may be very costly as it involves global TLB
* and cache flushes and potential page splitting / combining.
*/
-extern int ttm_tt_set_placement_caching(struct ttm_tt *ttm, uint32_t placement);
+extern int ttm_tt_set_placement_caching(struct ttm_tt *ttm, uint32_t *placement);
extern int ttm_tt_swapout(struct ttm_tt *ttm,
struct file *persistent_swap_storage);