ARM: 7428/1: Prevent KALLSYM size mismatch on ARM.

ARM builds seem to be plagued by an occasional build error:

    Inconsistent kallsyms data
    This is a bug - please report about it
    Try "make KALLSYMS_EXTRA_PASS=1" as a workaround

The problem has to do with alignment of some sections by the linker.
The kallsyms data is built in two passes by first linking the kernel
without it, and then linking the kernel again with the symbols
included.  Normally, this just shifts the symbols, without changing
their order, and the compression used by the kallsyms gives the same
result.

On non SMP, the per CPU data is empty.  Depending on the where the
alignment ends up, it can come out as either:

   +-------------------+
   | last text segment |
   +-------------------+
   /* padding */
   +-------------------+     <- L1_CACHE_BYTES alignemnt
   | per cpu (empty)   |
   +-------------------+
__per_cpu_end:
   /* padding */
__data_loc:
   +-------------------+     <- THREAD_SIZE alignment
   | data              |
   +-------------------+

or

   +-------------------+
   | last text segment |
   +-------------------+
   /* padding */
   +-------------------+     <- L1_CACHE_BYTES alignemnt
   | per cpu (empty)   |
   +-------------------+
__per_cpu_end:
   /* no padding */
__data_loc:
   +-------------------+     <- THREAD_SIZE alignment
   | data              |
   +-------------------+

if the alignment satisfies both.  Because symbols that have the same
address are sorted by 'nm -n', the second case will be in a different
order than the first case.  This changes the compression, changing the
size of the kallsym data, causing the build failure.

The KALLSYMS_EXTRA_PASS=1 workaround usually works, but it is still
possible to have the alignment change between the second and third
pass.  It's probably even possible for it to never reach a fixedpoint.

The problem only occurs on non-SMP, when the per-cpu data is empty,
and when the data segment has alignment (and immediately follows the
text segments).  Fix this by only including the per_cpu section on
SMP, when it is not empty.

Signed-off-by: David Brown <davidb@codeaurora.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
ARM: 7438/1: fill possible PMD empty section gaps

On ARM with the 2-level page table format, a PMD entry is represented by
two consecutive section entries covering 2MB of virtual space.

However, static mappings always were allowed to use separate 1MB section
entries.  This means in practice that a static mapping may create half
populated PMDs via create_mapping().

Since commit 0536bdf33f (ARM: move iotable mappings within the vmalloc
region) those static mappings are located in the vmalloc area. We must
ensure no such half populated PMDs are accessible once vmalloc() or
ioremap() start looking at the vmalloc area for nearby free virtual
address ranges, or various things leading to a kernel crash will happen.

Signed-off-by: Nicolas Pitre <nico@linaro.org>
Reported-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Tested-by: "R, Sricharan" <r.sricharan@ti.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: stable@vger.kernel.org
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Merge branch 'fixes' of git://git.linaro.org/people/rmk/linux-arm

Pull two ARM fixes from Russell King:
 "It's been fairly quiet with the fixes.  Just two this time.  One fixes
  a long standing problem with KALLSYMS needing an additional pass, and
  the other sorts a problem with the vmalloc space interacting with
  static IO mappings."

* 'fixes' of git://git.linaro.org/people/rmk/linux-arm:
  ARM: 7438/1: fill possible PMD empty section gaps
  ARM: 7428/1: Prevent KALLSYM size mismatch on ARM.
Support for Synology DiskStation / RackStation NASes
Support for Synology DiskStation / RackStation NASes using Marvell ID

Synology used the Marvell linux sources, which used a machine
ID that wasn't assigned to them.
Fix up initrd start address passed by bootloader

Some custom versions of u-boot put the source address of the
initrd, rather than the load address (which they still copy to)
into the ATAG_INITRD2 tag.
Merge commit '1b7bd28cbb1c139147f7338648417e6332af1683' into syno-628x-mainline
ARM: SYNOLOGY_6282: convert boot_params to atag_offset
Merge commit 'cb15dff4795932b98459da13dd3dd3693c6dd104' into syno-628x-mainline
ARM: restart: SYNOLOGY_6282: use new restart hook
Merge commit 'a3c2b511a844641f6d0b60bd84cd6076143b3f2d' into syno-628x-mainline
Re-add MACH_SYNOLOGY_6282 to the machine ID list
Merge branch 'master' into syno-628x-mainline
Merge commit 'c3dfde47b71bd1b7012328431aeb51422790d618' into syno-628x
ARM: SYNOLOGY_6282: convert boot_params to atag_offset
Merge commit '27a3f0e91bed0f4dcf0a363e5f5938126d1ff4e5^' into syno-628x
Merge commit '27a3f0e91bed0f4dcf0a363e5f5938126d1ff4e5' into syno-628x

Conflicts:
	arch/arm/mm/init.c
Merge commit '9d9f0e456b9aaa07cf04df4a881ef212c87125c6' into syno-628x
ARM: restart: SYNOLOGY_6282: use new restart hook
Merge commit 'b789c39b3a93d9c51bd583bebe224d03e8bdbdcb' into syno-628x