19
19
#include <soc/tegra/ahb.h>
20
20
#include <soc/tegra/mc.h>
21
21
22
+ #include "iommu-pages.h"
23
+
22
24
struct tegra_smmu_group {
23
25
struct list_head list ;
24
26
struct tegra_smmu * smmu ;
@@ -282,23 +284,23 @@ static struct iommu_domain *tegra_smmu_domain_alloc_paging(struct device *dev)
282
284
283
285
as -> attr = SMMU_PD_READABLE | SMMU_PD_WRITABLE | SMMU_PD_NONSECURE ;
284
286
285
- as -> pd = alloc_page (GFP_KERNEL | __GFP_DMA | __GFP_ZERO );
287
+ as -> pd = __iommu_alloc_pages (GFP_KERNEL | __GFP_DMA , 0 );
286
288
if (!as -> pd ) {
287
289
kfree (as );
288
290
return NULL ;
289
291
}
290
292
291
293
as -> count = kcalloc (SMMU_NUM_PDE , sizeof (u32 ), GFP_KERNEL );
292
294
if (!as -> count ) {
293
- __free_page (as -> pd );
295
+ __iommu_free_pages (as -> pd , 0 );
294
296
kfree (as );
295
297
return NULL ;
296
298
}
297
299
298
300
as -> pts = kcalloc (SMMU_NUM_PDE , sizeof (* as -> pts ), GFP_KERNEL );
299
301
if (!as -> pts ) {
300
302
kfree (as -> count );
301
- __free_page (as -> pd );
303
+ __iommu_free_pages (as -> pd , 0 );
302
304
kfree (as );
303
305
return NULL ;
304
306
}
@@ -599,14 +601,14 @@ static u32 *as_get_pte(struct tegra_smmu_as *as, dma_addr_t iova,
599
601
dma = dma_map_page (smmu -> dev , page , 0 , SMMU_SIZE_PT ,
600
602
DMA_TO_DEVICE );
601
603
if (dma_mapping_error (smmu -> dev , dma )) {
602
- __free_page (page );
604
+ __iommu_free_pages (page , 0 );
603
605
return NULL ;
604
606
}
605
607
606
608
if (!smmu_dma_addr_valid (smmu , dma )) {
607
609
dma_unmap_page (smmu -> dev , dma , SMMU_SIZE_PT ,
608
610
DMA_TO_DEVICE );
609
- __free_page (page );
611
+ __iommu_free_pages (page , 0 );
610
612
return NULL ;
611
613
}
612
614
@@ -649,7 +651,7 @@ static void tegra_smmu_pte_put_use(struct tegra_smmu_as *as, unsigned long iova)
649
651
tegra_smmu_set_pde (as , iova , 0 );
650
652
651
653
dma_unmap_page (smmu -> dev , pte_dma , SMMU_SIZE_PT , DMA_TO_DEVICE );
652
- __free_page (page );
654
+ __iommu_free_pages (page , 0 );
653
655
as -> pts [pde ] = NULL ;
654
656
}
655
657
}
@@ -688,7 +690,7 @@ static struct page *as_get_pde_page(struct tegra_smmu_as *as,
688
690
if (gfpflags_allow_blocking (gfp ))
689
691
spin_unlock_irqrestore (& as -> lock , * flags );
690
692
691
- page = alloc_page (gfp | __GFP_DMA | __GFP_ZERO );
693
+ page = __iommu_alloc_pages (gfp | __GFP_DMA , 0 );
692
694
693
695
if (gfpflags_allow_blocking (gfp ))
694
696
spin_lock_irqsave (& as -> lock , * flags );
@@ -700,7 +702,7 @@ static struct page *as_get_pde_page(struct tegra_smmu_as *as,
700
702
*/
701
703
if (as -> pts [pde ]) {
702
704
if (page )
703
- __free_page (page );
705
+ __iommu_free_pages (page , 0 );
704
706
705
707
page = as -> pts [pde ];
706
708
}
0 commit comments