diff options
author | Joerg Roedel <joerg.roedel@amd.com> | 2008-12-03 08:58:24 -0500 |
---|---|---|
committer | Joerg Roedel <joerg.roedel@amd.com> | 2009-01-03 08:11:08 -0500 |
commit | 4c5478c94eb29e6101f1f13175f7455bc8b5d953 (patch) | |
tree | 6235e9d9a22230c837f420f4f8d655817be8efa7 /drivers/pci/intel-iommu.c | |
parent | 5d450806eb0e569c5846a5825e7f535980b0da32 (diff) |
VT-d: adapt device attach and detach functions for IOMMU API
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Diffstat (limited to 'drivers/pci/intel-iommu.c')
-rw-r--r-- | drivers/pci/intel-iommu.c | 27 |
1 files changed, 15 insertions, 12 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) |