@@ -1308,6 +1308,24 @@ int ttm_bo_evict_mm(struct ttm_bo_device *bdev, unsigned
}
EXPORT_SYMBOL(ttm_bo_evict_mm);
+static void ttm_bo_filter_mem_type(struct ttm_bo_device *bdev, unsigned type,
+ struct ttm_mem_type_manager *man)
+{
+ /*
+ * On some architectures/patforms, we cannot allow non-cachable
+ * mappings of system memory. This can be a problem with AGP on
+ * old G5 systems vs. TTM_PL_TT but we don't really have a choice
+ * at this point on ppc64 at least and the AGP on these never
+ * worked reliably anyway.
+ */
+#if defined(CONFIG_PPC) && !defined(CONFIG_NOT_COHERENT_CACHE)
+ if (type == TTM_PL_SYSTEM || type == TTM_PL_TT) {
+ man->available_caching &= TTM_PL_FLAG_CACHED;
+ man->default_caching &= man->available_caching;
+ }
+#endif
+}
+
int ttm_bo_init_mm(struct ttm_bo_device *bdev, unsigned type,
unsigned long p_size)
{
@@ -1327,6 +1345,8 @@ int ttm_bo_init_mm(struct ttm_bo_device *bdev, unsigned ty
return ret;
man->bdev = bdev;
+ ttm_bo_filter_mem_type(bdev, type, man);
+
ret = 0;
if (type != TTM_PL_SYSTEM) {
ret = (*man->func->init)(man, p_size);