Skip to content

Commit

Permalink
ARM: dma-mapping: allow larger DMA mask than supported
Browse files Browse the repository at this point in the history
Since the Linux 5.1 merge window we allow drivers to just set the
largest DMA mask they support instead of falling back to smaller ones.

But I forgot to remove a check that prohibits this behavior in the
arm DMA code, as it is rather hidden.  There is not reason for this check
as the code will do the right thing for a "too large" DMA mask, so
just remove it.

Fixes: 9eb9e96 ("Documentation/DMA-API-HOWTO: update dma_mask sections")
Signed-off-by: Christoph Hellwig <hch@lst.de>
  • Loading branch information
Christoph Hellwig committed Jun 25, 2019
1 parent 4a54d16 commit ab74657
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions arch/arm/mm/dma-mapping.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,25 +219,7 @@ EXPORT_SYMBOL(arm_coherent_dma_ops);

static int __dma_supported(struct device *dev, u64 mask, bool warn)
{
unsigned long max_dma_pfn;

/*
* If the mask allows for more memory than we can address,
* and we actually have that much memory, then we must
* indicate that DMA to this device is not supported.
*/
if (sizeof(mask) != sizeof(dma_addr_t) &&
mask > (dma_addr_t)~0 &&
dma_to_pfn(dev, ~0) < max_pfn - 1) {
if (warn) {
dev_warn(dev, "Coherent DMA mask %#llx is larger than dma_addr_t allows\n",
mask);
dev_warn(dev, "Driver did not use or check the return value from dma_set_coherent_mask()?\n");
}
return 0;
}

max_dma_pfn = min(max_pfn, arm_dma_pfn_limit);
unsigned long max_dma_pfn = min(max_pfn, arm_dma_pfn_limit);

/*
* Translate the device's DMA mask to a PFN limit. This
Expand Down

0 comments on commit ab74657

Please sign in to comment.