Josh Boyer 6f1d3b
From b67e0a6a7409f9c1a12e573fb7d8d80ee455b103 Mon Sep 17 00:00:00 2001
Josh Boyer 6f1d3b
From: Adam Jackson <ajax@redhat.com>
Josh Boyer 6f1d3b
Date: Mon, 17 Jun 2013 09:59:34 -0400
Josh Boyer 6f1d3b
Subject: [PATCH] drm/radeon: Disable writeback by default on ppc
Josh Boyer 6f1d3b
Josh Boyer 6f1d3b
At least on an IBM Power 720, this check passes, but several piglit
Josh Boyer 6f1d3b
tests will reliably trigger GPU resets due to the ring buffer pointers
Josh Boyer 6f1d3b
not being updated.  There's probably a better way to limit this to just
Josh Boyer 6f1d3b
affected machines though.
Josh Boyer 6f1d3b
Josh Boyer 6f1d3b
Signed-off-by: Adam Jackson <ajax@redhat.com>
Josh Boyer 6f1d3b
---
Josh Boyer 6f1d3b
 drivers/gpu/drm/radeon/r600_cp.c       | 7 +++++++
Josh Boyer 6f1d3b
 drivers/gpu/drm/radeon/radeon_cp.c     | 7 +++++++
Josh Boyer 6f1d3b
 drivers/gpu/drm/radeon/radeon_device.c | 4 ++--
Josh Boyer 6f1d3b
 drivers/gpu/drm/radeon/radeon_drv.c    | 2 +-
Josh Boyer 6f1d3b
 4 files changed, 17 insertions(+), 3 deletions(-)
Josh Boyer 6f1d3b
Josh Boyer 6f1d3b
diff --git a/drivers/gpu/drm/radeon/r600_cp.c b/drivers/gpu/drm/radeon/r600_cp.c
Josh Boyer 6f1d3b
index 1c51c08..ef28532 100644
Josh Boyer 6f1d3b
--- a/drivers/gpu/drm/radeon/r600_cp.c
Josh Boyer 6f1d3b
+++ b/drivers/gpu/drm/radeon/r600_cp.c
Josh Boyer 6f1d3b
@@ -552,6 +552,13 @@ static void r600_test_writeback(drm_radeon_private_t *dev_priv)
Josh Boyer 6f1d3b
 		dev_priv->writeback_works = 0;
Josh Boyer 6f1d3b
 		DRM_INFO("writeback test failed\n");
Josh Boyer 6f1d3b
 	}
Josh Boyer 6f1d3b
+#if defined(__ppc__) || defined(__ppc64__)
Josh Boyer 6f1d3b
+	/* the test might succeed on ppc, but it's usually not reliable */
Josh Boyer 6f1d3b
+	if (radeon_no_wb == -1) {
Josh Boyer 6f1d3b
+		radeon_no_wb = 1;
Josh Boyer 6f1d3b
+		DRM_INFO("not trusting writeback test due to arch quirk\n");
Josh Boyer 6f1d3b
+	}
Josh Boyer 6f1d3b
+#endif
Josh Boyer 6f1d3b
 	if (radeon_no_wb == 1) {
Josh Boyer 6f1d3b
 		dev_priv->writeback_works = 0;
Josh Boyer 6f1d3b
 		DRM_INFO("writeback forced off\n");
Josh Boyer 6f1d3b
diff --git a/drivers/gpu/drm/radeon/radeon_cp.c b/drivers/gpu/drm/radeon/radeon_cp.c
Josh Boyer 6f1d3b
index efc4f64..a967b33 100644
Josh Boyer 6f1d3b
--- a/drivers/gpu/drm/radeon/radeon_cp.c
Josh Boyer 6f1d3b
+++ b/drivers/gpu/drm/radeon/radeon_cp.c
Josh Boyer 6f1d3b
@@ -892,6 +892,13 @@ static void radeon_test_writeback(drm_radeon_private_t * dev_priv)
Josh Boyer 6f1d3b
 		dev_priv->writeback_works = 0;
Josh Boyer 6f1d3b
 		DRM_INFO("writeback test failed\n");
Josh Boyer 6f1d3b
 	}
Josh Boyer 6f1d3b
+#if defined(__ppc__) || defined(__ppc64__)
Josh Boyer 6f1d3b
+	/* the test might succeed on ppc, but it's usually not reliable */
Josh Boyer 6f1d3b
+	if (radeon_no_wb == -1) {
Josh Boyer 6f1d3b
+		radeon_no_wb = 1;
Josh Boyer 6f1d3b
+		DRM_INFO("not trusting writeback test due to arch quirk\n");
Josh Boyer 6f1d3b
+	}
Josh Boyer 6f1d3b
+#endif
Josh Boyer 6f1d3b
 	if (radeon_no_wb == 1) {
Josh Boyer 6f1d3b
 		dev_priv->writeback_works = 0;
Josh Boyer 6f1d3b
 		DRM_INFO("writeback forced off\n");
Josh Boyer 6f1d3b
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
Josh Boyer 6f1d3b
index 1899738..524046e 100644
Josh Boyer 6f1d3b
--- a/drivers/gpu/drm/radeon/radeon_device.c
Josh Boyer 6f1d3b
+++ b/drivers/gpu/drm/radeon/radeon_device.c
Josh Boyer 6f1d3b
@@ -322,8 +322,8 @@ int radeon_wb_init(struct radeon_device *rdev)
Josh Boyer 6f1d3b
 	/* disable event_write fences */
Josh Boyer 6f1d3b
 	rdev->wb.use_event = false;
Josh Boyer 6f1d3b
 	/* disabled via module param */
Josh Boyer 6f1d3b
-	if (radeon_no_wb == 1) {
Josh Boyer 6f1d3b
-		rdev->wb.enabled = false;
Josh Boyer 6f1d3b
+	if (radeon_no_wb != -1) {
Josh Boyer 6f1d3b
+		rdev->wb.enabled = !!radeon_no_wb;
Josh Boyer 6f1d3b
 	} else {
Josh Boyer 6f1d3b
 		if (rdev->flags & RADEON_IS_AGP) {
Josh Boyer 6f1d3b
 			/* often unreliable on AGP */
Josh Boyer 6f1d3b
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
Josh Boyer 6f1d3b
index 094e7e5..04809d4 100644
Josh Boyer 6f1d3b
--- a/drivers/gpu/drm/radeon/radeon_drv.c
Josh Boyer 6f1d3b
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
Josh Boyer 6f1d3b
@@ -146,7 +146,7 @@ static inline void radeon_register_atpx_handler(void) {}
Josh Boyer 6f1d3b
 static inline void radeon_unregister_atpx_handler(void) {}
Josh Boyer 6f1d3b
 #endif
Josh Boyer 6f1d3b
 
Josh Boyer 6f1d3b
-int radeon_no_wb;
Josh Boyer 6f1d3b
+int radeon_no_wb = -1;
Josh Boyer 6f1d3b
 int radeon_modeset = -1;
Josh Boyer 6f1d3b
 int radeon_dynclks = -1;
Josh Boyer 6f1d3b
 int radeon_r4xx_atom = 0;
Josh Boyer 6f1d3b
-- 
Josh Boyer 6f1d3b
1.8.2.1
Josh Boyer 6f1d3b