@@ -65,13 +65,14 @@ static int riscv_iommu_devres_pages_match(struct device *dev, void *res, void *p
65
65
return devres -> addr == target -> addr ;
66
66
}
67
67
68
- static void * riscv_iommu_get_pages (struct riscv_iommu_device * iommu , int order )
68
+ static void * riscv_iommu_get_pages (struct riscv_iommu_device * iommu ,
69
+ unsigned int size )
69
70
{
70
71
struct riscv_iommu_devres * devres ;
71
72
void * addr ;
72
73
73
- addr = iommu_alloc_pages_node (dev_to_node (iommu -> dev ),
74
- GFP_KERNEL_ACCOUNT , order );
74
+ addr = iommu_alloc_pages_node_sz (dev_to_node (iommu -> dev ),
75
+ GFP_KERNEL_ACCOUNT , size );
75
76
if (unlikely (!addr ))
76
77
return NULL ;
77
78
@@ -161,9 +162,9 @@ static int riscv_iommu_queue_alloc(struct riscv_iommu_device *iommu,
161
162
} else {
162
163
do {
163
164
const size_t queue_size = entry_size << (logsz + 1 );
164
- const int order = get_order (queue_size );
165
165
166
- queue -> base = riscv_iommu_get_pages (iommu , order );
166
+ queue -> base = riscv_iommu_get_pages (
167
+ iommu , max (queue_size , SZ_4K ));
167
168
queue -> phys = __pa (queue -> base );
168
169
} while (!queue -> base && logsz -- > 0 );
169
170
}
@@ -618,7 +619,7 @@ static struct riscv_iommu_dc *riscv_iommu_get_dc(struct riscv_iommu_device *iomm
618
619
break ;
619
620
}
620
621
621
- ptr = riscv_iommu_get_pages (iommu , 0 );
622
+ ptr = riscv_iommu_get_pages (iommu , SZ_4K );
622
623
if (!ptr )
623
624
return NULL ;
624
625
@@ -698,7 +699,7 @@ static int riscv_iommu_iodir_alloc(struct riscv_iommu_device *iommu)
698
699
}
699
700
700
701
if (!iommu -> ddt_root ) {
701
- iommu -> ddt_root = riscv_iommu_get_pages (iommu , 0 );
702
+ iommu -> ddt_root = riscv_iommu_get_pages (iommu , SZ_4K );
702
703
iommu -> ddt_phys = __pa (iommu -> ddt_root );
703
704
}
704
705
0 commit comments