aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/intel-iommu.c
diff options
context:
space:
mode:
authorTom Lyon <pugs@cisco.com>2010-05-17 03:19:52 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2010-05-17 03:34:20 -0400
commit8954da1f82a468deeeae3683252b5440e7f4ccbe (patch)
tree3d9d7c6899f7757c68a4ccf5b38ad128d0d3dd7c /drivers/pci/intel-iommu.c
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>
Diffstat (limited to 'drivers/pci/intel-iommu.c')
-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 57be89e6f484..65741dc491d6 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,
3626{ 3626{
3627 struct dmar_domain *dmar_domain = domain->priv; 3627 struct dmar_domain *dmar_domain = domain->priv;
3628 u64 max_addr; 3628 u64 max_addr;
3629 int addr_width;
3630 int prot = 0; 3629 int prot = 0;
3631 int ret; 3630 int ret;
3632 3631
@@ -3639,18 +3638,14 @@ static int intel_iommu_map_range(struct iommu_domain *domain,
3639 3638
3640 max_addr = iova + size; 3639 max_addr = iova + size;
3641 if (dmar_domain->max_addr < max_addr) { 3640 if (dmar_domain->max_addr < max_addr) {
3642 int min_agaw;
3643 u64 end; 3641 u64 end;
3644 3642
3645 /* check if minimum agaw is sufficient for mapped address */ 3643 /* check if minimum agaw is sufficient for mapped address */
3646 min_agaw = vm_domain_min_agaw(dmar_domain); 3644 end = __DOMAIN_MAX_ADDR(dmar_domain->gaw) + 1;
3647 addr_width = agaw_to_width(min_agaw);
3648 end = DOMAIN_MAX_ADDR(addr_width);
3649 end = end & VTD_PAGE_MASK;
3650 if (end < max_addr) { 3645 if (end < max_addr) {
3651 printk(KERN_ERR "%s: iommu agaw (%d) is not " 3646 printk(KERN_ERR "%s: iommu width (%d) is not "
3652 "sufficient for the mapped address (%llx)\n", 3647 "sufficient for the mapped address (%llx)\n",
3653 __func__, min_agaw, max_addr); 3648 __func__, dmar_domain->gaw, max_addr);
3654 return -EFAULT; 3649 return -EFAULT;
3655 } 3650 }
3656 dmar_domain->max_addr = max_addr; 3651 dmar_domain->max_addr = max_addr;