All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paulo Zanoni <paulo.r.zanoni@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Subject: [PATCH 2/2] drm/i915: fully apply WaSkipStolenMemoryFirstPage
Date: Wed, 14 Dec 2016 12:55:38 -0200	[thread overview]
Message-ID: <1481727338-9901-2-git-send-email-paulo.r.zanoni@intel.com> (raw)
In-Reply-To: <1481727338-9901-1-git-send-email-paulo.r.zanoni@intel.com>

Reserve the first page of stolen memory right after initializing the
mm allocator. This means that we won't inherit the FB in case the BIOS
decides to put it at the start of stolen. But the BIOS should not be
putting it at the start of stolen since it's going to get corrupted. I
suppose the bug here is that some pixels at the very top of the screen
will be corrupted, so it's not exactly easy to notice.

We have confirmation that the first page of stolen does actually get
corrupted, so I really think we should do this in order to avoid any
possible future headaches, even if that means losing BIOS framebuffer
inheritance. Let's not use the HW in a way it's not supposed to be
used.

v2: don't even put the first page on the mm (Chris).

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94605
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
---
 drivers/gpu/drm/i915/i915_gem_stolen.c | 27 ++++++++-------------------
 1 file changed, 8 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c
index b1c8897..7435540 100644
--- a/drivers/gpu/drm/i915/i915_gem_stolen.c
+++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
@@ -54,12 +54,6 @@ int i915_gem_stolen_insert_node_in_range(struct drm_i915_private *dev_priv,
 	if (!drm_mm_initialized(&dev_priv->mm.stolen))
 		return -ENODEV;
 
-	/* See the comment at the drm_mm_init() call for more about this check.
-	 * WaSkipStolenMemoryFirstPage:bdw+ (incomplete)
-	 */
-	if (start < 4096 && INTEL_GEN(dev_priv) >= 8)
-		start = 4096;
-
 	mutex_lock(&dev_priv->mm.stolen_lock);
 	ret = drm_mm_insert_node_in_range(&dev_priv->mm.stolen, node, size,
 					  alignment, start, end,
@@ -410,7 +404,7 @@ int i915_gem_init_stolen(struct drm_i915_private *dev_priv)
 {
 	struct i915_ggtt *ggtt = &dev_priv->ggtt;
 	unsigned long reserved_total, reserved_base = 0, reserved_size;
-	unsigned long stolen_top;
+	unsigned long stolen_start = 0, stolen_top;
 
 	mutex_init(&dev_priv->mm.stolen_lock);
 
@@ -491,18 +485,13 @@ int i915_gem_init_stolen(struct drm_i915_private *dev_priv)
 
 	ggtt->stolen_usable_size = ggtt->stolen_size - reserved_total;
 
-	/*
-	 * Basic memrange allocator for stolen space.
-	 *
-	 * TODO: Notice that some platforms require us to not use the first page
-	 * of the stolen memory but their BIOSes may still put the framebuffer
-	 * on the first page. So we don't reserve this page for now because of
-	 * that. Our current solution is to just prevent new nodes from being
-	 * inserted on the first page - see the check we have at
-	 * i915_gem_stolen_insert_node_in_range(). We may want to fix the fbcon
-	 * problem later.
-	 */
-	drm_mm_init(&dev_priv->mm.stolen, 0, ggtt->stolen_usable_size);
+	/* WaSkipStolenMemoryFirstPage:bdw+ */
+	if (INTEL_GEN(dev_priv) >= 8)
+		stolen_start = 4096;
+
+	/* Basic memrange allocator for stolen space. */
+	drm_mm_init(&dev_priv->mm.stolen, stolen_start,
+		    ggtt->stolen_usable_size);
 
 	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-12-14 14:55 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-14 14:55 [PATCH 1/2] drm/i915: skip the first 4k of stolen memory on everything >= gen8 Paulo Zanoni
2016-12-14 14:55 ` Paulo Zanoni
2016-12-14 14:55 ` Paulo Zanoni [this message]
2016-12-14 15:43   ` [PATCH 2/2] drm/i915: fully apply WaSkipStolenMemoryFirstPage Chris Wilson
2016-12-14 16:39   ` Ville Syrjälä
2016-12-14 16:50     ` Chris Wilson
2016-12-14 19:55       ` Paulo Zanoni
2016-12-15  7:54         ` Daniel Vetter
2016-12-15  8:17         ` Chris Wilson
2016-12-15 13:23           ` Paulo Zanoni
2016-12-15 13:26             ` Ville Syrjälä
2016-12-15 13:40               ` Chris Wilson
2016-12-15 13:51                 ` Ville Syrjälä
2016-12-14 15:43 ` [Intel-gfx] [PATCH 1/2] drm/i915: skip the first 4k of stolen memory on everything >= gen8 Chris Wilson
2016-12-14 15:53 ` ✓ Fi.CI.BAT: success for series starting with [1/2] " Patchwork
2016-12-14 20:22 ` ✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915: skip the first 4k of stolen memory on everything >= gen8 (rev2) Patchwork
2016-12-15 14:45 ` ✗ Fi.CI.BAT: warning for series starting with [1/2] drm/i915: skip the first 4k of stolen memory on everything >= gen8 (rev3) Patchwork
2016-12-20 12:57 ` [PATCH 1/2] drm/i915: skip the first 4k of stolen memory on everything >= gen8 Paulo Zanoni

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=1481727338-9901-2-git-send-email-paulo.r.zanoni@intel.com \
    --to=paulo.r.zanoni@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /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.