@@ -107,9 +107,9 @@ static bool __alloc_iova_check_used(struct interval_tree_span_iter *span,
107
107
* Does not return a 0 IOVA even if it is valid.
108
108
*/
109
109
static int iopt_alloc_iova (struct io_pagetable * iopt , unsigned long * iova ,
110
- unsigned long uptr , unsigned long length )
110
+ unsigned long addr , unsigned long length )
111
111
{
112
- unsigned long page_offset = uptr % PAGE_SIZE ;
112
+ unsigned long page_offset = addr % PAGE_SIZE ;
113
113
struct interval_tree_double_span_iter used_span ;
114
114
struct interval_tree_span_iter allowed_span ;
115
115
unsigned long max_alignment = PAGE_SIZE ;
@@ -122,15 +122,15 @@ static int iopt_alloc_iova(struct io_pagetable *iopt, unsigned long *iova,
122
122
return - EOVERFLOW ;
123
123
124
124
/*
125
- * Keep alignment present in the uptr when building the IOVA, this
125
+ * Keep alignment present in addr when building the IOVA, which
126
126
* increases the chance we can map a THP.
127
127
*/
128
- if (!uptr )
128
+ if (!addr )
129
129
iova_alignment = roundup_pow_of_two (length );
130
130
else
131
131
iova_alignment = min_t (unsigned long ,
132
132
roundup_pow_of_two (length ),
133
- 1UL << __ffs64 (uptr ));
133
+ 1UL << __ffs64 (addr ));
134
134
135
135
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
136
136
max_alignment = HPAGE_SIZE ;
@@ -248,6 +248,7 @@ static int iopt_alloc_area_pages(struct io_pagetable *iopt,
248
248
int iommu_prot , unsigned int flags )
249
249
{
250
250
struct iopt_pages_list * elm ;
251
+ unsigned long start ;
251
252
unsigned long iova ;
252
253
int rc = 0 ;
253
254
@@ -267,9 +268,8 @@ static int iopt_alloc_area_pages(struct io_pagetable *iopt,
267
268
/* Use the first entry to guess the ideal IOVA alignment */
268
269
elm = list_first_entry (pages_list , struct iopt_pages_list ,
269
270
next );
270
- rc = iopt_alloc_iova (
271
- iopt , dst_iova ,
272
- (uintptr_t )elm -> pages -> uptr + elm -> start_byte , length );
271
+ start = elm -> start_byte + (uintptr_t )elm -> pages -> uptr ;
272
+ rc = iopt_alloc_iova (iopt , dst_iova , start , length );
273
273
if (rc )
274
274
goto out_unlock ;
275
275
if (IS_ENABLED (CONFIG_IOMMUFD_TEST ) &&
0 commit comments