All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lyude <cpaul@redhat.com>
To: intel-gfx@lists.freedesktop.org,
	"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Matt Roper" <matthew.d.roper@intel.com>
Cc: Lyude <cpaul@redhat.com>, Daniel Vetter <daniel.vetter@ffwll.ch>,
	stable@vger.kernel.org, Daniel Vetter <daniel.vetter@intel.com>,
	Jani Nikula <jani.nikula@linux.intel.com>,
	David Airlie <airlied@linux.ie>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: [PATCH v11 1/7] drm/i915/gen6+: Return -EINVAL on invalid pcode commands
Date: Thu, 11 Aug 2016 15:54:30 -0400	[thread overview]
Message-ID: <1470945277-7973-2-git-send-email-cpaul@redhat.com> (raw)
In-Reply-To: <1470945277-7973-1-git-send-email-cpaul@redhat.com>

In order to add proper support for the SAGV, we need to be able to know
what the cause of a failure to change the SAGV through the pcode mailbox
was. The reasoning for this is that some very early pre-release Skylake
machines don't actually allow you to control the SAGV on them, and
indicate an invalid mailbox command was sent.

This also might come in handy in the future for debugging.

Signed-off-by: Lyude <cpaul@redhat.com>
Cc: Matt Roper <matthew.d.roper@intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: stable@vger.kernel.org
---
 drivers/gpu/drm/i915/i915_reg.h |  1 +
 drivers/gpu/drm/i915/intel_pm.c | 10 ++++++++++
 2 files changed, 11 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index da82744..73b3d4d 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -7121,6 +7121,7 @@ enum {
 #define VLV_MEDIA_C0_COUNT			_MMIO(0x13811C)
 
 #define GEN6_PCODE_MAILBOX			_MMIO(0x138124)
+#define   GEN6_PCODE_INVALID_CMD		(1<<0)
 #define   GEN6_PCODE_READY			(1<<31)
 #define	  GEN6_PCODE_WRITE_RC6VIDS		0x4
 #define	  GEN6_PCODE_READ_RC6VIDS		0x5
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 99014d7..8752730 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -7674,6 +7674,11 @@ int sandybridge_pcode_read(struct drm_i915_private *dev_priv, u32 mbox, u32 *val
 	*val = I915_READ_FW(GEN6_PCODE_DATA);
 	I915_WRITE_FW(GEN6_PCODE_DATA, 0);
 
+	if (I915_READ_FW(GEN6_PCODE_MAILBOX) & GEN6_PCODE_INVALID_CMD) {
+		DRM_DEBUG_DRIVER("warning: pcode (read) mailbox access indicated invalid command\n");
+		return -EINVAL;
+	}
+
 	return 0;
 }
 
@@ -7704,6 +7709,11 @@ int sandybridge_pcode_write(struct drm_i915_private *dev_priv,
 
 	I915_WRITE_FW(GEN6_PCODE_DATA, 0);
 
+	if (I915_READ_FW(GEN6_PCODE_MAILBOX) & GEN6_PCODE_INVALID_CMD) {
+		DRM_DEBUG_DRIVER("warning: pcode (write) mailbox access indicated invalid command\n");
+		return -EINVAL;
+	}
+
 	return 0;
 }
 
-- 
2.7.4

WARNING: multiple messages have this Message-ID (diff)
From: Lyude <cpaul@redhat.com>
To: intel-gfx@lists.freedesktop.org,
	"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Matt Roper" <matthew.d.roper@intel.com>
Cc: David Airlie <airlied@linux.ie>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org, Daniel Vetter <daniel.vetter@intel.com>
Subject: [PATCH v11 1/7] drm/i915/gen6+: Return -EINVAL on invalid pcode commands
Date: Thu, 11 Aug 2016 15:54:30 -0400	[thread overview]
Message-ID: <1470945277-7973-2-git-send-email-cpaul@redhat.com> (raw)
In-Reply-To: <1470945277-7973-1-git-send-email-cpaul@redhat.com>

In order to add proper support for the SAGV, we need to be able to know
what the cause of a failure to change the SAGV through the pcode mailbox
was. The reasoning for this is that some very early pre-release Skylake
machines don't actually allow you to control the SAGV on them, and
indicate an invalid mailbox command was sent.

This also might come in handy in the future for debugging.

Signed-off-by: Lyude <cpaul@redhat.com>
Cc: Matt Roper <matthew.d.roper@intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: stable@vger.kernel.org
---
 drivers/gpu/drm/i915/i915_reg.h |  1 +
 drivers/gpu/drm/i915/intel_pm.c | 10 ++++++++++
 2 files changed, 11 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index da82744..73b3d4d 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -7121,6 +7121,7 @@ enum {
 #define VLV_MEDIA_C0_COUNT			_MMIO(0x13811C)
 
 #define GEN6_PCODE_MAILBOX			_MMIO(0x138124)
+#define   GEN6_PCODE_INVALID_CMD		(1<<0)
 #define   GEN6_PCODE_READY			(1<<31)
 #define	  GEN6_PCODE_WRITE_RC6VIDS		0x4
 #define	  GEN6_PCODE_READ_RC6VIDS		0x5
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 99014d7..8752730 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -7674,6 +7674,11 @@ int sandybridge_pcode_read(struct drm_i915_private *dev_priv, u32 mbox, u32 *val
 	*val = I915_READ_FW(GEN6_PCODE_DATA);
 	I915_WRITE_FW(GEN6_PCODE_DATA, 0);
 
+	if (I915_READ_FW(GEN6_PCODE_MAILBOX) & GEN6_PCODE_INVALID_CMD) {
+		DRM_DEBUG_DRIVER("warning: pcode (read) mailbox access indicated invalid command\n");
+		return -EINVAL;
+	}
+
 	return 0;
 }
 
@@ -7704,6 +7709,11 @@ int sandybridge_pcode_write(struct drm_i915_private *dev_priv,
 
 	I915_WRITE_FW(GEN6_PCODE_DATA, 0);
 
+	if (I915_READ_FW(GEN6_PCODE_MAILBOX) & GEN6_PCODE_INVALID_CMD) {
+		DRM_DEBUG_DRIVER("warning: pcode (write) mailbox access indicated invalid command\n");
+		return -EINVAL;
+	}
+
 	return 0;
 }
 
-- 
2.7.4

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

  reply	other threads:[~2016-08-11 19:56 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-11 19:54 [PATCH v11 0/7] Finally fix watermarks Lyude
2016-08-11 19:54 ` Lyude
2016-08-11 19:54 ` Lyude [this message]
2016-08-11 19:54   ` [PATCH v11 1/7] drm/i915/gen6+: Return -EINVAL on invalid pcode commands Lyude
2016-08-12 11:23   ` Ville Syrjälä
2016-08-12 11:23     ` Ville Syrjälä
2016-08-12 11:23     ` Ville Syrjälä
2016-08-11 19:54 ` [PATCH v11 2/7] drm/i915/skl: Add support for the SAGV, fix underrun hangs Lyude
2016-08-11 19:54   ` Lyude
2016-08-12 12:04   ` Ville Syrjälä
2016-08-12 12:04     ` Ville Syrjälä
2016-08-12 12:04     ` Ville Syrjälä
2016-08-11 19:54 ` [PATCH v11 3/7] drm/i915/gen9: Only copy WM results for changed pipes to skl_hw Lyude
2016-08-11 19:54   ` Lyude
2016-08-11 19:54 ` [PATCH v11 4/7] drm/i915/skl: Update plane watermarks atomically during plane updates Lyude
2016-08-11 19:54   ` Lyude
2016-08-12 12:42   ` Ville Syrjälä
2016-08-12 12:42     ` Ville Syrjälä
2016-08-12 12:42     ` Ville Syrjälä
2016-08-11 19:54 ` [PATCH v11 5/7] drm/i915/skl: Ensure pipes with changed wms get added to the state Lyude
2016-08-11 19:54   ` Lyude
2016-08-11 19:54 ` [PATCH v11 6/7] drm/i915: Move CRTC updating in atomic_commit into it's own hook Lyude
2016-08-11 19:54   ` Lyude
2016-08-11 19:54 ` [PATCH v11 7/7] drm/i915/skl: Update DDB values atomically with wms/plane attrs Lyude
2016-08-11 19:54   ` Lyude
2016-08-12 13:30   ` Ville Syrjälä
2016-08-12 13:30     ` Ville Syrjälä
2016-08-12  5:21 ` ✗ Ro.CI.BAT: failure for Finally fix watermarks (rev9) Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1470945277-7973-2-git-send-email-cpaul@redhat.com \
    --to=cpaul@redhat.com \
    --cc=airlied@linux.ie \
    --cc=daniel.vetter@ffwll.ch \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=matthew.d.roper@intel.com \
    --cc=stable@vger.kernel.org \
    --cc=ville.syrjala@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.