[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200218184103.35932-3-hch@lst.de>
Date: Tue, 18 Feb 2020 10:41:02 -0800
From: Christoph Hellwig <hch@....de>
To: Russell King <linux@...linux.org.uk>
Cc: Peter Ujfalusi <peter.ujfalusi@...com>,
Roger Quadros <rogerq@...com>,
Robin Murphy <robin.murphy@....com>,
iommu@...ts.linux-foundation.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org
Subject: [PATCH 2/3] ARM/dma-mapping: take the bus limit into account in __dma_alloc
The DMA coherent allocator needs to take bus limits into account for
picking the zone that the memory is allocated from.
Reported-by: Roger Quadros <rogerq@...com>
Signed-off-by: Christoph Hellwig <hch@....de>
Tested-by: Peter Ujfalusi <peter.ujfalusi@...com>
Tested-by: Roger Quadros <rogerq@...com>
---
arch/arm/mm/dma-mapping.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 72ddc3d0f5eb..87aba505554a 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -658,7 +658,7 @@ static void *__dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
gfp_t gfp, pgprot_t prot, bool is_coherent,
unsigned long attrs, const void *caller)
{
- u64 mask = dev->coherent_dma_mask;
+ u64 mask = min_not_zero(dev->coherent_dma_mask, dev->bus_dma_limit);
struct page *page = NULL;
void *addr;
bool allowblock, cma;
--
2.24.1
Powered by blists - more mailing lists