aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/kernel/setup.c
diff options
context:
space:
mode:
authorLaura Abbott <lauraa@codeaurora.org>2014-04-13 17:54:58 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2014-05-31 20:17:12 -0400
commit1c2f87c22566cd057bc8cde10c37ae9da1a1bb76 (patch)
tree6c135a3b2b6af6be3b6593ac6329d6d4f353b7dd /arch/arm/kernel/setup.c
parent1c8c3cf0b5239388e712508a85821f4718f4d889 (diff)
ARM: 8025/1: Get rid of meminfo
memblock is now fully integrated into the kernel and is the prefered method for tracking memory. Rather than reinvent the wheel with meminfo, migrate to using memblock directly instead of meminfo as an intermediate. Acked-by: Jason Cooper <jason@lakedaemon.net> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com> Acked-by: Kukjin Kim <kgene.kim@samsung.com> Tested-by: Marek Szyprowski <m.szyprowski@samsung.com> Tested-by: Leif Lindholm <leif.lindholm@linaro.org> Signed-off-by: Laura Abbott <lauraa@codeaurora.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/kernel/setup.c')
-rw-r--r--arch/arm/kernel/setup.c30
1 files changed, 8 insertions, 22 deletions
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 50e198c1e9c8..6d78ba47ea5b 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -628,15 +628,8 @@ void __init dump_machine_table(void)
628 628
629int __init arm_add_memory(u64 start, u64 size) 629int __init arm_add_memory(u64 start, u64 size)
630{ 630{
631 struct membank *bank = &meminfo.bank[meminfo.nr_banks];
632 u64 aligned_start; 631 u64 aligned_start;
633 632
634 if (meminfo.nr_banks >= NR_BANKS) {
635 pr_crit("NR_BANKS too low, ignoring memory at 0x%08llx\n",
636 (long long)start);
637 return -EINVAL;
638 }
639
640 /* 633 /*
641 * Ensure that start/size are aligned to a page boundary. 634 * Ensure that start/size are aligned to a page boundary.
642 * Size is appropriately rounded down, start is rounded up. 635 * Size is appropriately rounded down, start is rounded up.
@@ -677,17 +670,17 @@ int __init arm_add_memory(u64 start, u64 size)
677 aligned_start = PHYS_OFFSET; 670 aligned_start = PHYS_OFFSET;
678 } 671 }
679 672
680 bank->start = aligned_start; 673 start = aligned_start;
681 bank->size = size & ~(phys_addr_t)(PAGE_SIZE - 1); 674 size = size & ~(phys_addr_t)(PAGE_SIZE - 1);
682 675
683 /* 676 /*
684 * Check whether this memory region has non-zero size or 677 * Check whether this memory region has non-zero size or
685 * invalid node number. 678 * invalid node number.
686 */ 679 */
687 if (bank->size == 0) 680 if (size == 0)
688 return -EINVAL; 681 return -EINVAL;
689 682
690 meminfo.nr_banks++; 683 memblock_add(start, size);
691 return 0; 684 return 0;
692} 685}
693 686
@@ -695,6 +688,7 @@ int __init arm_add_memory(u64 start, u64 size)
695 * Pick out the memory size. We look for mem=size@start, 688 * Pick out the memory size. We look for mem=size@start,
696 * where start and size are "size[KkMm]" 689 * where start and size are "size[KkMm]"
697 */ 690 */
691
698static int __init early_mem(char *p) 692static int __init early_mem(char *p)
699{ 693{
700 static int usermem __initdata = 0; 694 static int usermem __initdata = 0;
@@ -709,7 +703,8 @@ static int __init early_mem(char *p)
709 */ 703 */
710 if (usermem == 0) { 704 if (usermem == 0) {
711 usermem = 1; 705 usermem = 1;
712 meminfo.nr_banks = 0; 706 memblock_remove(memblock_start_of_DRAM(),
707 memblock_end_of_DRAM() - memblock_start_of_DRAM());
713 } 708 }
714 709
715 start = PHYS_OFFSET; 710 start = PHYS_OFFSET;
@@ -854,13 +849,6 @@ static void __init reserve_crashkernel(void)
854static inline void reserve_crashkernel(void) {} 849static inline void reserve_crashkernel(void) {}
855#endif /* CONFIG_KEXEC */ 850#endif /* CONFIG_KEXEC */
856 851
857static int __init meminfo_cmp(const void *_a, const void *_b)
858{
859 const struct membank *a = _a, *b = _b;
860 long cmp = bank_pfn_start(a) - bank_pfn_start(b);
861 return cmp < 0 ? -1 : cmp > 0 ? 1 : 0;
862}
863
864void __init hyp_mode_check(void) 852void __init hyp_mode_check(void)
865{ 853{
866#ifdef CONFIG_ARM_VIRT_EXT 854#ifdef CONFIG_ARM_VIRT_EXT
@@ -903,12 +891,10 @@ void __init setup_arch(char **cmdline_p)
903 891
904 parse_early_param(); 892 parse_early_param();
905 893
906 sort(&meminfo.bank, meminfo.nr_banks, sizeof(meminfo.bank[0]), meminfo_cmp, NULL);
907
908 early_paging_init(mdesc, lookup_processor_type(read_cpuid_id())); 894 early_paging_init(mdesc, lookup_processor_type(read_cpuid_id()));
909 setup_dma_zone(mdesc); 895 setup_dma_zone(mdesc);
910 sanity_check_meminfo(); 896 sanity_check_meminfo();
911 arm_memblock_init(&meminfo, mdesc); 897 arm_memblock_init(mdesc);
912 898
913 paging_init(mdesc); 899 paging_init(mdesc);
914 request_standard_resources(mdesc); 900 request_standard_resources(mdesc);