diff options
| author | Catalin Marinas <catalin.marinas@arm.com> | 2024-08-11 10:09:35 +0300 |
|---|---|---|
| committer | Christoph Hellwig <hch@lst.de> | 2024-08-22 06:18:00 +0200 |
| commit | ba0fb44aed47693cc2482427f63ba6cd19051327 (patch) | |
| tree | 621c630705defd780fbeac9b9b103f3c80264c23 /kernel/dma/pool.c | |
| parent | fa3c109a6d302b56437a6412c5f3044c3e12de03 (diff) | |
| download | linux-next-ba0fb44aed47693cc2482427f63ba6cd19051327.tar.gz linux-next-ba0fb44aed47693cc2482427f63ba6cd19051327.zip | |
dma-mapping: replace zone_dma_bits by zone_dma_limit
The hardware DMA limit might not be power of 2. When RAM range starts
above 0, say 4GB, DMA limit of 30 bits should end at 5GB. A single high
bit can not encode this limit.
Use a plain address for the DMA zone limit instead.
Since the DMA zone can now potentially span beyond 4GB physical limit of
DMA32, make sure to use DMA zone for GFP_DMA32 allocations in that case.
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Co-developed-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: Petr Tesarik <ptesarik@suse.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'kernel/dma/pool.c')
| -rw-r--r-- | kernel/dma/pool.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/dma/pool.c b/kernel/dma/pool.c index d10613eb0f63..7b04f7575796 100644 --- a/kernel/dma/pool.c +++ b/kernel/dma/pool.c @@ -70,9 +70,9 @@ static bool cma_in_zone(gfp_t gfp) /* CMA can't cross zone boundaries, see cma_activate_area() */ end = cma_get_base(cma) + size - 1; if (IS_ENABLED(CONFIG_ZONE_DMA) && (gfp & GFP_DMA)) - return end <= DMA_BIT_MASK(zone_dma_bits); + return end <= zone_dma_limit; if (IS_ENABLED(CONFIG_ZONE_DMA32) && (gfp & GFP_DMA32)) - return end <= DMA_BIT_MASK(32); + return end <= max(DMA_BIT_MASK(32), zone_dma_limit); return true; } |
