* [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[parent not found: <8BF5CF93467D8C498F250C96583BC09CC6AD09@BGSMSX103.gar.corp.intel.com>]
* Re: [PATCH 2/7] drm/i915: Resolving the memory region conflict for Stolen area [not found] ` <8BF5CF93467D8C498F250C96583BC09CC6AD09@BGSMSX103.gar.corp.intel.com> @ 2014-01-28 9:14 ` Daniel Vetter 2014-02-18 19:49 ` Jesse Barnes 0 siblings, 1 reply; 14+ messages in thread From: Daniel Vetter @ 2014-01-28 9:14 UTC (permalink / raw) To: Goel, Akash; +Cc: Vetter, Daniel, intel-gfx On Tue, Jan 28, 2014 at 10:10 AM, Goel, Akash <akash.goel@intel.com> wrote: > 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 > > Best Regards > Akash > > -----Original Message----- > From: Goel, Akash > Sent: Monday, January 13, 2014 4:25 PM > To: intel-gfx@lists.freedesktop.org > Cc: Goel, Akash > Subject: [PATCH 2/7] drm/i915: Resolving the memory region conflict for Stolen area > > 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 > -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/7] drm/i915: Resolving the memory region conflict for Stolen area 2014-01-28 9:14 ` Daniel Vetter @ 2014-02-18 19:49 ` Jesse Barnes 2014-02-24 19:22 ` Jani Nikula 0 siblings, 1 reply; 14+ messages in thread From: Jesse Barnes @ 2014-02-18 19:49 UTC (permalink / raw) To: Daniel Vetter; +Cc: Jani Nikula, Vetter, Daniel, Goel, Akash, intel-gfx On Tue, 28 Jan 2014 10:14:03 +0100 Daniel Vetter <daniel@ffwll.ch> wrote: > On Tue, Jan 28, 2014 at 10:10 AM, Goel, Akash <akash.goel@intel.com> wrote: > > 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 > > > > > Best Regards > > Akash > > > > -----Original Message----- > > From: Goel, Akash > > Sent: Monday, January 13, 2014 4:25 PM > > To: intel-gfx@lists.freedesktop.org > > Cc: Goel, Akash > > Subject: [PATCH 2/7] drm/i915: Resolving the memory region conflict for Stolen area > > > > 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; 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. -- Jesse Barnes, Intel Open Source Technology Center ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/7] drm/i915: Resolving the memory region conflict for Stolen area 2014-02-18 19:49 ` Jesse Barnes @ 2014-02-24 19:22 ` Jani Nikula 2014-02-27 16:43 ` Chris Wilson 0 siblings, 1 reply; 14+ messages in thread From: Jani Nikula @ 2014-02-24 19:22 UTC (permalink / raw) To: Jesse Barnes, Daniel Vetter; +Cc: Vetter, Daniel, Goel, Akash, intel-gfx On Tue, 18 Feb 2014, Jesse Barnes <jbarnes@virtuousgeek.org> wrote: > On Tue, 28 Jan 2014 10:14:03 +0100 > Daniel Vetter <daniel@ffwll.ch> wrote: > >> On Tue, Jan 28, 2014 at 10:10 AM, Goel, Akash <akash.goel@intel.com> wrote: >> > 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 >> >> > >> > Best Regards >> > Akash >> > >> > -----Original Message----- >> > From: Goel, Akash >> > Sent: Monday, January 13, 2014 4:25 PM >> > To: intel-gfx@lists.freedesktop.org >> > Cc: Goel, Akash >> > Subject: [PATCH 2/7] drm/i915: Resolving the memory region conflict for Stolen area >> > >> > 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; > > 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 <akash.goel@intel.com> Date: Mon Jan 13 16:24:45 2014 +0530 drm/i915: Fix the offset issue for the stolen GEM objects i.e. something else. > 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/?i=20140128085325.GA7422@phenom.ffwll.local -- Jani Nikula, Intel Open Source Technology Center ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/7] drm/i915: Resolving the memory region conflict for Stolen area 2014-02-24 19:22 ` Jani Nikula @ 2014-02-27 16:43 ` Chris Wilson 2014-02-28 14:06 ` Jani Nikula 0 siblings, 1 reply; 14+ messages in thread From: Chris Wilson @ 2014-02-27 16:43 UTC (permalink / raw) To: Jani Nikula; +Cc: Vetter, Daniel, Goel, Akash, intel-gfx [-- Attachment #1: Type: text/plain, Size: 458 bytes --] On Mon, Feb 24, 2014 at 09:22:31PM +0200, Jani Nikula wrote: > 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 -- Chris Wilson, Intel Open Source Technology Centre [-- Attachment #2: 0001-drm-i915-Trim-stolen-region-for-reserved-pages-and-c.patch --] [-- Type: text/x-diff, Size: 7126 bytes --] >From e5230c7bf7186699f1b83dcbff5a45a3267c9941 Mon Sep 17 00:00:00 2001 From: Chris Wilson <chris@chris-wilson.co.uk> 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 <chris@chris-wilson.co.uk> --- 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(-) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 655a45c981fd..eb31c456eb35 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -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; diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c index adc5c91f6946..984ada1b0084 100644 --- a/drivers/gpu/drm/i915/i915_gem_stolen.c +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c @@ -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; diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index 3419ddae32c6..ac0cff40d5ec 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -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: -- 1.9.0 [-- Attachment #3: Type: text/plain, Size: 159 bytes --] _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/intel-gfx ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 2/7] drm/i915: Resolving the memory region conflict for Stolen area 2014-02-27 16:43 ` Chris Wilson @ 2014-02-28 14:06 ` Jani Nikula 2014-03-06 6:21 ` Jani Nikula 0 siblings, 1 reply; 14+ messages in thread From: Jani Nikula @ 2014-02-28 14:06 UTC (permalink / raw) To: Chris Wilson; +Cc: intel-gfx, Goel, Akash, Vetter, Daniel, Arjan van de Ven On Thu, 27 Feb 2014, Chris Wilson <chris@chris-wilson.co.uk> wrote: > On Mon, Feb 24, 2014 at 09:22:31PM +0200, Jani Nikula wrote: >> 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. > -Chris > > -- > Chris Wilson, Intel Open Source Technology Centre > From e5230c7bf7186699f1b83dcbff5a45a3267c9941 Mon Sep 17 00:00:00 2001 > From: Chris Wilson <chris@chris-wilson.co.uk> > 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 <chris@chris-wilson.co.uk> > --- > 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(-) > > diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h > index 655a45c981fd..eb31c456eb35 100644 > --- a/drivers/gpu/drm/i915/i915_drv.h > +++ b/drivers/gpu/drm/i915/i915_drv.h > @@ -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; > diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c > index adc5c91f6946..984ada1b0084 100644 > --- a/drivers/gpu/drm/i915/i915_gem_stolen.c > +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c > @@ -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; > diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c > index 3419ddae32c6..ac0cff40d5ec 100644 > --- a/drivers/gpu/drm/i915/intel_pm.c > +++ b/drivers/gpu/drm/i915/intel_pm.c > @@ -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: > -- > 1.9.0 > -- Jani Nikula, Intel Open Source Technology Center ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/7] drm/i915: Resolving the memory region conflict for Stolen area 2014-02-28 14:06 ` Jani Nikula @ 2014-03-06 6:21 ` Jani Nikula 0 siblings, 0 replies; 14+ messages in thread From: Jani Nikula @ 2014-03-06 6:21 UTC (permalink / raw) To: Chris Wilson; +Cc: Vetter, Daniel, intel-gfx, Arjan van de Ven, Goel, Akash On Fri, 28 Feb 2014, Jani Nikula <jani.nikula@intel.com> wrote: > 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. -- Jani Nikula, Intel Open Source Technology Center ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/7] drm/i915: Resolving the memory region conflict for Stolen area 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-02-26 16:21 ` Jesse Barnes 2014-02-27 8:59 ` Jani Nikula 1 sibling, 1 reply; 14+ messages in thread From: Jesse Barnes @ 2014-02-26 16:21 UTC (permalink / raw) To: akash.goel; +Cc: intel-gfx On Mon, 13 Jan 2014 16:25:21 +0530 akash.goel@intel.com wrote: > 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; Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org> Tested-by: Arjan van de Ven <arjan@linux.intel.com> Thanks, -- Jesse Barnes, Intel Open Source Technology Center ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/7] drm/i915: Resolving the memory region conflict for Stolen area 2014-02-26 16:21 ` Jesse Barnes @ 2014-02-27 8:59 ` Jani Nikula 2014-02-27 9:01 ` Jani Nikula 0 siblings, 1 reply; 14+ messages in thread From: Jani Nikula @ 2014-02-27 8:59 UTC (permalink / raw) To: Jesse Barnes, akash.goel; +Cc: intel-gfx On Wed, 26 Feb 2014, Jesse Barnes <jbarnes@virtuousgeek.org> wrote: > On Mon, 13 Jan 2014 16:25:21 +0530 > akash.goel@intel.com wrote: > >> 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; > > Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org> > Tested-by: Arjan van de Ven <arjan@linux.intel.com> Pushed to -fixes, thanks for the patch, review, and testing. Jani. > > Thanks, > -- > Jesse Barnes, Intel Open Source Technology Center > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/intel-gfx -- Jani Nikula, Intel Open Source Technology Center ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/7] drm/i915: Resolving the memory region conflict for Stolen area 2014-02-27 8:59 ` Jani Nikula @ 2014-02-27 9:01 ` Jani Nikula 2014-03-03 19:14 ` Jesse Barnes 0 siblings, 1 reply; 14+ messages in thread From: Jani Nikula @ 2014-02-27 9:01 UTC (permalink / raw) To: Jesse Barnes, akash.goel; +Cc: intel-gfx On Thu, 27 Feb 2014, Jani Nikula <jani.nikula@linux.intel.com> wrote: > On Wed, 26 Feb 2014, Jesse Barnes <jbarnes@virtuousgeek.org> wrote: >> On Mon, 13 Jan 2014 16:25:21 +0530 >> akash.goel@intel.com wrote: >> >>> 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; >> >> Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org> >> Tested-by: Arjan van de Ven <arjan@linux.intel.com> > > 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. > > Jani. > > >> >> Thanks, >> -- >> Jesse Barnes, Intel Open Source Technology Center >> _______________________________________________ >> Intel-gfx mailing list >> Intel-gfx@lists.freedesktop.org >> http://lists.freedesktop.org/mailman/listinfo/intel-gfx > > -- > Jani Nikula, Intel Open Source Technology Center -- Jani Nikula, Intel Open Source Technology Center ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/7] drm/i915: Resolving the memory region conflict for Stolen area 2014-02-27 9:01 ` Jani Nikula @ 2014-03-03 19:14 ` Jesse Barnes 2014-03-03 22:33 ` Jesse Barnes 0 siblings, 1 reply; 14+ messages in thread From: Jesse Barnes @ 2014-03-03 19:14 UTC (permalink / raw) To: Jani Nikula; +Cc: akash.goel, intel-gfx On Thu, 27 Feb 2014 11:01:08 +0200 Jani Nikula <jani.nikula@linux.intel.com> wrote: > On Thu, 27 Feb 2014, Jani Nikula <jani.nikula@linux.intel.com> wrote: > > On Wed, 26 Feb 2014, Jesse Barnes <jbarnes@virtuousgeek.org> wrote: > >> On Mon, 13 Jan 2014 16:25:21 +0530 > >> akash.goel@intel.com wrote: > >> > >>> 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; > >> > >> Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org> > >> Tested-by: Arjan van de Ven <arjan@linux.intel.com> > > > > 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. -- Jesse Barnes, Intel Open Source Technology Center ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/7] drm/i915: Resolving the memory region conflict for Stolen area 2014-03-03 19:14 ` Jesse Barnes @ 2014-03-03 22:33 ` Jesse Barnes 0 siblings, 0 replies; 14+ messages in thread From: Jesse Barnes @ 2014-03-03 22:33 UTC (permalink / raw) To: Jesse Barnes; +Cc: akash.goel, intel-gfx On Mon, 3 Mar 2014 11:14:09 -0800 Jesse Barnes <jbarnes@virtuousgeek.org> wrote: > On Thu, 27 Feb 2014 11:01:08 +0200 > Jani Nikula <jani.nikula@linux.intel.com> wrote: > > > On Thu, 27 Feb 2014, Jani Nikula <jani.nikula@linux.intel.com> wrote: > > > On Wed, 26 Feb 2014, Jesse Barnes <jbarnes@virtuousgeek.org> wrote: > > >> On Mon, 13 Jan 2014 16:25:21 +0530 > > >> akash.goel@intel.com wrote: > > >> > > >>> 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; > > >> > > >> Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org> > > >> Tested-by: Arjan van de Ven <arjan@linux.intel.com> > > > > > > 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. -- Jesse Barnes, Intel Open Source Technology Center ^ permalink raw reply [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
* Re: [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, 0 replies; 14+ messages in thread From: Daniel Vetter @ 2014-01-09 7:29 UTC (permalink / raw) To: akash.goel; +Cc: intel-gfx On Thu, Jan 09, 2014 at 11:00:28AM +0530, akash.goel@intel.com wrote: > 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. > + */ I think this comment can be shortened a bit: /* * 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. */ Curious readers can then bring up the full details with git blame. Also note that we now prefer the multi-line comment delimiters /* and */ on separate lines. Cheers, Daniel > + 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 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/intel-gfx -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch ^ permalink raw reply [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