Commit 11b9369cbb0a13cabb581aec3e6812a171cf2fd7
Committed by
Russell King
1 parent
30b99d07b7
Exists in
master
and in
7 other branches
ARM: 6625/1: use memblock memory regions for "System RAM" I/O resources
Do not use memory bank info to request the "system ram" resources as they do not track holes created by memblock_remove inside machine's reserve callback. If the removed memory is passed as platform_device's ioresource, then drivers that call request_mem_region would fail due to a conflict with the incorrectly configured system ram resource. Instead, iterate through the regions of memblock.memory and add those as "System RAM" resources. Signed-off-by: Dima Zavin <dima@android.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Showing 1 changed file with 6 additions and 10 deletions Side-by-side Diff
arch/arm/kernel/setup.c
... | ... | @@ -518,25 +518,21 @@ |
518 | 518 | #endif |
519 | 519 | } |
520 | 520 | |
521 | -static void __init | |
522 | -request_standard_resources(struct meminfo *mi, struct machine_desc *mdesc) | |
521 | +static void __init request_standard_resources(struct machine_desc *mdesc) | |
523 | 522 | { |
523 | + struct memblock_region *region; | |
524 | 524 | struct resource *res; |
525 | - int i; | |
526 | 525 | |
527 | 526 | kernel_code.start = virt_to_phys(_text); |
528 | 527 | kernel_code.end = virt_to_phys(_etext - 1); |
529 | 528 | kernel_data.start = virt_to_phys(_sdata); |
530 | 529 | kernel_data.end = virt_to_phys(_end - 1); |
531 | 530 | |
532 | - for (i = 0; i < mi->nr_banks; i++) { | |
533 | - if (mi->bank[i].size == 0) | |
534 | - continue; | |
535 | - | |
531 | + for_each_memblock(memory, region) { | |
536 | 532 | res = alloc_bootmem_low(sizeof(*res)); |
537 | 533 | res->name = "System RAM"; |
538 | - res->start = mi->bank[i].start; | |
539 | - res->end = mi->bank[i].start + mi->bank[i].size - 1; | |
534 | + res->start = __pfn_to_phys(memblock_region_memory_base_pfn(region)); | |
535 | + res->end = __pfn_to_phys(memblock_region_memory_end_pfn(region)) - 1; | |
540 | 536 | res->flags = IORESOURCE_MEM | IORESOURCE_BUSY; |
541 | 537 | |
542 | 538 | request_resource(&iomem_resource, res); |
... | ... | @@ -859,7 +855,7 @@ |
859 | 855 | arm_memblock_init(&meminfo, mdesc); |
860 | 856 | |
861 | 857 | paging_init(mdesc); |
862 | - request_standard_resources(&meminfo, mdesc); | |
858 | + request_standard_resources(mdesc); | |
863 | 859 | |
864 | 860 | #ifdef CONFIG_SMP |
865 | 861 | if (is_smp()) |