aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2008-12-03 08:58:24 -0500
committerJoerg Roedel <joerg.roedel@amd.com>2009-01-03 08:11:08 -0500
commit4c5478c94eb29e6101f1f13175f7455bc8b5d953 (patch)
tree6235e9d9a22230c837f420f4f8d655817be8efa7
parent5d450806eb0e569c5846a5825e7f535980b0da32 (diff)
VT-d: adapt device attach and detach functions for IOMMU API
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
-rw-r--r--drivers/pci/intel-iommu.c27
-rw-r--r--include/linux/intel-iommu.h4
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
2995int intel_iommu_attach_device(struct dmar_domain *domain, 2995static 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}
3038EXPORT_SYMBOL_GPL(intel_iommu_attach_device);
3039 3040
3040void intel_iommu_detach_device(struct dmar_domain *domain, 3041static 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}
3045EXPORT_SYMBOL_GPL(intel_iommu_detach_device);
3046 3049
3047int intel_iommu_map_address(struct dmar_domain *domain, dma_addr_t iova, 3050int 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
331extern void qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu); 331extern void qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu);
332 332
333int intel_iommu_attach_device(struct dmar_domain *domain,
334 struct pci_dev *pdev);
335void intel_iommu_detach_device(struct dmar_domain *domain,
336 struct pci_dev *pdev);
337int intel_iommu_map_address(struct dmar_domain *domain, dma_addr_t iova, 333int 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);
339void intel_iommu_unmap_address(struct dmar_domain *domain, 335void intel_iommu_unmap_address(struct dmar_domain *domain,