All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/10] drm-intel-collector - update
@ 2014-07-03 21:32 Rodrigo Vivi
  2014-07-03 21:32 ` [PATCH 01/10] drm/i915: Bring UP Power Wells before disabling RC6 Rodrigo Vivi
                   ` (10 more replies)
  0 siblings, 11 replies; 16+ messages in thread
From: Rodrigo Vivi @ 2014-07-03 21:32 UTC (permalink / raw)
  To: intel-gfx; +Cc: Rodrigo Vivi


This is another drm-intel-collector updated notice:
http://cgit.freedesktop.org/~vivijim/drm-intel/log/?h=drm-intel-collector

It was 4 rounds out of date what made it hard to get old patches. However Daniel and Jani didn't leave
many patches behind.
0 on Apr 4 - Apr 16
1 on Apr 16 - May 6
2 on May 6 - May 23
3 on May 23 - Jun 6

Next round Jun 6 to Jun 20 is only after next drm-intel-testing update.

Here goes the update list in order for better reviewers assignment:

Patch     drm/i915: Bring UP Power Wells before disabling RC6. - Reviewer: Paulo Zanoni <paulo.r.zanoni@intel.com> - Reviewer:
Patch     drm/i915: Don't save/restore RS when not used - Reviewer:
Patch     drm/i915: Upgrade execbuffer fail after resume failure to EIO - Reviewer:
Patch     drm/i915: Add property to set HDMI aspect ratio - Reviewer: Ville Syrjälä <ville.syrjala@linux.intel.com> - Reviewer:
Patch     drm/i915/vlv: WA for Turbo and RC6 to work together. - Reviewer:
Patch     drm/i915: honour forced connector modes - Reviewer:
Patch     drm/i915: HWS must be in the mappable region for g33 - Reviewer:
Patch     drm/i915: Don't promote UC to WT automagically - Reviewer:
Patch     drm/i915/bdw: Always issue a force restore - Reviewer:
Patch     drm/i915/vlv: T12 eDP panel timing enforcement during reboot. - Reviewer:


There are some reasons that some patches can be left behind:
1. Your patch didn't applied cleanly and I couldn't easily solve the conflicts.
2. Kernel didn't compiled with your patch.
3. I simply missed it. If you believe this is the case please warn me.
4. Remind that any reply to your email automatically take your patch to next round.

Please help me to get these patches reviewed and queued by Daniel.

Thanks,
Rodrigo.


Ben Widawsky (2):
  drm/i915: Don't save/restore RS when not used
  drm/i915/bdw: Always issue a force restore

Chris Wilson (3):
  drm/i915: Upgrade execbuffer fail after resume failure to EIO
  drm/i915: honour forced connector modes
  drm/i915: HWS must be in the mappable region for g33

Clint Taylor (1):
  drm/i915/vlv: T12 eDP panel timing enforcement during reboot.

Deepak S (2):
  drm/i915: Bring UP Power Wells before disabling RC6.
  drm/i915/vlv: WA for Turbo and RC6 to work together.

Vandana Kannan (1):
  drm/i915: Add property to set HDMI aspect ratio

Ville Syrjälä (1):
  drm/i915: Don't promote UC to WT automagically

 drivers/gpu/drm/i915/i915_drv.h            |  16 ++++
 drivers/gpu/drm/i915/i915_gem.c            |   9 +-
 drivers/gpu/drm/i915/i915_gem_context.c    |  15 ++--
 drivers/gpu/drm/i915/i915_gem_execbuffer.c |  15 +++-
 drivers/gpu/drm/i915/i915_irq.c            | 133 ++++++++++++++++++++++++++++-
 drivers/gpu/drm/i915/i915_reg.h            |  11 +++
 drivers/gpu/drm/i915/intel_dp.c            |  42 +++++++++
 drivers/gpu/drm/i915/intel_drv.h           |   4 +
 drivers/gpu/drm/i915/intel_fbdev.c         |  33 +++----
 drivers/gpu/drm/i915/intel_hdmi.c          |  12 +++
 drivers/gpu/drm/i915/intel_modes.c         |  28 ++++++
 drivers/gpu/drm/i915/intel_pm.c            |  18 +++-
 drivers/gpu/drm/i915/intel_ringbuffer.c    |  16 +++-
 13 files changed, 318 insertions(+), 34 deletions(-)

-- 
1.9.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH 01/10] drm/i915: Bring UP Power Wells before disabling RC6.
  2014-07-03 21:32 [PATCH 00/10] drm-intel-collector - update Rodrigo Vivi
@ 2014-07-03 21:32 ` Rodrigo Vivi
  2014-07-03 21:32 ` [PATCH 02/10] drm/i915: Don't save/restore RS when not used Rodrigo Vivi
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 16+ messages in thread
From: Rodrigo Vivi @ 2014-07-03 21:32 UTC (permalink / raw)
  To: intel-gfx; +Cc: Deepak S, Paulo Zanoni, Rodrigo Vivi

From: Deepak S <deepak.s@intel.com>

We need do forcewake before Disabling RC6, This is what the BIOS
expects while going into suspend.

v2: updated commit message. (Daniel)

Reviewer: Paulo Zanoni <paulo.r.zanoni@intel.com>
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Deepak S <deepak.s@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
 drivers/gpu/drm/i915/intel_pm.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index d771e82..1e4611a 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -3354,8 +3354,14 @@ static void valleyview_disable_rps(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
+	/* we're doing forcewake before Disabling RC6,
+	 * This what the BIOS expects when going into suspend */
+	gen6_gt_force_wake_get(dev_priv, FORCEWAKE_ALL);
+
 	I915_WRITE(GEN6_RC_CONTROL, 0);
 
+	gen6_gt_force_wake_put(dev_priv, FORCEWAKE_ALL);
+
 	gen6_disable_rps_interrupts(dev);
 }
 
-- 
1.9.0

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

