@@ -5781,78 +5781,27 @@ static bool intel_iommu_capable(enum iommu_cap cap)
5781
5781
return false;
5782
5782
}
5783
5783
5784
- static int intel_iommu_add_device (struct device * dev )
5784
+ static struct iommu_device * intel_iommu_probe_device (struct device * dev )
5785
5785
{
5786
- struct dmar_domain * dmar_domain ;
5787
- struct iommu_domain * domain ;
5788
5786
struct intel_iommu * iommu ;
5789
- struct iommu_group * group ;
5790
5787
u8 bus , devfn ;
5791
- int ret ;
5792
5788
5793
5789
iommu = device_to_iommu (dev , & bus , & devfn );
5794
5790
if (!iommu )
5795
- return - ENODEV ;
5796
-
5797
- iommu_device_link (& iommu -> iommu , dev );
5791
+ return ERR_PTR (- ENODEV );
5798
5792
5799
5793
if (translation_pre_enabled (iommu ))
5800
5794
dev -> archdata .iommu = DEFER_DEVICE_DOMAIN_INFO ;
5801
5795
5802
- group = iommu_group_get_for_dev (dev );
5803
-
5804
- if (IS_ERR (group )) {
5805
- ret = PTR_ERR (group );
5806
- goto unlink ;
5807
- }
5808
-
5809
- iommu_group_put (group );
5810
-
5811
- domain = iommu_get_domain_for_dev (dev );
5812
- dmar_domain = to_dmar_domain (domain );
5813
- if (domain -> type == IOMMU_DOMAIN_DMA ) {
5814
- if (device_def_domain_type (dev ) == IOMMU_DOMAIN_IDENTITY ) {
5815
- ret = iommu_request_dm_for_dev (dev );
5816
- if (ret ) {
5817
- dmar_remove_one_dev_info (dev );
5818
- dmar_domain -> flags |= DOMAIN_FLAG_LOSE_CHILDREN ;
5819
- domain_add_dev_info (si_domain , dev );
5820
- dev_info (dev ,
5821
- "Device uses a private identity domain.\n" );
5822
- }
5823
- }
5824
- } else {
5825
- if (device_def_domain_type (dev ) == IOMMU_DOMAIN_DMA ) {
5826
- ret = iommu_request_dma_domain_for_dev (dev );
5827
- if (ret ) {
5828
- dmar_remove_one_dev_info (dev );
5829
- dmar_domain -> flags |= DOMAIN_FLAG_LOSE_CHILDREN ;
5830
- if (!get_private_domain_for_dev (dev )) {
5831
- dev_warn (dev ,
5832
- "Failed to get a private domain.\n" );
5833
- ret = - ENOMEM ;
5834
- goto unlink ;
5835
- }
5836
-
5837
- dev_info (dev ,
5838
- "Device uses a private dma domain.\n" );
5839
- }
5840
- }
5841
- }
5842
-
5843
5796
if (device_needs_bounce (dev )) {
5844
5797
dev_info (dev , "Use Intel IOMMU bounce page dma_ops\n" );
5845
5798
set_dma_ops (dev , & bounce_dma_ops );
5846
5799
}
5847
5800
5848
- return 0 ;
5849
-
5850
- unlink :
5851
- iommu_device_unlink (& iommu -> iommu , dev );
5852
- return ret ;
5801
+ return & iommu -> iommu ;
5853
5802
}
5854
5803
5855
- static void intel_iommu_remove_device (struct device * dev )
5804
+ static void intel_iommu_release_device (struct device * dev )
5856
5805
{
5857
5806
struct intel_iommu * iommu ;
5858
5807
u8 bus , devfn ;
@@ -5863,10 +5812,6 @@ static void intel_iommu_remove_device(struct device *dev)
5863
5812
5864
5813
dmar_remove_one_dev_info (dev );
5865
5814
5866
- iommu_group_remove_device (dev );
5867
-
5868
- iommu_device_unlink (& iommu -> iommu , dev );
5869
-
5870
5815
if (device_needs_bounce (dev ))
5871
5816
set_dma_ops (dev , NULL );
5872
5817
}
@@ -6198,8 +6143,8 @@ const struct iommu_ops intel_iommu_ops = {
6198
6143
.map = intel_iommu_map ,
6199
6144
.unmap = intel_iommu_unmap ,
6200
6145
.iova_to_phys = intel_iommu_iova_to_phys ,
6201
- .add_device = intel_iommu_add_device ,
6202
- .remove_device = intel_iommu_remove_device ,
6146
+ .probe_device = intel_iommu_probe_device ,
6147
+ .release_device = intel_iommu_release_device ,
6203
6148
.get_resv_regions = intel_iommu_get_resv_regions ,
6204
6149
.put_resv_regions = generic_iommu_put_resv_regions ,
6205
6150
.apply_resv_region = intel_iommu_apply_resv_region ,
0 commit comments