board: increase the rpm regulator constraints
msm: kgsl: correct amount of scaling steps
lib/memcopy: use glibc version

the kernel's memcpy and memmove is very inefficient. But the glibc version is
quite fast, in some cases it is 10 times faster than the kernel version. So I
introduce some memory copy macros and functions of the glibc to improve the
kernel version's performance.

The strategy of the memory functions is:
1. Copy bytes until the destination pointer is aligned.
2. Copy words in unrolled loops.  If the source and destination are not
   aligned in the same way, use word memory operations, but shift and merge
   two read words before writing.
3. Copy the few remaining bytes.

Signed-off-by: Miao Xie <miaox*******>
lib/string: use glibc version

the performance of memcpy and memmove of the general version is very
inefficient, this patch improved them.

Signed-off-by: Miao Xie <miaox*******>
Optimized ARM RWSEM algorithm

RWSEM implementation for ARM using atomic functions.
Heavily based on arch/sh/include/asm/rwsem.h

Signed-off-by: Ashwin Chaugule <ashwinc@codeaurora.org>
ARM: net: JIT compiler for packet filters

based of Matt Evans's PPC64 implementation.

The compiler generates ARM instructions but interworking is
supported for Thumb2 kernels.

Supports both little and big endian. Unaligned loads are emitted
for ARMv6+. Not all the BPF opcodes that deal with ancillary data
are supported. The scratch memory of the filter lives on the stack.
Hardware integer division is used if it is available.

Enabled in the same way as for x86-64 and PPC64:

	echo 1 > /proc/sys/net/core/bpf_jit_enable

A value greater than 1 enables opcode output.

Signed-off-by: Mircea Gherzan <mgherzan@xxxxxxxxx>
---

Changes in v7:
 * fix the intruction generation for LDX_MSH, OR_X, LSH_K,
   RSH_K and JMP_JA
 * fix the condition for saving the A register
 * use fls() instead of the compiler builtin
 * punt to the interpreter on absolute loads with K < 0
 * check for invalid data references
 * support the NEG opcode
 * clear X in the prologue based on a context flag
 * simplify the conditional jumps

Changes in v6:
 * fix the code generation for the ANC_CPU opcode

Changes in v5:
 * replace SEEN_LEN with SEEN_SKB
 * set ctx->seen when handling some ancillary data opcodes

Changes in v4:
 * first check if the JIT compiler is enabled
 * fix the code generation for the LDX_MSH opcode

Changes in v3:
 * no longer depend on EABI and !Thumb2
 * add BLX "emulation" for ARMv4 without Thumb
 * use the integer divide instruction on Cortex-A15
 * fix the handling of the DIV_K opcode
 * use a C wrapper for __aeabi_uidiv
 * fix the generation of the epilogue (non-FP case)

Changes in v2:
 * enable the compiler only for ARMv5+ because of the BLX instruction
 * use the same comparison for the ARM version checks
 * use misaligned accesses on ARMv6
 * fix the SEEN_MEM
 * fix the mem_words_used()
acpu: use config variable here instead of static value
msm: kgsl: Allow device attributes to be re-created

Leave the attributes initialized so that removing and
restoring policies doesn't result in a kernel panic.

Change-Id: I9724ebf94e3845b6cbaea18abf49d1813043eb52
Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
msm: kgsl: fix infinite loop in adreno_find_region()

If postmortem dump tried to parse a context switch
buffer for any context except the current context
this function would never return.

Change-Id: I19f2fe7afda5796180cdf5f81c17fad960e84f05
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
msm: kgsl: adreno_isidle shouldn't BUG()

If the ringbuffer isn't idle, the GPU is probably in
SLUMBER or SUSPEND which are very idle states. This
function probably still shouldn't be called, so WARN
instead.

Change-Id: Ia49a819d935d6dce9cae2c193aff8e9de87d8af6
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
msm: kgsl: in postmortem, log powerstate before changing it

Change-Id: I9b6533acbe99c5094d51ac4fb12a23a280cc07c7
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
msm: kgsl: Eventually transition to SLUMBER

Even if a core is ACTIVE during an early_suspend call make
sure it switches off eventually with lack of use.

Change-Id: I476e8a14a0d7e90a8ed8b8c05d0cf5ed88632cad
Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
msm: kgsl: power state cleanup

Clean up kgsl_pwrctrl_sleep() and kgsl_pwrctrl_wake() to make
state transistions clearer.  Add kgsl_pwrctrl_request_state()
and kgsl_pwrctrl_set_state() to make it easier to debug the
state machine.

CRs-Fixed: 315833
Change-Id: I656ce8bd19feabd4186ef91dc031f8a6c6a7d09a
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
msm: kgsl: add power tracepoints

Add kgsl_clk, kgsl_bus, kgsl_irq, kgsl_rail, kgsl_pwrlevel,
kgsl_pwr_set_state and kgsl_pwr_request_state trace
events.

Change-Id: I3bf246f350b1208123ab9a33c08495cea9c533eb
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
msm: kgsl: Do not ramp to turbo if the screen is off.

Change-Id: I1f6e7a829352c0c5c8f31132bc22ad95ed737e28
Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
msm: kgsl: Move the GPU register lists to a common location

Move the GPU register lists to a common location so they can be used
by multiple sub-systems.  To avoid confusion, convert the lists from
byte offsets to dword offsets to match how we do register offsets
throughout the entire driver and in user space.

Change-Id: Ic0dedbad0f320242b77231a444939f9c6d852976
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
msm: kgsl: Don't wake core to check if it is idle.

Scenarios which check for idle and inadvertently turn
on the core when it was off happen fairly frequently.
Fixing this at the root rather than continuing to work
around each one.

Change-Id: Ibddd40bf69352733c8d4779272aa08757981d494
Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
msm: kgsl: Power scale policy needs at least three power levels.

Since 7x25A supports two power levels, do not allow it to register
with the power scale policy.

Change-Id: I1a77f0aa8e7affa126d7c18cb2d73e8617602dcf
Signed-off-by: Lynus Vaz <lvaz@codeaurora.org>
msm: kgsl: call device->irqctrl from start/stop

These functions write registers and so if they are called
from kgsl_pwrctrl_irq() there is a chance that they
might be called when clocks are disabled.

Change-Id: I259d840d9996d424aba3e3481201d49f602637e8
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
msm: kgsl: Collect a sample only if GPU is active

If the device is not in active state, collecting a sample is not
necessary and will cause frequent wake-ups, resulting in higher power
consumption.

Change-Id: Icb4f82b1300cab3b4cc4ed17117a92725a5a11d4
Signed-off-by: Lynus Vaz <lvaz@codeaurora.org>