diff options
-rw-r--r-- | arch/x86/kernel/pci-swiotlb.c | 5 | ||||
-rw-r--r-- | include/linux/swiotlb.h | 2 | ||||
-rw-r--r-- | lib/swiotlb.c | 15 |
3 files changed, 2 insertions, 20 deletions
diff --git a/arch/x86/kernel/pci-swiotlb.c b/arch/x86/kernel/pci-swiotlb.c index ea675cfe76fe..165bd7f93bb1 100644 --- a/arch/x86/kernel/pci-swiotlb.c +++ b/arch/x86/kernel/pci-swiotlb.c | |||
@@ -23,11 +23,6 @@ phys_addr_t swiotlb_bus_to_phys(struct device *hwdev, dma_addr_t baddr) | |||
23 | return baddr; | 23 | return baddr; |
24 | } | 24 | } |
25 | 25 | ||
26 | int __weak swiotlb_arch_range_needs_mapping(phys_addr_t paddr, size_t size) | ||
27 | { | ||
28 | return 0; | ||
29 | } | ||
30 | |||
31 | static void *x86_swiotlb_alloc_coherent(struct device *hwdev, size_t size, | 26 | static void *x86_swiotlb_alloc_coherent(struct device *hwdev, size_t size, |
32 | dma_addr_t *dma_handle, gfp_t flags) | 27 | dma_addr_t *dma_handle, gfp_t flags) |
33 | { | 28 | { |
diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h index 6bc50944040f..a977da24f17c 100644 --- a/include/linux/swiotlb.h +++ b/include/linux/swiotlb.h | |||
@@ -28,8 +28,6 @@ extern dma_addr_t swiotlb_phys_to_bus(struct device *hwdev, | |||
28 | extern phys_addr_t swiotlb_bus_to_phys(struct device *hwdev, | 28 | extern phys_addr_t swiotlb_bus_to_phys(struct device *hwdev, |
29 | dma_addr_t address); | 29 | dma_addr_t address); |
30 | 30 | ||
31 | extern int swiotlb_arch_range_needs_mapping(phys_addr_t paddr, size_t size); | ||
32 | |||
33 | extern void | 31 | extern void |
34 | *swiotlb_alloc_coherent(struct device *hwdev, size_t size, | 32 | *swiotlb_alloc_coherent(struct device *hwdev, size_t size, |
35 | dma_addr_t *dma_handle, gfp_t flags); | 33 | dma_addr_t *dma_handle, gfp_t flags); |
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 | ||
144 | int __weak swiotlb_arch_range_needs_mapping(phys_addr_t paddr, size_t size) | ||
145 | { | ||
146 | return 0; | ||
147 | } | ||
148 | |||
149 | static void swiotlb_print_info(unsigned long bytes) | 144 | static 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 | ||
315 | static 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 | |||
320 | static int is_swiotlb_buffer(char *addr) | 310 | static 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); |