aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/intel-iommu.c
diff options
context:
space:
mode:
authorDavid Woodhouse <David.Woodhouse@intel.com>2009-07-07 14:43:20 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2009-07-07 14:43:24 -0400
commit147202aa772329a02c6e80bc2b7a6b8dd3deac0b (patch)
treea0d148e7865e6505f69652d739a8e23458da90d0 /drivers/pci/intel-iommu.c
parent085ff82c9c615d502d1e6754879d8d4ff590d143 (diff)
intel-iommu: Speed up map routines by using cached domain ASAP
We did before, in the end -- but it was at the bottom of a long stack of functions. Add an inline wrapper get_valid_domain_for_dev() which will use the cached one _first_ and only make the out-of-line call if it's not already set. This takes the average time taken for a 1-page intel_map_sg() from 5961 cycles to 4812 cycles on my Lenovo x200s test box -- a modest 20%. Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/pci/intel-iommu.c')
-rw-r--r--drivers/pci/intel-iommu.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index 360fb67a30d7..c5f7c73cbb55 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -2455,8 +2455,7 @@ static struct iova *intel_alloc_iova(struct device *dev,
2455 return iova; 2455 return iova;
2456} 2456}
2457 2457
2458static struct dmar_domain * 2458static struct dmar_domain *__get_valid_domain_for_dev(struct pci_dev *pdev)
2459get_valid_domain_for_dev(struct pci_dev *pdev)
2460{ 2459{
2461 struct dmar_domain *domain; 2460 struct dmar_domain *domain;
2462 int ret; 2461 int ret;
@@ -2484,6 +2483,18 @@ get_valid_domain_for_dev(struct pci_dev *pdev)
2484 return domain; 2483 return domain;
2485} 2484}
2486 2485
2486static inline struct dmar_domain *get_valid_domain_for_dev(struct pci_dev *dev)
2487{
2488 struct device_domain_info *info;
2489
2490 /* No lock here, assumes no domain exit in normal case */
2491 info = dev->dev.archdata.iommu;
2492 if (likely(info))
2493 return info->domain;
2494
2495 return __get_valid_domain_for_dev(dev);
2496}
2497
2487static int iommu_dummy(struct pci_dev *pdev) 2498static int iommu_dummy(struct pci_dev *pdev)
2488{ 2499{
2489 return pdev->dev.archdata.iommu == DUMMY_DEVICE_DOMAIN_INFO; 2500 return pdev->dev.archdata.iommu == DUMMY_DEVICE_DOMAIN_INFO;