Skip to contentSkip to conversation

drm/i915: Resolving the memory region conflict for Stolen area

PATCH In review [email protected] 6 participants 12 messages Jan 13, 2014 – Mar 6, 2014 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/7 drm/i915: Resolving the memory region conflict for Stolen area

From: Akash Goel <[email protected]>

There is a conflict seen when requesting the kernel to reserve the physical space used for the stolen area. This is because some BIOS are wrapping the stolen area in the root PCI bus, but have an off-by-one error. As a workaround we retry the reservation with an offset of 1 instead of 0.

v2: updated commit message & the comment in source file (Daniel)

---
 drivers/gpu/drm/i915/i915_gem_stolen.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_gem_stolen.c +17 -3
index 1a24e84..114a806 100644
@@ -82,9 +82,23 @@ static unsigned long i915_stolen_to_physical(struct drm_device *dev)
 	r = devm_request_mem_region(dev->dev, base, dev_priv->gtt.stolen_size,
 				    "Graphics Stolen Memory");
 	if (r == NULL) {
-		DRM_ERROR("conflict detected with stolen region: [0x%08x - 0x%08x]\n",
-			  base, base + (uint32_t)dev_priv->gtt.stolen_size);
-		base = 0;
+		/*
+		 * One more attempt but this time requesting region from
+		 * base + 1, as we have seen that this resolves the region
+		 * conflict with the PCI Bus.
+		 * This is a BIOS w/a: Some BIOS wrap stolen in the root
+		 * PCI bus, but have an off-by-one error. Hence retry the
+		 * reservation starting from 1 instead of 0.
+		 */
+		r = devm_request_mem_region(dev->dev, base + 1,
+					    dev_priv->gtt.stolen_size - 1,
+					    "Graphics Stolen Memory");
+		if (r == NULL) {
+			DRM_ERROR("conflict detected with stolen region:"\
+				  "[0x%08x - 0x%08x]\n",
+				  base, base + (uint32_t)dev_priv->gtt.stolen_size);
+			base = 0;
+		}
 	}
 
 	return base;
Signature · 1 line
1.8.5.2

A message that is not in the archive (sent off-list or not yet received): 8BF5CF93467D8C498F250C96583BC09CC6AD09@BGSMSX103.gar.corp.intel.com

#2 lore raw
Quoted 3 lines · Akash

Hi Daniel,

Please let us know about this patch, will this be up-streamed.

1. I've just sent out the merge confirmation mail minutes ago.
2. Please _never_ drop mailing lists when poking me (or in general, really). See the internally documented bkm in the patch submission guidelines.

Cheers, Daniel

Quoted 56 lines

Best Regards
Akash

-----Original Message-----
From: Goel, Akash
Sent: Monday, January 13, 2014 4:25 PM
To: [email protected]
Cc: Goel, Akash
Subject: [PATCH 2/7] drm/i915: Resolving the memory region conflict for Stolen area

From: Akash Goel <[email protected]>

There is a conflict seen when requesting the kernel to reserve the physical space used for the stolen area. This is because some BIOS are wrapping the stolen area in the root PCI bus, but have an off-by-one error. As a workaround we retry the reservation with an offset of 1 instead of 0.

v2: updated commit message & the comment in source file (Daniel)

---
 drivers/gpu/drm/i915/i915_gem_stolen.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_gem_stolen.c +17 -4
index 1a24e84..114a806 100644
@@ -82,9 +82,23 @@ static unsigned long i915_stolen_to_physical(struct drm_device *dev)
        r = devm_request_mem_region(dev->dev, base, dev_priv->gtt.stolen_size,
                                    "Graphics Stolen Memory");
        if (r == NULL) {
-               DRM_ERROR("conflict detected with stolen region: [0x%08x - 0x%08x]\n",
-                         base, base + (uint32_t)dev_priv->gtt.stolen_size);
-               base = 0;
+               /*
+                * One more attempt but this time requesting region from
+                * base + 1, as we have seen that this resolves the region
+                * conflict with the PCI Bus.
+                * This is a BIOS w/a: Some BIOS wrap stolen in the root
+                * PCI bus, but have an off-by-one error. Hence retry the
+                * reservation starting from 1 instead of 0.
+                */
+               r = devm_request_mem_region(dev->dev, base + 1,
+                                           dev_priv->gtt.stolen_size - 1,
+                                           "Graphics Stolen Memory");
+               if (r == NULL) {
+                       DRM_ERROR("conflict detected with stolen region:"\
+                                 "[0x%08x - 0x%08x]\n",
+                                 base, base + (uint32_t)dev_priv->gtt.stolen_size);
+                       base = 0;
+               }
        }
 
        return base;
--

