diff options
-rw-r--r-- | drivers/pci/intel-iommu.c | 27 | ||||
-rw-r--r-- | include/linux/intel-iommu.h | 4 |
2 files changed, 15 insertions, 16 deletions
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index 5c95a5a65440..db9a26cfeb8f 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c | |||
@@ -2992,9 +2992,11 @@ static void intel_iommu_domain_destroy(struct iommu_domain *domain) | |||
2992 | vm_domain_exit(dmar_domain); | 2992 | vm_domain_exit(dmar_domain); |
2993 | } | 2993 | } |
2994 | 2994 | ||
2995 | int intel_iommu_attach_device(struct dmar_domain *domain, | 2995 | static int intel_iommu_attach_device(struct iommu_domain *domain, |
2996 | struct pci_dev *pdev) | 2996 | struct device *dev) |
2997 | { | 2997 | { |
2998 | struct dmar_domain *dmar_domain = domain->priv; | ||
2999 | struct pci_dev *pdev = to_pci_dev(dev); | ||
2998 | struct intel_iommu *iommu; | 3000 | struct intel_iommu *iommu; |
2999 | int addr_width; | 3001 | int addr_width; |
3000 | u64 end; | 3002 | u64 end; |
@@ -3006,7 +3008,7 @@ int intel_iommu_attach_device(struct dmar_domain *domain, | |||
3006 | 3008 | ||
3007 | old_domain = find_domain(pdev); | 3009 | old_domain = find_domain(pdev); |
3008 | if (old_domain) { | 3010 | if (old_domain) { |
3009 | if (domain->flags & DOMAIN_FLAG_VIRTUAL_MACHINE) | 3011 | if (dmar_domain->flags & DOMAIN_FLAG_VIRTUAL_MACHINE) |
3010 | vm_domain_remove_one_dev_info(old_domain, pdev); | 3012 | vm_domain_remove_one_dev_info(old_domain, pdev); |
3011 | else | 3013 | else |
3012 | domain_remove_dev_info(old_domain); | 3014 | domain_remove_dev_info(old_domain); |
@@ -3021,28 +3023,29 @@ int intel_iommu_attach_device(struct dmar_domain *domain, | |||
3021 | addr_width = agaw_to_width(iommu->agaw); | 3023 | addr_width = agaw_to_width(iommu->agaw); |
3022 | end = DOMAIN_MAX_ADDR(addr_width); | 3024 | end = DOMAIN_MAX_ADDR(addr_width); |
3023 | end = end & VTD_PAGE_MASK; | 3025 | end = end & VTD_PAGE_MASK; |
3024 | if (end < domain->max_addr) { | 3026 | if (end < dmar_domain->max_addr) { |
3025 | printk(KERN_ERR "%s: iommu agaw (%d) is not " | 3027 | printk(KERN_ERR "%s: iommu agaw (%d) is not " |
3026 | "sufficient for the mapped address (%llx)\n", | 3028 | "sufficient for the mapped address (%llx)\n", |
3027 | __func__, iommu->agaw, domain->max_addr); | 3029 | __func__, iommu->agaw, dmar_domain->max_addr); |
3028 | return -EFAULT; | 3030 | return -EFAULT; |
3029 | } | 3031 | } |
3030 | 3032 | ||
3031 | ret = domain_context_mapping(domain, pdev); | 3033 | ret = domain_context_mapping(dmar_domain, pdev); |
3032 | if (ret) | 3034 | if (ret) |
3033 | return ret; | 3035 | return ret; |
3034 | 3036 | ||
3035 | ret = vm_domain_add_dev_info(domain, pdev); | 3037 | ret = vm_domain_add_dev_info(dmar_domain, pdev); |
3036 | return ret; | 3038 | return ret; |
3037 | } | 3039 | } |
3038 | EXPORT_SYMBOL_GPL(intel_iommu_attach_device); | ||
3039 | 3040 | ||
3040 | void intel_iommu_detach_device(struct dmar_domain *domain, | 3041 | static void intel_iommu_detach_device(struct iommu_domain *domain, |
3041 | struct pci_dev *pdev) | 3042 | struct device *dev) |
3042 | { | 3043 | { |
3043 | vm_domain_remove_one_dev_info(domain, pdev); | 3044 | struct dmar_domain *dmar_domain = domain->priv; |
3045 | struct pci_dev *pdev = to_pci_dev(dev); | ||
3046 | |||
3047 | vm_domain_remove_one_dev_info(dmar_domain, pdev); | ||
3044 | } | 3048 | } |
3045 | EXPORT_SYMBOL_GPL(intel_iommu_detach_device); | ||
3046 | 3049 | ||
3047 | int intel_iommu_map_address(struct dmar_domain *domain, dma_addr_t iova, | 3050 | int intel_iommu_map_address(struct dmar_domain *domain, dma_addr_t iova, |
3048 | u64 hpa, size_t size, int prot) | 3051 | u64 hpa, size_t size, int prot) |
diff --git a/include/linux/intel-iommu.h b/include/linux/intel-iommu.h index 0a7ba0cefc74..9909c5a1b20f 100644 --- a/include/linux/intel-iommu.h +++ b/include/linux/intel-iommu.h | |||
@@ -330,10 +330,6 @@ extern int qi_flush_iotlb(struct intel_iommu *iommu, u16 did, u64 addr, | |||
330 | 330 | ||
331 | extern void qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu); | 331 | extern void qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu); |
332 | 332 | ||
333 | int intel_iommu_attach_device(struct dmar_domain *domain, | ||
334 | struct pci_dev *pdev); | ||
335 | void intel_iommu_detach_device(struct dmar_domain *domain, | ||
336 | struct pci_dev *pdev); | ||
337 | int intel_iommu_map_address(struct dmar_domain *domain, dma_addr_t iova, | 333 | int intel_iommu_map_address(struct dmar_domain *domain, dma_addr_t iova, |
338 | u64 hpa, size_t size, int prot); | 334 | u64 hpa, size_t size, int prot); |
339 | void intel_iommu_unmap_address(struct dmar_domain *domain, | 335 | void intel_iommu_unmap_address(struct dmar_domain *domain, |