[PATCH 4.4 214/342] drm/radeon: mask out WC from BO on unsupported arches

From: Greg Kroah-Hartman
Date: Tue Mar 01 2016 - 18:57:38 EST


4.4-stable review patch. If anyone has any objections, please let me know.

------------------

From: Oded Gabbay <oded.gabbay@xxxxxxxxx>

commit c5244987394648913ae1a03879c58058a2fc2cee upstream.

Reviewed-by: Christian KÃnig <christian.koenig@xxxxxxx>
Reviewed-by: Michel DÃnzer <michel.daenzer@xxxxxxx>
Signed-off-by: Oded Gabbay <oded.gabbay@xxxxxxxxx>
Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
drivers/gpu/drm/radeon/radeon_object.c | 7 +++++++
1 file changed, 7 insertions(+)

--- a/drivers/gpu/drm/radeon/radeon_object.c
+++ b/drivers/gpu/drm/radeon/radeon_object.c
@@ -33,6 +33,7 @@
#include <linux/slab.h>
#include <drm/drmP.h>
#include <drm/radeon_drm.h>
+#include <drm/drm_cache.h>
#include "radeon.h"
#include "radeon_trace.h"

@@ -245,6 +246,12 @@ int radeon_bo_create(struct radeon_devic
DRM_INFO_ONCE("Please enable CONFIG_MTRR and CONFIG_X86_PAT for "
"better performance thanks to write-combining\n");
bo->flags &= ~(RADEON_GEM_GTT_WC | RADEON_GEM_GTT_UC);
+#else
+ /* For architectures that don't support WC memory,
+ * mask out the WC flag from the BO
+ */
+ if (!drm_arch_can_wc_memory())
+ bo->flags &= ~RADEON_GEM_GTT_WC;
#endif

radeon_ttm_placement_from_domain(bo, domain);