1.8.5.2

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
#3 lore raw
Quoted 64 lines · On Tue, 28 Jan 2014 10:14:03 +0100 Daniel Vetter <[email protected]> wrote:
Quoted 3 lines · Akash

Hi Daniel,

Please let us know about this patch, will this be up-streamed.

1. I've just sent out the merge confirmation mail minutes ago.
2. Please _never_ drop mailing lists when poking me (or in general, really). See the internally documented bkm in the patch submission guidelines.

Cheers, Daniel

Quoted 52 lines

Best Regards
Akash

-----Original Message-----
From: Goel, Akash
Sent: Monday, January 13, 2014 4:25 PM
To: [email protected]
Cc: Goel, Akash
Subject: [PATCH 2/7] drm/i915: Resolving the memory region conflict for Stolen area

From: Akash Goel <[email protected]>

There is a conflict seen when requesting the kernel to reserve the physical space used for the stolen area. This is because some BIOS are wrapping the stolen area in the root PCI bus, but have an off-by-one error. As a workaround we retry the reservation with an offset of 1 instead of 0.

v2: updated commit message & the comment in source file (Daniel)

---
 drivers/gpu/drm/i915/i915_gem_stolen.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_gem_stolen.c +17 -3
index 1a24e84..114a806 100644
@@ -82,9 +82,23 @@ static unsigned long i915_stolen_to_physical(struct drm_device *dev)
        r = devm_request_mem_region(dev->dev, base, dev_priv->gtt.stolen_size,
                                    "Graphics Stolen Memory");
        if (r == NULL) {
-               DRM_ERROR("conflict detected with stolen region: [0x%08x - 0x%08x]\n",
-                         base, base + (uint32_t)dev_priv->gtt.stolen_size);
-               base = 0;
+               /*
+                * One more attempt but this time requesting region from
+                * base + 1, as we have seen that this resolves the region
+                * conflict with the PCI Bus.
+                * This is a BIOS w/a: Some BIOS wrap stolen in the root
+                * PCI bus, but have an off-by-one error. Hence retry the
+                * reservation starting from 1 instead of 0.
+                */
+               r = devm_request_mem_region(dev->dev, base + 1,
+                                           dev_priv->gtt.stolen_size - 1,
+                                           "Graphics Stolen Memory");
+               if (r == NULL) {
+                       DRM_ERROR("conflict detected with stolen region:"\
+                                 "[0x%08x - 0x%08x]\n",
+                                 base, base + (uint32_t)dev_priv->gtt.stolen_size);
+                       base = 0;
+               }
        }
 
Quoted 1 line

drivers/gpu/drm/i915/i915_gem_stolen.c static unsigned long i915_stolen_to_physical(struct drm_device *dev) · line 104

Quoted 1 line
drivers/gpu/drm/i915/i915_gem_stolen.c +0 -0
        return base;

It doesn't look like this was actually merged, and it belongs in -fixes with a cc: stable since it affects existing machines with these BIOS issues.

Cc'ing Jani so he can pick it up when he returns.

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
#4 lore raw
Quoted 67 lines · Jesse Barnes
Quoted 64 lines · On Tue, 28 Jan 2014 10:14:03 +0100 Daniel Vetter <[email protected]> wrote:
Quoted 3 lines · Akash

Hi Daniel,

Please let us know about this patch, will this be up-streamed.

1. I've just sent out the merge confirmation mail minutes ago.
2. Please _never_ drop mailing lists when poking me (or in general, really). See the internally documented bkm in the patch submission guidelines.

Cheers, Daniel

Quoted 52 lines

Best Regards
Akash

-----Original Message-----
From: Goel, Akash
Sent: Monday, January 13, 2014 4:25 PM
To: [email protected]
Cc: Goel, Akash
Subject: [PATCH 2/7] drm/i915: Resolving the memory region conflict for Stolen area

From: Akash Goel <[email protected]>

There is a conflict seen when requesting the kernel to reserve the physical space used for the stolen area. This is because some BIOS are wrapping the stolen area in the root PCI bus, but have an off-by-one error. As a workaround we retry the reservation with an offset of 1 instead of 0.

v2: updated commit message & the comment in source file (Daniel)

---
 drivers/gpu/drm/i915/i915_gem_stolen.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_gem_stolen.c +17 -3
