The function returns the maximum size that can be remapped by the SWIOTLB implementation. This function will be later exposed to users through the DMA-API.
Unified · Split
| @@ -76,6 +76,7 @@ bool swiotlb_map(struct device *dev, phys_addr_t *phys, dma_addr_t *dma_addr, · 75 unmodified lines | |||
| 76 | size_t size, enum dma_data_direction dir, unsigned long attrs); | 76 | size_t size, enum dma_data_direction dir, unsigned long attrs); |
| 77 | void __init swiotlb_exit(void); | 77 | void __init swiotlb_exit(void); |
| 78 | unsigned int swiotlb_max_segment(void); | 78 | unsigned int swiotlb_max_segment(void); |
| 79 | size_t swiotlb_max_mapping_size(struct device *dev); | ||
| 79 | #else | 80 | #else |
| 80 | #define swiotlb_force SWIOTLB_NO_FORCE | 81 | #define swiotlb_force SWIOTLB_NO_FORCE |
| 81 | static inline bool is_swiotlb_buffer(phys_addr_t paddr) | 82 | static inline bool is_swiotlb_buffer(phys_addr_t paddr) |
| @@ -95,6 +96,10 @@ static inline unsigned int swiotlb_max_segment(void) · 13 unmodified lines | |||
| 95 | { | 96 | { |
| 96 | return 0; | 97 | return 0; |
| 97 | } | 98 | } |
| 99 | static inline size_t swiotlb_max_mapping_size(struct device *dev) | ||
| 100 | { | ||
| 101 | return SIZE_MAX; | ||
| 102 | } | ||
| 98 | #endif /* CONFIG_SWIOTLB */ | 103 | #endif /* CONFIG_SWIOTLB */ |
| 99 | 104 | ||
| 100 | extern void swiotlb_print_info(void); | 105 | extern void swiotlb_print_info(void); |
| @@ -662,3 +662,8 @@ swiotlb_dma_supported(struct device *hwdev, u64 mask) · 661 unmodified lines | |||
| 662 | { | 662 | { |
| 663 | return __phys_to_dma(hwdev, io_tlb_end - 1) <= mask; | 663 | return __phys_to_dma(hwdev, io_tlb_end - 1) <= mask; |
| 664 | } | 664 | } |
| 665 | |||
| 666 | size_t swiotlb_max_mapping_size(struct device *dev) | ||
| 667 | { | ||
| 668 | return ((size_t)1 << IO_TLB_SHIFT) * IO_TLB_SEGSIZE; | ||
| 669 | } | ||