@@ -62,8 +62,7 @@ dma_addr_t swiotlb_map(struct device *dev, phys_addr_t phys,
6262#ifdef CONFIG_SWIOTLB
6363
6464/**
65- * struct io_tlb_mem - IO TLB Memory Pool Descriptor
66- *
65+ * struct io_tlb_pool - IO TLB memory pool descriptor
6766 * @start: The start address of the swiotlb memory pool. Used to do a quick
6867 * range check to see if the memory was in fact allocated by this
6968 * API.
@@ -73,34 +72,46 @@ dma_addr_t swiotlb_map(struct device *dev, phys_addr_t phys,
7372 * @vaddr: The vaddr of the swiotlb memory pool. The swiotlb memory pool
7473 * may be remapped in the memory encrypted case and store virtual
7574 * address for bounce buffer operation.
76- * @nslabs: The number of IO TLB blocks (in groups of 64) between @start and
77- * @end. For default swiotlb, this is command line adjustable via
78- * setup_io_tlb_npages.
75+ * @nslabs: The number of IO TLB slots between @start and @end. For the
76+ * default swiotlb, this can be adjusted with a boot parameter,
77+ * see setup_io_tlb_npages().
78+ * @late_alloc: %true if allocated using the page allocator.
79+ * @nareas: Number of areas in the pool.
80+ * @area_nslabs: Number of slots in each area.
81+ * @areas: Array of memory area descriptors.
82+ * @slots: Array of slot descriptors.
83+ */
84+ struct io_tlb_pool {
85+ phys_addr_t start ;
86+ phys_addr_t end ;
87+ void * vaddr ;
88+ unsigned long nslabs ;
89+ bool late_alloc ;
90+ unsigned int nareas ;
91+ unsigned int area_nslabs ;
92+ struct io_tlb_area * areas ;
93+ struct io_tlb_slot * slots ;
94+ };
95+
96+ /**
97+ * struct io_tlb_mem - Software IO TLB allocator
98+ * @defpool: Default (initial) IO TLB memory pool descriptor.
99+ * @nslabs: Total number of IO TLB slabs in all pools.
79100 * @debugfs: The dentry to debugfs.
80- * @late_alloc: %true if allocated using the page allocator
81101 * @force_bounce: %true if swiotlb bouncing is forced
82102 * @for_alloc: %true if the pool is used for memory allocation
83- * @nareas: The area number in the pool.
84- * @area_nslabs: The slot number in the area.
85103 * @total_used: The total number of slots in the pool that are currently used
86104 * across all areas. Used only for calculating used_hiwater in
87105 * debugfs.
88106 * @used_hiwater: The high water mark for total_used. Used only for reporting
89107 * in debugfs.
90108 */
91109struct io_tlb_mem {
92- phys_addr_t start ;
93- phys_addr_t end ;
94- void * vaddr ;
110+ struct io_tlb_pool defpool ;
95111 unsigned long nslabs ;
96112 struct dentry * debugfs ;
97- bool late_alloc ;
98113 bool force_bounce ;
99114 bool for_alloc ;
100- unsigned int nareas ;
101- unsigned int area_nslabs ;
102- struct io_tlb_area * areas ;
103- struct io_tlb_slot * slots ;
104115#ifdef CONFIG_DEBUG_FS
105116 atomic_long_t total_used ;
106117 atomic_long_t used_hiwater ;
@@ -122,7 +133,7 @@ static inline bool is_swiotlb_buffer(struct device *dev, phys_addr_t paddr)
122133{
123134 struct io_tlb_mem * mem = dev -> dma_io_tlb_mem ;
124135
125- return mem && paddr >= mem -> start && paddr < mem -> end ;
136+ return mem && paddr >= mem -> defpool . start && paddr < mem -> defpool . end ;
126137}
127138
128139static inline bool is_swiotlb_force_bounce (struct device * dev )
0 commit comments