lkml.org 
[lkml]   [2018]   [May]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 6/6] swiotlb: respect DMA_ATTR_NO_WARN in __swiotlb_map_page
Date
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
lib/swiotlb.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/lib/swiotlb.c b/lib/swiotlb.c
index 5becc2fc680a..5cf88e090cb6 100644
--- a/lib/swiotlb.c
+++ b/lib/swiotlb.c
@@ -608,8 +608,11 @@ __swiotlb_map_page(struct device *dev, phys_addr_t phys, size_t size,

switch (swiotlb_force) {
case SWIOTLB_NO_FORCE:
- dev_warn_ratelimited(dev,
- "swiotlb: force disabled for address %pa\n", &phys);
+ if (!(attrs & DMA_ATTR_NO_WARN)) {
+ dev_warn_ratelimited(dev,
+ "swiotlb: force disabled for address %pa\n",
+ &phys);
+ }
return -EOPNOTSUPP;
case SWIOTLB_NORMAL:
/* can we address the memory directly? */
@@ -629,10 +632,12 @@ __swiotlb_map_page(struct device *dev, phys_addr_t phys, size_t size,
/* Ensure that the address returned is DMA'ble */
*dma_addr = __phys_to_dma(dev, map_addr);
if (unlikely(!dma_capable(dev, *dma_addr, size))) {
- dev_err_ratelimited(dev,
- "DMA: swiotlb buffer not addressable.\n");
+ if (!(attrs & DMA_ATTR_NO_WARN)) {
+ dev_err_ratelimited(dev,
+ "DMA: swiotlb buffer not addressable.\n");
+ }
swiotlb_tbl_unmap_single(dev, map_addr, size, dir,
- attrs | DMA_ATTR_SKIP_CPU_SYNC);
+ attrs | DMA_ATTR_SKIP_CPU_SYNC);
return -EINVAL;
}
return 0;
--
2.17.0
\
 
 \ /
  Last update: 2018-05-15 20:07    [W:0.116 / U:2.412 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site