aboutsummaryrefslogtreecommitdiffstats
path: root/lib/swiotlb.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/swiotlb.c')
-rw-r--r--lib/swiotlb.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/lib/swiotlb.c b/lib/swiotlb.c
index 3c4c21cdf43d..dc1cd1f5369e 100644
--- a/lib/swiotlb.c
+++ b/lib/swiotlb.c
@@ -141,11 +141,6 @@ int __weak swiotlb_arch_address_needs_mapping(struct device *hwdev,
141 return !is_buffer_dma_capable(dma_get_mask(hwdev), addr, size); 141 return !is_buffer_dma_capable(dma_get_mask(hwdev), addr, size);
142} 142}
143 143
144int __weak swiotlb_arch_range_needs_mapping(phys_addr_t paddr, size_t size)
145{
146 return 0;
147}
148
149static void swiotlb_print_info(unsigned long bytes) 144static void swiotlb_print_info(unsigned long bytes)
150{ 145{
151 phys_addr_t pstart, pend; 146 phys_addr_t pstart, pend;
@@ -312,11 +307,6 @@ address_needs_mapping(struct device *hwdev, dma_addr_t addr, size_t size)
312 return swiotlb_arch_address_needs_mapping(hwdev, addr, size); 307 return swiotlb_arch_address_needs_mapping(hwdev, addr, size);
313} 308}
314 309
315static inline int range_needs_mapping(phys_addr_t paddr, size_t size)
316{
317 return swiotlb_force || swiotlb_arch_range_needs_mapping(paddr, size);
318}
319
320static int is_swiotlb_buffer(char *addr) 310static int is_swiotlb_buffer(char *addr)
321{ 311{
322 return addr >= io_tlb_start && addr < io_tlb_end; 312 return addr >= io_tlb_start && addr < io_tlb_end;
@@ -646,8 +636,7 @@ dma_addr_t swiotlb_map_page(struct device *dev, struct page *page,
646 * we can safely return the device addr and not worry about bounce 636 * we can safely return the device addr and not worry about bounce
647 * buffering it. 637 * buffering it.
648 */ 638 */
649 if (!address_needs_mapping(dev, dev_addr, size) && 639 if (!address_needs_mapping(dev, dev_addr, size) && !swiotlb_force)
650 !range_needs_mapping(phys, size))
651 return dev_addr; 640 return dev_addr;
652 641
653 /* 642 /*
@@ -810,7 +799,7 @@ swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl, int nelems,
810 phys_addr_t paddr = sg_phys(sg); 799 phys_addr_t paddr = sg_phys(sg);
811 dma_addr_t dev_addr = swiotlb_phys_to_bus(hwdev, paddr); 800 dma_addr_t dev_addr = swiotlb_phys_to_bus(hwdev, paddr);
812 801
813 if (range_needs_mapping(paddr, sg->length) || 802 if (swiotlb_force ||
814 address_needs_mapping(hwdev, dev_addr, sg->length)) { 803 address_needs_mapping(hwdev, dev_addr, sg->length)) {
815 void *map = map_single(hwdev, sg_phys(sg), 804 void *map = map_single(hwdev, sg_phys(sg),
816 sg->length, dir); 805 sg->length, dir);