diff options
| -rw-r--r-- | drivers/iommu/intel-iommu.c | 53 |
1 files changed, 27 insertions, 26 deletions
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 52311a6d9d3f..de47bdb57e48 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
| @@ -2341,32 +2341,33 @@ static int __domain_mapping(struct dmar_domain *domain, unsigned long iov_pfn, | |||
| 2341 | } | 2341 | } |
| 2342 | 2342 | ||
| 2343 | static int domain_mapping(struct dmar_domain *domain, unsigned long iov_pfn, | 2343 | static int domain_mapping(struct dmar_domain *domain, unsigned long iov_pfn, |
| 2344 | struct scatterlist *sg, unsigned long phys_pfn, | 2344 | struct scatterlist *sg, unsigned long phys_pfn, |
| 2345 | unsigned long nr_pages, int prot) | 2345 | unsigned long nr_pages, int prot) |
| 2346 | { | 2346 | { |
| 2347 | int ret; | 2347 | int ret; |
| 2348 | struct intel_iommu *iommu; | 2348 | struct intel_iommu *iommu; |
| 2349 | 2349 | ||
| 2350 | /* Do the real mapping first */ | 2350 | /* Do the real mapping first */ |
| 2351 | ret = __domain_mapping(domain, iov_pfn, sg, phys_pfn, nr_pages, prot); | 2351 | ret = __domain_mapping(domain, iov_pfn, sg, phys_pfn, nr_pages, prot); |
| 2352 | if (ret) | 2352 | if (ret) |
| 2353 | return ret; | 2353 | return ret; |
| 2354 | |||
| 2355 | /* Notify about the new mapping */ | ||
| 2356 | if (domain_type_is_vm(domain)) { | ||
| 2357 | /* VM typed domains can have more than one IOMMUs */ | ||
| 2358 | int iommu_id; | ||
| 2359 | for_each_domain_iommu(iommu_id, domain) { | ||
| 2360 | iommu = g_iommus[iommu_id]; | ||
| 2361 | __mapping_notify_one(iommu, domain, iov_pfn, nr_pages); | ||
| 2362 | } | ||
| 2363 | } else { | ||
| 2364 | /* General domains only have one IOMMU */ | ||
| 2365 | iommu = domain_get_iommu(domain); | ||
| 2366 | __mapping_notify_one(iommu, domain, iov_pfn, nr_pages); | ||
| 2367 | } | ||
| 2368 | 2354 | ||
| 2369 | return 0; | 2355 | /* Notify about the new mapping */ |
| 2356 | if (domain_type_is_vm(domain)) { | ||
| 2357 | /* VM typed domains can have more than one IOMMUs */ | ||
| 2358 | int iommu_id; | ||
| 2359 | |||
| 2360 | for_each_domain_iommu(iommu_id, domain) { | ||
| 2361 | iommu = g_iommus[iommu_id]; | ||
| 2362 | __mapping_notify_one(iommu, domain, iov_pfn, nr_pages); | ||
| 2363 | } | ||
| 2364 | } else { | ||
| 2365 | /* General domains only have one IOMMU */ | ||
| 2366 | iommu = domain_get_iommu(domain); | ||
| 2367 | __mapping_notify_one(iommu, domain, iov_pfn, nr_pages); | ||
| 2368 | } | ||
| 2369 | |||
| 2370 | return 0; | ||
| 2370 | } | 2371 | } |
| 2371 | 2372 | ||
| 2372 | static inline int domain_sg_mapping(struct dmar_domain *domain, unsigned long iov_pfn, | 2373 | static inline int domain_sg_mapping(struct dmar_domain *domain, unsigned long iov_pfn, |
| @@ -4083,7 +4084,7 @@ static int init_iommu_hw(void) | |||
| 4083 | iommu_disable_protect_mem_regions(iommu); | 4084 | iommu_disable_protect_mem_regions(iommu); |
| 4084 | continue; | 4085 | continue; |
| 4085 | } | 4086 | } |
| 4086 | 4087 | ||
| 4087 | iommu_flush_write_buffer(iommu); | 4088 | iommu_flush_write_buffer(iommu); |
| 4088 | 4089 | ||
| 4089 | iommu_set_root_entry(iommu); | 4090 | iommu_set_root_entry(iommu); |
