summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSrinath Mannam <srinath.mannam@broadcom.com>2020-09-14 12:53:19 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-07-14 16:56:42 +0200
commit45a3d00eafb7112a1ee62c842124d750f6ff5551 (patch)
treeb96847147ec9dcaca2a69be74aaedbc361997aa8
parentad736838155c997a06c4da0b1309d96667ae61fa (diff)
downloadlinux-stable-45a3d00eafb7112a1ee62c842124d750f6ff5551.tar.gz
linux-stable-45a3d00eafb7112a1ee62c842124d750f6ff5551.tar.bz2
linux-stable-45a3d00eafb7112a1ee62c842124d750f6ff5551.zip
iommu/dma: Fix IOVA reserve dma ranges
[ Upstream commit 571f316074a203e979ea90211d9acf423dfe5f46 ] Fix IOVA reserve failure in the case when address of first memory region listed in dma-ranges is equal to 0x0. Fixes: aadad097cd46f ("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> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/iommu/dma-iommu.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
index 0cbcd3fc3e7e..840dd2b66ce7 100644
--- a/drivers/iommu/dma-iommu.c
+++ b/drivers/iommu/dma-iommu.c
@@ -216,9 +216,11 @@ resv_iova:
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;
}