@@ -1778,6 +1778,17 @@ static int domain_setup_second_level(struct intel_iommu *iommu,
1778
1778
pasid );
1779
1779
}
1780
1780
1781
+ static int domain_setup_passthrough (struct intel_iommu * iommu ,
1782
+ struct device * dev , ioasid_t pasid ,
1783
+ struct iommu_domain * old )
1784
+ {
1785
+ if (!old )
1786
+ return intel_pasid_setup_pass_through (iommu , dev , pasid );
1787
+ return intel_pasid_replace_pass_through (iommu , dev ,
1788
+ iommu_domain_did (old , iommu ),
1789
+ pasid );
1790
+ }
1791
+
1781
1792
static int domain_setup_first_level (struct intel_iommu * iommu ,
1782
1793
struct dmar_domain * domain ,
1783
1794
struct device * dev ,
@@ -4423,11 +4434,17 @@ static int identity_domain_set_dev_pasid(struct iommu_domain *domain,
4423
4434
{
4424
4435
struct device_domain_info * info = dev_iommu_priv_get (dev );
4425
4436
struct intel_iommu * iommu = info -> iommu ;
4437
+ int ret ;
4426
4438
4427
4439
if (!pasid_supported (iommu ) || dev_is_real_dma_subdevice (dev ))
4428
4440
return - EOPNOTSUPP ;
4429
4441
4430
- return intel_pasid_setup_pass_through (iommu , dev , pasid );
4442
+ ret = domain_setup_passthrough (iommu , dev , pasid , old );
4443
+ if (ret )
4444
+ return ret ;
4445
+
4446
+ domain_remove_dev_pasid (old , dev , pasid );
4447
+ return 0 ;
4431
4448
}
4432
4449
4433
4450
static struct iommu_domain identity_domain = {
0 commit comments