ARM: move VFP init to an earlier boot stage

In order to use the NEON unit in the kernel, we should
initialize it a bit earlier in the boot process so NEON users
that like to do a quick benchmark at load time (like the
xor_blocks or RAID-6 code) find the NEON/VFP unit already
enabled.

Replaced late_initcall() with core_initcall().

Signed-off-by: Ard Biesheuvel <ard.biesheuvel at linaro.org>
Acked-by: Nicolas Pitre <nico at linaro.org>

Signed-off-by: Paul Reioux <reioux@gmail.com>
Signed-off-by: aatjitra <aatjitra@gmail.com>
ARM: be strict about FP exceptions in kernel mode

The support code in vfp_support_entry does not care whether the
exception that caused it to be invoked occurred in kernel mode or
in user mode. However, neither condition that could trigger this
exception (lazy restore and VFP bounce to support code) is
currently allowable in kernel mode.

In either case, print a message describing the condition before
letting the undefined instruction handler run its course and trigger
an oops.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel at linaro.org>
Acked-by: Nicolas Pitre <nico at linaro.org>
Signed-off-by: Paul Reioux <reioux@gmail.com>
Signed-off-by: aatjitra <aatjitra@gmail.com>
ARM: add support for kernel mode NEON

In order to safely support the use of NEON instructions in
kernel mode, some precautions need to be taken:
- the userland context that may be present in the registers (even
  if the NEON/VFP is currently disabled) must be stored under the
  correct task (which may not be 'current' in the UP case),
- to avoid having to keep track of additional vfpstates for the
  kernel side, disallow the use of NEON in interrupt context
  and run with preemption disabled,
- after use, re-enable preemption and re-enable the lazy restore
  machinery by disabling the NEON/VFP unit.

This patch adds the functions kernel_neon_begin() and
kernel_neon_end() which take care of the above. It also adds
the Kconfig symbol KERNEL_MODE_NEON to enable it.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: Paul Reioux <reioux@gmail.com>
Signed-off-by: aatjitra <aatjitra@gmail.com>
ARM: crypto: add NEON accelerated XOR implementation

Add a source file xor-neon.c (which is really just the reference
C implementation passed through the GCC vectorizer) and hook it
up to the XOR framework.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Nicolas Pitre <nico@linaro.org>
Signed-off-by: aatjitra <aatjitra@gmail.com>
ARM: 7835/2: fix modular build of xor_blocks() with NEON enabled

Commit 0195659 introduced a NEON accelerated version of the xor_blocks()
function, but it needs the changes in this patch to allow it to be built
as a module rather than statically into the kernel.

This patch creates a separate module xor-neon.ko which exports the NEON
inner xor_blocks() functions depended upon by the regular xor.ko if it
is built with CONFIG_KERNEL_MODE_NEON=y

Reported-by: Josh Boyer <jwboyer@fedoraproject.org>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: aatjitra <aatjitra@gmail.com>
ARM: only allow kernel mode neon with AEABI

This prevents the linker erroring with:

arm-linux-ld: error: arch/arm/lib/xor-neon.o uses VFP instructions, whereas arch/arm/lib/built-in.o does not
arm-linux-ld: failed to merge target specific data of file arch/arm/lib/xor-neon.o

This is due to the non-neon files being marked as containing FPA data/
instructions (even though they do not) being mixed with files which
contain VFP, which is an incompatible floating point format.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: aatjitra <aatjitra@gmail.com>
f2fs: data: AIO optimization compatibility fixup

Signed-off-by: Paul Reioux <reioux@gmail.com>
Signed-off-by: aatjitra <aatjitra@gmail.com>
arm/dt: hammerhead: change usb otg detection level

The vadc value on the USB ID pin should be less than 20 milivolts
when the otg cable has been connected.
However some devices return over 15 milivolts with PMIC ES 3.1
and couldn't recognize an otg cable connection in that case.
Fix this by adjusting vadc threshold value on the USB ID pin to 100 milivolts.

Bug: 13312153
Change-Id: I8342d447c1e3ab5861e702a24fa973df16b1ffb2
Signed-off-by: jude84.kim <jude84.kim@lge.com>
Signed-off-by: Devin Kim <dojip.kim@lge.com>
(cherry picked from commit df13a5d7a4328b193edf8111b82d7463b4bb71f6)
Signed-off-by: aatjitra <aatjitra@gmail.com>
msm: msm_watchdog_v2: Increase watchdog bark timeout during panic

We now wait for 10 seconds during panic handling before triggerring a
watchdog bark. This is done because the earlier timeout of 4 seconds
was not sufficient for all targets which resulted in the device resetting
in the middle of the panic handler.

Bug: 11293746

Change-Id: I1a45ac2ccf626d93848763fe56bb6ad164c2471d
Signed-off-by: Ameya Thakur <ameyat@codeaurora.org>
(cherry picked from commit c2acf59dc892653e1a67852c5bdb298ed1a09689)
Signed-off-by: aatjitra <aatjitra@gmail.com>
pm-8x60.c: complaining of power collapse within 1 ms is pointless

since latency for cores is > 10 ms

Signed-off-by: Paul Reioux <reioux@gmail.com>
Signed-off-by: aatjitra <aatjitra@gmail.com>
msm: kgsl: Fix mem leak when page allocation fails

Page allocation may fail during OOM condition. Update
sglen and size to correct value (allocated) so that
they get freed in kgsl_sharedmem_free().

Change-Id: I1aa0ca77bb767523dfcf0f6cc3a21eac2b6b80e4
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
Signed-off-by: aatjitra <aatjitra@gmail.com>