index 1a24e84..114a806 100644
@@ -82,9 +82,23 @@ static unsigned long i915_stolen_to_physical(struct drm_device *dev)
        r = devm_request_mem_region(dev->dev, base, dev_priv->gtt.stolen_size,
                                    "Graphics Stolen Memory");
        if (r == NULL) {
-               DRM_ERROR("conflict detected with stolen region: [0x%08x - 0x%08x]\n",
-                         base, base + (uint32_t)dev_priv->gtt.stolen_size);
-               base = 0;
+               /*
+                * One more attempt but this time requesting region from
+                * base + 1, as we have seen that this resolves the region
+                * conflict with the PCI Bus.
+                * This is a BIOS w/a: Some BIOS wrap stolen in the root
+                * PCI bus, but have an off-by-one error. Hence retry the
+                * reservation starting from 1 instead of 0.
+                */
+               r = devm_request_mem_region(dev->dev, base + 1,
+                                           dev_priv->gtt.stolen_size - 1,
+                                           "Graphics Stolen Memory");
+               if (r == NULL) {
+                       DRM_ERROR("conflict detected with stolen region:"\
+                                 "[0x%08x - 0x%08x]\n",
+                                 base, base + (uint32_t)dev_priv->gtt.stolen_size);
+                       base = 0;
+               }
        }
 
Quoted 5 lines
Quoted 1 line

drivers/gpu/drm/i915/i915_gem_stolen.c static unsigned long i915_stolen_to_physical(struct drm_device *dev) · line 104

Quoted 1 line
drivers/gpu/drm/i915/i915_gem_stolen.c +0 -0
        return base;

It doesn't look like this was actually merged, and it belongs in -fixes with a cc: stable since it affects existing machines with these BIOS issues.

It looks like Daniel was referring to [1] which includes

commit ec14ba47791965d2c08e0a681ff44eacbf3c4553

Author: Akash Goel <[email protected]>
Date:   Mon Jan 13 16:24:45 2014 +0530

drm/i915: Fix the offset issue for the stolen GEM objects

i.e. something else.

Quoted 1 line

Cc'ing Jani so he can pick it up when he returns.

I'm going to need a Reviewed-by and preferrably a Tested-by on this.

Thanks,
Jani.

[1] http://marc.info/[email protected]

Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
#5 lore raw
Quoted 1 line · Jani Nikula

I'm going to need a Reviewed-by and preferrably a Tested-by on this.

I really didn't like this patch because requesting a region other than the one we use is morally equivalent to not requesting a region at all. The approach I would prefer is to only use the requested resource as our available stolen region, like in the attached.
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Quoted 1 line

From e5230c7bf7186699f1b83dcbff5a45a3267c9941 Mon Sep 17 00:00:00 2001

From: Chris Wilson <[email protected]>
Date: Wed, 26 Feb 2014 18:01:42 +0000
Subject: [PATCH] drm/i915: Trim stolen region for reserved pages and
conflicting BIOS setups

On a few systems we have to reserve regions inside the stolen portion for use by the BIOS - we have to trim that out of our own allocation. In some cases, the BIOS will have reduced the reserved region in the e820 map and so we have to adjust our own region request to suit. Either way, we need to only use the resource that we successfully reserve for ourselves - rather than claim one region and use another.

v2: Fix resource request bounds to be inclusive. (Jani)

---
 drivers/gpu/drm/i915/i915_drv.h        |  2 +-
 drivers/gpu/drm/i915/i915_gem_stolen.c | 64 ++++++++++++++++++++++------------
 drivers/gpu/drm/i915/intel_pm.c        |  9 +++--
 3 files changed, 49 insertions(+), 26 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +1 -1
