ARM: dma-mapping: define dma_(un)?map_single in terms of dma_(un)?map_page

Use dma_map_page()/dma_unmap_page() internals to handle dma_map_single()
and dma_unmap_single().

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
ARM: dmabounce: avoid needless valid_dma_direction() check

This check is done at the DMA API level, so there's no point repeating
it here.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
ARM: dmabounce: separate out decision to bounce

Move the decision to perform DMA bouncing out of map_single() into its
own stand-alone function.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
ARM: dmabounce: move decision for bouncing into __dma_map_page()

Move the decision whether to bounce into __dma_map_page(), before
the check for high pages.  This avoids triggering the high page
check for devices which aren't using dmabounce.  Fix the unmap path
to cope too.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
ARM: dmabounce: remove useless pr_err

We already check that dev != NULL, so this won't be reached.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
ARM: dmabounce: check pointer against NULL not 0

Pointers should be checked against NULL rather than 0, otherwise we
get sparse warnings.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
ARM: dmabounce: correct unmap_single dev_dbg

DMA addresses should not be casted to void * for printing.  Fix
that to be consistent with the rest of the file.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
ARM: dmabounce: get rid of dma_needs_bounce global function

Pass the device type specific needs_bounce function in at dmabounce
register time, avoiding the need for a platform specific global
function to do this.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
ARM: zImage: Allow the appending of a device tree binary

This patch provides the ability to boot using a device tree that is appended
to the raw binary zImage (e.g. cat zImage <filename>.dtb > zImage_w_dtb).

Signed-off-by: John Bonesio <bones@secretlab.ca>
[nico: ported to latest zImage changes plus additional cleanups/improvements]
Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Tony Lindgren <tony@atomide.com>
Tested-by: Shawn Guo <shawn.guo@linaro.org>
Tested-by: Dave Martin <dave.martin@linaro.org>
Tested-by: Thomas Abraham <thomas.abraham@linaro.org>

Signed-off-by: zwliew <zhaoweiliew@gmail.com>

Conflicts:
	arch/arm/boot/compressed/head.S

Change-Id: I8efa246654e9f14a7159a6a1c8b7ebf3b4575942
ARM: zImage: allow supplementing appended DTB with traditional ATAG data

Some old bootloaders can't be updated to a device tree capable one,
yet they provide ATAGs with memory configuration, the ramdisk address,
the kernel cmdline string, etc.  To allow a device tree enabled
kernel to be used with such bootloaders, it is necessary to convert those
ATAGs into FDT properties and fold them into the DTB appended to zImage.

Currently the following ATAGs are converted:

	ATAG_CMDLINE
	ATAG_MEM
	ATAG_INITRD2

If the corresponding information already exists in the appended DTB, it
is replaced, otherwise the required node is created to hold it.

The code looks for ATAGs at the location pointed by the value of r2 upon
entry into the zImage code.  If no ATAGs are found there, an attempt at
finding ATAGs at the typical 0x100 offset from start of RAM is made.
Otherwise the DTB is left unchanged.

Thisstarted from an older patch from John Bonesio <bones@secretlab.ca>,
with contributions from David Brown <davidb@codeaurora.org>.

Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Tested-by: Shawn Guo <shawn.guo@linaro.org>
Tested-by: Dave Martin <dave.martin@linaro.org>
Tested-by: Thomas Abraham <thomas.abraham@linaro.org>
Signed-off-by: zwliew <zhaoweiliew@gmail.com>

Conflicts:
	arch/arm/boot/compressed/.gitignore

Change-Id: Ic3ab3ff516fb8ccfb9c21dce103fa97d6e8a0f04
remove gitignore

Change-Id: I81605b0f3a9d27d78873b37adf43b3673cc13ed8
Signed-off-by: zwliew <zhaoweiliew@gmail.com>
ARM: zImage: make sure appended DTB doesn't get overwritten by kernel .bss

The appended DTB gets relocated with the decompressor code to get out
of the way of the decompressed kernel.  However the kernel's .bss section
may be larger than the relocated code and data, and then the DTB gets
overwritten.  Let's make sure the relocation takes care of moving zImage
far enough so no such conflict with .bss occurs.

Thanks to Tony Lindgren <tony@atomide.com> for figuring out this issue.

While at it, let's clean up the code a bit so that the wont_overwrite
symbol is used while determining if a conflict exists, making the above
change more precise as well as eliminating some ARM/THUMB alternates.

Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Acked-by: Tony Lindgren <tony@atomide.com>
Tested-by: Shawn Guo <shawn.guo@linaro.org>
Tested-by: Dave Martin <dave.martin@linaro.org>
Tested-by: Thomas Abraham <thomas.abraham@linaro.org>
ARM: decompressor: use better output sections

