aboutsummaryrefslogtreecommitdiff
path: root/kernel/dma/swiotlb.c
diff options
context:
space:
mode:
authorGravatar Christoph Hellwig <hch@lst.de> 2019-11-19 17:38:58 +0100
committerGravatar Christoph Hellwig <hch@lst.de> 2019-11-20 20:31:41 +0100
commit68a33b1794665ba8a1d1ef1d3bfcc7c587d380a6 (patch)
treefa623a6dfd451c161630422aafd0bec2fe486285 /kernel/dma/swiotlb.c
parentdma-direct: don't check swiotlb=force in dma_direct_map_resource (diff)
downloadlinux-68a33b1794665ba8a1d1ef1d3bfcc7c587d380a6.tar.gz
linux-68a33b1794665ba8a1d1ef1d3bfcc7c587d380a6.tar.bz2
linux-68a33b1794665ba8a1d1ef1d3bfcc7c587d380a6.zip
dma-direct: exclude dma_direct_map_resource from the min_low_pfn check
The valid memory address check in dma_capable only makes sense when mapping normal memory, not when using dma_map_resource to map a device resource. Add a new boolean argument to dma_capable to exclude that check for the dma_map_resource case. Fixes: b12d66278dd6 ("dma-direct: check for overflows on 32 bit DMA addresses") Reported-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Marek Szyprowski <m.szyprowski@samsung.com> Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Diffstat (limited to 'kernel/dma/swiotlb.c')
-rw-r--r--kernel/dma/swiotlb.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
index 673a2cdb2656..9280d6f8271e 100644
--- a/kernel/dma/swiotlb.c
+++ b/kernel/dma/swiotlb.c
@@ -678,7 +678,7 @@ bool swiotlb_map(struct device *dev, phys_addr_t *phys, dma_addr_t *dma_addr,
/* Ensure that the address returned is DMA'ble */
*dma_addr = __phys_to_dma(dev, *phys);
- if (unlikely(!dma_capable(dev, *dma_addr, size))) {
+ if (unlikely(!dma_capable(dev, *dma_addr, size, true))) {
swiotlb_tbl_unmap_single(dev, *phys, size, size, dir,
attrs | DMA_ATTR_SKIP_CPU_SYNC);
return false;