diff options
author | David Woodhouse <David.Woodhouse@intel.com> | 2014-03-09 19:07:40 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2014-03-24 10:07:57 -0400 |
commit | d4b709f48ed44d42ed90c1a85dda7fd053d36ce1 (patch) | |
tree | 86644df9f3f02983e62394ae05c4dc035e3eb0a4 /drivers/iommu/intel-iommu.c | |
parent | 3bdb259116059a6b805cfe9be66f4054f92598a3 (diff) |
iommu/vt-d: Make get_valid_domain_for_dev() take struct device
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/iommu/intel-iommu.c')
-rw-r--r-- | drivers/iommu/intel-iommu.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index ccfce8832954..e18b93cc1224 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
@@ -2862,26 +2862,24 @@ static struct iova *intel_alloc_iova(struct device *dev, | |||
2862 | return iova; | 2862 | return iova; |
2863 | } | 2863 | } |
2864 | 2864 | ||
2865 | static struct dmar_domain *__get_valid_domain_for_dev(struct pci_dev *pdev) | 2865 | static struct dmar_domain *__get_valid_domain_for_dev(struct device *dev) |
2866 | { | 2866 | { |
2867 | struct dmar_domain *domain; | 2867 | struct dmar_domain *domain; |
2868 | int ret; | 2868 | int ret; |
2869 | 2869 | ||
2870 | domain = get_domain_for_dev(&pdev->dev, DEFAULT_DOMAIN_ADDRESS_WIDTH); | 2870 | domain = get_domain_for_dev(dev, DEFAULT_DOMAIN_ADDRESS_WIDTH); |
2871 | if (!domain) { | 2871 | if (!domain) { |
2872 | printk(KERN_ERR | 2872 | printk(KERN_ERR "Allocating domain for %s failed", |
2873 | "Allocating domain for %s failed", pci_name(pdev)); | 2873 | dev_name(dev)); |
2874 | return NULL; | 2874 | return NULL; |
2875 | } | 2875 | } |
2876 | 2876 | ||
2877 | /* make sure context mapping is ok */ | 2877 | /* make sure context mapping is ok */ |
2878 | if (unlikely(!domain_context_mapped(&pdev->dev))) { | 2878 | if (unlikely(!domain_context_mapped(dev))) { |
2879 | ret = domain_context_mapping(domain, &pdev->dev, | 2879 | ret = domain_context_mapping(domain, dev, CONTEXT_TT_MULTI_LEVEL); |
2880 | CONTEXT_TT_MULTI_LEVEL); | ||
2881 | if (ret) { | 2880 | if (ret) { |
2882 | printk(KERN_ERR | 2881 | printk(KERN_ERR "Domain context map for %s failed", |
2883 | "Domain context map for %s failed", | 2882 | dev_name(dev)); |
2884 | pci_name(pdev)); | ||
2885 | return NULL; | 2883 | return NULL; |
2886 | } | 2884 | } |
2887 | } | 2885 | } |
@@ -2889,12 +2887,12 @@ static struct dmar_domain *__get_valid_domain_for_dev(struct pci_dev *pdev) | |||
2889 | return domain; | 2887 | return domain; |
2890 | } | 2888 | } |
2891 | 2889 | ||
2892 | static inline struct dmar_domain *get_valid_domain_for_dev(struct pci_dev *dev) | 2890 | static inline struct dmar_domain *get_valid_domain_for_dev(struct device *dev) |
2893 | { | 2891 | { |
2894 | struct device_domain_info *info; | 2892 | struct device_domain_info *info; |
2895 | 2893 | ||
2896 | /* No lock here, assumes no domain exit in normal case */ | 2894 | /* No lock here, assumes no domain exit in normal case */ |
2897 | info = dev->dev.archdata.iommu; | 2895 | info = dev->archdata.iommu; |
2898 | if (likely(info)) | 2896 | if (likely(info)) |
2899 | return info->domain; | 2897 | return info->domain; |
2900 | 2898 | ||
@@ -2975,7 +2973,7 @@ static dma_addr_t __intel_map_single(struct device *hwdev, phys_addr_t paddr, | |||
2975 | if (iommu_no_mapping(hwdev)) | 2973 | if (iommu_no_mapping(hwdev)) |
2976 | return paddr; | 2974 | return paddr; |
2977 | 2975 | ||
2978 | domain = get_valid_domain_for_dev(pdev); | 2976 | domain = get_valid_domain_for_dev(hwdev); |
2979 | if (!domain) | 2977 | if (!domain) |
2980 | return 0; | 2978 | return 0; |
2981 | 2979 | ||
@@ -3280,7 +3278,7 @@ static int intel_map_sg(struct device *hwdev, struct scatterlist *sglist, int ne | |||
3280 | if (iommu_no_mapping(hwdev)) | 3278 | if (iommu_no_mapping(hwdev)) |
3281 | return intel_nontranslate_map_sg(hwdev, sglist, nelems, dir); | 3279 | return intel_nontranslate_map_sg(hwdev, sglist, nelems, dir); |
3282 | 3280 | ||
3283 | domain = get_valid_domain_for_dev(pdev); | 3281 | domain = get_valid_domain_for_dev(hwdev); |
3284 | if (!domain) | 3282 | if (!domain) |
3285 | return 0; | 3283 | return 0; |
3286 | 3284 | ||