diff mbox

drm/i915: Pass DMA_ATTR_NO_WARN to dma_map_sg()

Message ID 20180104163842.11635-1-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson Jan. 4, 2018, 4:38 p.m. UTC
In some iommu, e.g. swiotlb, the available space can be quite limited.
So we employ a trial-and-error approach to seeing if our large
contiguous chunks can fit, and if that fails we try again with smaller
chunks after trying to free our own lazily allocated blobs. As we use a
trial-and-error approach, we do not want dma_map_sg() to emit a WARN of
its own accord, we want to gracefully report the error back to the caller
instead.

Note that our noisy culprit, swiotlb, doesn't honour the flag, yet.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Matthew Auld <matthew.auld@intel.com>
---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Matthew Auld Jan. 4, 2018, 5:20 p.m. UTC | #1
On 4 January 2018 at 16:38, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> In some iommu, e.g. swiotlb, the available space can be quite limited.
> So we employ a trial-and-error approach to seeing if our large
> contiguous chunks can fit, and if that fails we try again with smaller
> chunks after trying to free our own lazily allocated blobs. As we use a
> trial-and-error approach, we do not want dma_map_sg() to emit a WARN of
> its own accord, we want to gracefully report the error back to the caller
> instead.
>
> Note that our noisy culprit, swiotlb, doesn't honour the flag, yet.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Matthew Auld <matthew.auld@intel.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Chris Wilson Jan. 4, 2018, 6:50 p.m. UTC | #2
Quoting Matthew Auld (2018-01-04 17:20:16)
> On 4 January 2018 at 16:38, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> > In some iommu, e.g. swiotlb, the available space can be quite limited.
> > So we employ a trial-and-error approach to seeing if our large
> > contiguous chunks can fit, and if that fails we try again with smaller
> > chunks after trying to free our own lazily allocated blobs. As we use a
> > trial-and-error approach, we do not want dma_map_sg() to emit a WARN of
> > its own accord, we want to gracefully report the error back to the caller
> > instead.
> >
> > Note that our noisy culprit, swiotlb, doesn't honour the flag, yet.
> >
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> > Cc: Matthew Auld <matthew.auld@intel.com>
> Reviewed-by: Matthew Auld <matthew.auld@intel.com>

Thanks, pushed the small tweak for a silent future.
-Chris
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index c5f393870532..f2a0f556da21 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -2335,9 +2335,10 @@  int i915_gem_gtt_prepare_pages(struct drm_i915_gem_object *obj,
 			       struct sg_table *pages)
 {
 	do {
-		if (dma_map_sg(&obj->base.dev->pdev->dev,
-			       pages->sgl, pages->nents,
-			       PCI_DMA_BIDIRECTIONAL))
+		if (dma_map_sg_attrs(&obj->base.dev->pdev->dev,
+				     pages->sgl, pages->nents,
+				     PCI_DMA_BIDIRECTIONAL,
+				     DMA_ATTR_NO_WARN))
 			return 0;
 
 		/* If the DMA remap fails, one cause can be that we have