@@ -3785,29 +3785,35 @@ static struct iommu_device *intel_iommu_probe_device(struct device *dev)
3785
3785
3786
3786
intel_iommu_debugfs_create_dev (info );
3787
3787
3788
+ return & iommu -> iommu ;
3789
+ free_table :
3790
+ intel_pasid_free_table (dev );
3791
+ clear_rbtree :
3792
+ device_rbtree_remove (info );
3793
+ free :
3794
+ kfree (info );
3795
+
3796
+ return ERR_PTR (ret );
3797
+ }
3798
+
3799
+ static void intel_iommu_probe_finalize (struct device * dev )
3800
+ {
3801
+ struct device_domain_info * info = dev_iommu_priv_get (dev );
3802
+ struct intel_iommu * iommu = info -> iommu ;
3803
+
3788
3804
/*
3789
3805
* The PCIe spec, in its wisdom, declares that the behaviour of the
3790
3806
* device is undefined if you enable PASID support after ATS support.
3791
3807
* So always enable PASID support on devices which have it, even if
3792
3808
* we can't yet know if we're ever going to use it.
3793
3809
*/
3794
3810
if (info -> pasid_supported &&
3795
- !pci_enable_pasid (pdev , info -> pasid_supported & ~1 ))
3811
+ !pci_enable_pasid (to_pci_dev ( dev ) , info -> pasid_supported & ~1 ))
3796
3812
info -> pasid_enabled = 1 ;
3797
3813
3798
- if (sm_supported (iommu ))
3814
+ if (sm_supported (iommu ) && ! dev_is_real_dma_subdevice ( dev ) )
3799
3815
iommu_enable_pci_ats (info );
3800
3816
iommu_enable_pci_pri (info );
3801
-
3802
- return & iommu -> iommu ;
3803
- free_table :
3804
- intel_pasid_free_table (dev );
3805
- clear_rbtree :
3806
- device_rbtree_remove (info );
3807
- free :
3808
- kfree (info );
3809
-
3810
- return ERR_PTR (ret );
3811
3817
}
3812
3818
3813
3819
static void intel_iommu_release_device (struct device * dev )
@@ -4391,6 +4397,7 @@ const struct iommu_ops intel_iommu_ops = {
4391
4397
.domain_alloc_sva = intel_svm_domain_alloc ,
4392
4398
.domain_alloc_nested = intel_iommu_domain_alloc_nested ,
4393
4399
.probe_device = intel_iommu_probe_device ,
4400
+ .probe_finalize = intel_iommu_probe_finalize ,
4394
4401
.release_device = intel_iommu_release_device ,
4395
4402
.get_resv_regions = intel_iommu_get_resv_regions ,
4396
4403
.device_group = intel_iommu_device_group ,
0 commit comments