@@ -564,8 +564,7 @@ static int arm_v7s_map_pages(struct io_pgtable_ops *ops, unsigned long iova,
564564
565565 iova += pgsize ;
566566 paddr += pgsize ;
567- if (mapped )
568- * mapped += pgsize ;
567+ * mapped += pgsize ;
569568 }
570569 /*
571570 * Synchronise all PTE updates for the new mapping before there's
@@ -576,12 +575,6 @@ static int arm_v7s_map_pages(struct io_pgtable_ops *ops, unsigned long iova,
576575 return ret ;
577576}
578577
579- static int arm_v7s_map (struct io_pgtable_ops * ops , unsigned long iova ,
580- phys_addr_t paddr , size_t size , int prot , gfp_t gfp )
581- {
582- return arm_v7s_map_pages (ops , iova , paddr , size , 1 , prot , gfp , NULL );
583- }
584-
585578static void arm_v7s_free_pgtable (struct io_pgtable * iop )
586579{
587580 struct arm_v7s_io_pgtable * data = io_pgtable_to_data (iop );
@@ -764,12 +757,6 @@ static size_t arm_v7s_unmap_pages(struct io_pgtable_ops *ops, unsigned long iova
764757 return unmapped ;
765758}
766759
767- static size_t arm_v7s_unmap (struct io_pgtable_ops * ops , unsigned long iova ,
768- size_t size , struct iommu_iotlb_gather * gather )
769- {
770- return arm_v7s_unmap_pages (ops , iova , size , 1 , gather );
771- }
772-
773760static phys_addr_t arm_v7s_iova_to_phys (struct io_pgtable_ops * ops ,
774761 unsigned long iova )
775762{
@@ -842,9 +829,7 @@ static struct io_pgtable *arm_v7s_alloc_pgtable(struct io_pgtable_cfg *cfg,
842829 goto out_free_data ;
843830
844831 data -> iop .ops = (struct io_pgtable_ops ) {
845- .map = arm_v7s_map ,
846832 .map_pages = arm_v7s_map_pages ,
847- .unmap = arm_v7s_unmap ,
848833 .unmap_pages = arm_v7s_unmap_pages ,
849834 .iova_to_phys = arm_v7s_iova_to_phys ,
850835 };
@@ -954,6 +939,7 @@ static int __init arm_v7s_do_selftests(void)
954939 };
955940 unsigned int iova , size , iova_start ;
956941 unsigned int i , loopnr = 0 ;
942+ size_t mapped ;
957943
958944 selftest_running = true;
959945
@@ -984,15 +970,16 @@ static int __init arm_v7s_do_selftests(void)
984970 iova = 0 ;
985971 for_each_set_bit (i , & cfg .pgsize_bitmap , BITS_PER_LONG ) {
986972 size = 1UL << i ;
987- if (ops -> map (ops , iova , iova , size , IOMMU_READ |
988- IOMMU_WRITE |
989- IOMMU_NOEXEC |
990- IOMMU_CACHE , GFP_KERNEL ))
973+ if (ops -> map_pages (ops , iova , iova , size , 1 ,
974+ IOMMU_READ | IOMMU_WRITE |
975+ IOMMU_NOEXEC | IOMMU_CACHE ,
976+ GFP_KERNEL , & mapped ))
991977 return __FAIL (ops );
992978
993979 /* Overlapping mappings */
994- if (!ops -> map (ops , iova , iova + size , size ,
995- IOMMU_READ | IOMMU_NOEXEC , GFP_KERNEL ))
980+ if (!ops -> map_pages (ops , iova , iova + size , size , 1 ,
981+ IOMMU_READ | IOMMU_NOEXEC , GFP_KERNEL ,
982+ & mapped ))
996983 return __FAIL (ops );
997984
998985 if (ops -> iova_to_phys (ops , iova + 42 ) != (iova + 42 ))
@@ -1007,11 +994,12 @@ static int __init arm_v7s_do_selftests(void)
1007994 size = 1UL << __ffs (cfg .pgsize_bitmap );
1008995 while (i < loopnr ) {
1009996 iova_start = i * SZ_16M ;
1010- if (ops -> unmap (ops , iova_start + size , size , NULL ) != size )
997+ if (ops -> unmap_pages (ops , iova_start + size , size , 1 , NULL ) != size )
1011998 return __FAIL (ops );
1012999
10131000 /* Remap of partial unmap */
1014- if (ops -> map (ops , iova_start + size , size , size , IOMMU_READ , GFP_KERNEL ))
1001+ if (ops -> map_pages (ops , iova_start + size , size , size , 1 ,
1002+ IOMMU_READ , GFP_KERNEL , & mapped ))
10151003 return __FAIL (ops );
10161004
10171005 if (ops -> iova_to_phys (ops , iova_start + size + 42 )
@@ -1025,14 +1013,15 @@ static int __init arm_v7s_do_selftests(void)
10251013 for_each_set_bit (i , & cfg .pgsize_bitmap , BITS_PER_LONG ) {
10261014 size = 1UL << i ;
10271015
1028- if (ops -> unmap (ops , iova , size , NULL ) != size )
1016+ if (ops -> unmap_pages (ops , iova , size , 1 , NULL ) != size )
10291017 return __FAIL (ops );
10301018
10311019 if (ops -> iova_to_phys (ops , iova + 42 ))
10321020 return __FAIL (ops );
10331021
10341022 /* Remap full block */
1035- if (ops -> map (ops , iova , iova , size , IOMMU_WRITE , GFP_KERNEL ))
1023+ if (ops -> map_pages (ops , iova , iova , size , 1 , IOMMU_WRITE ,
1024+ GFP_KERNEL , & mapped ))
10361025 return __FAIL (ops );
10371026
10381027 if (ops -> iova_to_phys (ops , iova + 42 ) != (iova + 42 ))
0 commit comments