diff options
author | Sheng Yang <sheng@linux.intel.com> | 2009-03-18 03:33:06 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2009-03-24 05:42:51 -0400 |
commit | dbb9fd8630e95b6155aff658a2b5f80e95ca2bc6 (patch) | |
tree | b24caff50e1c5bfb428cb7422608bfef95d916e8 /drivers | |
parent | 58c610bd1a3f50820e45a7c09ec0e44d2cda15dd (diff) |
iommu: Add domain_has_cap iommu_ops
This iommu_op can tell if domain have a specific capability, like snooping
control for Intel IOMMU, which can be used by other components of kernel to
adjust the behaviour.
Signed-off-by: Sheng Yang <sheng@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/base/iommu.c | 7 | ||||
-rw-r--r-- | drivers/pci/intel-iommu.c | 12 |
2 files changed, 19 insertions, 0 deletions
diff --git a/drivers/base/iommu.c b/drivers/base/iommu.c index 5e039d4f877c..c314f144825f 100644 --- a/drivers/base/iommu.c +++ b/drivers/base/iommu.c | |||
@@ -98,3 +98,10 @@ phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain, | |||
98 | return iommu_ops->iova_to_phys(domain, iova); | 98 | return iommu_ops->iova_to_phys(domain, iova); |
99 | } | 99 | } |
100 | EXPORT_SYMBOL_GPL(iommu_iova_to_phys); | 100 | EXPORT_SYMBOL_GPL(iommu_iova_to_phys); |
101 | |||
102 | int iommu_domain_has_cap(struct iommu_domain *domain, | ||
103 | unsigned long cap) | ||
104 | { | ||
105 | return iommu_ops->domain_has_cap(domain, cap); | ||
106 | } | ||
107 | EXPORT_SYMBOL_GPL(iommu_domain_has_cap); | ||
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index be999ff025af..3778ab149baf 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c | |||
@@ -3158,6 +3158,17 @@ static phys_addr_t intel_iommu_iova_to_phys(struct iommu_domain *domain, | |||
3158 | return phys; | 3158 | return phys; |
3159 | } | 3159 | } |
3160 | 3160 | ||
3161 | static int intel_iommu_domain_has_cap(struct iommu_domain *domain, | ||
3162 | unsigned long cap) | ||
3163 | { | ||
3164 | struct dmar_domain *dmar_domain = domain->priv; | ||
3165 | |||
3166 | if (cap == IOMMU_CAP_CACHE_COHERENCY) | ||
3167 | return dmar_domain->iommu_snooping; | ||
3168 | |||
3169 | return 0; | ||
3170 | } | ||
3171 | |||
3161 | static struct iommu_ops intel_iommu_ops = { | 3172 | static struct iommu_ops intel_iommu_ops = { |
3162 | .domain_init = intel_iommu_domain_init, | 3173 | .domain_init = intel_iommu_domain_init, |
3163 | .domain_destroy = intel_iommu_domain_destroy, | 3174 | .domain_destroy = intel_iommu_domain_destroy, |
@@ -3166,6 +3177,7 @@ static struct iommu_ops intel_iommu_ops = { | |||
3166 | .map = intel_iommu_map_range, | 3177 | .map = intel_iommu_map_range, |
3167 | .unmap = intel_iommu_unmap_range, | 3178 | .unmap = intel_iommu_unmap_range, |
3168 | .iova_to_phys = intel_iommu_iova_to_phys, | 3179 | .iova_to_phys = intel_iommu_iova_to_phys, |
3180 | .domain_has_cap = intel_iommu_domain_has_cap, | ||
3169 | }; | 3181 | }; |
3170 | 3182 | ||
3171 | static void __devinit quirk_iommu_rwbf(struct pci_dev *dev) | 3183 | static void __devinit quirk_iommu_rwbf(struct pci_dev *dev) |