diff mbox

drm/i915: Skip Stolen Memory first page.

Message ID 1406742466-25128-1-git-send-email-rodrigo.vivi@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Rodrigo Vivi July 30, 2014, 5:47 p.m. UTC
WA to skip the first page of stolen memory due to sporadic HW write on *CS Idle

Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
---
 drivers/gpu/drm/i915/i915_gem_stolen.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Comments

Ben Widawsky July 31, 2014, 3:57 a.m. UTC | #1
On Wed, Jul 30, 2014 at 10:47:46AM -0700, Rodrigo Vivi wrote:
> WA to skip the first page of stolen memory due to sporadic HW write on *CS Idle
> 
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_gem_stolen.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c
> index 21c025a..3acefb3 100644
> --- a/drivers/gpu/drm/i915/i915_gem_stolen.c
> +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
> @@ -290,6 +290,7 @@ int i915_gem_init_stolen(struct drm_device *dev)
>  {
>  	struct drm_i915_private *dev_priv = dev->dev_private;
>  	int bios_reserved = 0;
> +	int initial_reserved = 0;
>  
>  #ifdef CONFIG_INTEL_IOMMU
>  	if (intel_iommu_gfx_mapped && INTEL_INFO(dev)->gen < 8) {
> @@ -314,9 +315,13 @@ int i915_gem_init_stolen(struct drm_device *dev)
>  	if (WARN_ON(bios_reserved > dev_priv->gtt.stolen_size))
>  		return 0;
>  
> +	/* WaSkipStolenMemoryFirstPage */
> +	if (INTEL_INFO(dev)->gen >= 8)
> +		initial_reserved = 4096;
> +
>  	/* Basic memrange allocator for stolen space */
> -	drm_mm_init(&dev_priv->mm.stolen, 0, dev_priv->gtt.stolen_size -
> -		    bios_reserved);
> +	drm_mm_init(&dev_priv->mm.stolen, initial_reserved,
> +		    dev_priv->gtt.stolen_size - bios_reserved);
>  
>  	return 0;
>  }

Actually, you need to fix the size in the initialization:
drm_mm_init(stolen, 4096, dev_priv->gtt.stolen_size - bios_reserved - 4096);

Also, I think we have a bug here today, you need to
dev_priv->gtt.stolen_size -= ...

Or else we don't have the correct assertion in
i915_pages_create_for_stolen(). I didn't look carefully if it's safe to
currently do it, but it does seem wrong to me as it is.

With the first fix (I didn't verify that's the real workaround name),
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
Chris Wilson July 31, 2014, 5:57 a.m. UTC | #2
On Wed, Jul 30, 2014 at 10:47:46AM -0700, Rodrigo Vivi wrote:
> WA to skip the first page of stolen memory due to sporadic HW write on *CS Idle
> 
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_gem_stolen.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c
> index 21c025a..3acefb3 100644
> --- a/drivers/gpu/drm/i915/i915_gem_stolen.c
> +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
> @@ -290,6 +290,7 @@ int i915_gem_init_stolen(struct drm_device *dev)
>  {
>  	struct drm_i915_private *dev_priv = dev->dev_private;
>  	int bios_reserved = 0;
> +	int initial_reserved = 0;

start_reserved, end_reserved?
-Chris
Ville Syrjälä July 31, 2014, 1:39 p.m. UTC | #3
On Wed, Jul 30, 2014 at 10:47:46AM -0700, Rodrigo Vivi wrote:
> WA to skip the first page of stolen memory due to sporadic HW write on *CS Idle

How does this interact with the BIOS FB takeover? Do BDW systems even
place the BIOS FB at the start if stolen due to this W/A? We have no
code to verify if that's true or not. The takeover code just blindly
assumes that it's true.

If the BIOS places the FB at the start of stolen, then I had an idea
of copying the first page over just past the end of the BIOS FB and
fixing up the the GTT to account for that. The CS is then free to 
clobber the first page of stolen without corrupting the FB. But I'm
not sure our stolen object code can deal with >1 entry sg lists
currently. Also we'd probably need to copy the page first to some
temporary place (maybe just end of stolen), and only once we know
the size of the BIOS FB it could be copied to the final place. Or I
guess we could just leave it at the end of stolen since the GTT
will remap any access anyway. As long as we don't access the stolen
memory directly this should work just fine.

> 
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_gem_stolen.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c
> index 21c025a..3acefb3 100644
> --- a/drivers/gpu/drm/i915/i915_gem_stolen.c
> +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
> @@ -290,6 +290,7 @@ int i915_gem_init_stolen(struct drm_device *dev)
>  {
>  	struct drm_i915_private *dev_priv = dev->dev_private;
>  	int bios_reserved = 0;
> +	int initial_reserved = 0;
>  
>  #ifdef CONFIG_INTEL_IOMMU
>  	if (intel_iommu_gfx_mapped && INTEL_INFO(dev)->gen < 8) {
> @@ -314,9 +315,13 @@ int i915_gem_init_stolen(struct drm_device *dev)
>  	if (WARN_ON(bios_reserved > dev_priv->gtt.stolen_size))
>  		return 0;
>  
> +	/* WaSkipStolenMemoryFirstPage */
> +	if (INTEL_INFO(dev)->gen >= 8)
> +		initial_reserved = 4096;
> +
>  	/* Basic memrange allocator for stolen space */
> -	drm_mm_init(&dev_priv->mm.stolen, 0, dev_priv->gtt.stolen_size -
> -		    bios_reserved);
> +	drm_mm_init(&dev_priv->mm.stolen, initial_reserved,
> +		    dev_priv->gtt.stolen_size - bios_reserved);
>  
>  	return 0;
>  }
> -- 
> 1.9.3
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c
index 21c025a..3acefb3 100644
--- a/drivers/gpu/drm/i915/i915_gem_stolen.c
+++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
@@ -290,6 +290,7 @@  int i915_gem_init_stolen(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	int bios_reserved = 0;
+	int initial_reserved = 0;
 
 #ifdef CONFIG_INTEL_IOMMU
 	if (intel_iommu_gfx_mapped && INTEL_INFO(dev)->gen < 8) {
@@ -314,9 +315,13 @@  int i915_gem_init_stolen(struct drm_device *dev)
 	if (WARN_ON(bios_reserved > dev_priv->gtt.stolen_size))
 		return 0;
 
+	/* WaSkipStolenMemoryFirstPage */
+	if (INTEL_INFO(dev)->gen >= 8)
+		initial_reserved = 4096;
+
 	/* Basic memrange allocator for stolen space */
-	drm_mm_init(&dev_priv->mm.stolen, 0, dev_priv->gtt.stolen_size -
-		    bios_reserved);
+	drm_mm_init(&dev_priv->mm.stolen, initial_reserved,
+		    dev_priv->gtt.stolen_size - bios_reserved);
 
 	return 0;
 }