public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH 2/7] drm/i915: Resolving the memory region conflict for Stolen area
@ 2014-01-13 10:55 akash.goel
       [not found] ` <8BF5CF93467D8C498F250C96583BC09CC6AD09@BGSMSX103.gar.corp.intel.com>
  2014-02-26 16:21 ` Jesse Barnes
  0 siblings, 2 replies; 14+ messages in thread
From: akash.goel @ 2014-01-13 10:55 UTC (permalink / raw)
  To: intel-gfx; +Cc: Akash Goel

From: Akash Goel <akash.goel@intel.com>

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)

Signed-off-by: Akash Goel <akash.goel@intel.com>
---
 drivers/gpu/drm/i915/i915_gem_stolen.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c
index 1a24e84..114a806 100644
--- a/drivers/gpu/drm/i915/i915_gem_stolen.c
+++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
@@ -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

^ permalink raw reply related	[flat|nested] 14+ messages in thread
* [PATCH 2/7] drm/i915: Resolving the memory region conflict for Stolen area
@ 2014-01-09  5:30 akash.goel
  2014-01-09  7:29 ` Daniel Vetter
  0 siblings, 1 reply; 14+ messages in thread
From: akash.goel @ 2014-01-09  5:30 UTC (permalink / raw)
  To: intel-gfx; +Cc: Akash Goel

From: Akash Goel <akash.goel@intel.com>

There is a conflict seen when requesting the kernel to reserve
the physical space used for the stolen area. This is because
as somehow the start/base location of the Parent region
of Stolen area which is PCI Bus 0000:00 is not coinciding with
the start of Stolen area and is conflicting with it. For ex.
from the device memory map info provided by '/proc/iomem',
we have seen that somehow a region of PCI Bus 0000:00 is being
shown to start from 0x7b000001,
i.e. (7b000001-ffffffff : PCI Bus 0000:00) & not from
0x7b000000. And the stolen base is coming as 0x7b000000,
thus there is a conflict & stolen area remains unused by driver.
So to circumvent this issue we adjust the base of stolen area by
1 byte when registering it with the kernel.
Otherwise if we don't resolve this conflict or don't remove the
conflict error check from the driver, the stolen area will remain
disabled.

Signed-off-by: Akash Goel <akash.goel@intel.com>
---
 drivers/gpu/drm/i915/i915_gem_stolen.c | 27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c
index 1a24e84..29b3693 100644
--- a/drivers/gpu/drm/i915/i915_gem_stolen.c
+++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
@@ -82,9 +82,30 @@ 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 because as somehow the start/base location of
+		 * the Parent region of Stolen area which is PCI Bus 0000:00
+		 * is not coinciding with the start of Stolen area and is
+		 * conflicting with it. For ex. from the device memory map
+		 * info provided by '/proc/iomem', we have seen that somehow
+		 * a region of PCI Bus 0000:00 is being shown to start from
+		 * 0x7b000001, i.e. (7b000001-ffffffff : PCI Bus 0000:00).
+		 * And the stolen base is coming as 0x7b000000, thus there is a
+		 * conflict and stolen memory remains unused by the driver.
+		 * So to circumvent this issue we adjust the base of stolen
+		 * area by 1 when registering it with the kernel.
+		 */
+		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

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

end of thread, other threads:[~2014-03-06  6:22 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-13 10:55 [PATCH 2/7] drm/i915: Resolving the memory region conflict for Stolen area akash.goel
     [not found] ` <8BF5CF93467D8C498F250C96583BC09CC6AD09@BGSMSX103.gar.corp.intel.com>
2014-01-28  9:14   ` Daniel Vetter
2014-02-18 19:49     ` Jesse Barnes
2014-02-24 19:22       ` Jani Nikula
2014-02-27 16:43         ` Chris Wilson
2014-02-28 14:06           ` Jani Nikula
2014-03-06  6:21             ` Jani Nikula
2014-02-26 16:21 ` Jesse Barnes
2014-02-27  8:59   ` Jani Nikula
2014-02-27  9:01     ` Jani Nikula
2014-03-03 19:14       ` Jesse Barnes
2014-03-03 22:33         ` Jesse Barnes
  -- strict thread matches above, loose matches on Subject: below --
2014-01-09  5:30 akash.goel
2014-01-09  7:29 ` Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox