@@ -62,8 +62,7 @@ dma_addr_t swiotlb_map(struct device *dev, phys_addr_t phys,
62
62
#ifdef CONFIG_SWIOTLB
63
63
64
64
/**
65
- * struct io_tlb_mem - IO TLB Memory Pool Descriptor
66
- *
65
+ * struct io_tlb_pool - IO TLB memory pool descriptor
67
66
* @start: The start address of the swiotlb memory pool. Used to do a quick
68
67
* range check to see if the memory was in fact allocated by this
69
68
* API.
@@ -73,34 +72,46 @@ dma_addr_t swiotlb_map(struct device *dev, phys_addr_t phys,
73
72
* @vaddr: The vaddr of the swiotlb memory pool. The swiotlb memory pool
74
73
* may be remapped in the memory encrypted case and store virtual
75
74
* 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.
79
100
* @debugfs: The dentry to debugfs.
80
- * @late_alloc: %true if allocated using the page allocator
81
101
* @force_bounce: %true if swiotlb bouncing is forced
82
102
* @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.
85
103
* @total_used: The total number of slots in the pool that are currently used
86
104
* across all areas. Used only for calculating used_hiwater in
87
105
* debugfs.
88
106
* @used_hiwater: The high water mark for total_used. Used only for reporting
89
107
* in debugfs.
90
108
*/
91
109
struct io_tlb_mem {
92
- phys_addr_t start ;
93
- phys_addr_t end ;
94
- void * vaddr ;
110
+ struct io_tlb_pool defpool ;
95
111
unsigned long nslabs ;
96
112
struct dentry * debugfs ;
97
- bool late_alloc ;
98
113
bool force_bounce ;
99
114
bool for_alloc ;
100
- unsigned int nareas ;
101
- unsigned int area_nslabs ;
102
- struct io_tlb_area * areas ;
103
- struct io_tlb_slot * slots ;
104
115
#ifdef CONFIG_DEBUG_FS
105
116
atomic_long_t total_used ;
106
117
atomic_long_t used_hiwater ;
@@ -122,7 +133,7 @@ static inline bool is_swiotlb_buffer(struct device *dev, phys_addr_t paddr)
122
133
{
123
134
struct io_tlb_mem * mem = dev -> dma_io_tlb_mem ;
124
135
125
- return mem && paddr >= mem -> start && paddr < mem -> end ;
136
+ return mem && paddr >= mem -> defpool . start && paddr < mem -> defpool . end ;
126
137
}
127
138
128
139
static inline bool is_swiotlb_force_bounce (struct device * dev )
0 commit comments