Skip to content

Commit 3be9b84

Browse files
ctmarinasChristoph Hellwig
authored andcommitted
arm64: support DMA zone above 4GB
Commit 791ab8b ("arm64: Ignore any DMA offsets in the max_zone_phys() calculation") made arm64 DMA/DMA32 zones span the entire RAM when RAM starts above 32-bits. This breaks hardware with DMA area that start above 32-bits. But the commit log says that "we haven't noticed any such hardware". It turns out that such hardware does exist. One such platform has RAM starting at 32GB with an internal bus that has the following DMA limits: #address-cells = <2>; #size-cells = <2>; dma-ranges = <0x00 0xc0000000 0x08 0x00000000 0x00 0x40000000>; That is, devices under this bus see 1GB of DMA range between 3GB-4GB in their address space. This range is mapped to CPU memory at 32GB-33GB. With current code DMA allocations for devices under this bus are not limited to DMA area, leading to run-time allocation failure. This commit reinstates DMA zone at the bottom of RAM. The result is DMA zone that properly reflects the hardware constraints as follows: [ 0.000000] Zone ranges: [ 0.000000] DMA [mem 0x0000000800000000-0x000000083fffffff] [ 0.000000] DMA32 empty [ 0.000000] Normal [mem 0x0000000840000000-0x0000000bffffffff] Signed-off-by: Catalin Marinas <[email protected]> [baruch: split off the original patch] Signed-off-by: Baruch Siach <[email protected]> Reviewed-by: Petr Tesarik <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]>
1 parent ba0fb44 commit 3be9b84

File tree

1 file changed

+0
-12
lines changed

1 file changed

+0
-12
lines changed

arch/arm64/mm/init.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -114,20 +114,8 @@ static void __init arch_reserve_crashkernel(void)
114114
low_size, high);
115115
}
116116

117-
/*
118-
* Return the maximum physical address for a zone given its limit.
119-
* If DRAM starts above 32-bit, expand the zone to the maximum
120-
* available memory, otherwise cap it at 32-bit.
121-
*/
122117
static phys_addr_t __init max_zone_phys(phys_addr_t zone_limit)
123118
{
124-
phys_addr_t phys_start = memblock_start_of_DRAM();
125-
126-
if (phys_start > U32_MAX)
127-
zone_limit = PHYS_ADDR_MAX;
128-
else if (phys_start > zone_limit)
129-
zone_limit = U32_MAX;
130-
131119
return min(zone_limit, memblock_end_of_DRAM() - 1) + 1;
132120
}
133121

0 commit comments

Comments
 (0)