@@ -360,7 +360,7 @@ static int __arm_lpae_map(struct arm_lpae_io_pgtable *data, unsigned long iova,
360360 max_entries = ARM_LPAE_PTES_PER_TABLE (data ) - map_idx_start ;
361361 num_entries = min_t (int , pgcount , max_entries );
362362 ret = arm_lpae_init_pte (data , iova , paddr , prot , lvl , num_entries , ptep );
363- if (!ret && mapped )
363+ if (!ret )
364364 * mapped += num_entries * size ;
365365
366366 return ret ;
@@ -496,13 +496,6 @@ static int arm_lpae_map_pages(struct io_pgtable_ops *ops, unsigned long iova,
496496 return ret ;
497497}
498498
499- static int arm_lpae_map (struct io_pgtable_ops * ops , unsigned long iova ,
500- phys_addr_t paddr , size_t size , int iommu_prot , gfp_t gfp )
501- {
502- return arm_lpae_map_pages (ops , iova , paddr , size , 1 , iommu_prot , gfp ,
503- NULL );
504- }
505-
506499static void __arm_lpae_free_pgtable (struct arm_lpae_io_pgtable * data , int lvl ,
507500 arm_lpae_iopte * ptep )
508501{
@@ -682,12 +675,6 @@ static size_t arm_lpae_unmap_pages(struct io_pgtable_ops *ops, unsigned long iov
682675 data -> start_level , ptep );
683676}
684677
685- static size_t arm_lpae_unmap (struct io_pgtable_ops * ops , unsigned long iova ,
686- size_t size , struct iommu_iotlb_gather * gather )
687- {
688- return arm_lpae_unmap_pages (ops , iova , size , 1 , gather );
689- }
690-
691678static phys_addr_t arm_lpae_iova_to_phys (struct io_pgtable_ops * ops ,
692679 unsigned long iova )
693680{
@@ -799,9 +786,7 @@ arm_lpae_alloc_pgtable(struct io_pgtable_cfg *cfg)
799786 data -> pgd_bits = va_bits - (data -> bits_per_level * (levels - 1 ));
800787
801788 data -> iop .ops = (struct io_pgtable_ops ) {
802- .map = arm_lpae_map ,
803789 .map_pages = arm_lpae_map_pages ,
804- .unmap = arm_lpae_unmap ,
805790 .unmap_pages = arm_lpae_unmap_pages ,
806791 .iova_to_phys = arm_lpae_iova_to_phys ,
807792 };
@@ -1176,7 +1161,7 @@ static int __init arm_lpae_run_tests(struct io_pgtable_cfg *cfg)
11761161
11771162 int i , j ;
11781163 unsigned long iova ;
1179- size_t size ;
1164+ size_t size , mapped ;
11801165 struct io_pgtable_ops * ops ;
11811166
11821167 selftest_running = true;
@@ -1209,15 +1194,16 @@ static int __init arm_lpae_run_tests(struct io_pgtable_cfg *cfg)
12091194 for_each_set_bit (j , & cfg -> pgsize_bitmap , BITS_PER_LONG ) {
12101195 size = 1UL << j ;
12111196
1212- if (ops -> map (ops , iova , iova , size , IOMMU_READ |
1213- IOMMU_WRITE |
1214- IOMMU_NOEXEC |
1215- IOMMU_CACHE , GFP_KERNEL ))
1197+ if (ops -> map_pages (ops , iova , iova , size , 1 ,
1198+ IOMMU_READ | IOMMU_WRITE |
1199+ IOMMU_NOEXEC | IOMMU_CACHE ,
1200+ GFP_KERNEL , & mapped ))
12161201 return __FAIL (ops , i );
12171202
12181203 /* Overlapping mappings */
1219- if (!ops -> map (ops , iova , iova + size , size ,
1220- IOMMU_READ | IOMMU_NOEXEC , GFP_KERNEL ))
1204+ if (!ops -> map_pages (ops , iova , iova + size , size , 1 ,
1205+ IOMMU_READ | IOMMU_NOEXEC ,
1206+ GFP_KERNEL , & mapped ))
12211207 return __FAIL (ops , i );
12221208
12231209 if (ops -> iova_to_phys (ops , iova + 42 ) != (iova + 42 ))
@@ -1228,11 +1214,12 @@ static int __init arm_lpae_run_tests(struct io_pgtable_cfg *cfg)
12281214
12291215 /* Partial unmap */
12301216 size = 1UL << __ffs (cfg -> pgsize_bitmap );
1231- if (ops -> unmap (ops , SZ_1G + size , size , NULL ) != size )
1217+ if (ops -> unmap_pages (ops , SZ_1G + size , size , 1 , NULL ) != size )
12321218 return __FAIL (ops , i );
12331219
12341220 /* Remap of partial unmap */
1235- if (ops -> map (ops , SZ_1G + size , size , size , IOMMU_READ , GFP_KERNEL ))
1221+ if (ops -> map_pages (ops , SZ_1G + size , size , size , 1 ,
1222+ IOMMU_READ , GFP_KERNEL , & mapped ))
12361223 return __FAIL (ops , i );
12371224
12381225 if (ops -> iova_to_phys (ops , SZ_1G + size + 42 ) != (size + 42 ))
@@ -1243,14 +1230,15 @@ static int __init arm_lpae_run_tests(struct io_pgtable_cfg *cfg)
12431230 for_each_set_bit (j , & cfg -> pgsize_bitmap , BITS_PER_LONG ) {
12441231 size = 1UL << j ;
12451232
1246- if (ops -> unmap (ops , iova , size , NULL ) != size )
1233+ if (ops -> unmap_pages (ops , iova , size , 1 , NULL ) != size )
12471234 return __FAIL (ops , i );
12481235
12491236 if (ops -> iova_to_phys (ops , iova + 42 ))
12501237 return __FAIL (ops , i );
12511238
12521239 /* Remap full block */
1253- if (ops -> map (ops , iova , iova , size , IOMMU_WRITE , GFP_KERNEL ))
1240+ if (ops -> map_pages (ops , iova , iova , size , 1 ,
1241+ IOMMU_WRITE , GFP_KERNEL , & mapped ))
12541242 return __FAIL (ops , i );
12551243
12561244 if (ops -> iova_to_phys (ops , iova + 42 ) != (iova + 42 ))
0 commit comments