* [PATCH 02/10] drm/i915: Don't save/restore RS when not used
  2014-07-03 21:32 [PATCH 00/10] drm-intel-collector - update Rodrigo Vivi
  2014-07-03 21:32 ` [PATCH 01/10] drm/i915: Bring UP Power Wells before disabling RC6 Rodrigo Vivi
@ 2014-07-03 21:32 ` Rodrigo Vivi
  2014-07-03 21:32 ` [PATCH 03/10] drm/i915: Upgrade execbuffer fail after resume failure to EIO Rodrigo Vivi
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 16+ messages in thread
From: Rodrigo Vivi @ 2014-07-03 21:32 UTC (permalink / raw)
  To: intel-gfx; +Cc: Rodrigo Vivi, Ben Widawsky, Ben Widawsky

From: Ben Widawsky <benjamin.widawsky@intel.com>

Cc: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
 drivers/gpu/drm/i915/i915_gem_context.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index 21eda88..633e318 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -545,6 +545,7 @@ mi_set_context(struct intel_engine_cs *ring,
 	       struct intel_context *new_context,
 	       u32 hw_flags)
 {
+	u32 flags = hw_flags | MI_MM_SPACE_GTT;
 	int ret;
 
 	/* w/a: If Flush TLB Invalidation Mode is enabled, driver must do a TLB
@@ -558,6 +559,10 @@ mi_set_context(struct intel_engine_cs *ring,
 			return ret;
 	}
 
+	/* These flags are for resource streamer on HSW+ */
+	if (!IS_HASWELL(ring->dev) && INTEL_INFO(ring->dev)->gen < 8)
+		flags |= (MI_SAVE_EXT_STATE_EN | MI_RESTORE_EXT_STATE_EN);
+
 	ret = intel_ring_begin(ring, 6);
 	if (ret)
 		return ret;
@@ -570,11 +575,8 @@ mi_set_context(struct intel_engine_cs *ring,
 
 	intel_ring_emit(ring, MI_NOOP);
 	intel_ring_emit(ring, MI_SET_CONTEXT);
-	intel_ring_emit(ring, i915_gem_obj_ggtt_offset(new_context->obj) |
-			MI_MM_SPACE_GTT |
-			MI_SAVE_EXT_STATE_EN |
-			MI_RESTORE_EXT_STATE_EN |
-			hw_flags);
+	intel_ring_emit(ring,
+			i915_gem_obj_ggtt_offset(new_context->obj) | flags);
 	/*
 	 * w/a: MI_SET_CONTEXT must always be followed by MI_NOOP
 	 * WaMiSetContext_Hang:snb,ivb,vlv
-- 
1.9.0

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

* [PATCH 03/10] drm/i915: Upgrade execbuffer fail after resume failure to EIO
  2014-07-03 21:32 [PATCH 00/10] drm-intel-collector - update Rodrigo Vivi
  2014-07-03 21:32 ` [PATCH 01/10] drm/i915: Bring UP Power Wells before disabling RC6 Rodrigo Vivi
  2014-07-03 21:32 ` [PATCH 02/10] drm/i915: Don't save/restore RS when not used Rodrigo Vivi
@ 2014-07-03 21:32 ` Rodrigo Vivi
  2014-07-03 21:33 ` [PATCH 04/10] drm/i915: Add property to set HDMI aspect ratio Rodrigo Vivi
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 16+ messages in thread
From: Rodrigo Vivi @ 2014-07-03 21:32 UTC (permalink / raw)
  To: intel-gfx; +Cc: Rodrigo Vivi

From: Chris Wilson <chris@chris-wilson.co.uk>

If we try to execute on a known ring, but it has failed to be
initialised correctly, report that the GPU is hung rather than the
command invalid. This leaves us reporting EINVAL only if the user
requests execution on a ring that is not supported by the device.

This should prevent UXA from getting stuck in a null render loop after a
failed resume.

v2 (Rodrigo): Fix conflict and add VCS2 ring and
   	      s/intel_ring_buffer/intel_engine_cs.

Reported-by: Jiri Kosina <jikos@jikos.cz>
References: https://bugs.freedesktop.org/show_bug.cgi?id=76554
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
 drivers/gpu/drm/i915/i915_gem_execbuffer.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index d815ef5..23786ab 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -1076,6 +1076,19 @@ eb_get_batch(struct eb_vmas *eb)
 	return vma->obj;
 }
 
+static bool
+intel_ring_valid(struct intel_engine_cs *ring)
+{
+	switch (ring->id) {
+	case RCS: return true;
+	case VCS: return HAS_BSD(ring->dev);
+	case BCS: return HAS_BLT(ring->dev);
+	case VECS: return HAS_VEBOX(ring->dev);
+	case VCS2: return HAS_BSD2(ring->dev);
+	default: return false;
+	}
+}
+
 static int
 i915_gem_do_execbuffer(struct drm_device *dev, void *data,
 		       struct drm_file *file,
@@ -1133,7 +1146,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
 	if (!intel_ring_initialized(ring)) {
 		DRM_DEBUG("execbuf with invalid ring: %d\n",
 			  (int)(args->flags & I915_EXEC_RING_MASK));
-		return -EINVAL;
+		return intel_ring_valid(ring) ? -EIO : -EINVAL;
 	}
 
 	mode = args->flags & I915_EXEC_CONSTANTS_MASK;
-- 
1.9.0

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

* [PATCH 04/10] drm/i915: Add property to set HDMI aspect ratio
  2014-07-03 21:32 [PATCH 00/10] drm-intel-collector - update Rodrigo Vivi
                   ` (2 preceding siblings ...)
  2014-07-03 21:32 ` [PATCH 03/10] drm/i915: Upgrade execbuffer fail after resume failure to EIO Rodrigo Vivi
@ 2014-07-03 21:33 ` Rodrigo Vivi
  2014-07-03 21:33 ` [PATCH 05/10] drm/i915/vlv: WA for Turbo and RC6 to work together Rodrigo Vivi
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 16+ messages in thread
From: Rodrigo Vivi @ 2014-07-03 21:33 UTC (permalink / raw)
  To: intel-gfx; +Cc: Daniel Vetter, Jesse Barnes, Rodrigo Vivi

From: Vandana Kannan <vandana.kannan@intel.com>

Added a property to enable user space to set aspect ratio for HDMI displays.
If there is no user specified value, then PAR_NONE/Automatic option is set
by default. User can select aspect ratio 4:3 or 16:9. The aspect ratio
selected by user would come into effect with a mode set.

v2: Daniel's review comments incorporated.
Call for a mode set to update property.

Reviewer: Ville Syrjälä <ville.syrjala@linux.intel.com>
Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Vandana Kannan <vandana.kannan@intel.com>
Cc: Jesse Barnes <jesse.barnes@intel.com>
Cc: Vijay Purushothaman <vijay.a.purushothaman@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h    |  1 +
 drivers/gpu/drm/i915/intel_drv.h   |  2 ++
 drivers/gpu/drm/i915/intel_hdmi.c  | 12 ++++++++++++
 drivers/gpu/drm/i915/intel_modes.c | 28 ++++++++++++++++++++++++++++
 4 files changed, 43 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 8cea596..1bf277e 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1529,6 +1529,7 @@ struct drm_i915_private {
 
 	struct drm_property *broadcast_rgb_property;
 	struct drm_property *force_audio_property;
+	struct drm_property *aspect_ratio_property;
 
 	uint32_t hw_context_size;
 	struct list_head context_list;
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 5f7c7bd..7b4d743 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -495,6 +495,7 @@ struct intel_hdmi {
 	bool has_audio;
 	enum hdmi_force_audio force_audio;
 	bool rgb_quant_range_selectable;
+	enum hdmi_picture_aspect aspect_ratio;
 	void (*write_infoframe)(struct drm_encoder *encoder,
 				enum hdmi_infoframe_type type,
 				const void *frame, ssize_t len);
@@ -923,6 +924,7 @@ int intel_connector_update_modes(struct drm_connector *connector,
 int intel_ddc_get_modes(struct drm_connector *c, struct i2c_adapter *adapter);
 void intel_attach_force_audio_property(struct drm_connector *connector);
 void intel_attach_broadcast_rgb_property(struct drm_connector *connector);
+void intel_attach_aspect_ratio_property(struct drm_connector *connector);
 
 
 /* intel_overlay.c */
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index 2422413..1851284 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -367,6 +367,9 @@ static void intel_hdmi_set_avi_infoframe(struct drm_encoder *encoder,
 	union hdmi_infoframe frame;
 	int ret;
 
+	/* Set user selected PAR to incoming mode's member */
+	adjusted_mode->picture_aspect_ratio = intel_hdmi->aspect_ratio;
+
 	ret = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi,
 						       adjusted_mode);
 	if (ret < 0) {
@@ -1124,6 +1127,11 @@ intel_hdmi_set_property(struct drm_connector *connector,
 		goto done;
 	}
 
+	if (property == dev_priv->aspect_ratio_property) {
+		intel_hdmi->aspect_ratio = val;
+		goto done;
+	}
+
 	return -EINVAL;
 
 done:
@@ -1484,6 +1492,7 @@ intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *c
 {
 	intel_attach_force_audio_property(connector);
 	intel_attach_broadcast_rgb_property(connector);
+	intel_attach_aspect_ratio_property(connector);
 	intel_hdmi->color_range_auto = true;
 }
 
@@ -1551,6 +1560,9 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
 		intel_connector->get_hw_state = intel_connector_get_hw_state;
 	intel_connector->unregister = intel_connector_unregister;
 
+	/* Initialize aspect ratio member of intel_hdmi */
+	intel_hdmi->aspect_ratio = HDMI_PICTURE_ASPECT_NONE;
+
 	intel_hdmi_add_properties(intel_hdmi, connector);
 
 	intel_connector_attach_encoder(intel_connector, intel_encoder);
diff --git a/drivers/gpu/drm/i915/intel_modes.c b/drivers/gpu/drm/i915/intel_modes.c
index 0e860f3..6f814da 100644
--- a/drivers/gpu/drm/i915/intel_modes.c
+++ b/drivers/gpu/drm/i915/intel_modes.c
@@ -126,3 +126,31 @@ intel_attach_broadcast_rgb_property(struct drm_connector *connector)
 
 	drm_object_attach_property(&connector->base, prop, 0);
 }
+
+static const struct drm_prop_enum_list aspect_ratio_names[] = {
+	{ HDMI_PICTURE_ASPECT_NONE, "Automatic" },
+	{ HDMI_PICTURE_ASPECT_4_3, "4:3" },
+	{ HDMI_PICTURE_ASPECT_16_9, "16:9" },
+};
+
+void
+intel_attach_aspect_ratio_property(struct drm_connector *connector)
+{
+	struct drm_device *dev = connector->dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_property *prop;
+
+	prop = dev_priv->aspect_ratio_property;
+	if (prop == NULL) {
+		prop = drm_property_create_enum(dev, DRM_MODE_PROP_ENUM,
+					   "HDMI aspect ratio",
+					   aspect_ratio_names,
+					   ARRAY_SIZE(aspect_ratio_names));
+		if (prop == NULL)
+			return;
+
+		dev_priv->aspect_ratio_property = prop;
+	}
+
+	drm_object_attach_property(&connector->base, prop, 0);
+}
-- 
1.9.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH 05/10] drm/i915/vlv: WA for Turbo and RC6 to work together.
  2014-07-03 21:32 [PATCH 00/10] drm-intel-collector - update Rodrigo Vivi
                   ` (3 preceding siblings ...)
  2014-07-03 21:33 ` [PATCH 04/10] drm/i915: Add property to set HDMI aspect ratio Rodrigo Vivi
@ 2014-07-03 21:33 ` Rodrigo Vivi
  2014-07-08 19:05   ` Daniel Vetter
  2014-07-03 21:33 ` [PATCH 06/10] drm/i915: honour forced connector modes Rodrigo Vivi
                   ` (5 subsequent siblings)
  10 siblings, 1 reply; 16+ messages in thread
From: Rodrigo Vivi @ 2014-07-03 21:33 UTC (permalink / raw)
  To: intel-gfx; +Cc: Rodrigo Vivi

From: Deepak S <deepak.s@linux.intel.com>

With RC6 enabled, BYT has an HW issue in determining the right
Gfx busyness.
WA for Turbo + RC6: Use SW based Gfx busy-ness detection to decide
on increasing/decreasing the freq. This logic will monitor C0
counters of render/media power-wells over EI period and takes
necessary action based on these values

v2: Refactor duplicate code. (Ville)

v3: Reformat the comments. (Ville)

v4: Enable required counters and remove unwanted code (Ville)

v5: Added frequency change acceleration support and remove kernel-doc
style comments. (Ville)

v6: Updated comment section and Fix w/a comment. (Ville)

Signed-off-by: Deepak S <deepak.s@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h |  15 +++++
 drivers/gpu/drm/i915/i915_irq.c | 133 +++++++++++++++++++++++++++++++++++++++-
 drivers/gpu/drm/i915/i915_reg.h |  11 ++++
 drivers/gpu/drm/i915/intel_pm.c |  12 +++-
 4 files changed, 167 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 1bf277e..db33a34 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -880,6 +880,12 @@ struct vlv_s0ix_state {
 	u32 clock_gate_dis2;
 };
 
+struct intel_rps_ei_calc {
+	u32 cz_ts_ei;
+	u32 render_ei_c0;
+	u32 media_ei_c0;
+};
+
 struct intel_gen6_power_mgmt {
 	/* work and pm_iir are protected by dev_priv->irq_lock */
 	struct work_struct work;
@@ -904,6 +910,8 @@ struct intel_gen6_power_mgmt {
 	u8 rp1_freq;		/* "less than" RP0 power/freqency */
 	u8 rp0_freq;		/* Non-overclocked max frequency. */
 
+	u32 ei_interrupt_count;
+
 	int last_adj;
 	enum { LOW_POWER, BETWEEN, HIGH_POWER } power;
 
@@ -1504,6 +1512,13 @@ struct drm_i915_private {
 	/* gen6+ rps state */
 	struct intel_gen6_power_mgmt rps;
 
+	/* rps wa up ei calculation */
+	struct intel_rps_ei_calc rps_up_ei;
+
+	/* rps wa down ei calculation */
+	struct intel_rps_ei_calc rps_down_ei;
+
+
 	/* ilk-only ips/rps state. Everything in here is protected by the global
 	 * mchdev_lock in intel_pm.c */
 	struct intel_ilk_power_mgmt ips;
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 0217a41..7ae17af 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -1225,6 +1225,131 @@ static void notify_ring(struct drm_device *dev,
 	i915_queue_hangcheck(dev);
 }
 
+static u32 vlv_c0_residency(struct drm_i915_private *dev_priv,
+				struct  intel_rps_ei_calc *rps_ei)
+{
+	u32 cz_ts, cz_freq_khz;
+	u32 render_count, media_count;
+	u32 elapsed_render, elapsed_media, elapsed_time;
+	u32 residency = 0;
+
+	cz_ts = vlv_punit_read(dev_priv, PUNIT_REG_CZ_TIMESTAMP);
+	cz_freq_khz = DIV_ROUND_CLOSEST(dev_priv->mem_freq * 1000, 4);
+
+	render_count = I915_READ(VLV_RENDER_C0_COUNT_REG);
+	media_count = I915_READ(VLV_MEDIA_C0_COUNT_REG);
+
+	if (rps_ei->cz_ts_ei == 0) {
+		rps_ei->cz_ts_ei = cz_ts;
+		rps_ei->render_ei_c0 = render_count;
+		rps_ei->media_ei_c0 = media_count;
+
+		return dev_priv->rps.cur_freq;
+	}
+
+	elapsed_time = cz_ts - rps_ei->cz_ts_ei;
+	rps_ei->cz_ts_ei = cz_ts;
+
+	elapsed_render = render_count - rps_ei->render_ei_c0;
+	rps_ei->render_ei_c0 = render_count;
+
+	elapsed_media = media_count - rps_ei->media_ei_c0;
+	rps_ei->media_ei_c0 = media_count;
+
+	/* Convert all the counters into common unit of milli sec */
+	elapsed_time /= VLV_CZ_CLOCK_TO_MILLI_SEC;
+	elapsed_render /=  cz_freq_khz;
+	elapsed_media /= cz_freq_khz;
+
+	/*
+	 * Calculate overall C0 residency percentage
+	 * only if elapsed time is non zero
+	 */
+	if (elapsed_time) {
+		residency =
+			((max(elapsed_render, elapsed_media) * 100)
+				/ elapsed_time);
+	}
+
+	return residency;
+}
+
+/**
+ * vlv_calc_delay_from_C0_counters - Increase/Decrease freq based on GPU
+ * busy-ness calculated from C0 counters of render & media power wells
+ * @dev_priv: DRM device private
+ *
+ */
+static u32 vlv_calc_delay_from_C0_counters(struct drm_i915_private *dev_priv)
+{
+	u32 residency_C0_up = 0, residency_C0_down = 0;
+	u8 new_delay, adj;
+
+	dev_priv->rps.ei_interrupt_count++;
+
+	WARN_ON(!mutex_is_locked(&dev_priv->rps.hw_lock));
+
+
+	if (dev_priv->rps_up_ei.cz_ts_ei == 0) {
+		vlv_c0_residency(dev_priv, &dev_priv->rps_up_ei);
+		vlv_c0_residency(dev_priv, &dev_priv->rps_down_ei);
+		return dev_priv->rps.cur_freq;
+	}
+
+
+	/*
+	 * To down throttle, C0 residency should be less than down threshold
+	 * for continous EI intervals. So calculate down EI counters
+	 * once in VLV_INT_COUNT_FOR_DOWN_EI
+	 */
+	if (dev_priv->rps.ei_interrupt_count == VLV_INT_COUNT_FOR_DOWN_EI) {
+
+		dev_priv->rps.ei_interrupt_count = 0;
+
+		residency_C0_down = vlv_c0_residency(dev_priv,
+						&dev_priv->rps_down_ei);
+	} else {
+		residency_C0_up = vlv_c0_residency(dev_priv,
+						&dev_priv->rps_up_ei);
+	}
+
+	new_delay = dev_priv->rps.cur_freq;
+
+	adj = dev_priv->rps.last_adj;
+	/* C0 residency is greater than UP threshold. Increase Frequency */
+	if (residency_C0_up >= VLV_RP_UP_EI_THRESHOLD) {
+		if (adj > 0)
+			adj *= 2;
+		else
+			adj = 1;
+
+		if (dev_priv->rps.cur_freq < dev_priv->rps.max_freq_softlimit)
+			new_delay = dev_priv->rps.cur_freq + adj;
+
+		/*
+		 * For better performance, jump directly
+		 * to RPe if we're below it.
+		 */
+		if (new_delay < dev_priv->rps.efficient_freq)
+			new_delay = dev_priv->rps.efficient_freq;
+
+	} else if (!dev_priv->rps.ei_interrupt_count &&
+			(residency_C0_down < VLV_RP_DOWN_EI_THRESHOLD)) {
+		if (adj < 0)
+			adj *= 2;
+		else
+			adj = -1;
+		/*
+		 * This means, C0 residency is less than down threshold over
+		 * a period of VLV_INT_COUNT_FOR_DOWN_EI. So, reduce the freq
+		 */
+		if (dev_priv->rps.cur_freq > dev_priv->rps.min_freq_softlimit)
+			new_delay = dev_priv->rps.cur_freq + adj;
+	}
+
+	return new_delay;
+}
+
 static void gen6_pm_rps_work(struct work_struct *work)
 {
 	struct drm_i915_private *dev_priv =
@@ -1273,6 +1398,8 @@ static void gen6_pm_rps_work(struct work_struct *work)
 		else
 			new_delay = dev_priv->rps.min_freq_softlimit;
 		adj = 0;
+	} else if (pm_iir & GEN6_PM_RP_UP_EI_EXPIRED) {
+		new_delay = vlv_calc_delay_from_C0_counters(dev_priv);
 	} else if (pm_iir & GEN6_PM_RP_DOWN_THRESHOLD) {
 		if (adj < 0)
 			adj *= 2;
@@ -4363,7 +4490,11 @@ void intel_irq_init(struct drm_device *dev)
 	INIT_WORK(&dev_priv->l3_parity.error_work, ivybridge_parity_work);
 
 	/* Let's track the enabled rps events */
-	dev_priv->pm_rps_events = GEN6_PM_RPS_EVENTS;
+	if (IS_VALLEYVIEW(dev))
+		/* WaGsvRC0ResidenncyMethod:VLV */
+		dev_priv->pm_rps_events = GEN6_PM_RP_UP_EI_EXPIRED;
+	else
+		dev_priv->pm_rps_events = GEN6_PM_RPS_EVENTS;
 
 	setup_timer(&dev_priv->gpu_error.hangcheck_timer,
 		    i915_hangcheck_elapsed,
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 3488567..99413ae 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -525,6 +525,7 @@ enum punit_power_well {
 #define PUNIT_REG_GPU_FREQ_STS			0xd8
 #define   GENFREQSTATUS				(1<<0)
 #define PUNIT_REG_MEDIA_TURBO_FREQ_REQ		0xdc
+#define PUNIT_REG_CZ_TIMESTAMP			0xce
 
 #define PUNIT_FUSE_BUS2				0xf6 /* bits 47:40 */
 #define PUNIT_FUSE_BUS1				0xf5 /* bits 55:48 */
@@ -550,6 +551,11 @@ enum punit_power_well {
 #define   FB_FMAX_VMIN_FREQ_LO_SHIFT		27
 #define   FB_FMAX_VMIN_FREQ_LO_MASK		0xf8000000
 
+#define VLV_CZ_CLOCK_TO_MILLI_SEC		100000
+#define VLV_RP_UP_EI_THRESHOLD			90
+#define VLV_RP_DOWN_EI_THRESHOLD		70
+#define VLV_INT_COUNT_FOR_DOWN_EI		5
+
 /* vlv2 north clock has */
 #define CCK_FUSE_REG				0x8
 #define  CCK_FUSE_HPLL_FREQ_MASK		0x3
@@ -5383,6 +5389,7 @@ enum punit_power_well {
 #define   VLV_GTLC_ALLOWWAKEERR			(1 << 1)
 #define   VLV_GTLC_PW_MEDIA_STATUS_MASK		(1 << 5)
 #define   VLV_GTLC_PW_RENDER_STATUS_MASK	(1 << 7)
+#define VLV_GTLC_SURVIVABILITY_REG              0x130098
 #define  FORCEWAKE_MT				0xa188 /* multi-threaded */
 #define   FORCEWAKE_KERNEL			0x1
 #define   FORCEWAKE_USER			0x2
@@ -5530,6 +5537,8 @@ enum punit_power_well {
 #define GEN6_GT_GFX_RC6_LOCKED			0x138104
 #define VLV_COUNTER_CONTROL			0x138104
 #define   VLV_COUNT_RANGE_HIGH			(1<<15)
+#define   VLV_MEDIA_RC0_COUNT_EN		(1<<5)
+#define   VLV_RENDER_RC0_COUNT_EN		(1<<4)
 #define   VLV_MEDIA_RC6_COUNT_EN		(1<<1)
 #define   VLV_RENDER_RC6_COUNT_EN		(1<<0)
 #define GEN6_GT_GFX_RC6				0x138108
@@ -5538,6 +5547,8 @@ enum punit_power_well {
 
 #define GEN6_GT_GFX_RC6p			0x13810C
 #define GEN6_GT_GFX_RC6pp			0x138110
+#define VLV_RENDER_C0_COUNT_REG		0x138118
+#define VLV_MEDIA_C0_COUNT_REG			0x13811C
 
 #define GEN6_PCODE_MAILBOX			0x138124
 #define   GEN6_PCODE_READY			(1<<31)
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 1e4611a..8ea96ff 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -3235,8 +3235,11 @@ static void vlv_set_rps_idle(struct drm_i915_private *dev_priv)
 
 	vlv_force_gfx_clock(dev_priv, false);
 
-	I915_WRITE(GEN6_PMINTRMSK,
-		   gen6_rps_pm_mask(dev_priv, dev_priv->rps.cur_freq));
+	if (dev_priv->pm_rps_events & GEN6_PM_RP_UP_EI_EXPIRED)
+		I915_WRITE(GEN6_PMINTRMSK, ~dev_priv->pm_rps_events);
+	else 
+		I915_WRITE(GEN6_PMINTRMSK,
+			   gen6_rps_pm_mask(dev_priv, dev_priv->rps.cur_freq));
 }
 
 void gen6_rps_idle(struct drm_i915_private *dev_priv)
@@ -4076,6 +4079,7 @@ static void valleyview_enable_rps(struct drm_device *dev)
 	I915_WRITE(GEN6_RP_DOWN_EI, 350000);
 
 	I915_WRITE(GEN6_RP_IDLE_HYSTERSIS, 10);
+	I915_WRITE(GEN6_RP_DOWN_TIMEOUT, 0xf4240);
 
 	I915_WRITE(GEN6_RP_CONTROL,
 		   GEN6_RP_MEDIA_TURBO |
@@ -4096,9 +4100,11 @@ static void valleyview_enable_rps(struct drm_device *dev)
 
 	/* allows RC6 residency counter to work */
 	I915_WRITE(VLV_COUNTER_CONTROL,
-		   _MASKED_BIT_ENABLE(VLV_COUNT_RANGE_HIGH |
+		   _MASKED_BIT_ENABLE(VLV_MEDIA_RC0_COUNT_EN |
+				      VLV_RENDER_RC0_COUNT_EN |
 				      VLV_MEDIA_RC6_COUNT_EN |
 				      VLV_RENDER_RC6_COUNT_EN));
+
 	if (intel_enable_rc6(dev) & INTEL_RC6_ENABLE)
 		rc6_mode = GEN7_RC_CTL_TO_MODE | VLV_RC_CTL_CTX_RST_PARALLEL;
 
-- 
1.9.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH 06/10] drm/i915: honour forced connector modes
  2014-07-03 21:32 [PATCH 00/10] drm-intel-collector - update Rodrigo Vivi
                   ` (4 preceding siblings ...)
  2014-07-03 21:33 ` [PATCH 05/10] drm/i915/vlv: WA for Turbo and RC6 to work together Rodrigo Vivi
@ 2014-07-03 21:33 ` Rodrigo Vivi
  2014-07-03 21:33 ` [PATCH 07/10] drm/i915: HWS must be in the mappable region for g33 Rodrigo Vivi
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 16+ messages in thread
From: Rodrigo Vivi @ 2014-07-03 21:33 UTC (permalink / raw)
  To: intel-gfx; +Cc: Rodrigo Vivi

From: Chris Wilson <chris@chris-wilson.co.uk>

In the move over to use BIOS connector configs, we lost the ability to
force a specific set of connectors on or off.  Try to remedy that by
dropping back to the old behavior if we detect a hard coded connector
config that tries to enable a connector (disabling is easy!).

Based on earlier patches by Jesse Barnes.

v2: Remove Jesse's patch

Reported-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
 drivers/gpu/drm/i915/intel_fbdev.c | 33 ++++++++++++---------------------
 1 file changed, 12 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
index 226fbc7..34c1a3d 100644
--- a/drivers/gpu/drm/i915/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/intel_fbdev.c
@@ -331,24 +331,6 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
 	int num_connectors_enabled = 0;
 	int num_connectors_detected = 0;
 
-	/*
-	 * If the user specified any force options, just bail here
-	 * and use that config.
-	 */
-	for (i = 0; i < fb_helper->connector_count; i++) {
-		struct drm_fb_helper_connector *fb_conn;
-		struct drm_connector *connector;
-
-		fb_conn = fb_helper->connector_info[i];
-		connector = fb_conn->connector;
-
-		if (!enabled[i])
-			continue;
-
-		if (connector->force != DRM_FORCE_UNSPECIFIED)
-			return false;
-	}
-
 	save_enabled = kcalloc(dev->mode_config.num_connector, sizeof(bool),
 			       GFP_KERNEL);
 	if (!save_enabled)
@@ -374,8 +356,18 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
 			continue;
 		}
 
+		if (connector->force == DRM_FORCE_OFF) {
+			DRM_DEBUG_KMS("connector %s is disabled by user, skipping\n",
+				      connector->name);
+			enabled[i] = false;
+			continue;
+		}
+
 		encoder = connector->encoder;
 		if (!encoder || WARN_ON(!encoder->crtc)) {
+			if (connector->force > DRM_FORCE_OFF)
+				goto bail;
+
 			DRM_DEBUG_KMS("connector %s has no encoder or crtc, skipping\n",
 				      connector->name);
 			enabled[i] = false;
@@ -394,8 +386,7 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
 		for (j = 0; j < fb_helper->connector_count; j++) {
 			if (crtcs[j] == new_crtc) {
 				DRM_DEBUG_KMS("fallback: cloned configuration\n");
-				fallback = true;
-				goto out;
+				goto bail;
 			}
 		}
 
@@ -466,8 +457,8 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper,
 		fallback = true;
 	}
 
-out:
 	if (fallback) {
+bail:
 		DRM_DEBUG_KMS("Not using firmware configuration\n");
 		memcpy(enabled, save_enabled, dev->mode_config.num_connector);
 		kfree(save_enabled);
-- 
1.9.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH 07/10] drm/i915: HWS must be in the mappable region for g33
  2014-07-03 21:32 [PATCH 00/10] drm-intel-collector - update Rodrigo Vivi
                   ` (5 preceding siblings ...)
  2014-07-03 21:33 ` [PATCH 06/10] drm/i915: honour forced connector modes Rodrigo Vivi
@ 2014-07-03 21:33 ` Rodrigo Vivi
  2014-07-08 19:07   ` Daniel Vetter
  2014-07-03 21:33 ` [PATCH 08/10] drm/i915: Don't promote UC to WT automagically Rodrigo Vivi
                   ` (3 subsequent siblings)
  10 siblings, 1 reply; 16+ messages in thread
From: Rodrigo Vivi @ 2014-07-03 21:33 UTC (permalink / raw)
  To: intel-gfx; +Cc: Rodrigo Vivi

From: Chris Wilson <chris@chris-wilson.co.uk>

On g33, the documentation states

"HWS_PGA:
 Format = Bits 28:12 of graphics memory address (bits 31:29 MBZ)."

which translates to that the address of the HWS must be below 256MiB,
which is conveniently the mappable aperture.

This also appears to be true (but not documented as so) for gen4 and
gen5. To generalise we force it into the low mappable region for all
non-LLC platforms. If we locate the HWS at the top of the GTT the
machine will hard hang during boot (fails on pnv, gm45, ilk and byt,
but works on snb, ivb, hsw).

v2: Add comments to explain why use PIN_MAPPABLE even though we have
    no intention of mapping the object. (Ville)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
 drivers/gpu/drm/i915/intel_ringbuffer.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index 2faef26..f49a3dd 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -1331,6 +1331,7 @@ static int init_status_page(struct intel_engine_cs *ring)
 	struct drm_i915_gem_object *obj;
 
 	if ((obj = ring->status_page.obj) == NULL) {
+		unsigned flags;
 		int ret;
 
 		obj = i915_gem_alloc_object(ring->dev, 4096);
@@ -1343,7 +1344,20 @@ static int init_status_page(struct intel_engine_cs *ring)
 		if (ret)
 			goto err_unref;
 
-		ret = i915_gem_obj_ggtt_pin(obj, 4096, 0);
+		flags = 0;
+		if (!HAS_LLC(ring->dev))
+			/* On g33, we cannot place HWS above 256MiB, so
+			 * restrict its pinning to the low mappable arena.
+			 * Though this restriction is not documented for
+			 * gen4, gen5, or byt, they also behave similarly
+			 * and hang if the HWS is placed at the top of the
+			 * GTT. To generalise, it appears that all !llc
+			 * platforms have issues with us placing the HWS
+			 * above the mappable region (even though we never
+			 * actualy map it).
+			 */
+			flags |= PIN_MAPPABLE;
+		ret = i915_gem_obj_ggtt_pin(obj, 4096, flags);
 		if (ret) {
 err_unref:
 			drm_gem_object_unreference(&obj->base);
-- 
1.9.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH 08/10] drm/i915: Don't promote UC to WT automagically
  2014-07-03 21:32 [PATCH 00/10] drm-intel-collector - update Rodrigo Vivi
                   ` (6 preceding siblings ...)
  2014-07-03 21:33 ` [PATCH 07/10] drm/i915: HWS must be in the mappable region for g33 Rodrigo Vivi
@ 2014-07-03 21:33 ` Rodrigo Vivi
  2014-07-03 21:33 ` [PATCH 09/10] drm/i915/bdw: Always issue a force restore Rodrigo Vivi
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 16+ messages in thread
From: Rodrigo Vivi @ 2014-07-03 21:33 UTC (permalink / raw)
  To: intel-gfx; +Cc: Rodrigo Vivi

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

If the object is already UC leave it as UC instead of automagically
promoting it to WT in i915_gem_object_pin_to_display_plane() when
the hardware is WT capable.

Supposedly the user wanted UC for a reason, so let's respect that.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
 drivers/gpu/drm/i915/i915_gem.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index f6d1238..b705d2d 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -3838,6 +3838,7 @@ i915_gem_object_pin_to_display_plane(struct drm_i915_gem_object *obj,
 				     struct intel_engine_cs *pipelined)
 {
 	u32 old_read_domains, old_write_domain;
+	unsigned int cache_level;
 	bool was_pin_display;
 	int ret;
 
@@ -3862,8 +3863,12 @@ i915_gem_object_pin_to_display_plane(struct drm_i915_gem_object *obj,
 	 * of uncaching, which would allow us to flush all the LLC-cached data
 	 * with that bit in the PTE to main memory with just one PIPE_CONTROL.
 	 */
-	ret = i915_gem_object_set_cache_level(obj,
-					      HAS_WT(obj->base.dev) ? I915_CACHE_WT : I915_CACHE_NONE);
+	if (HAS_WT(obj->base.dev) && obj->cache_level != I915_CACHE_NONE)
+		cache_level = I915_CACHE_WT;
+	else
+		cache_level = I915_CACHE_NONE;
+
+	ret = i915_gem_object_set_cache_level(obj, cache_level);
 	if (ret)
 		goto err_unpin_display;
 
-- 
1.9.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH 09/10] drm/i915/bdw: Always issue a force restore
  2014-07-03 21:32 [PATCH 00/10] drm-intel-collector - update Rodrigo Vivi
                   ` (7 preceding siblings ...)
  2014-07-03 21:33 ` [PATCH 08/10] drm/i915: Don't promote UC to WT automagically Rodrigo Vivi
@ 2014-07-03 21:33 ` Rodrigo Vivi
  2014-07-03 21:38   ` Ben Widawsky
  2014-07-03 21:33 ` [PATCH 10/10] drm/i915/vlv: T12 eDP panel timing enforcement during reboot Rodrigo Vivi
  2014-07-08 19:09 ` [PATCH 00/10] drm-intel-collector - update Daniel Vetter
  10 siblings, 1 reply; 16+ messages in thread
From: Rodrigo Vivi @ 2014-07-03 21:33 UTC (permalink / raw)
  To: intel-gfx; +Cc: Ben Widawsky, Rodrigo Vivi, Ben Widawsky

From: Ben Widawsky <benjamin.widawsky@intel.com>

The PDPs seem to get screwed up otherwise, specifically PDP0. I am not
really clear why this is required, it just works with full PPGTT.

v2: Only do it for gen8, to limit regression potential

v3: Fix the bugzilla links

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=78891
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=78935
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=78936
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=78937
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=78938

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
 drivers/gpu/drm/i915/i915_gem_context.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index 633e318..61b60b6 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -573,6 +573,9 @@ mi_set_context(struct intel_engine_cs *ring,
 	else
 		intel_ring_emit(ring, MI_NOOP);
 
+	if (INTEL_INFO(ring->dev)->gen == 8)
+		hw_flags |= MI_FORCE_RESTORE;
+
 	intel_ring_emit(ring, MI_NOOP);
 	intel_ring_emit(ring, MI_SET_CONTEXT);
 	intel_ring_emit(ring,
-- 
1.9.0

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

* [PATCH 10/10] drm/i915/vlv: T12 eDP panel timing enforcement during reboot.
  2014-07-03 21:32 [PATCH 00/10] drm-intel-collector - update Rodrigo Vivi
                   ` (8 preceding siblings ...)
  2014-07-03 21:33 ` [PATCH 09/10] drm/i915/bdw: Always issue a force restore Rodrigo Vivi
@ 2014-07-03 21:33 ` Rodrigo Vivi
  2014-07-08 19:09 ` [PATCH 00/10] drm-intel-collector - update Daniel Vetter
  10 siblings, 0 replies; 16+ messages in thread
From: Rodrigo Vivi @ 2014-07-03 21:33 UTC (permalink / raw)
  To: intel-gfx; +Cc: Rodrigo Vivi

From: Clint Taylor <Clinton.A.Taylor@intel.com>

The panel power sequencer on vlv doesn't appear to accept changes to its
T12 power down duration during warm reboots. This change forces a delay
for warm reboots to the T12 panel timing as defined in the VBT table for
the connected panel.

Ver2: removed redundant pr_crit(), commented magic value for pp_div_reg

Ver3: moved SYS_RESTART check earlier, new name for pp_div.

Signed-off-by: Clint Taylor <clinton.a.taylor@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c  | 42 ++++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_drv.h |  2 ++
 2 files changed, 44 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index b5ec489..ece8f28 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -28,6 +28,8 @@
 #include <linux/i2c.h>
 #include <linux/slab.h>
 #include <linux/export.h>
+#include <linux/notifier.h>
+#include <linux/reboot.h>
 #include <drm/drmP.h>
 #include <drm/drm_crtc.h>
 #include <drm/drm_crtc_helper.h>
@@ -336,6 +338,38 @@ static u32 _pp_stat_reg(struct intel_dp *intel_dp)
 		return VLV_PIPE_PP_STATUS(vlv_power_sequencer_pipe(intel_dp));
 }
 
+/* Reboot notifier handler to shutdown panel power to guarantee T12 timing */
+static int edp_notify_handler(struct notifier_block *this, unsigned long code,
+							  void *unused)
+{
+	struct intel_dp *intel_dp = container_of(this, typeof(* intel_dp),
+						 edp_notifier);
+	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
+	struct drm_device *dev = intel_dig_port->base.base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	u32 pp_div;
+	u32 pp_ctrl_reg, pp_div_reg;
+	enum pipe pipe = vlv_power_sequencer_pipe(intel_dp);
+
+	if ((!is_edp(intel_dp)) &&
+	    (code != SYS_RESTART ))
+		return 0;
+
+	if (IS_VALLEYVIEW(dev)) {
+		pp_ctrl_reg = VLV_PIPE_PP_CONTROL(pipe);
+		pp_div_reg  = VLV_PIPE_PP_DIVISOR(pipe);
+		pp_div = I915_READ(VLV_PIPE_PP_DIVISOR(pipe));
+		pp_div &= PP_REFERENCE_DIVIDER_MASK;
+
+		/* 0x1F write to PP_DIV_REG sets max cycle delay */
+		I915_WRITE(pp_div_reg , pp_div | 0x1F);
+		I915_WRITE(pp_ctrl_reg,
+			   PANEL_UNLOCK_REGS | PANEL_POWER_OFF);
+		msleep(intel_dp->panel_power_cycle_delay);
+	}
+	return 0;
+}
+
 static bool edp_have_panel_power(struct intel_dp *intel_dp)
 {
 	struct drm_device *dev = intel_dp_to_dev(intel_dp);
@@ -3785,6 +3819,10 @@ void intel_dp_encoder_destroy(struct drm_encoder *encoder)
 		drm_modeset_lock(&dev->mode_config.connection_mutex, NULL);
 		edp_panel_vdd_off_sync(intel_dp);
 		drm_modeset_unlock(&dev->mode_config.connection_mutex);
+		if (intel_dp->edp_notifier.notifier_call) {
+			unregister_reboot_notifier(&intel_dp->edp_notifier);
+			intel_dp->edp_notifier.notifier_call = NULL;
+		}
 	}
 	kfree(intel_dig_port);
 }
@@ -4353,6 +4391,10 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
 	if (is_edp(intel_dp)) {
 		intel_dp_init_panel_power_timestamps(intel_dp);
 		intel_dp_init_panel_power_sequencer(dev, intel_dp, &power_seq);
+		if (IS_VALLEYVIEW(dev)) {
+			intel_dp->edp_notifier.notifier_call = edp_notify_handler;
+			register_reboot_notifier(&intel_dp->edp_notifier);
+		}
 	}
 
 	intel_dp_aux_init(intel_dp, intel_connector);
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 7b4d743..c52e879 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -542,6 +542,8 @@ struct intel_dp {
 	unsigned long last_power_cycle;
 	unsigned long last_power_on;
 	unsigned long last_backlight_off;
+	struct notifier_block  edp_notifier;
+
 	bool use_tps3;
 	struct intel_connector *attached_connector;
 
-- 
1.9.0

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

* Re: [PATCH 09/10] drm/i915/bdw: Always issue a force restore
  2014-07-03 21:33 ` [PATCH 09/10] drm/i915/bdw: Always issue a force restore Rodrigo Vivi
