From: Chris Wilson <chris@chris-wilson.co.uk> To: iommu@lists.linux-foundation.org Cc: linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, "Chris Wilson" <chris@chris-wilson.co.uk>, "Christian König" <christian.koenig@amd.com>, "Mike Galbraith" <efault@gmx.de>, "Konrad Rzeszutek Wilk" <konrad.wilk@oracle.com>, "Christoph Hellwig" <hch@lst.de> Subject: [PATCH] swiotlb: Suppress "Out of SW-IOMMU" errors for NO_WARN Date: Wed, 2 May 2018 11:05:01 +0100 [thread overview] Message-ID: <20180502100501.28440-1-chris@chris-wilson.co.uk> (raw) This extends the warning suppression from commit d0bc0c2a31c9 ("swiotlb: suppress warning when __GFP_NOWARN is set") to suppress the warnings when DMA_ATTR_NO_WARN is given by caller. In such cases the caller wants to handle the error themselves. Fixes: d0bc0c2a31c9 ("swiotlb: suppress warning when __GFP_NOWARN is set") Cc: Christian König <christian.koenig@amd.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Cc: Christoph Hellwig <hch@lst.de> --- lib/swiotlb.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/swiotlb.c b/lib/swiotlb.c index fece57566d45..2bfb936c5708 100644 --- a/lib/swiotlb.c +++ b/lib/swiotlb.c @@ -768,11 +768,14 @@ static bool swiotlb_free_buffer(struct device *dev, size_t size, static void swiotlb_full(struct device *dev, size_t size, enum dma_data_direction dir, - int do_panic) + unsigned long attrs, int do_panic) { if (swiotlb_force == SWIOTLB_NO_FORCE) return; + if (attrs & DMA_ATTR_NO_WARN) + return; + /* * Ran out of IOMMU space for this operation. This is very bad. * Unfortunately the drivers cannot handle this operation properly. @@ -823,7 +826,7 @@ dma_addr_t swiotlb_map_page(struct device *dev, struct page *page, /* Oh well, have to allocate and map a bounce buffer. */ map = map_single(dev, phys, size, dir, attrs); if (map == SWIOTLB_MAP_ERROR) { - swiotlb_full(dev, size, dir, 1); + swiotlb_full(dev, size, dir, attrs, 1); return __phys_to_dma(dev, io_tlb_overflow_buffer); } @@ -959,7 +962,7 @@ swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl, int nelems, if (map == SWIOTLB_MAP_ERROR) { /* Don't panic here, we expect map_sg users to do proper error handling. */ - swiotlb_full(hwdev, sg->length, dir, 0); + swiotlb_full(hwdev, sg->length, dir, attrs, 0); attrs |= DMA_ATTR_SKIP_CPU_SYNC; swiotlb_unmap_sg_attrs(hwdev, sgl, i, dir, attrs); -- 2.17.0
WARNING: multiple messages have this Message-ID (diff)
From: Chris Wilson <chris@chris-wilson.co.uk> To: iommu@lists.linux-foundation.org Cc: "Konrad Rzeszutek Wilk" <konrad.wilk@oracle.com>, intel-gfx@lists.freedesktop.org, "Mike Galbraith" <efault@gmx.de>, linux-kernel@vger.kernel.org, "Christoph Hellwig" <hch@lst.de>, "Christian König" <christian.koenig@amd.com> Subject: [PATCH] swiotlb: Suppress "Out of SW-IOMMU" errors for NO_WARN Date: Wed, 2 May 2018 11:05:01 +0100 [thread overview] Message-ID: <20180502100501.28440-1-chris@chris-wilson.co.uk> (raw) This extends the warning suppression from commit d0bc0c2a31c9 ("swiotlb: suppress warning when __GFP_NOWARN is set") to suppress the warnings when DMA_ATTR_NO_WARN is given by caller. In such cases the caller wants to handle the error themselves. Fixes: d0bc0c2a31c9 ("swiotlb: suppress warning when __GFP_NOWARN is set") Cc: Christian König <christian.koenig@amd.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Cc: Christoph Hellwig <hch@lst.de> --- lib/swiotlb.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/swiotlb.c b/lib/swiotlb.c index fece57566d45..2bfb936c5708 100644 --- a/lib/swiotlb.c +++ b/lib/swiotlb.c @@ -768,11 +768,14 @@ static bool swiotlb_free_buffer(struct device *dev, size_t size, static void swiotlb_full(struct device *dev, size_t size, enum dma_data_direction dir, - int do_panic) + unsigned long attrs, int do_panic) { if (swiotlb_force == SWIOTLB_NO_FORCE) return; + if (attrs & DMA_ATTR_NO_WARN) + return; + /* * Ran out of IOMMU space for this operation. This is very bad. * Unfortunately the drivers cannot handle this operation properly. @@ -823,7 +826,7 @@ dma_addr_t swiotlb_map_page(struct device *dev, struct page *page, /* Oh well, have to allocate and map a bounce buffer. */ map = map_single(dev, phys, size, dir, attrs); if (map == SWIOTLB_MAP_ERROR) { - swiotlb_full(dev, size, dir, 1); + swiotlb_full(dev, size, dir, attrs, 1); return __phys_to_dma(dev, io_tlb_overflow_buffer); } @@ -959,7 +962,7 @@ swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl, int nelems, if (map == SWIOTLB_MAP_ERROR) { /* Don't panic here, we expect map_sg users to do proper error handling. */ - swiotlb_full(hwdev, sg->length, dir, 0); + swiotlb_full(hwdev, sg->length, dir, attrs, 0); attrs |= DMA_ATTR_SKIP_CPU_SYNC; swiotlb_unmap_sg_attrs(hwdev, sgl, i, dir, attrs); -- 2.17.0 _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next reply other threads:[~2018-05-02 10:05 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-05-02 10:05 Chris Wilson [this message] 2018-05-02 10:05 ` [PATCH] swiotlb: Suppress "Out of SW-IOMMU" errors for NO_WARN Chris Wilson 2018-05-02 12:44 ` Christoph Hellwig 2018-05-02 13:29 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork 2018-05-02 13:54 ` ✓ Fi.CI.BAT: success " Patchwork 2018-05-02 17:43 ` ✓ Fi.CI.IGT: " Patchwork
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20180502100501.28440-1-chris@chris-wilson.co.uk \ --to=chris@chris-wilson.co.uk \ --cc=christian.koenig@amd.com \ --cc=efault@gmx.de \ --cc=hch@lst.de \ --cc=intel-gfx@lists.freedesktop.org \ --cc=iommu@lists.linux-foundation.org \ --cc=konrad.wilk@oracle.com \ --cc=linux-kernel@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.