linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/i915: By default, enable RC6 on IVB and SNB when reasonable
@ 2011-11-19  6:41 Keith Packard
  2011-11-19  7:37 ` [Intel-gfx] " Kenneth Graunke
                   ` (4 more replies)
  0 siblings, 5 replies; 25+ messages in thread
From: Keith Packard @ 2011-11-19  6:41 UTC (permalink / raw)
  To: intel-gfx; +Cc: linux-kernel, dri-devel, Keith Packard

RC6 should always work on IVB, and should work on SNB whenever IO
remapping is disabled. Make the default value for the parameter turn
it on in these cases. Setting the value to either 0 or 1 will force
the specified behavior.

Signed-off-by: Keith Packard <keithp@keithp.com>
---
 drivers/gpu/drm/i915/i915_drv.c      |    4 ++--
 drivers/gpu/drm/i915/i915_drv.h      |    2 +-
 drivers/gpu/drm/i915/intel_display.c |   26 +++++++++++++++++++++++---
 3 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 15bfa91..cf5c1bd 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -63,10 +63,10 @@ module_param_named(semaphores, i915_semaphores, int, 0600);
 MODULE_PARM_DESC(semaphores,
 		"Use semaphores for inter-ring sync (default: false)");
 
-unsigned int i915_enable_rc6 __read_mostly = 0;
+int i915_enable_rc6 __read_mostly = -1;
 module_param_named(i915_enable_rc6, i915_enable_rc6, int, 0600);
 MODULE_PARM_DESC(i915_enable_rc6,
-		"Enable power-saving render C-state 6 (default: true)");
+		"Enable power-saving render C-state 6 (default: -1 (false when VT-d enabled)");
 
 int i915_enable_fbc __read_mostly = -1;
 module_param_named(i915_enable_fbc, i915_enable_fbc, int, 0600);
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 4a9c1b9..172b022 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1002,7 +1002,7 @@ extern unsigned int i915_semaphores __read_mostly;
 extern unsigned int i915_lvds_downclock __read_mostly;
 extern int i915_panel_use_ssc __read_mostly;
 extern int i915_vbt_sdvo_panel_type __read_mostly;
-extern unsigned int i915_enable_rc6 __read_mostly;
+extern int i915_enable_rc6 __read_mostly;
 extern int i915_enable_fbc __read_mostly;
 extern bool i915_enable_hangcheck __read_mostly;
 
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index e77a863..13fd4c0 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -38,8 +38,11 @@
 #include "i915_drv.h"
 #include "i915_trace.h"
 #include "drm_dp_helper.h"
-
 #include "drm_crtc_helper.h"
+#ifdef CONFIG_INTEL_IOMMU
+#include <linux/dma_remapping.h>
+#include <linux/dmar.h>
+#endif
 
 #define HAS_eDP (intel_pipe_has_type(crtc, INTEL_OUTPUT_EDP))
 
@@ -7887,6 +7890,23 @@ void intel_init_emon(struct drm_device *dev)
 	dev_priv->corr = (lcfuse & LCFUSE_HIV_MASK);
 }
 
+static bool intel_enable_rc6(struct drm_device *dev)
+{
+	if (i915_enable_rc6 >= 0)
+		return i915_enable_rc6;
+	if (INTEL_INFO(dev)->gen >= 7)
+		return 1;
+#ifdef CONFIG_INTEL_IOMMU
+	/*
+	 * Only enable RC6 if all dma remapping is disabled, or if
+	 * there's no iommu present in the machine.
+	 */
+	if (INTEL_INFO(dev)->gen == 6)
+		return no_iommu || dmar_disabled;
+#endif
+	return 0;
+}
+
 void gen6_enable_rps(struct drm_i915_private *dev_priv)
 {
 	u32 rp_state_cap = I915_READ(GEN6_RP_STATE_CAP);
@@ -7923,7 +7943,7 @@ void gen6_enable_rps(struct drm_i915_private *dev_priv)
 	I915_WRITE(GEN6_RC6p_THRESHOLD, 100000);
 	I915_WRITE(GEN6_RC6pp_THRESHOLD, 64000); /* unused */
 
-	if (i915_enable_rc6)
+	if (intel_enable_rc6(dev_priv->dev))
 		rc6_mask = GEN6_RC_CTL_RC6p_ENABLE |
 			GEN6_RC_CTL_RC6_ENABLE;
 
@@ -8372,7 +8392,7 @@ void ironlake_enable_rc6(struct drm_device *dev)
 	/* rc6 disabled by default due to repeated reports of hanging during
 	 * boot and resume.
 	 */
-	if (!i915_enable_rc6)
+	if (!intel_enable_rc6(dev))
 		return;
 
 	mutex_lock(&dev->struct_mutex);
-- 
1.7.7.3


^ permalink raw reply related	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2011-12-13  3:46 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-19  6:41 [PATCH] drm/i915: By default, enable RC6 on IVB and SNB when reasonable Keith Packard
2011-11-19  7:37 ` [Intel-gfx] " Kenneth Graunke
2011-11-19  9:25 ` Eugeni Dodonov
2011-11-19 18:32   ` Keith Packard
2011-11-20 21:19     ` Eugeni Dodonov
2011-11-22 20:15 ` Matthew Garrett
     [not found]   ` <CAC7Lmnts+QwZ2XTvbTQa=aa3XO5_Sna0vk3KHWJJ6oi6+D5BXw@mail.gmail.com>
2011-11-22 20:51     ` Matthew Garrett
2011-11-23  3:31   ` Keith Packard
2011-11-23 10:26     ` Daniel Vetter
2011-11-23 14:01       ` David Woodhouse
2011-11-23 14:39         ` Daniel Vetter
2011-11-23 15:03           ` David Woodhouse
2011-11-23 15:31             ` Daniel Vetter
2011-11-23 15:36               ` David Woodhouse
2011-11-23 15:46               ` Daniel Vetter
2011-11-23 15:41             ` Daniel Vetter
2011-11-23 15:43               ` David Woodhouse
2011-11-23 20:35                 ` Daniel Vetter
2011-11-23 18:42 ` [PATCH] iommu: export no_iommu and dmar_disabled symbols Eugeni Dodonov
2011-11-23 20:36   ` [Intel-gfx] " David Woodhouse
2011-11-23 20:48     ` Keith Packard
     [not found] ` <1322526298-2746-1-git-send-email-eugeni.dodonov@intel.com>
2011-12-09 23:53   ` drm/i915: Enabling RC6 where possible Keith Packard
2011-12-09 23:53     ` [PATCH 1/2] iommu: Export intel_iommu_enabled to signal when iommu is in use Keith Packard
2011-12-09 23:53     ` [PATCH 2/2] drm/i915: By default, enable RC6 on IVB and SNB when reasonable Keith Packard
2011-12-13  3:45       ` Matthew Garrett

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).