index 655a45c981fd..eb31c456eb35 100644
@@ -1099,7 +1099,7 @@ struct i915_gem_mm {
 	struct list_head unbound_list;
 
 	/** Usable portion of the GTT for GEM */
-	unsigned long stolen_base; /* limited to low memory (32-bit) */
+	struct resource *stolen_region; /* limited to low memory (32-bit) */
 
 	/** PPGTT used for aliasing the PPGTT with the GTT */
 	struct i915_hw_ppgtt *aliasing_ppgtt;
drivers/gpu/drm/i915/i915_gem_stolen.c +41 -23

117 lines not on this page · raw message

drivers/gpu/drm/i915/intel_pm.c +7 -2
index 3419ddae32c6..ac0cff40d5ec 100644
@@ -3564,12 +3564,17 @@ static void valleyview_setup_pctx(struct drm_device *dev)
 	u32 pcbr;
 	int pctx_size = 24*1024;
 
+	if (dev_priv->mm.stolen_region == NULL) {
+		DRM_DEBUG("stolen space not reserved, unable to setup power saving context");
+		return;
+	}
+
 	pcbr = I915_READ(VLV_PCBR);
 	if (pcbr) {
 		/* BIOS set it up already, grab the pre-alloc'd space */
 		int pcbr_offset;
 
-		pcbr_offset = (pcbr & (~4095)) - dev_priv->mm.stolen_base;
+		pcbr_offset = (pcbr & (~4095)) - dev_priv->mm.stolen_region->start;
 		pctx = i915_gem_object_create_stolen_for_preallocated(dev_priv->dev,
 								      pcbr_offset,
 								      I915_GTT_OFFSET_NONE,
@@ -3591,7 +3596,7 @@ static void valleyview_setup_pctx(struct drm_device *dev)
 		return;
 	}
 
-	pctx_paddr = dev_priv->mm.stolen_base + pctx->stolen->start;
+	pctx_paddr = dev_priv->mm.stolen_region->start + pctx->stolen->start;
 	I915_WRITE(VLV_PCBR, pctx_paddr);
 
 out:
Signature · 1 line
1.9.0

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#6 lore raw
Quoted 7 lines · Chris Wilson
Quoted 1 line · Jani Nikula

I'm going to need a Reviewed-by and preferrably a Tested-by on this.

I really didn't like this patch because requesting a region other than the one we use is morally equivalent to not requesting a region at all. The approach I would prefer is to only use the requested resource as our available stolen region, like in the attached.

I would need the reviewed- and tested-bys on this one instead then.

I'm keeping Akash's patch in -fixes for now as I've already pushed it there. Frankly, I'm inclined to queuing that one for 3.14 and fixing this right for 3.15, as it's a broken BIOS we're talking about, but I could be convinced otherwise. Particularly with the r-b and t-b.

BR,
Jani.

Quoted 201 lines

-Chris

Signature · 22 lines
Chris Wilson, Intel Open Source Technology Centre
From e5230c7bf7186699f1b83dcbff5a45a3267c9941 Mon Sep 17 00:00:00 2001
From: Chris Wilson <[email protected]>
Date: Wed, 26 Feb 2014 18:01:42 +0000
Subject: [PATCH] drm/i915: Trim stolen region for reserved pages and
 conflicting BIOS setups

On a few systems we have to reserve regions inside the stolen portion
for use by the BIOS - we have to trim that out of our own allocation. In
some cases, the BIOS will have reduced the reserved region in the e820
map and so we have to adjust our own region request to suit. Either way,
we need to only use the resource that we successfully reserve for
ourselves - rather than claim one region and use another.

v2: Fix resource request bounds to be inclusive. (Jani)

Signed-off-by: Chris Wilson <[email protected]>
---
 drivers/gpu/drm/i915/i915_drv.h        |  2 +-
 drivers/gpu/drm/i915/i915_gem_stolen.c | 64 ++++++++++++++++++++++------------
 drivers/gpu/drm/i915/intel_pm.c        |  9 +++--
 3 files changed, 49 insertions(+), 26 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +1 -1
index 655a45c981fd..eb31c456eb35 100644
@@ -1099,7 +1099,7 @@ struct i915_gem_mm {
 	struct list_head unbound_list;
 
 	/** Usable portion of the GTT for GEM */
-	unsigned long stolen_base; /* limited to low memory (32-bit) */
+	struct resource *stolen_region; /* limited to low memory (32-bit) */
 
 	/** PPGTT used for aliasing the PPGTT with the GTT */
 	struct i915_hw_ppgtt *aliasing_ppgtt;
drivers/gpu/drm/i915/i915_gem_stolen.c +41 -23
index adc5c91f6946..984ada1b0084 100644
@@ -45,10 +45,11 @@
  * for is a boon.
  */
 
-static unsigned long i915_stolen_to_physical(struct drm_device *dev)
+static struct resource *i915_stolen_to_physical(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct resource *r;
+	unsigned long start, end;
 	u32 base;
 
 	/* Almost universally we can find the Graphics Base of Stolen Memory
@@ -184,15 +185,38 @@ static unsigned long i915_stolen_to_physical(struct drm_device *dev)
 	 * kernel. So if the region is already marked as busy, something
 	 * is seriously wrong.
 	 */
-	r = devm_request_mem_region(dev->dev, base, dev_priv->gtt.stolen_size,
+	start = base + PAGE_SIZE; /* leave the first page alone! */
+
+	end = base + dev_priv->gtt.stolen_size - 1;
+	if (IS_VALLEYVIEW(dev))
+		end -= 1024*1024; /* top 1M on VLV/BYT is reserved */
+
+	r = devm_request_mem_region(dev->dev, start, end-start,
 				    "Graphics Stolen Memory");
 	if (r == NULL) {
-		DRM_ERROR("conflict detected with stolen region: [0x%08x - 0x%08x]\n",
-			  base, base + (uint32_t)dev_priv->gtt.stolen_size);
-		base = 0;
+		/* Weird. BIOS has not reserved the whole region for us,
+		 * try something smaller.
+		 */
+		do {
+			start += PAGE_SIZE;
+			end -= PAGE_SIZE;
+			if (start < end)
+				break;
+
+			r = devm_request_mem_region(dev->dev, start, end-start,
+						    "Graphics Stolen Memory");
+		} while (r == NULL);
+
+		if (r == NULL)
+			DRM_ERROR("conflicting resource reservations detected with stolen region: [0x%08x - 0x%08x]\n",
+				  base, base + (uint32_t)dev_priv->gtt.stolen_size - 1);
+		else
+			DRM_INFO("conflict detected with stolen region [0x%08x - 0x%08x], reducing to [0x%08lx - 0x%08lx]\n",
+				 base, base + (uint32_t)dev_priv->gtt.stolen_size - 1,
+				 start, end);
 	}
 
-	return base;
+	return r;
 }
 
 static int i915_setup_compression(struct drm_device *dev, int size)
@@ -232,9 +256,9 @@ static int i915_setup_compression(struct drm_device *dev, int size)
 		dev_priv->fbc.compressed_llb = compressed_llb;
 
 		I915_WRITE(FBC_CFB_BASE,
-			   dev_priv->mm.stolen_base + compressed_fb->start);
+			   dev_priv->mm.stolen_region->start + compressed_fb->start);
 		I915_WRITE(FBC_LL_BASE,
-			   dev_priv->mm.stolen_base + compressed_llb->start);
+			   dev_priv->mm.stolen_region->start + compressed_llb->start);
 	}
 
 	dev_priv->fbc.compressed_fb = compressed_fb;
@@ -304,28 +328,22 @@ void i915_gem_cleanup_stolen(struct drm_device *dev)
 int i915_gem_init_stolen(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
-	int bios_reserved = 0;
+	struct resource *r;
 
 	if (dev_priv->gtt.stolen_size == 0)
 		return 0;
 
-	dev_priv->mm.stolen_base = i915_stolen_to_physical(dev);
-	if (dev_priv->mm.stolen_base == 0)
+	r = i915_stolen_to_physical(dev);
+	if (r == NULL)
 		return 0;
 
-	DRM_DEBUG_KMS("found %zd bytes of stolen memory at %08lx\n",
-		      dev_priv->gtt.stolen_size, dev_priv->mm.stolen_base);
-
-	if (IS_VALLEYVIEW(dev))
-		bios_reserved = 1024*1024; /* top 1M on VLV/BYT */
-
-	if (WARN_ON(bios_reserved > dev_priv->gtt.stolen_size))
-		return 0;
+	DRM_DEBUG_KMS("found %ld bytes of stolen memory at %08lx\n",
+		      (long)resource_size(r), (long)r->start);
 
 	/* 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, 0, resource_size(r));
 
+	dev_priv->mm.stolen_region = r;
 	return 0;
 }
 
@@ -338,7 +356,7 @@ i915_pages_create_for_stolen(struct drm_device *dev,
 	struct scatterlist *sg;
 
 	DRM_DEBUG_DRIVER("offset=0x%x, size=%d\n", offset, size);
-	BUG_ON(offset > dev_priv->gtt.stolen_size - size);
+	BUG_ON(offset > resource_size(dev_priv->mm.stolen_region) - size);
 
 	/* We hide that we have no struct page backing our stolen object
 	 * by wrapping the contiguous physical allocation with a fake
@@ -358,7 +376,7 @@ i915_pages_create_for_stolen(struct drm_device *dev,
 	sg->offset = 0;
 	sg->length = size;
 
-	sg_dma_address(sg) = (dma_addr_t)dev_priv->mm.stolen_base + offset;
+	sg_dma_address(sg) = (dma_addr_t)dev_priv->mm.stolen_region->start + offset;
 	sg_dma_len(sg) = size;
 
 	return st;
drivers/gpu/drm/i915/intel_pm.c +7 -2
index 3419ddae32c6..ac0cff40d5ec 100644
@@ -3564,12 +3564,17 @@ static void valleyview_setup_pctx(struct drm_device *dev)
 	u32 pcbr;
 	int pctx_size = 24*1024;
 
+	if (dev_priv->mm.stolen_region == NULL) {
+		DRM_DEBUG("stolen space not reserved, unable to setup power saving context");
+		return;
+	}
+
 	pcbr = I915_READ(VLV_PCBR);
 	if (pcbr) {
 		/* BIOS set it up already, grab the pre-alloc'd space */
 		int pcbr_offset;
 
-		pcbr_offset = (pcbr & (~4095)) - dev_priv->mm.stolen_base;
+		pcbr_offset = (pcbr & (~4095)) - dev_priv->mm.stolen_region->start;
 		pctx = i915_gem_object_create_stolen_for_preallocated(dev_priv->dev,
 								      pcbr_offset,
 								      I915_GTT_OFFSET_NONE,
@@ -3591,7 +3596,7 @@ static void valleyview_setup_pctx(struct drm_device *dev)
 		return;
 	}
 
-	pctx_paddr = dev_priv->mm.stolen_base + pctx->stolen->start;
+	pctx_paddr = dev_priv->mm.stolen_region->start + pctx->stolen->start;
 	I915_WRITE(VLV_PCBR, pctx_paddr);
 
 out:
Signature · 1 line
1.9.0
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
#7 lore raw
Quoted 4 lines · Jani Nikula

I'm keeping Akash's patch in -fixes for now as I've already pushed it there. Frankly, I'm inclined to queuing that one for 3.14 and fixing this right for 3.15, as it's a broken BIOS we're talking about, but I could be convinced otherwise. Particularly with the r-b and t-b.

Just following up on this: Akash's patch is now on its way to 3.14.

Chris, please rebase your patch on -nightly so we can get it ready for 3.15.

Thanks,
Jani.

Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
Reviewed-by Tested-by Arjan van de Ven on v1 2/7
#8 lore raw
In reply to [email protected]
Quoted 36 lines · On Mon, 13 Jan 2014 16:25:21 +0530 [email protected] wrote:

From: Akash Goel <[email protected]>

There is a conflict seen when requesting the kernel to reserve the physical space used for the stolen area. This is because some BIOS are wrapping the stolen area in the root PCI bus, but have an off-by-one error. As a workaround we retry the reservation with an offset of 1 instead of 0.

v2: updated commit message & the comment in source file (Daniel)

---
 drivers/gpu/drm/i915/i915_gem_stolen.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_gem_stolen.c +10 -3
index 1a24e84..114a806 100644
@@ -82,9 +82,23 @@ static unsigned long i915_stolen_to_physical(struct drm_device *dev)
 	r = devm_request_mem_region(dev->dev, base, dev_priv->gtt.stolen_size,
 				    "Graphics Stolen Memory");
 	if (r == NULL) {
-		DRM_ERROR("conflict detected with stolen region: [0x%08x - 0x%08x]\n",
-			  base, base + (uint32_t)dev_priv->gtt.stolen_size);
-		base = 0;
+		/*
+		 * One more attempt but this time requesting region from
+		 * base + 1, as we have seen that this resolves the region
+		 * conflict with the PCI Bus.
+		 * This is a BIOS w/a: Some BIOS wrap stolen in the root
+		 * PCI bus, but have an off-by-one error. Hence retry the
+		 * reservation starting from 1 instead of 0.
+		 */
+		r = devm_request_mem_region(dev->dev, base + 1,
+					    dev_priv->gtt.stolen_size - 1,

drivers/gpu/drm/i915/i915_gem_stolen.c static unsigned long i915_stolen_to_physical(struct drm_device *dev) · line 104

Quoted 10 lines
drivers/gpu/drm/i915/i915_gem_stolen.c +7 -0
+					    "Graphics Stolen Memory");
+		if (r == NULL) {
+			DRM_ERROR("conflict detected with stolen region:"\
+				  "[0x%08x - 0x%08x]\n",
+				  base, base + (uint32_t)dev_priv->gtt.stolen_size);
+			base = 0;
+		}
 	}
 
 	return base;

Thanks,

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
maintainer
#9 lore raw
Quoted 48 lines · Jesse Barnes
Quoted 45 lines · On Mon, 13 Jan 2014 16:25:21 +0530 [email protected] wrote:

From: Akash Goel <[email protected]>

There is a conflict seen when requesting the kernel to reserve the physical space used for the stolen area. This is because some BIOS are wrapping the stolen area in the root PCI bus, but have an off-by-one error. As a workaround we retry the reservation with an offset of 1 instead of 0.

v2: updated commit message & the comment in source file (Daniel)

---
 drivers/gpu/drm/i915/i915_gem_stolen.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_gem_stolen.c +17 -3
index 1a24e84..114a806 100644
@@ -82,9 +82,23 @@ static unsigned long i915_stolen_to_physical(struct drm_device *dev)
 	r = devm_request_mem_region(dev->dev, base, dev_priv->gtt.stolen_size,
 				    "Graphics Stolen Memory");
 	if (r == NULL) {
-		DRM_ERROR("conflict detected with stolen region: [0x%08x - 0x%08x]\n",
-			  base, base + (uint32_t)dev_priv->gtt.stolen_size);
-		base = 0;
+		/*
+		 * One more attempt but this time requesting region from
+		 * base + 1, as we have seen that this resolves the region
+		 * conflict with the PCI Bus.
+		 * This is a BIOS w/a: Some BIOS wrap stolen in the root
+		 * PCI bus, but have an off-by-one error. Hence retry the
+		 * reservation starting from 1 instead of 0.
+		 */
+		r = devm_request_mem_region(dev->dev, base + 1,
+					    dev_priv->gtt.stolen_size - 1,
+					    "Graphics Stolen Memory");
+		if (r == NULL) {
+			DRM_ERROR("conflict detected with stolen region:"\
+				  "[0x%08x - 0x%08x]\n",
+				  base, base + (uint32_t)dev_priv->gtt.stolen_size);
+			base = 0;
+		}
 	}
 
Quoted 4 lines

drivers/gpu/drm/i915/i915_gem_stolen.c static unsigned long i915_stolen_to_physical(struct drm_device *dev) · line 104

Quoted 1 line
drivers/gpu/drm/i915/i915_gem_stolen.c +0 -0
 	return base;

Pushed to -fixes, thanks for the patch, review, and testing.

Jani.

Quoted 8 lines

Thanks,

Signature · 5 lines
Jesse Barnes, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
maintainer
#10 lore raw
Quoted 49 lines · Jani Nikula
Quoted 48 lines · Jesse Barnes
Quoted 45 lines · On Mon, 13 Jan 2014 16:25:21 +0530 [email protected] wrote:

From: Akash Goel <[email protected]>

There is a conflict seen when requesting the kernel to reserve the physical space used for the stolen area. This is because some BIOS are wrapping the stolen area in the root PCI bus, but have an off-by-one error. As a workaround we retry the reservation with an offset of 1 instead of 0.

v2: updated commit message & the comment in source file (Daniel)

---
 drivers/gpu/drm/i915/i915_gem_stolen.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_gem_stolen.c +17 -3
index 1a24e84..114a806 100644
@@ -82,9 +82,23 @@ static unsigned long i915_stolen_to_physical(struct drm_device *dev)
 	r = devm_request_mem_region(dev->dev, base, dev_priv->gtt.stolen_size,
 				    "Graphics Stolen Memory");
 	if (r == NULL) {
-		DRM_ERROR("conflict detected with stolen region: [0x%08x - 0x%08x]\n",
-			  base, base + (uint32_t)dev_priv->gtt.stolen_size);
-		base = 0;
+		/*
+		 * One more attempt but this time requesting region from
+		 * base + 1, as we have seen that this resolves the region
+		 * conflict with the PCI Bus.
+		 * This is a BIOS w/a: Some BIOS wrap stolen in the root
+		 * PCI bus, but have an off-by-one error. Hence retry the
+		 * reservation starting from 1 instead of 0.
+		 */
+		r = devm_request_mem_region(dev->dev, base + 1,
+					    dev_priv->gtt.stolen_size - 1,
+					    "Graphics Stolen Memory");
+		if (r == NULL) {
+			DRM_ERROR("conflict detected with stolen region:"\
+				  "[0x%08x - 0x%08x]\n",
+				  base, base + (uint32_t)dev_priv->gtt.stolen_size);
+			base = 0;
+		}
 	}
 
Quoted 6 lines
Quoted 4 lines

drivers/gpu/drm/i915/i915_gem_stolen.c static unsigned long i915_stolen_to_physical(struct drm_device *dev) · line 104

Quoted 1 line
drivers/gpu/drm/i915/i915_gem_stolen.c +0 -0
 	return base;

Pushed to -fixes, thanks for the patch, review, and testing.

Oh, forgot to add that I fixed the DRM_ERROR string split up that checkpatch complained about while applying.

Quoted 15 lines

Jani.

Quoted 8 lines

Thanks,

Signature · 5 lines
Jesse Barnes, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
#11 lore raw
Quoted 55 lines · On Thu, 27 Feb 2014 11:01:08 +0200 Jani Nikula <[email protected]>…
Quoted 54 lines · Jani Nikula
Quoted 52 lines · Jesse Barnes
Quoted 36 lines · On Mon, 13 Jan 2014 16:25:21 +0530 [email protected] wrote:

From: Akash Goel <[email protected]>

There is a conflict seen when requesting the kernel to reserve the physical space used for the stolen area. This is because some BIOS are wrapping the stolen area in the root PCI bus, but have an off-by-one error. As a workaround we retry the reservation with an offset of 1 instead of 0.

v2: updated commit message & the comment in source file (Daniel)

---
 drivers/gpu/drm/i915/i915_gem_stolen.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_gem_stolen.c +10 -3
index 1a24e84..114a806 100644
@@ -82,9 +82,23 @@ static unsigned long i915_stolen_to_physical(struct drm_device *dev)
 	r = devm_request_mem_region(dev->dev, base, dev_priv->gtt.stolen_size,
 				    "Graphics Stolen Memory");
 	if (r == NULL) {
-		DRM_ERROR("conflict detected with stolen region: [0x%08x - 0x%08x]\n",
-			  base, base + (uint32_t)dev_priv->gtt.stolen_size);
-		base = 0;
+		/*
+		 * One more attempt but this time requesting region from
+		 * base + 1, as we have seen that this resolves the region
+		 * conflict with the PCI Bus.
+		 * This is a BIOS w/a: Some BIOS wrap stolen in the root
+		 * PCI bus, but have an off-by-one error. Hence retry the
+		 * reservation starting from 1 instead of 0.
+		 */
+		r = devm_request_mem_region(dev->dev, base + 1,
+					    dev_priv->gtt.stolen_size - 1,

drivers/gpu/drm/i915/i915_gem_stolen.c static unsigned long i915_stolen_to_physical(struct drm_device *dev) · line 104

Quoted 10 lines
drivers/gpu/drm/i915/i915_gem_stolen.c +7 -0
+					    "Graphics Stolen Memory");
+		if (r == NULL) {
+			DRM_ERROR("conflict detected with stolen region:"\
+				  "[0x%08x - 0x%08x]\n",
+				  base, base + (uint32_t)dev_priv->gtt.stolen_size);
+			base = 0;
+		}
 	}
 
 	return base;
Quoted 4 lines
Quoted 1 line

Pushed to -fixes, thanks for the patch, review, and testing.

Oh, forgot to add that I fixed the DRM_ERROR string split up that checkpatch complained about while applying.

Note I think we should do this at the x86 quirk level as well since otherwise the kernel may put MMIO space on top of our stolen range.

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
#12 lore raw
Quoted 58 lines · On Mon, 3 Mar 2014 11:14:09 -0800 Jesse Barnes <[email protected]> wrote:
Quoted 55 lines · On Thu, 27 Feb 2014 11:01:08 +0200 Jani Nikula <[email protected]>…
Quoted 54 lines · Jani Nikula
Quoted 52 lines · Jesse Barnes
Quoted 36 lines · On Mon, 13 Jan 2014 16:25:21 +0530 [email protected] wrote:

From: Akash Goel <[email protected]>

There is a conflict seen when requesting the kernel to reserve the physical space used for the stolen area. This is because some BIOS are wrapping the stolen area in the root PCI bus, but have an off-by-one error. As a workaround we retry the reservation with an offset of 1 instead of 0.

v2: updated commit message & the comment in source file (Daniel)

---
 drivers/gpu/drm/i915/i915_gem_stolen.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_gem_stolen.c +10 -3
index 1a24e84..114a806 100644
@@ -82,9 +82,23 @@ static unsigned long i915_stolen_to_physical(struct drm_device *dev)
 	r = devm_request_mem_region(dev->dev, base, dev_priv->gtt.stolen_size,
 				    "Graphics Stolen Memory");
 	if (r == NULL) {
-		DRM_ERROR("conflict detected with stolen region: [0x%08x - 0x%08x]\n",
-			  base, base + (uint32_t)dev_priv->gtt.stolen_size);
-		base = 0;
+		/*
+		 * One more attempt but this time requesting region from
+		 * base + 1, as we have seen that this resolves the region
+		 * conflict with the PCI Bus.
+		 * This is a BIOS w/a: Some BIOS wrap stolen in the root
+		 * PCI bus, but have an off-by-one error. Hence retry the
+		 * reservation starting from 1 instead of 0.
+		 */
+		r = devm_request_mem_region(dev->dev, base + 1,
+					    dev_priv->gtt.stolen_size - 1,

drivers/gpu/drm/i915/i915_gem_stolen.c static unsigned long i915_stolen_to_physical(struct drm_device *dev) · line 104

Quoted 10 lines
drivers/gpu/drm/i915/i915_gem_stolen.c +7 -0
+					    "Graphics Stolen Memory");
+		if (r == NULL) {
+			DRM_ERROR("conflict detected with stolen region:"\
+				  "[0x%08x - 0x%08x]\n",
+				  base, base + (uint32_t)dev_priv->gtt.stolen_size);
+			base = 0;
+		}
 	}
 
 	return base;
Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Pushed to -fixes, thanks for the patch, review, and testing.

Oh, forgot to add that I fixed the DRM_ERROR string split up that checkpatch complained about while applying.

Note I think we should do this at the x86 quirk level as well since otherwise the kernel may put MMIO space on top of our stolen range.

Nevermind, I think the stolen core code will do the right thing and mark this region reserved... but it's worth checking on an affected system.

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center