@@ -36,6 +36,8 @@ module_param(disable_msipolling, bool, 0444);
36
36
MODULE_PARM_DESC (disable_msipolling ,
37
37
"Disable MSI-based polling for CMD_SYNC completion." );
38
38
39
+ static struct iommu_ops arm_smmu_ops ;
40
+
39
41
enum arm_smmu_msi_index {
40
42
EVTQ_MSI_INDEX ,
41
43
GERROR_MSI_INDEX ,
@@ -3020,6 +3022,34 @@ static struct iommu_domain arm_smmu_blocked_domain = {
3020
3022
.ops = & arm_smmu_blocked_ops ,
3021
3023
};
3022
3024
3025
+ static struct iommu_domain *
3026
+ arm_smmu_domain_alloc_user (struct device * dev , u32 flags ,
3027
+ struct iommu_domain * parent ,
3028
+ const struct iommu_user_data * user_data )
3029
+ {
3030
+ struct arm_smmu_master * master = dev_iommu_priv_get (dev );
3031
+ struct arm_smmu_domain * smmu_domain ;
3032
+ int ret ;
3033
+
3034
+ if (flags || parent || user_data )
3035
+ return ERR_PTR (- EOPNOTSUPP );
3036
+
3037
+ smmu_domain = arm_smmu_domain_alloc ();
3038
+ if (!smmu_domain )
3039
+ return ERR_PTR (- ENOMEM );
3040
+
3041
+ smmu_domain -> domain .type = IOMMU_DOMAIN_UNMANAGED ;
3042
+ smmu_domain -> domain .ops = arm_smmu_ops .default_domain_ops ;
3043
+ ret = arm_smmu_domain_finalise (smmu_domain , master -> smmu );
3044
+ if (ret )
3045
+ goto err_free ;
3046
+ return & smmu_domain -> domain ;
3047
+
3048
+ err_free :
3049
+ kfree (smmu_domain );
3050
+ return ERR_PTR (ret );
3051
+ }
3052
+
3023
3053
static int arm_smmu_map_pages (struct iommu_domain * domain , unsigned long iova ,
3024
3054
phys_addr_t paddr , size_t pgsize , size_t pgcount ,
3025
3055
int prot , gfp_t gfp , size_t * mapped )
@@ -3190,8 +3220,6 @@ static void arm_smmu_remove_master(struct arm_smmu_master *master)
3190
3220
kfree (master -> streams );
3191
3221
}
3192
3222
3193
- static struct iommu_ops arm_smmu_ops ;
3194
-
3195
3223
static struct iommu_device * arm_smmu_probe_device (struct device * dev )
3196
3224
{
3197
3225
int ret ;
@@ -3399,6 +3427,7 @@ static struct iommu_ops arm_smmu_ops = {
3399
3427
.capable = arm_smmu_capable ,
3400
3428
.domain_alloc_paging = arm_smmu_domain_alloc_paging ,
3401
3429
.domain_alloc_sva = arm_smmu_sva_domain_alloc ,
3430
+ .domain_alloc_user = arm_smmu_domain_alloc_user ,
3402
3431
.probe_device = arm_smmu_probe_device ,
3403
3432
.release_device = arm_smmu_release_device ,
3404
3433
.device_group = arm_smmu_device_group ,
0 commit comments