diff options
Diffstat (limited to 'lib/swiotlb.c')
| -rw-r--r-- | lib/swiotlb.c | 15 | 
1 files changed, 5 insertions, 10 deletions
diff --git a/lib/swiotlb.c b/lib/swiotlb.c index fece57566d45..04b68d9dffac 100644 --- a/lib/swiotlb.c +++ b/lib/swiotlb.c @@ -593,9 +593,8 @@ found:  }  /* - * Allocates bounce buffer and returns its kernel virtual address. + * Allocates bounce buffer and returns its physical address.   */ -  static phys_addr_t  map_single(struct device *hwdev, phys_addr_t phys, size_t size,  	   enum dma_data_direction dir, unsigned long attrs) @@ -614,7 +613,7 @@ map_single(struct device *hwdev, phys_addr_t phys, size_t size,  }  /* - * dma_addr is the kernel virtual address of the bounce buffer to unmap. + * tlb_addr is the physical address of the bounce buffer to unmap.   */  void swiotlb_tbl_unmap_single(struct device *hwdev, phys_addr_t tlb_addr,  			      size_t size, enum dma_data_direction dir, @@ -692,7 +691,6 @@ void swiotlb_tbl_sync_single(struct device *hwdev, phys_addr_t tlb_addr,  	}  } -#ifdef CONFIG_DMA_DIRECT_OPS  static inline bool dma_coherent_ok(struct device *dev, dma_addr_t addr,  		size_t size)  { @@ -714,7 +712,7 @@ swiotlb_alloc_buffer(struct device *dev, size_t size, dma_addr_t *dma_handle,  	phys_addr = swiotlb_tbl_map_single(dev,  			__phys_to_dma(dev, io_tlb_start), -			0, size, DMA_FROM_DEVICE, 0); +			0, size, DMA_FROM_DEVICE, attrs);  	if (phys_addr == SWIOTLB_MAP_ERROR)  		goto out_warn; @@ -727,7 +725,7 @@ swiotlb_alloc_buffer(struct device *dev, size_t size, dma_addr_t *dma_handle,  out_unmap:  	dev_warn(dev, "hwdev DMA mask = 0x%016Lx, dev_addr = 0x%016Lx\n", -		(unsigned long long)(dev ? dev->coherent_dma_mask : 0), +		(unsigned long long)dev->coherent_dma_mask,  		(unsigned long long)*dma_handle);  	/* @@ -737,7 +735,7 @@ out_unmap:  	swiotlb_tbl_unmap_single(dev, phys_addr, size, DMA_TO_DEVICE,  			DMA_ATTR_SKIP_CPU_SYNC);  out_warn: -	if ((attrs & DMA_ATTR_NO_WARN) && printk_ratelimit()) { +	if (!(attrs & DMA_ATTR_NO_WARN) && printk_ratelimit()) {  		dev_warn(dev,  			"swiotlb: coherent allocation failed, size=%zu\n",  			size); @@ -764,7 +762,6 @@ static bool swiotlb_free_buffer(struct device *dev, size_t size,  				 DMA_ATTR_SKIP_CPU_SYNC);  	return true;  } -#endif  static void  swiotlb_full(struct device *dev, size_t size, enum dma_data_direction dir, @@ -1045,7 +1042,6 @@ swiotlb_dma_supported(struct device *hwdev, u64 mask)  	return __phys_to_dma(hwdev, io_tlb_end - 1) <= mask;  } -#ifdef CONFIG_DMA_DIRECT_OPS  void *swiotlb_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,  		gfp_t gfp, unsigned long attrs)  { @@ -1089,4 +1085,3 @@ const struct dma_map_ops swiotlb_dma_ops = {  	.unmap_page		= swiotlb_unmap_page,  	.dma_supported		= dma_direct_supported,  }; -#endif /* CONFIG_DMA_DIRECT_OPS */  | 
