summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Lyon <pugs@cisco.com>2010-05-17 08:19:52 +0100
committerDavid Woodhouse <David.Woodhouse@intel.com>2010-05-17 08:34:20 +0100
commit8954da1f82a468deeeae3683252b5440e7f4ccbe (patch)
tree3d9d7c6899f7757c68a4ccf5b38ad128d0d3dd7c
parenta99c47a228c194aa75bffdcb82806c5f33c7c63b (diff)
intel-iommu: intel_iommu_map_range failed at very end of address space
intel_iommu_map_range() doesn't allow allocation at the very end of the address space; that code has been simplified and corrected. Signed-off-by: Tom Lyon <pugs@cisco.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
-rw-r--r--drivers/pci/intel-iommu.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index 57be89e6f48..65741dc491d 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -3626,7 +3626,6 @@ static int intel_iommu_map_range(struct iommu_domain *domain,
{
struct dmar_domain *dmar_domain = domain->priv;
u64 max_addr;
- int addr_width;
int prot = 0;
int ret;
@@ -3639,18 +3638,14 @@ static int intel_iommu_map_range(struct iommu_domain *domain,
max_addr = iova + size;
if (dmar_domain->max_addr < max_addr) {
- int min_agaw;
u64 end;
/* check if minimum agaw is sufficient for mapped address */
- min_agaw = vm_domain_min_agaw(dmar_domain);
- addr_width = agaw_to_width(min_agaw);
- end = DOMAIN_MAX_ADDR(addr_width);
- end = end & VTD_PAGE_MASK;
+ end = __DOMAIN_MAX_ADDR(dmar_domain->gaw) + 1;
if (end < max_addr) {
- printk(KERN_ERR "%s: iommu agaw (%d) is not "
+ printk(KERN_ERR "%s: iommu width (%d) is not "
"sufficient for the mapped address (%llx)\n",
- __func__, min_agaw, max_addr);
+ __func__, dmar_domain->gaw, max_addr);
return -EFAULT;
}
dmar_domain->max_addr = max_addr;