Place read-only data in a .rodata output section, and the compressed
piggy data in .piggydata.  Place the .got.plt section before the .got
section as is standard ELF practise.

This allows the piggydata to be more easily extracted from the
compressed vmlinux file for verification purposes.

Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
ARM: zImage: ensure it is always a multiple of 64 bits in size

This is needed for proper alignment when the DTB appending feature
is used.

Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Acked-by: Tony Lindgren <tony@atomide.com>
Tested-by: Shawn Guo <shawn.guo@linaro.org>
Tested-by: Dave Martin <dave.martin@linaro.org>
Tested-by: Thomas Abraham <thomas.abraham@linaro.org>
ARM: CPU hotplug: fix abuse of irqdesc->node

irqdesc's node member is supposed to mark the numa node number for the
interrupt.  Our use of it is non-standard.  Remove this, replacing the
functionality with a test of the affinity mask.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
ARM: GIC: move gic_chip_data structure declaration to header

Since Samsung EXYNOS4210 cannot support register banking in GIC,
so needs to update CPU interface base address.
The 'gic_chip_data' is used for it, this patch moves gic_chip_data
structure declaraton to arch/arm/include/asm/hardware/gic.h to use
it.

Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Changhwan Youn <chaos.youn@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: zwliew <zhaoweiliew@gmail.com>

Conflicts:
	arch/arm/include/asm/hardware/gic.h

Change-Id: I1023e45465366ab023ed07fbee893933aa4656ec
ARM: GIC: avoid routing interrupts to offline CPUs

The irq_set_affinity() method can be called with masks which include
offline CPUs.  This allows offline CPUs to have interrupts routed to
them by writing to /proc/irq/*/smp_affinity after hotplug has taken
a CPU offline.  Fix this by ensuring that we select a target CPU
present in both the required affinity and the online CPU mask.

Ensure that we return IRQ_SET_MASK_OK (which happens to be 0) on
success to ensure generic code copies the new mask into the irq_data
structure.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
PCI: Make the struct pci_dev * argument of pci_fixup_irqs const.

Aside of the usual motivation for constification,  this function has a
history of being abused a hook for interrupt and other fixups so I turned
this function const ages ago in the MIPS code but it should be done
treewide.

Due to function pointer passing in varous places a few other functions
had to be constified as well.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
To: Anton Vorontsov <avorontsov@mvista.com>
To: Chris Metcalf <cmetcalf@tilera.com>
To: Colin Cross <ccross@android.com>
Acked-by: "David S. Miller" <davem@davemloft.net>
To: Eric Miao <eric.y.miao@gmail.com>
To: Erik Gilling <konkers@android.com>
Acked-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
To: "H. Peter Anvin" <hpa@zytor.com>
To: Imre Kaloz <kaloz@openwrt.org>
To: Ingo Molnar <mingo@redhat.com>
To: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
To: Jesse Barnes <jbarnes@virtuousgeek.org>
To: Krzysztof Halasa <khc@pm.waw.pl>
To: Lennert Buytenhek <kernel@wantstofly.org>
To: Matt Turner <mattst88@gmail.com>
To: Nicolas Pitre <nico@fluxnic.net>
To: Olof Johansson <olof@lixom.net>
Acked-by: Paul Mundt <lethal@linux-sh.org>
To: Richard Henderson <rth@twiddle.net>
To: Russell King <linux@arm.linux.org.uk>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-alpha@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Cc: linux-pci@vger.kernel.org
Cc: linux-sh@vger.kernel.org
Cc: linux-tegra@vger.kernel.org
Cc: sparclinux@vger.kernel.org
Cc: x86@kernel.org
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Boottime - A tool for automatic measurement of kernel and possible boot loader boot time.

The overhead is very low and the results will be found under sysfs/bootime, as well as
detailed results in debugfs under boottime/. The bootgraph* files are compatible with
scripts/bootgraph.pl. The reason for this patch is to provide data (sysfs/boottime)
suitable for automatic testcases as well as help for developers to reduce the boot
time (debugfs).

Signed-off-by: Jonas Aaberg <jonas.aberg@stericsson.com>
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/2760
Change-Id: Id8ea7226b3f1f783448962195193b90699d32fc6
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/3174
Tested-by: Mian Yousaf KAUKAB <mian.yousaf.kaukab@stericsson.com>
Reviewed-by: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>
Signed-off-by: Mian Yousaf Kaukab <mian.yousaf.kaukab@stericsson.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: zwliew <zhaoweiliew@gmail.com>

Conflicts:
	init/main.c
ARM: 7128/1: vic: Don't write to the read-only register VIC_IRQ_STATUS

This is unneeded and causes an abort on the SPMP8000 platform.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Zoltan Devai <zoss@devai.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>