forked from Minki/linux
Fix arm64 regression introduced by limiting the CMA buffer to ZONE_DMA
on platforms where RAM starts above 4GB (and ZONE_DMA becoming 0). -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iQIcBAABAgAGBQJTz+NOAAoJEGvWsS0AyF7xmxQP+wYU76kz2mAyroFdVSCAidqc k8DgpYDkDRpxWmkoTYYAuLlMbMk6po+HyX+Gz0ZZw2A8c7bnf3+/ljVk7Y88Shs5 B+uRLrvIb6BCuroM9oGMUxYF5s+jPmBSLvh+jefypSLrffYoGBAbXN2w9M0CP4Uh NiUFSNczs/F6Se7uP1vd8PiN6pJxZfWsb2nFKW3Gzi5Oo2x5JR/kLhJXM/9k6ahE XAskRjiHE52pfoyiC66ZLvT1PeZ/smz6quaWquoQ/9obwISWPqIRkF5UoMwpuJOY n9R4G7BjJH/dD7yYpgMYzANxOYMwKLtSbwJ6YO1iazWXy3t6+aF1ZsfFb7f42Ysw Rnpa4OGUCgWqqge+B8j2Zm7nX/TW/HpX/5YKHhTYH4dU/xsHcM4/IR+jkZ91HyJ5 RVa9SC3wH6OEASxmN4T3pP24pT9IHKR4ckviBrrAskby7QZ1Ud+HPp2lrxdt8R3N m/Ee8iUPOA+uZMXYihx2Bb7E5IaMr2Dzk040nzOc+9lOOpgv2iVqgHQ5gme2DRko 6QX6575IvqTgl4gqiQmpII4Pqu9r0NR2EWYlsLqXsiqnoWBy4ltRdvsZqy4VpP0s FIIC1cOXDhiNWHU5Q+QAC4CEnsnMlnb9hfbAfrLOVpyotY7ry27zGx67EdF4h8d0 4U+HGdmgxDJf9WtAbR0X =NrXJ -----END PGP SIGNATURE----- Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux Pull arm64 fix from Catalin Marinas: "Fix arm64 regression introduced by limiting the CMA buffer to ZONE_DMA on platforms where RAM starts above 4GB (and ZONE_DMA becoming 0)" * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux: arm64: Create non-empty ZONE_DMA when DRAM starts above 4GB
This commit is contained in:
commit
98de5ab713
@ -60,6 +60,17 @@ static int __init early_initrd(char *p)
|
||||
early_param("initrd", early_initrd);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Return the maximum physical address for ZONE_DMA (DMA_BIT_MASK(32)). It
|
||||
* currently assumes that for memory starting above 4G, 32-bit devices will
|
||||
* use a DMA offset.
|
||||
*/
|
||||
static phys_addr_t max_zone_dma_phys(void)
|
||||
{
|
||||
phys_addr_t offset = memblock_start_of_DRAM() & GENMASK_ULL(63, 32);
|
||||
return min(offset + (1ULL << 32), memblock_end_of_DRAM());
|
||||
}
|
||||
|
||||
static void __init zone_sizes_init(unsigned long min, unsigned long max)
|
||||
{
|
||||
struct memblock_region *reg;
|
||||
@ -70,9 +81,7 @@ static void __init zone_sizes_init(unsigned long min, unsigned long max)
|
||||
|
||||
/* 4GB maximum for 32-bit only capable devices */
|
||||
if (IS_ENABLED(CONFIG_ZONE_DMA)) {
|
||||
unsigned long max_dma_phys =
|
||||
(unsigned long)(dma_to_phys(NULL, DMA_BIT_MASK(32)) + 1);
|
||||
max_dma = max(min, min(max, max_dma_phys >> PAGE_SHIFT));
|
||||
max_dma = PFN_DOWN(max_zone_dma_phys());
|
||||
zone_size[ZONE_DMA] = max_dma - min;
|
||||
}
|
||||
zone_size[ZONE_NORMAL] = max - max_dma;
|
||||
@ -146,7 +155,7 @@ void __init arm64_memblock_init(void)
|
||||
|
||||
/* 4GB maximum for 32-bit only capable devices */
|
||||
if (IS_ENABLED(CONFIG_ZONE_DMA))
|
||||
dma_phys_limit = dma_to_phys(NULL, DMA_BIT_MASK(32)) + 1;
|
||||
dma_phys_limit = max_zone_dma_phys();
|
||||
dma_contiguous_reserve(dma_phys_limit);
|
||||
|
||||
memblock_allow_resize();
|
||||
|
Loading…
Reference in New Issue
Block a user