@@ -1558,6 +1558,7 @@ static irqreturn_t arm_smmu_evtq_thread(int irq, void *dev)
15581558 dev_info (smmu -> dev , "\t0x%016llx\n" ,
15591559 (unsigned long long )evt [i ]);
15601560
1561+ cond_resched ();
15611562 }
15621563
15631564 /*
@@ -2841,17 +2842,9 @@ static int arm_smmu_dev_disable_feature(struct device *dev,
28412842static struct iommu_ops arm_smmu_ops = {
28422843 .capable = arm_smmu_capable ,
28432844 .domain_alloc = arm_smmu_domain_alloc ,
2844- .domain_free = arm_smmu_domain_free ,
2845- .attach_dev = arm_smmu_attach_dev ,
2846- .map_pages = arm_smmu_map_pages ,
2847- .unmap_pages = arm_smmu_unmap_pages ,
2848- .flush_iotlb_all = arm_smmu_flush_iotlb_all ,
2849- .iotlb_sync = arm_smmu_iotlb_sync ,
2850- .iova_to_phys = arm_smmu_iova_to_phys ,
28512845 .probe_device = arm_smmu_probe_device ,
28522846 .release_device = arm_smmu_release_device ,
28532847 .device_group = arm_smmu_device_group ,
2854- .enable_nesting = arm_smmu_enable_nesting ,
28552848 .of_xlate = arm_smmu_of_xlate ,
28562849 .get_resv_regions = arm_smmu_get_resv_regions ,
28572850 .put_resv_regions = generic_iommu_put_resv_regions ,
@@ -2865,6 +2858,16 @@ static struct iommu_ops arm_smmu_ops = {
28652858 .page_response = arm_smmu_page_response ,
28662859 .pgsize_bitmap = -1UL , /* Restricted during device attach */
28672860 .owner = THIS_MODULE ,
2861+ .default_domain_ops = & (const struct iommu_domain_ops ) {
2862+ .attach_dev = arm_smmu_attach_dev ,
2863+ .map_pages = arm_smmu_map_pages ,
2864+ .unmap_pages = arm_smmu_unmap_pages ,
2865+ .flush_iotlb_all = arm_smmu_flush_iotlb_all ,
2866+ .iotlb_sync = arm_smmu_iotlb_sync ,
2867+ .iova_to_phys = arm_smmu_iova_to_phys ,
2868+ .enable_nesting = arm_smmu_enable_nesting ,
2869+ .free = arm_smmu_domain_free ,
2870+ }
28682871};
28692872
28702873/* Probing and initialisation functions */
@@ -2911,32 +2914,20 @@ static int arm_smmu_init_one_queue(struct arm_smmu_device *smmu,
29112914 return 0 ;
29122915}
29132916
2914- static void arm_smmu_cmdq_free_bitmap (void * data )
2915- {
2916- unsigned long * bitmap = data ;
2917- bitmap_free (bitmap );
2918- }
2919-
29202917static int arm_smmu_cmdq_init (struct arm_smmu_device * smmu )
29212918{
2922- int ret = 0 ;
29232919 struct arm_smmu_cmdq * cmdq = & smmu -> cmdq ;
29242920 unsigned int nents = 1 << cmdq -> q .llq .max_n_shift ;
2925- atomic_long_t * bitmap ;
29262921
29272922 atomic_set (& cmdq -> owner_prod , 0 );
29282923 atomic_set (& cmdq -> lock , 0 );
29292924
2930- bitmap = (atomic_long_t * )bitmap_zalloc (nents , GFP_KERNEL );
2931- if (!bitmap ) {
2932- dev_err (smmu -> dev , "failed to allocate cmdq bitmap\n" );
2933- ret = - ENOMEM ;
2934- } else {
2935- cmdq -> valid_map = bitmap ;
2936- devm_add_action (smmu -> dev , arm_smmu_cmdq_free_bitmap , bitmap );
2937- }
2925+ cmdq -> valid_map = (atomic_long_t * )devm_bitmap_zalloc (smmu -> dev , nents ,
2926+ GFP_KERNEL );
2927+ if (!cmdq -> valid_map )
2928+ return - ENOMEM ;
29382929
2939- return ret ;
2930+ return 0 ;
29402931}
29412932
29422933static int arm_smmu_init_queues (struct arm_smmu_device * smmu )
@@ -2981,10 +2972,10 @@ static int arm_smmu_init_l1_strtab(struct arm_smmu_device *smmu)
29812972{
29822973 unsigned int i ;
29832974 struct arm_smmu_strtab_cfg * cfg = & smmu -> strtab_cfg ;
2984- size_t size = sizeof (* cfg -> l1_desc ) * cfg -> num_l1_ents ;
29852975 void * strtab = smmu -> strtab_cfg .strtab ;
29862976
2987- cfg -> l1_desc = devm_kzalloc (smmu -> dev , size , GFP_KERNEL );
2977+ cfg -> l1_desc = devm_kcalloc (smmu -> dev , cfg -> num_l1_ents ,
2978+ sizeof (* cfg -> l1_desc ), GFP_KERNEL );
29882979 if (!cfg -> l1_desc )
29892980 return - ENOMEM ;
29902981
0 commit comments