aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Woodhouse <David.Woodhouse@intel.com>2014-03-09 19:27:31 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2014-03-24 10:08:03 -0400
commit5913c9bf0efecfa869375af8b4619529d3464038 (patch)
treef7f77190d22cdf6fe343916a64e1ccb59ca8e0f6
parentbf9c9eda718bd56dde772270d117a8ef51bcea7e (diff)
iommu/vt-d: Make domain_add_dev_info() take struct device
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
-rw-r--r--drivers/iommu/intel-iommu.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 66c2921f6404..2333f36f4866 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -2470,25 +2470,24 @@ static int identity_mapping(struct device *dev)
2470} 2470}
2471 2471
2472static int domain_add_dev_info(struct dmar_domain *domain, 2472static int domain_add_dev_info(struct dmar_domain *domain,
2473 struct pci_dev *pdev, 2473 struct device *dev, int translation)
2474 int translation)
2475{ 2474{
2476 struct dmar_domain *ndomain; 2475 struct dmar_domain *ndomain;
2477 struct intel_iommu *iommu; 2476 struct intel_iommu *iommu;
2478 u8 bus, devfn; 2477 u8 bus, devfn;
2479 int ret; 2478 int ret;
2480 2479
2481 iommu = device_to_iommu(&pdev->dev, &bus, &devfn); 2480 iommu = device_to_iommu(dev, &bus, &devfn);
2482 if (!iommu) 2481 if (!iommu)
2483 return -ENODEV; 2482 return -ENODEV;
2484 2483
2485 ndomain = dmar_insert_dev_info(iommu, bus, devfn, &pdev->dev, domain); 2484 ndomain = dmar_insert_dev_info(iommu, bus, devfn, dev, domain);
2486 if (ndomain != domain) 2485 if (ndomain != domain)
2487 return -EBUSY; 2486 return -EBUSY;
2488 2487
2489 ret = domain_context_mapping(domain, &pdev->dev, translation); 2488 ret = domain_context_mapping(domain, dev, translation);
2490 if (ret) { 2489 if (ret) {
2491 domain_remove_one_dev_info(domain, &pdev->dev); 2490 domain_remove_one_dev_info(domain, dev);
2492 return ret; 2491 return ret;
2493 } 2492 }
2494 2493
@@ -2607,7 +2606,7 @@ static int __init iommu_prepare_static_identity_mapping(int hw)
2607 2606
2608 for_each_pci_dev(pdev) { 2607 for_each_pci_dev(pdev) {
2609 if (iommu_should_identity_map(&pdev->dev, 1)) { 2608 if (iommu_should_identity_map(&pdev->dev, 1)) {
2610 ret = domain_add_dev_info(si_domain, pdev, 2609 ret = domain_add_dev_info(si_domain, &pdev->dev,
2611 hw ? CONTEXT_TT_PASS_THROUGH : 2610 hw ? CONTEXT_TT_PASS_THROUGH :
2612 CONTEXT_TT_MULTI_LEVEL); 2611 CONTEXT_TT_MULTI_LEVEL);
2613 if (ret) { 2612 if (ret) {
@@ -2940,7 +2939,7 @@ static int iommu_no_mapping(struct device *dev)
2940 */ 2939 */
2941 if (iommu_should_identity_map(&pdev->dev, 0)) { 2940 if (iommu_should_identity_map(&pdev->dev, 0)) {
2942 int ret; 2941 int ret;
2943 ret = domain_add_dev_info(si_domain, pdev, 2942 ret = domain_add_dev_info(si_domain, dev,
2944 hw_pass_through ? 2943 hw_pass_through ?
2945 CONTEXT_TT_PASS_THROUGH : 2944 CONTEXT_TT_PASS_THROUGH :
2946 CONTEXT_TT_MULTI_LEVEL); 2945 CONTEXT_TT_MULTI_LEVEL);
@@ -4201,7 +4200,7 @@ static int intel_iommu_attach_device(struct iommu_domain *domain,
4201 dmar_domain->agaw--; 4200 dmar_domain->agaw--;
4202 } 4201 }
4203 4202
4204 return domain_add_dev_info(dmar_domain, pdev, CONTEXT_TT_MULTI_LEVEL); 4203 return domain_add_dev_info(dmar_domain, dev, CONTEXT_TT_MULTI_LEVEL);
4205} 4204}
4206 4205
4207static void intel_iommu_detach_device(struct iommu_domain *domain, 4206static void intel_iommu_detach_device(struct iommu_domain *domain,