ARM: SMP: use a timing out completion for cpu hotplug

    ARM: SMP: use a timing out completion for cpu hotplug

    Rather than open-coding the jiffy-based wait, and polling for the
    secondary CPU to come online, use a completion instead.  This
    removes the need to poll, instead we will be notified when the
    secondary CPU has initialized.

    Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
ARM: 7011/1: Add ARM cpu topology definition

The affinity between ARM processors is defined in the MPIDR register.
We can identify which processors are in the same cluster,
and which ones have performance interdependency. We can define the
cpu topology of ARM platform, that is then used by sched_mc and sched_smt.

The default state of sched_mc and sched_smt config is disable.
When enabled, the behavior of the scheduler can be modified with
sched_mc_power_savings and sched_smt_power_savings sysfs interfaces.

Changes since v4 :
*  Remove unnecessary parentheses and blank lines

Changes since v3 :
* Update the format of printk message
* Remove blank line

Changes since v2 :
* Update the commit message and some comments

Changes since v1 :
* Update the commit message
* Add read_cpuid_mpidr in arch/arm/include/asm/cputype.h
* Modify header of arch/arm/kernel/topology.c
* Modify tests and manipulation of MPIDR's bitfields
* Modify the place and dependancy of the config
* Modify Noop functions

Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
Reviewed-by: Amit Kucheria <amit.kucheria@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

(cherry-picked from i9100 kernel)
ARM: 7182/1: ARM cpu topology: fix warning

kernel/sched.c:7354:2: warning: initialization from incompatible pointer type

Align cpu_coregroup_mask prototype interface with sched_domain_mask_f typedef
use int cpu instead of unsigned int cpu

Cc: <stable@vger.kernel.org>
Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
sched: Ensure cpu_power periodic update

With a lot of small tasks, the softirq sched is nearly never called
when no_hz is enabled. In this case load_balance() is mainly called
with the newly_idle mode which doesn't update the cpu_power.

Add a next_update field which ensure a maximum update period when
there is short activity.

Having stale cpu_power information can skew the load-balancing
decisions, this is cured by the guaranteed update.

Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1323717668-2143-1-git-send-email-vincent.guittot@linaro.org
ARM: cpu topology: Enable ARCH_POWER

Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
ARM: topology: save cpu id of each core
ARM: topology: Update topology according to current sched_mc mode
ARM: topology: Add a cpu_power function
ARM: topology: Add a topology update notification
ARM: cpu topology: Add asym topology flag for using cpu0 1st

Modify the CPU sched_domain flags in powersave mode for using the cpu0 in ched_mc powersave mode

Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
ARM: cpu topology: add debugfs
cpupower: update the cpu_power according to cpu load

This driver updates the capacity of each core according to current
sched_mc level and cpu frequency (in fact current cpu load)

When the lowest frequencies are used, we are in a light load use case
and we increase the cpu capacity to keep these light tasks on CPU0

Conflicts:

	drivers/staging/Kconfig
RWSEM_XCHGADD_ALGORITHM for ARM (R/W semaphores implemented using ARM atomic functions) by CodeAurora
delete orphaned file
ARM: compressed/head.S: work around for new binutils warning

In August 2012, Matthew Gretton-Dann checked a change
into binutils labelled "Error on obsolete & warn on
deprecated registers", apparently as part of ARMv8
support. Apparently, this was supposed to emit
the message "Warning: This coprocessor register access
is deprecated in ARMv8" when using certain mcr/mrc
instructions and building for ARMv8. Unfortunately,
the message that is actually emitted appears to be
'(null)', which is less helpful in comparison.

Even more unfortunately, this is biting us on
every single kernel build with a new gas, because
arch/arm/boot/compressed/head.S and some other files
in that directory are built with -march=all since
kernel commit 80cec14a8 "[ARM] Add -march=all to
assembly file build in arch/arm/boot/compressed"
back in v2.6.28.

This patch reverts Russell's nice solution and
replaces it with a more complex one that sprinkles
.arch statements inside of the head.S file in
functions that are executed in different architecture
levels, which seems to solve the original problem
just as well, and gets rid of the new one, too.

Without this patch, building anything results in:

arch/arm/boot/compressed/head.S: Assembler messages:
arch/arm/boot/compressed/head.S:565: Warning: (null)
arch/arm/boot/compressed/head.S:676: Warning: (null)
arch/arm/boot/compressed/head.S:698: Warning: (null)
arch/arm/boot/compressed/head.S:722: Warning: (null)
arch/arm/boot/compressed/head.S:726: Warning: (null)
arch/arm/boot/compressed/head.S:957: Warning: (null)
arch/arm/boot/compressed/head.S:996: Warning: (null)
arch/arm/boot/compressed/head.S:997: Warning: (null)
arch/arm/boot/compressed/head.S:1027: Warning: (null)
arch/arm/boot/compressed/head.S:1035: Warning: (null)
arch/arm/boot/compressed/head.S:1046: Warning: (null)
arch/arm/boot/compressed/head.S:1060: Warning: (null)
arch/arm/boot/compressed/head.S:1092: Warning: (null)
arch/arm/boot/compressed/head.S:1094: Warning: (null)
arch/arm/boot/compressed/head.S:1095: Warning: (null)
arch/arm/boot/compressed/head.S:1102: Warning: (null)
arch/arm/boot/compressed/head.S:1134: Warning: (null)

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
  * arch/arm/boot/compressed/Makefile
  * arch/arm/boot/compressed/head.S
