aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Widawsky <ben@bwidawsk.net>2012-09-02 01:59:47 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2012-09-03 04:20:43 -0400
commitb67a4376d53e1ae6eaef05389cfd0e6e5b7097db (patch)
tree20606e3e2fb028b48a700e1ea57ca87b32780b2d
parent5fa7ac9c9cadd598a22c09660c270bdb92da1e91 (diff)
drm/i915: Extract forcewake ack timeout
It's used all over the place, and we want to be able to play around with the value, apparently. Note that it doesn't touch other timeouts of the same value (like gtfifo, and thread C0 wait). Signed-off-by: Ben Widawsky <ben@bwidawsk.net> Reviewed-by: Chris Wilson <chris@chris-wilson.oc.uk> [danvet: fixup conflict with vlv forcewake patches.] Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r--drivers/gpu/drm/i915/intel_pm.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index ec7fbf956ff5..fd8d37f97a45 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -31,6 +31,8 @@
31#include "../../../platform/x86/intel_ips.h" 31#include "../../../platform/x86/intel_ips.h"
32#include <linux/module.h> 32#include <linux/module.h>
33 33
34#define FORCEWAKE_ACK_TIMEOUT_US 500
35
34/* FBC, or Frame Buffer Compression, is a technique employed to compress the 36/* FBC, or Frame Buffer Compression, is a technique employed to compress the
35 * framebuffer contents in-memory, aiming at reducing the required bandwidth 37 * framebuffer contents in-memory, aiming at reducing the required bandwidth
36 * during in-memory transfers and, therefore, reduce the power packet. 38 * during in-memory transfers and, therefore, reduce the power packet.
@@ -3962,13 +3964,15 @@ static void __gen6_gt_force_wake_get(struct drm_i915_private *dev_priv)
3962 else 3964 else
3963 forcewake_ack = FORCEWAKE_ACK; 3965 forcewake_ack = FORCEWAKE_ACK;
3964 3966
3965 if (wait_for_atomic_us((I915_READ_NOTRACE(forcewake_ack) & 1) == 0, 500)) 3967 if (wait_for_atomic_us((I915_READ_NOTRACE(forcewake_ack) & 1) == 0,
3968 FORCEWAKE_ACK_TIMEOUT_US))
3966 DRM_ERROR("Timed out waiting for forcewake old ack to clear.\n"); 3969 DRM_ERROR("Timed out waiting for forcewake old ack to clear.\n");
3967 3970
3968 I915_WRITE_NOTRACE(FORCEWAKE, 1); 3971 I915_WRITE_NOTRACE(FORCEWAKE, 1);
3969 POSTING_READ(FORCEWAKE); 3972 POSTING_READ(FORCEWAKE);
3970 3973
3971 if (wait_for_atomic_us((I915_READ_NOTRACE(forcewake_ack) & 1), 500)) 3974 if (wait_for_atomic_us((I915_READ_NOTRACE(forcewake_ack) & 1),
3975 FORCEWAKE_ACK_TIMEOUT_US))
3972 DRM_ERROR("Timed out waiting for forcewake to ack request.\n"); 3976 DRM_ERROR("Timed out waiting for forcewake to ack request.\n");
3973 3977
3974 __gen6_gt_wait_for_thread_c0(dev_priv); 3978 __gen6_gt_wait_for_thread_c0(dev_priv);
@@ -3983,13 +3987,15 @@ static void __gen6_gt_force_wake_mt_get(struct drm_i915_private *dev_priv)
3983 else 3987 else
3984 forcewake_ack = FORCEWAKE_MT_ACK; 3988 forcewake_ack = FORCEWAKE_MT_ACK;
3985 3989
3986 if (wait_for_atomic_us((I915_READ_NOTRACE(forcewake_ack) & 1) == 0, 500)) 3990 if (wait_for_atomic_us((I915_READ_NOTRACE(forcewake_ack) & 1) == 0,
3991 FORCEWAKE_ACK_TIMEOUT_US))
3987 DRM_ERROR("Timed out waiting for forcewake old ack to clear.\n"); 3992 DRM_ERROR("Timed out waiting for forcewake old ack to clear.\n");
3988 3993
3989 I915_WRITE_NOTRACE(FORCEWAKE_MT, _MASKED_BIT_ENABLE(1)); 3994 I915_WRITE_NOTRACE(FORCEWAKE_MT, _MASKED_BIT_ENABLE(1));
3990 POSTING_READ(FORCEWAKE_MT); 3995 POSTING_READ(FORCEWAKE_MT);
3991 3996
3992 if (wait_for_atomic_us((I915_READ_NOTRACE(forcewake_ack) & 1), 500)) 3997 if (wait_for_atomic_us((I915_READ_NOTRACE(forcewake_ack) & 1),
3998 FORCEWAKE_ACK_TIMEOUT_US))
3993 DRM_ERROR("Timed out waiting for forcewake to ack request.\n"); 3999 DRM_ERROR("Timed out waiting for forcewake to ack request.\n");
3994 4000
3995 __gen6_gt_wait_for_thread_c0(dev_priv); 4001 __gen6_gt_wait_for_thread_c0(dev_priv);
@@ -4069,12 +4075,14 @@ int __gen6_gt_wait_for_fifo(struct drm_i915_private *dev_priv)
4069 4075
4070static void vlv_force_wake_get(struct drm_i915_private *dev_priv) 4076static void vlv_force_wake_get(struct drm_i915_private *dev_priv)
4071{ 4077{
4072 if (wait_for_atomic_us((I915_READ_NOTRACE(FORCEWAKE_ACK_VLV) & 1) == 0, 500)) 4078 if (wait_for_atomic_us((I915_READ_NOTRACE(FORCEWAKE_ACK_VLV) & 1) == 0,
4079 FORCEWAKE_ACK_TIMEOUT_US))
4073 DRM_ERROR("Timed out waiting for forcewake old ack to clear.\n"); 4080 DRM_ERROR("Timed out waiting for forcewake old ack to clear.\n");
4074 4081
4075 I915_WRITE_NOTRACE(FORCEWAKE_VLV, _MASKED_BIT_ENABLE(1)); 4082 I915_WRITE_NOTRACE(FORCEWAKE_VLV, _MASKED_BIT_ENABLE(1));
4076 4083
4077 if (wait_for_atomic_us((I915_READ_NOTRACE(FORCEWAKE_ACK_VLV) & 1), 500)) 4084 if (wait_for_atomic_us((I915_READ_NOTRACE(FORCEWAKE_ACK_VLV) & 1),
4085 FORCEWAKE_ACK_TIMEOUT_US))
4078 DRM_ERROR("Timed out waiting for forcewake to ack request.\n"); 4086 DRM_ERROR("Timed out waiting for forcewake to ack request.\n");
4079 4087
4080 __gen6_gt_wait_for_thread_c0(dev_priv); 4088 __gen6_gt_wait_for_thread_c0(dev_priv);