diff options
author | Magnus Damm <damm@opensource.se> | 2013-10-22 12:59:54 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2013-10-29 07:06:30 -0400 |
commit | 6d7d5da7d75c6df676c8b72d32b02ff024438f0c (patch) | |
tree | f527a2fd59de0da7fdbc6a13b2e697de99581792 | |
parent | 6a5014aa037495a14ea083b621ed97fd0c3c7e9e (diff) |
ARM: 7864/1: Handle 64-bit memory in case of 32-bit phys_addr_t
Use CONFIG_ARCH_PHYS_ADDR_T_64BIT to determine
if ignoring or truncating of memory banks is
neccessary. This may be needed in the case of
64-bit memory bank addresses but when phys_addr_t
is kept 32-bit.
Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | arch/arm/kernel/setup.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 5ec4443af08b..53c3901f7ee3 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c | |||
@@ -624,6 +624,7 @@ void __init dump_machine_table(void) | |||
624 | int __init arm_add_memory(u64 start, u64 size) | 624 | int __init arm_add_memory(u64 start, u64 size) |
625 | { | 625 | { |
626 | struct membank *bank = &meminfo.bank[meminfo.nr_banks]; | 626 | struct membank *bank = &meminfo.bank[meminfo.nr_banks]; |
627 | u64 aligned_start; | ||
627 | 628 | ||
628 | if (meminfo.nr_banks >= NR_BANKS) { | 629 | if (meminfo.nr_banks >= NR_BANKS) { |
629 | printk(KERN_CRIT "NR_BANKS too low, " | 630 | printk(KERN_CRIT "NR_BANKS too low, " |
@@ -636,10 +637,16 @@ int __init arm_add_memory(u64 start, u64 size) | |||
636 | * Size is appropriately rounded down, start is rounded up. | 637 | * Size is appropriately rounded down, start is rounded up. |
637 | */ | 638 | */ |
638 | size -= start & ~PAGE_MASK; | 639 | size -= start & ~PAGE_MASK; |
639 | bank->start = PAGE_ALIGN(start); | 640 | aligned_start = PAGE_ALIGN(start); |
640 | 641 | ||
641 | #ifndef CONFIG_ARM_LPAE | 642 | #ifndef CONFIG_ARCH_PHYS_ADDR_T_64BIT |
642 | if (bank->start + size < bank->start) { | 643 | if (aligned_start > ULONG_MAX) { |
644 | printk(KERN_CRIT "Ignoring memory at 0x%08llx outside " | ||
645 | "32-bit physical address space\n", (long long)start); | ||
646 | return -EINVAL; | ||
647 | } | ||
648 | |||
649 | if (aligned_start + size > ULONG_MAX) { | ||
643 | printk(KERN_CRIT "Truncating memory at 0x%08llx to fit in " | 650 | printk(KERN_CRIT "Truncating memory at 0x%08llx to fit in " |
644 | "32-bit physical address space\n", (long long)start); | 651 | "32-bit physical address space\n", (long long)start); |
645 | /* | 652 | /* |
@@ -647,10 +654,11 @@ int __init arm_add_memory(u64 start, u64 size) | |||
647 | * 32 bits, we use ULONG_MAX as the upper limit rather than 4GB. | 654 | * 32 bits, we use ULONG_MAX as the upper limit rather than 4GB. |
648 | * This means we lose a page after masking. | 655 | * This means we lose a page after masking. |
649 | */ | 656 | */ |
650 | size = ULONG_MAX - bank->start; | 657 | size = ULONG_MAX - aligned_start; |
651 | } | 658 | } |
652 | #endif | 659 | #endif |
653 | 660 | ||
661 | bank->start = aligned_start; | ||
654 | bank->size = size & ~(phys_addr_t)(PAGE_SIZE - 1); | 662 | bank->size = size & ~(phys_addr_t)(PAGE_SIZE - 1); |
655 | 663 | ||
656 | /* | 664 | /* |