Installed Latest Mainstream Update (3.0.72)
	modified:   Makefile
	modified:   arch/arm/include/asm/signal.h
	modified:   arch/avr32/include/asm/signal.h
	modified:   arch/cris/include/asm/signal.h
	modified:   arch/h8300/include/asm/signal.h
	modified:   arch/ia64/kvm/kvm-ia64.c
	modified:   arch/m32r/include/asm/signal.h
	modified:   arch/m68k/include/asm/signal.h
	modified:   arch/mn10300/include/asm/signal.h
	modified:   arch/powerpc/include/asm/signal.h
	modified:   arch/s390/include/asm/signal.h
	modified:   arch/sparc/include/asm/signal.h
	modified:   arch/x86/include/asm/signal.h
	modified:   arch/x86/kernel/amd_iommu.c
	modified:   arch/x86/kvm/i8254.c
	modified:   arch/x86/kvm/x86.c
	modified:   arch/xtensa/include/asm/signal.h
	modified:   build_kernel.sh
	modified:   drivers/block/aoe/aoecmd.c
	modified:   drivers/block/loop.c
	modified:   drivers/block/xen-blkback/blkback.c
	modified:   drivers/bluetooth/ath3k.c
	modified:   drivers/bluetooth/btusb.c
	modified:   drivers/char/Makefile
	deleted:    drivers/char/frandom.c
	modified:   drivers/firmware/efivars.c
	modified:   drivers/gpu/drm/i915/intel_display.c
	modified:   drivers/net/atl1e/atl1e.h
modified:   drivers/net/atl1e/atl1e_main.c
	modified:   drivers/net/bonding/bond_main.c
	modified:   drivers/net/davinci_emac.c
	modified:   drivers/net/ks8851.c
	modified:   drivers/net/macvtap.c
	modified:   drivers/net/pch_gbe/pch_gbe_main.c
	modified:   drivers/net/sky2.c
	modified:   drivers/net/sky2.h
	modified:   drivers/net/usb/smsc75xx.c
	modified:   drivers/net/wireless/b43/dma.c
	modified:   drivers/net/wireless/mwifiex/init.c
	modified:   drivers/staging/comedi/drivers/s626.c
	modified:   drivers/tty/vt/vc_screen.c
	modified:   drivers/usb/host/xhci-ring.c
	modified:   drivers/usb/host/xhci.h
	modified:   drivers/usb/serial/ftdi_sio.c
	modified:   drivers/usb/serial/ftdi_sio_ids.h
	modified:   fs/block_dev.c
	modified:   fs/btrfs/extent-tree.c
	modified:   fs/ext4/ext4.h
	modified:   fs/ext4/ialloc.c
	modified:   fs/ext4/mballoc.c
	modified:   fs/ext4/resize.c
	modified:   fs/ext4/super.c
	modified:   fs/nfs/nfs4proc.c
	modified:   fs/nfs/nfs4xdr.c
	modified:   fs/nfsd/nfs4xdr.c
	modified:   fs/sysfs/dir.c
	modified:   include/asm-generic/signal.h
	modified:   include/linux/kvm_host.h
	modified:   include/linux/nfs_xdr.h
	modified:   include/linux/sunrpc/xdr.h
	modified:   include/linux/thermal.h
	modified:   kernel/signal.c
	modified:   kernel/trace/trace.c
	modified:   kernel/trace/trace.h
	modified:   kernel/trace/trace_irqsoff.c
	modified:   kernel/trace/trace_sched_wakeup.c
	modified:   net/8021q/vlan.c
	modified:   net/batman-adv/icmp_socket.c
	modified:   net/bluetooth/sco.c
	modified:   net/core/dev.c
	modified:   net/ipv4/tcp_input.c
	modified:   net/ipv4/tcp_output.c
	modified:   net/ipv6/addrconf.c
	modified:   net/irda/af_irda.c
	modified:   net/netlink/genetlink.c
	modified:   net/sunrpc/sched.c
	modified:   net/sunrpc/xdr.c
	modified:   net/unix/af_unix.c
	modified:   net/x25/af_x25.c
	modified:   net/x25/x25_dev.c
	modified:   net/x25/x25_facilities.c
	modified:   net/x25/x25_in.c
	modified:   net/x25/x25_link.c
	modified:   net/x25/x25_subr.c
	modified:   virt/kvm/irq_comm.c
	modified:   virt/kvm/kvm_main.c