@ 2014-07-03 21:38   ` Ben Widawsky
  2014-07-03 21:39     ` Rodrigo Vivi
  0 siblings, 1 reply; 16+ messages in thread
From: Ben Widawsky @ 2014-07-03 21:38 UTC (permalink / raw)
  To: Rodrigo Vivi; +Cc: intel-gfx, Ben Widawsky, Rodrigo Vivi

On Thu, Jul 03, 2014 at 05:33:05PM -0400, Rodrigo Vivi wrote:
> From: Ben Widawsky <benjamin.widawsky@intel.com>
> 
> The PDPs seem to get screwed up otherwise, specifically PDP0. I am not
> really clear why this is required, it just works with full PPGTT.
> 
> v2: Only do it for gen8, to limit regression potential
> 
> v3: Fix the bugzilla links
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=78891
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=78935
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=78936
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=78937
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=78938
> 
> Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_gem_context.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
> index 633e318..61b60b6 100644
> --- a/drivers/gpu/drm/i915/i915_gem_context.c
> +++ b/drivers/gpu/drm/i915/i915_gem_context.c
> @@ -573,6 +573,9 @@ mi_set_context(struct intel_engine_cs *ring,
>  	else
>  		intel_ring_emit(ring, MI_NOOP);
>  
> +	if (INTEL_INFO(ring->dev)->gen == 8)
> +		hw_flags |= MI_FORCE_RESTORE;
> +
>  	intel_ring_emit(ring, MI_NOOP);
>  	intel_ring_emit(ring, MI_SET_CONTEXT);
>  	intel_ring_emit(ring,

Ville had a good point on this patch wrt to note setting both
MI_FORCE_RESTORE, and MI_RESTORE_INHIBIT (though it seems to cause no
problems).

I think also with some of the do_switch() cleanups recently submitted,
this one may no longer be necessary - not sure.

-- 
Ben Widawsky, Intel Open Source Technology Center

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

* Re: [PATCH 09/10] drm/i915/bdw: Always issue a force restore
  2014-07-03 21:38   ` Ben Widawsky
@ 2014-07-03 21:39     ` Rodrigo Vivi
  0 siblings, 0 replies; 16+ messages in thread
From: Rodrigo Vivi @ 2014-07-03 21:39 UTC (permalink / raw)
  To: Ben Widawsky; +Cc: intel-gfx, Ben Widawsky, Rodrigo Vivi


[-- Attachment #1.1: Type: text/plain, Size: 2055 bytes --]

Thanks

Please just ignore this one for now. It will be removed on next round.


On Thu, Jul 3, 2014 at 5:38 PM, Ben Widawsky <benjamin.widawsky@intel.com>
wrote:

> On Thu, Jul 03, 2014 at 05:33:05PM -0400, Rodrigo Vivi wrote:
> > From: Ben Widawsky <benjamin.widawsky@intel.com>
> >
> > The PDPs seem to get screwed up otherwise, specifically PDP0. I am not
> > really clear why this is required, it just works with full PPGTT.
> >
> > v2: Only do it for gen8, to limit regression potential
> >
> > v3: Fix the bugzilla links
> >
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=78891
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=78935
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=78936
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=78937
> > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=78938
> >
> > Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
> > Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > ---
> >  drivers/gpu/drm/i915/i915_gem_context.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_gem_context.c
> b/drivers/gpu/drm/i915/i915_gem_context.c
> > index 633e318..61b60b6 100644
> > --- a/drivers/gpu/drm/i915/i915_gem_context.c
> > +++ b/drivers/gpu/drm/i915/i915_gem_context.c
> > @@ -573,6 +573,9 @@ mi_set_context(struct intel_engine_cs *ring,
> >       else
> >               intel_ring_emit(ring, MI_NOOP);
> >
> > +     if (INTEL_INFO(ring->dev)->gen == 8)
> > +             hw_flags |= MI_FORCE_RESTORE;
> > +
> >       intel_ring_emit(ring, MI_NOOP);
> >       intel_ring_emit(ring, MI_SET_CONTEXT);
> >       intel_ring_emit(ring,
>
> Ville had a good point on this patch wrt to note setting both
> MI_FORCE_RESTORE, and MI_RESTORE_INHIBIT (though it seems to cause no
> problems).
>
> I think also with some of the do_switch() cleanups recently submitted,
> this one may no longer be necessary - not sure.
>
> --
> Ben Widawsky, Intel Open Source Technology Center
>



-- 
Rodrigo Vivi
Blog: http://blog.vivi.eng.br

[-- Attachment #1.2: Type: text/html, Size: 3442 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH 05/10] drm/i915/vlv: WA for Turbo and RC6 to work together.
  2014-07-03 21:33 ` [PATCH 05/10] drm/i915/vlv: WA for Turbo and RC6 to work together Rodrigo Vivi
@ 2014-07-08 19:05   ` Daniel Vetter
  0 siblings, 0 replies; 16+ messages in thread
From: Daniel Vetter @ 2014-07-08 19:05 UTC (permalink / raw)
  To: Rodrigo Vivi; +Cc: intel-gfx, Rodrigo Vivi

On Thu, Jul 03, 2014 at 05:33:01PM -0400, Rodrigo Vivi wrote:
> From: Deepak S <deepak.s@linux.intel.com>
> 
> With RC6 enabled, BYT has an HW issue in determining the right
> Gfx busyness.
> WA for Turbo + RC6: Use SW based Gfx busy-ness detection to decide
> on increasing/decreasing the freq. This logic will monitor C0
> counters of render/media power-wells over EI period and takes
> necessary action based on these values
> 
> v2: Refactor duplicate code. (Ville)
> 
> v3: Reformat the comments. (Ville)
> 
> v4: Enable required counters and remove unwanted code (Ville)
> 
> v5: Added frequency change acceleration support and remove kernel-doc
> style comments. (Ville)
> 
> v6: Updated comment section and Fix w/a comment. (Ville)
> 
> Signed-off-by: Deepak S <deepak.s@linux.intel.com>
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

Queued for -next, thanks for the patch.
-Daniel

> ---
>  drivers/gpu/drm/i915/i915_drv.h |  15 +++++
>  drivers/gpu/drm/i915/i915_irq.c | 133 +++++++++++++++++++++++++++++++++++++++-
>  drivers/gpu/drm/i915/i915_reg.h |  11 ++++
>  drivers/gpu/drm/i915/intel_pm.c |  12 +++-
>  4 files changed, 167 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 1bf277e..db33a34 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -880,6 +880,12 @@ struct vlv_s0ix_state {
>  	u32 clock_gate_dis2;
>  };
>  
> +struct intel_rps_ei_calc {
> +	u32 cz_ts_ei;
> +	u32 render_ei_c0;
> +	u32 media_ei_c0;
> +};
> +
>  struct intel_gen6_power_mgmt {
>  	/* work and pm_iir are protected by dev_priv->irq_lock */
>  	struct work_struct work;
> @@ -904,6 +910,8 @@ struct intel_gen6_power_mgmt {
>  	u8 rp1_freq;		/* "less than" RP0 power/freqency */
>  	u8 rp0_freq;		/* Non-overclocked max frequency. */
>  
> +	u32 ei_interrupt_count;
> +
>  	int last_adj;
>  	enum { LOW_POWER, BETWEEN, HIGH_POWER } power;
>  
> @@ -1504,6 +1512,13 @@ struct drm_i915_private {
>  	/* gen6+ rps state */
>  	struct intel_gen6_power_mgmt rps;
>  
> +	/* rps wa up ei calculation */
> +	struct intel_rps_ei_calc rps_up_ei;
> +
> +	/* rps wa down ei calculation */
> +	struct intel_rps_ei_calc rps_down_ei;
> +
> +
>  	/* ilk-only ips/rps state. Everything in here is protected by the global
>  	 * mchdev_lock in intel_pm.c */
>  	struct intel_ilk_power_mgmt ips;
> diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
> index 0217a41..7ae17af 100644
> --- a/drivers/gpu/drm/i915/i915_irq.c
> +++ b/drivers/gpu/drm/i915/i915_irq.c
> @@ -1225,6 +1225,131 @@ static void notify_ring(struct drm_device *dev,
>  	i915_queue_hangcheck(dev);
>  }
>  
> +static u32 vlv_c0_residency(struct drm_i915_private *dev_priv,
> +				struct  intel_rps_ei_calc *rps_ei)
> +{
> +	u32 cz_ts, cz_freq_khz;
> +	u32 render_count, media_count;
> +	u32 elapsed_render, elapsed_media, elapsed_time;
> +	u32 residency = 0;
> +
> +	cz_ts = vlv_punit_read(dev_priv, PUNIT_REG_CZ_TIMESTAMP);
> +	cz_freq_khz = DIV_ROUND_CLOSEST(dev_priv->mem_freq * 1000, 4);
> +
> +	render_count = I915_READ(VLV_RENDER_C0_COUNT_REG);
> +	media_count = I915_READ(VLV_MEDIA_C0_COUNT_REG);
> +
> +	if (rps_ei->cz_ts_ei == 0) {
> +		rps_ei->cz_ts_ei = cz_ts;
> +		rps_ei->render_ei_c0 = render_count;
> +		rps_ei->media_ei_c0 = media_count;
> +
> +		return dev_priv->rps.cur_freq;
> +	}
> +
> +	elapsed_time = cz_ts - rps_ei->cz_ts_ei;
> +	rps_ei->cz_ts_ei = cz_ts;
> +
> +	elapsed_render = render_count - rps_ei->render_ei_c0;
> +	rps_ei->render_ei_c0 = render_count;
> +
> +	elapsed_media = media_count - rps_ei->media_ei_c0;
> +	rps_ei->media_ei_c0 = media_count;
> +
> +	/* Convert all the counters into common unit of milli sec */
> +	elapsed_time /= VLV_CZ_CLOCK_TO_MILLI_SEC;
> +	elapsed_render /=  cz_freq_khz;
> +	elapsed_media /= cz_freq_khz;
> +
> +	/*
> +	 * Calculate overall C0 residency percentage
> +	 * only if elapsed time is non zero
> +	 */
> +	if (elapsed_time) {
> +		residency =
> +			((max(elapsed_render, elapsed_media) * 100)
> +				/ elapsed_time);
> +	}
> +
> +	return residency;
> +}
> +
> +/**
> + * vlv_calc_delay_from_C0_counters - Increase/Decrease freq based on GPU
> + * busy-ness calculated from C0 counters of render & media power wells
> + * @dev_priv: DRM device private
> + *
> + */
> +static u32 vlv_calc_delay_from_C0_counters(struct drm_i915_private *dev_priv)
> +{
> +	u32 residency_C0_up = 0, residency_C0_down = 0;
> +	u8 new_delay, adj;
> +
> +	dev_priv->rps.ei_interrupt_count++;
> +
> +	WARN_ON(!mutex_is_locked(&dev_priv->rps.hw_lock));
> +
> +
> +	if (dev_priv->rps_up_ei.cz_ts_ei == 0) {
> +		vlv_c0_residency(dev_priv, &dev_priv->rps_up_ei);
> +		vlv_c0_residency(dev_priv, &dev_priv->rps_down_ei);
> +		return dev_priv->rps.cur_freq;
> +	}
> +
> +
> +	/*
> +	 * To down throttle, C0 residency should be less than down threshold
> +	 * for continous EI intervals. So calculate down EI counters
> +	 * once in VLV_INT_COUNT_FOR_DOWN_EI
> +	 */
> +	if (dev_priv->rps.ei_interrupt_count == VLV_INT_COUNT_FOR_DOWN_EI) {
> +
> +		dev_priv->rps.ei_interrupt_count = 0;
> +
> +		residency_C0_down = vlv_c0_residency(dev_priv,
> +						&dev_priv->rps_down_ei);
> +	} else {
> +		residency_C0_up = vlv_c0_residency(dev_priv,
> +						&dev_priv->rps_up_ei);
> +	}
> +
> +	new_delay = dev_priv->rps.cur_freq;
> +
> +	adj = dev_priv->rps.last_adj;
> +	/* C0 residency is greater than UP threshold. Increase Frequency */
> +	if (residency_C0_up >= VLV_RP_UP_EI_THRESHOLD) {
> +		if (adj > 0)
> +			adj *= 2;
> +		else
> +			adj = 1;
> +
> +		if (dev_priv->rps.cur_freq < dev_priv->rps.max_freq_softlimit)
> +			new_delay = dev_priv->rps.cur_freq + adj;
> +
> +		/*
> +		 * For better performance, jump directly
> +		 * to RPe if we're below it.
> +		 */
> +		if (new_delay < dev_priv->rps.efficient_freq)
> +			new_delay = dev_priv->rps.efficient_freq;
> +
> +	} else if (!dev_priv->rps.ei_interrupt_count &&
> +			(residency_C0_down < VLV_RP_DOWN_EI_THRESHOLD)) {
> +		if (adj < 0)
> +			adj *= 2;
> +		else
> +			adj = -1;
> +		/*
> +		 * This means, C0 residency is less than down threshold over
> +		 * a period of VLV_INT_COUNT_FOR_DOWN_EI. So, reduce the freq
> +		 */
> +		if (dev_priv->rps.cur_freq > dev_priv->rps.min_freq_softlimit)
> +			new_delay = dev_priv->rps.cur_freq + adj;
> +	}
> +
> +	return new_delay;
> +}
> +
>  static void gen6_pm_rps_work(struct work_struct *work)
>  {
>  	struct drm_i915_private *dev_priv =
> @@ -1273,6 +1398,8 @@ static void gen6_pm_rps_work(struct work_struct *work)
>  		else
>  			new_delay = dev_priv->rps.min_freq_softlimit;
>  		adj = 0;
> +	} else if (pm_iir & GEN6_PM_RP_UP_EI_EXPIRED) {
> +		new_delay = vlv_calc_delay_from_C0_counters(dev_priv);
>  	} else if (pm_iir & GEN6_PM_RP_DOWN_THRESHOLD) {
>  		if (adj < 0)
>  			adj *= 2;
> @@ -4363,7 +4490,11 @@ void intel_irq_init(struct drm_device *dev)
>  	INIT_WORK(&dev_priv->l3_parity.error_work, ivybridge_parity_work);
>  
>  	/* Let's track the enabled rps events */
> -	dev_priv->pm_rps_events = GEN6_PM_RPS_EVENTS;
> +	if (IS_VALLEYVIEW(dev))
> +		/* WaGsvRC0ResidenncyMethod:VLV */
> +		dev_priv->pm_rps_events = GEN6_PM_RP_UP_EI_EXPIRED;
> +	else
> +		dev_priv->pm_rps_events = GEN6_PM_RPS_EVENTS;
>  
>  	setup_timer(&dev_priv->gpu_error.hangcheck_timer,
>  		    i915_hangcheck_elapsed,
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index 3488567..99413ae 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -525,6 +525,7 @@ enum punit_power_well {
>  #define PUNIT_REG_GPU_FREQ_STS			0xd8
>  #define   GENFREQSTATUS				(1<<0)
>  #define PUNIT_REG_MEDIA_TURBO_FREQ_REQ		0xdc
> +#define PUNIT_REG_CZ_TIMESTAMP			0xce
>  
>  #define PUNIT_FUSE_BUS2				0xf6 /* bits 47:40 */
>  #define PUNIT_FUSE_BUS1				0xf5 /* bits 55:48 */
> @@ -550,6 +551,11 @@ enum punit_power_well {
>  #define   FB_FMAX_VMIN_FREQ_LO_SHIFT		27
>  #define   FB_FMAX_VMIN_FREQ_LO_MASK		0xf8000000
>  
> +#define VLV_CZ_CLOCK_TO_MILLI_SEC		100000
> +#define VLV_RP_UP_EI_THRESHOLD			90
> +#define VLV_RP_DOWN_EI_THRESHOLD		70
> +#define VLV_INT_COUNT_FOR_DOWN_EI		5
> +
>  /* vlv2 north clock has */
>  #define CCK_FUSE_REG				0x8
>  #define  CCK_FUSE_HPLL_FREQ_MASK		0x3
> @@ -5383,6 +5389,7 @@ enum punit_power_well {
>  #define   VLV_GTLC_ALLOWWAKEERR			(1 << 1)
>  #define   VLV_GTLC_PW_MEDIA_STATUS_MASK		(1 << 5)
>  #define   VLV_GTLC_PW_RENDER_STATUS_MASK	(1 << 7)
> +#define VLV_GTLC_SURVIVABILITY_REG              0x130098
>  #define  FORCEWAKE_MT				0xa188 /* multi-threaded */
>  #define   FORCEWAKE_KERNEL			0x1
>  #define   FORCEWAKE_USER			0x2
> @@ -5530,6 +5537,8 @@ enum punit_power_well {
>  #define GEN6_GT_GFX_RC6_LOCKED			0x138104
>  #define VLV_COUNTER_CONTROL			0x138104
>  #define   VLV_COUNT_RANGE_HIGH			(1<<15)
> +#define   VLV_MEDIA_RC0_COUNT_EN		(1<<5)
> +#define   VLV_RENDER_RC0_COUNT_EN		(1<<4)
>  #define   VLV_MEDIA_RC6_COUNT_EN		(1<<1)
>  #define   VLV_RENDER_RC6_COUNT_EN		(1<<0)
>  #define GEN6_GT_GFX_RC6				0x138108
> @@ -5538,6 +5547,8 @@ enum punit_power_well {
>  
>  #define GEN6_GT_GFX_RC6p			0x13810C
>  #define GEN6_GT_GFX_RC6pp			0x138110
> +#define VLV_RENDER_C0_COUNT_REG		0x138118
> +#define VLV_MEDIA_C0_COUNT_REG			0x13811C
>  
>  #define GEN6_PCODE_MAILBOX			0x138124
>  #define   GEN6_PCODE_READY			(1<<31)
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index 1e4611a..8ea96ff 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -3235,8 +3235,11 @@ static void vlv_set_rps_idle(struct drm_i915_private *dev_priv)
>  
>  	vlv_force_gfx_clock(dev_priv, false);
>  
> -	I915_WRITE(GEN6_PMINTRMSK,
> -		   gen6_rps_pm_mask(dev_priv, dev_priv->rps.cur_freq));
> +	if (dev_priv->pm_rps_events & GEN6_PM_RP_UP_EI_EXPIRED)
> +		I915_WRITE(GEN6_PMINTRMSK, ~dev_priv->pm_rps_events);
> +	else 
> +		I915_WRITE(GEN6_PMINTRMSK,
> +			   gen6_rps_pm_mask(dev_priv, dev_priv->rps.cur_freq));
>  }
>  
>  void gen6_rps_idle(struct drm_i915_private *dev_priv)
> @@ -4076,6 +4079,7 @@ static void valleyview_enable_rps(struct drm_device *dev)
>  	I915_WRITE(GEN6_RP_DOWN_EI, 350000);
>  
>  	I915_WRITE(GEN6_RP_IDLE_HYSTERSIS, 10);
> +	I915_WRITE(GEN6_RP_DOWN_TIMEOUT, 0xf4240);
>  
>  	I915_WRITE(GEN6_RP_CONTROL,
>  		   GEN6_RP_MEDIA_TURBO |
> @@ -4096,9 +4100,11 @@ static void valleyview_enable_rps(struct drm_device *dev)
>  
>  	/* allows RC6 residency counter to work */
>  	I915_WRITE(VLV_COUNTER_CONTROL,
> -		   _MASKED_BIT_ENABLE(VLV_COUNT_RANGE_HIGH |
> +		   _MASKED_BIT_ENABLE(VLV_MEDIA_RC0_COUNT_EN |
> +				      VLV_RENDER_RC0_COUNT_EN |
>  				      VLV_MEDIA_RC6_COUNT_EN |
>  				      VLV_RENDER_RC6_COUNT_EN));
> +
>  	if (intel_enable_rc6(dev) & INTEL_RC6_ENABLE)
>  		rc6_mode = GEN7_RC_CTL_TO_MODE | VLV_RC_CTL_CTX_RST_PARALLEL;
>  
> -- 
> 1.9.0
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

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

* Re: [PATCH 07/10] drm/i915: HWS must be in the mappable region for g33
  2014-07-03 21:33 ` [PATCH 07/10] drm/i915: HWS must be in the mappable region for g33 Rodrigo Vivi
@ 2014-07-08 19:07   ` Daniel Vetter
  0 siblings, 0 replies; 16+ messages in thread
From: Daniel Vetter @ 2014-07-08 19:07 UTC (permalink / raw)
  To: Rodrigo Vivi; +Cc: intel-gfx, Rodrigo Vivi

On Thu, Jul 03, 2014 at 05:33:03PM -0400, Rodrigo Vivi wrote:
> From: Chris Wilson <chris@chris-wilson.co.uk>
> 
> On g33, the documentation states
> 
> "HWS_PGA:
>  Format = Bits 28:12 of graphics memory address (bits 31:29 MBZ)."
> 
> which translates to that the address of the HWS must be below 256MiB,
> which is conveniently the mappable aperture.
> 
> This also appears to be true (but not documented as so) for gen4 and
> gen5. To generalise we force it into the low mappable region for all
> non-LLC platforms. If we locate the HWS at the top of the GTT the
> machine will hard hang during boot (fails on pnv, gm45, ilk and byt,
> but works on snb, ivb, hsw).
> 
> v2: Add comments to explain why use PIN_MAPPABLE even though we have
>     no intention of mapping the object. (Ville)
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

Queued for -next, thanks for the patch.
-Daniel

> ---
>  drivers/gpu/drm/i915/intel_ringbuffer.c | 16 +++++++++++++++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
> index 2faef26..f49a3dd 100644
> --- a/drivers/gpu/drm/i915/intel_ringbuffer.c
> +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
> @@ -1331,6 +1331,7 @@ static int init_status_page(struct intel_engine_cs *ring)
>  	struct drm_i915_gem_object *obj;
>  
>  	if ((obj = ring->status_page.obj) == NULL) {
> +		unsigned flags;
>  		int ret;
>  
>  		obj = i915_gem_alloc_object(ring->dev, 4096);
> @@ -1343,7 +1344,20 @@ static int init_status_page(struct intel_engine_cs *ring)
>  		if (ret)
>  			goto err_unref;
>  
> -		ret = i915_gem_obj_ggtt_pin(obj, 4096, 0);
> +		flags = 0;
> +		if (!HAS_LLC(ring->dev))
> +			/* On g33, we cannot place HWS above 256MiB, so
> +			 * restrict its pinning to the low mappable arena.
> +			 * Though this restriction is not documented for
> +			 * gen4, gen5, or byt, they also behave similarly
> +			 * and hang if the HWS is placed at the top of the
> +			 * GTT. To generalise, it appears that all !llc
> +			 * platforms have issues with us placing the HWS
> +			 * above the mappable region (even though we never
> +			 * actualy map it).
> +			 */
> +			flags |= PIN_MAPPABLE;
> +		ret = i915_gem_obj_ggtt_pin(obj, 4096, flags);
>  		if (ret) {
>  err_unref:
>  			drm_gem_object_unreference(&obj->base);
> -- 
> 1.9.0
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

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

* Re: [PATCH 00/10] drm-intel-collector - update
  2014-07-03 21:32 [PATCH 00/10] drm-intel-collector - update Rodrigo Vivi
                   ` (9 preceding siblings ...)
  2014-07-03 21:33 ` [PATCH 10/10] drm/i915/vlv: T12 eDP panel timing enforcement during reboot Rodrigo Vivi
@ 2014-07-08 19:09 ` Daniel Vetter
  10 siblings, 0 replies; 16+ messages in thread
From: Daniel Vetter @ 2014-07-08 19:09 UTC (permalink / raw)
  To: Rodrigo Vivi; +Cc: intel-gfx, Rodrigo Vivi

On Thu, Jul 03, 2014 at 05:32:56PM -0400, Rodrigo Vivi wrote:
> 
> This is another drm-intel-collector updated notice:
> http://cgit.freedesktop.org/~vivijim/drm-intel/log/?h=drm-intel-collector
> 
> It was 4 rounds out of date what made it hard to get old patches. However Daniel and Jani didn't leave
> many patches behind.
> 0 on Apr 4 - Apr 16
> 1 on Apr 16 - May 6
> 2 on May 6 - May 23
> 3 on May 23 - Jun 6
> 
> Next round Jun 6 to Jun 20 is only after next drm-intel-testing update.
> 
> Here goes the update list in order for better reviewers assignment:
> 
> Patch     drm/i915: Bring UP Power Wells before disabling RC6. - Reviewer: Paulo Zanoni <paulo.r.zanoni@intel.com> - Reviewer:
> Patch     drm/i915: Don't save/restore RS when not used - Reviewer:
> Patch     drm/i915: Upgrade execbuffer fail after resume failure to EIO - Reviewer:
> Patch     drm/i915: Add property to set HDMI aspect ratio - Reviewer: Ville Syrjälä <ville.syrjala@linux.intel.com> - Reviewer:
> Patch     drm/i915/vlv: WA for Turbo and RC6 to work together. - Reviewer:
> Patch     drm/i915: honour forced connector modes - Reviewer:
> Patch     drm/i915: HWS must be in the mappable region for g33 - Reviewer:
> Patch     drm/i915: Don't promote UC to WT automagically - Reviewer:

Not really sold on this patch from Ville ... I honestly can't think of a
use-case. Merged a few patches, and all the others look sane. Can you
please sign up a bunch of reviewers for this?

Thanks, Daniel

> Patch     drm/i915/bdw: Always issue a force restore - Reviewer:
> Patch     drm/i915/vlv: T12 eDP panel timing enforcement during reboot. - Reviewer:
> 
> 
> There are some reasons that some patches can be left behind:
> 1. Your patch didn't applied cleanly and I couldn't easily solve the conflicts.
> 2. Kernel didn't compiled with your patch.
> 3. I simply missed it. If you believe this is the case please warn me.
> 4. Remind that any reply to your email automatically take your patch to next round.
> 
> Please help me to get these patches reviewed and queued by Daniel.
> 
> Thanks,
> Rodrigo.
> 
> 
> Ben Widawsky (2):
>   drm/i915: Don't save/restore RS when not used
>   drm/i915/bdw: Always issue a force restore
> 
> Chris Wilson (3):
>   drm/i915: Upgrade execbuffer fail after resume failure to EIO
>   drm/i915: honour forced connector modes
>   drm/i915: HWS must be in the mappable region for g33
> 
> Clint Taylor (1):
>   drm/i915/vlv: T12 eDP panel timing enforcement during reboot.
> 
> Deepak S (2):
>   drm/i915: Bring UP Power Wells before disabling RC6.
>   drm/i915/vlv: WA for Turbo and RC6 to work together.
> 
> Vandana Kannan (1):
>   drm/i915: Add property to set HDMI aspect ratio
> 
> Ville Syrjälä (1):
>   drm/i915: Don't promote UC to WT automagically
> 
>  drivers/gpu/drm/i915/i915_drv.h            |  16 ++++
>  drivers/gpu/drm/i915/i915_gem.c            |   9 +-
>  drivers/gpu/drm/i915/i915_gem_context.c    |  15 ++--
>  drivers/gpu/drm/i915/i915_gem_execbuffer.c |  15 +++-
>  drivers/gpu/drm/i915/i915_irq.c            | 133 ++++++++++++++++++++++++++++-
>  drivers/gpu/drm/i915/i915_reg.h            |  11 +++
>  drivers/gpu/drm/i915/intel_dp.c            |  42 +++++++++
>  drivers/gpu/drm/i915/intel_drv.h           |   4 +
>  drivers/gpu/drm/i915/intel_fbdev.c         |  33 +++----
>  drivers/gpu/drm/i915/intel_hdmi.c          |  12 +++
>  drivers/gpu/drm/i915/intel_modes.c         |  28 ++++++
>  drivers/gpu/drm/i915/intel_pm.c            |  18 +++-
>  drivers/gpu/drm/i915/intel_ringbuffer.c    |  16 +++-
>  13 files changed, 318 insertions(+), 34 deletions(-)
> 
> -- 
> 1.9.0
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

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

end of thread, other threads:[~2014-07-08 19:09 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-03 21:32 [PATCH 00/10] drm-intel-collector - update Rodrigo Vivi
2014-07-03 21:32 ` [PATCH 01/10] drm/i915: Bring UP Power Wells before disabling RC6 Rodrigo Vivi
2014-07-03 21:32 ` [PATCH 02/10] drm/i915: Don't save/restore RS when not used Rodrigo Vivi
2014-07-03 21:32 ` [PATCH 03/10] drm/i915: Upgrade execbuffer fail after resume failure to EIO Rodrigo Vivi
2014-07-03 21:33 ` [PATCH 04/10] drm/i915: Add property to set HDMI aspect ratio Rodrigo Vivi
2014-07-03 21:33 ` [PATCH 05/10] drm/i915/vlv: WA for Turbo and RC6 to work together Rodrigo Vivi
2014-07-08 19:05   ` Daniel Vetter
2014-07-03 21:33 ` [PATCH 06/10] drm/i915: honour forced connector modes Rodrigo Vivi
2014-07-03 21:33 ` [PATCH 07/10] drm/i915: HWS must be in the mappable region for g33 Rodrigo Vivi
2014-07-08 19:07   ` Daniel Vetter
2014-07-03 21:33 ` [PATCH 08/10] drm/i915: Don't promote UC to WT automagically Rodrigo Vivi
2014-07-03 21:33 ` [PATCH 09/10] drm/i915/bdw: Always issue a force restore Rodrigo Vivi
2014-07-03 21:38   ` Ben Widawsky
2014-07-03 21:39     ` Rodrigo Vivi
2014-07-03 21:33 ` [PATCH 10/10] drm/i915/vlv: T12 eDP panel timing enforcement during reboot Rodrigo Vivi
2014-07-08 19:09 ` [PATCH 00/10] drm-intel-collector - update Daniel Vetter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.