aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/intel-iommu.c
diff options
context:
space:
mode:
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;