ARM: LPAE: drop wrong carry flag correction after adding TTBR1_OFFSET

In commit 7fb00c2fca4b6c58be521eb3676cf4b4ba8dde3b ("ARM: 8114/1: LPAE:
load upper bits of early TTBR0/TTBR1") part which fixes carrying in adding
TTBR1_OFFSET to TTRR1 was wrong:

	addls   \ttbr1, \ttbr1, #TTBR1_OFFSET
	adcls   \tmp, \tmp, #0

addls doesn't update flags, adcls adds carry from cmp above:

	cmp	\ttbr1, \tmp			@ PHYS_OFFSET > PAGE_OFFSET?

Condition 'ls' means carry flag is clear or zero flag is set, thus only one
case is affected: when PHYS_OFFSET == PAGE_OFFSET.

It seems safer to remove this fixup. Bug is here for ages and nobody
complained. Let's fix it separately.

Signed-off-by: Konstantin Khlebnikov <k.khlebnikov@samsung.com>
Reported-and-tested-by: Jassi Brar <jassisinghbrar@gmail.com>
arm: permit stack trace dumping for non-current tasks

Both implementations of stack-unwinding now carefully checks stack boundaries:
* frame-pointer version since commit 3abb6671a9c04479c4bd026798a05f857393b7e2
  ("ARM: 7913/1: fix framepointer check in unwind_frame")
* unwind-table version since commit a51345770e519552e749ff457a2a9f83171a67b5
  ("ARM: 7987/1: ARM : unwinder : Prevent data abort due to stack overflow")

So, now it's safe to dump stack traces for any task, not only for current.
If that task is running we could get some garbage but kernel will not explode.
Anyway unwind_frame() always been used by get_wchan() after racy check:
"p->state == TASK_RUNNING"

This patch unblocks CONFIG_STACKTRACE dumper for non-current tasks.
It's exposed into userspace by /proc/$pid/stack.

Signed-off-by: Konstantin Khlebnikov <k.khlebnikov@samsung.com>
ARM: LPAE: rework TTBR0/TTBR1 split

This patch fixes several flaws in current implementation of LPAE TTBRx split:
* conflict with idmap when PHYS_OFFSET > PAGE_OFFSET
* carry flags fixup in TTBR1 calculation inside  macro v7_ttb_setup

This patch moves enabling TTBRx split from __v7_setup (macro v7_ttb_setup)
into cpu_init() which is called in init_mm context after leaving idmap.
Also when setup_mm_for_reboot() switches to idmap it also disables split.
Thus where is no conflict with idmap.

Callback keystone_smp_secondary_initmem no longer required, all this setup is
done in cpu_init which is called right before smp_ops.smp_secondary_init.

Signed-off-by: Konstantin Khlebnikov <k.khlebnikov@samsung.com>
ARM: enable TTBR0/TTBR1 split in short mode

This feature was partially implemented long time ago. All cpus load
swapper_pg_dir into TTBR1 since commit d427958a46af24f75d0017c45eadd172273bbf33
("ARM: 6942/1: mm: make TTBR1 always point to swapper_pg_dir on ARMv6/7").
But split isn't enabled in TTBCR, so cpus don't use TTBR1 at all.

This patch enables TTBRx split for 2Gb/2Gb and 1Gb/3Gb vm split combinations.
Area covered by TTBR0 must be power of two, thus 3Gb/1Gb mode is unsupported.

Signed-off-by: Konstantin Khlebnikov <k.khlebnikov@samsung.com>
ARM: reduce size of page table directory for short mode

Virtual memory above PAGE_OFFSET now controlled by TTBR1. It always points to
swapper_pg_dir thus size of all other page table directories might be reduced.

This patch saves 8k per process for 2G/2G split and 12k for 1G/3G split.
Of course idmap_pgd is special, we need whole 16k table for it.

Signed-off-by: Konstantin Khlebnikov <k.khlebnikov@samsung.com>
ARM: fix phys_addr_t overflow in sanity_check_meminfo

vmalloc_limit easily overflows in case of 1G/3G split. For example if
PHYS_OFFSET=0x80000000 PAGE_OFFSET=0x40000000 then vmalloc_limit=0x1_2F800000

This patch calculates it via maximum lowmem pfn.

Signed-off-by: Konstantin Khlebnikov <k.khlebnikov@samsung.com>