diff options
-rw-r--r-- | arch/arm/include/asm/dma-iommu.h | 2 | ||||
-rw-r--r-- | arch/arm/mm/dma-mapping.c | 13 |
2 files changed, 6 insertions, 9 deletions
diff --git a/arch/arm/include/asm/dma-iommu.h b/arch/arm/include/asm/dma-iommu.h index 8e3fcb924db6..2ef282f96651 100644 --- a/arch/arm/include/asm/dma-iommu.h +++ b/arch/arm/include/asm/dma-iommu.h | |||
@@ -25,7 +25,7 @@ struct dma_iommu_mapping { | |||
25 | }; | 25 | }; |
26 | 26 | ||
27 | struct dma_iommu_mapping * | 27 | struct dma_iommu_mapping * |
28 | arm_iommu_create_mapping(struct bus_type *bus, dma_addr_t base, size_t size); | 28 | arm_iommu_create_mapping(struct bus_type *bus, dma_addr_t base, u64 size); |
29 | 29 | ||
30 | void arm_iommu_release_mapping(struct dma_iommu_mapping *mapping); | 30 | void arm_iommu_release_mapping(struct dma_iommu_mapping *mapping); |
31 | 31 | ||
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index 09c5fe3d30c2..7e7583ddd607 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c | |||
@@ -1878,7 +1878,7 @@ struct dma_map_ops iommu_coherent_ops = { | |||
1878 | * arm_iommu_attach_device function. | 1878 | * arm_iommu_attach_device function. |
1879 | */ | 1879 | */ |
1880 | struct dma_iommu_mapping * | 1880 | struct dma_iommu_mapping * |
1881 | arm_iommu_create_mapping(struct bus_type *bus, dma_addr_t base, size_t size) | 1881 | arm_iommu_create_mapping(struct bus_type *bus, dma_addr_t base, u64 size) |
1882 | { | 1882 | { |
1883 | unsigned int bits = size >> PAGE_SHIFT; | 1883 | unsigned int bits = size >> PAGE_SHIFT; |
1884 | unsigned int bitmap_size = BITS_TO_LONGS(bits) * sizeof(long); | 1884 | unsigned int bitmap_size = BITS_TO_LONGS(bits) * sizeof(long); |
@@ -1886,6 +1886,10 @@ arm_iommu_create_mapping(struct bus_type *bus, dma_addr_t base, size_t size) | |||
1886 | int extensions = 1; | 1886 | int extensions = 1; |
1887 | int err = -ENOMEM; | 1887 | int err = -ENOMEM; |
1888 | 1888 | ||
1889 | /* currently only 32-bit DMA address space is supported */ | ||
1890 | if (size > DMA_BIT_MASK(32) + 1) | ||
1891 | return ERR_PTR(-ERANGE); | ||
1892 | |||
1889 | if (!bitmap_size) | 1893 | if (!bitmap_size) |
1890 | return ERR_PTR(-EINVAL); | 1894 | return ERR_PTR(-EINVAL); |
1891 | 1895 | ||
@@ -2057,13 +2061,6 @@ static bool arm_setup_iommu_dma_ops(struct device *dev, u64 dma_base, u64 size, | |||
2057 | if (!iommu) | 2061 | if (!iommu) |
2058 | return false; | 2062 | return false; |
2059 | 2063 | ||
2060 | /* | ||
2061 | * currently arm_iommu_create_mapping() takes a max of size_t | ||
2062 | * for size param. So check this limit for now. | ||
2063 | */ | ||
2064 | if (size > SIZE_MAX) | ||
2065 | return false; | ||
2066 | |||
2067 | mapping = arm_iommu_create_mapping(dev->bus, dma_base, size); | 2064 | mapping = arm_iommu_create_mapping(dev->bus, dma_base, size); |
2068 | if (IS_ERR(mapping)) { | 2065 | if (IS_ERR(mapping)) { |
2069 | pr_warn("Failed to create %llu-byte IOMMU mapping for device %s\n", | 2066 | pr_warn("Failed to create %llu-byte IOMMU mapping for device %s\n", |