Skip to content

Commit

Permalink
iommu/dma: Fix IOVA reserve dma ranges
Browse files Browse the repository at this point in the history
Fix IOVA reserve failure in the case when address of first memory region
listed in dma-ranges is equal to 0x0.

Fixes: aadad09 ("iommu/dma: Reserve IOVA for PCIe inaccessible DMA address")
Signed-off-by: Srinath Mannam <srinath.mannam@broadcom.com>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Tested-by: Sven Peter <sven@svenpeter.dev>
Link: https://lore.kernel.org/r/20200914072319.6091-1-srinath.mannam@broadcom.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
  • Loading branch information
Srinath Mannam authored and Joerg Roedel committed Jun 8, 2021
1 parent 8124c8a commit 571f316
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/iommu/dma-iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,11 @@ static int iova_reserve_pci_windows(struct pci_dev *dev,
lo = iova_pfn(iovad, start);
hi = iova_pfn(iovad, end);
reserve_iova(iovad, lo, hi);
} else {
} else if (end < start) {
/* dma_ranges list should be sorted */
dev_err(&dev->dev, "Failed to reserve IOVA\n");
dev_err(&dev->dev,
"Failed to reserve IOVA [%#010llx-%#010llx]\n",
start, end);
return -EINVAL;
}

Expand Down

0 comments on commit 571f316

Please sign in to comment.