msm8974: Adapt memutils optimizations from msm8960pro

Preload farther to take advantage of the memory bus, and assume
64-byte cache lines.  Unroll some pairs of ldm/stm as well, for
unexplainable reasons.

Future enhancements should include,

- #define for how far to preload, possibly defined separately for
  memcpy, copy_*_user
- Tuning for misaligned buffers
- Tuning for memmove
- Tuning for small buffers
- Understanding mechanism behind ldm/stm unroll causing some gains
  in copy_to_user

BASELINE (msm8960pro):
======================================================================
memcpy 1000MB at 5MB       : took 808850 usec, bandwidth 1236.236 MB/s
copy_to_user 1000MB at 5MB : took 810071 usec, bandwidth 1234.234 MB/s
copy_from_user 1000MB at 5M: took 942926 usec, bandwidth 1060.060 MB/s
memmove 1000GB at 5MB      : took 848588 usec, bandwidth 1178.178 MB/s
copy_to_user 1000GB at 4kB : took 847916 usec, bandwidth 1179.179 MB/s
copy_from_user 1000GB at 4k: took 935113 usec, bandwidth 1069.069 MB/s
copy_page 1000GB at 4kB    : took 779459 usec, bandwidth 1282.282 MB/s

THIS PATCH:
======================================================================
memcpy 1000MB at 5MB       : took 346223 usec, bandwidth 2888.888 MB/s
copy_to_user 1000MB at 5MB : took 348084 usec, bandwidth 2872.872 MB/s
copy_from_user 1000MB at 5M: took 348176 usec, bandwidth 2872.872 MB/s
memmove 1000GB at 5MB      : took 348267 usec, bandwidth 2871.871 MB/s
copy_to_user 1000GB at 4kB : took 377018 usec, bandwidth 2652.652 MB/s
copy_from_user 1000GB at 4k: took 371829 usec, bandwidth 2689.689 MB/s
copy_page 1000GB at 4kB    : took 383763 usec, bandwidth 2605.605 MB/s

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
Signed-off-by: Chester Kener <Cl3Kener@gmail.com>

Conflicts:
	arch/arm/lib/Makefile
	arch/arm/mach-msm/Kconfig
	arch/arm/mach-msm/Makefile

Restore missing fastchg

Signed-off-by: Chester Kener <Cl3Kener@gmail.com>

Conflicts:
	arch/arm/lib/Makefile
	arch/arm/mach-msm/Kconfig
	arch/arm/mach-msm/Makefile
Makefile: MSM Krait CPUs
drivers: msm_thermal: make thermal throttle temperature threshold user configurable.

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>

Conflicts:
	drivers/thermal/msm_thermal.c

Conflicts:
	drivers/thermal/msm_thermal.c
drivers: thermal: properly limit CPU frequency when the temperature is too hot: if we throttle too much games will lag so we'll only scale down to 1026MHz until the device cools down, then back to 1512MHz again. Added other smaller routine changes to make it work properly.

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
thermal: tsens8960: Increase the polling rate

Change the polling rate at which the sensors temperature
is read from 1 second to .25 seconds. On faster parts
there is a need to poll the temperature at a higher
frequency to improve reporting temperature changes.

Change-Id: I10049707c3e55316597fff72fbd00246cd29bed3
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
lib/int_sqrt.c: optimize square root algorithm

Optimize the current version of the shift-and-subtract (hardware)
algorithm, described by John von Newmann[1] and Guy L Steele.

Iterating 1,000,000 times, perf shows for the current version:

 Performance counter stats for './sqrt-curr' (10 runs):

         27.170996 task-clock                #    0.979 CPUs utilized            ( +-  3.19% )
                 3 context-switches          #    0.103 K/sec                    ( +-  4.76% )
                 0 cpu-migrations            #    0.004 K/sec                    ( +-100.00% )
               104 page-faults               #    0.004 M/sec                    ( +-  0.16% )
        64,921,199 cycles                    #    2.389 GHz                      ( +-  0.03% )
        28,967,789 stalled-cycles-frontend   #   44.62% frontend cycles idle     ( +-  0.18% )
   <not supported> stalled-cycles-backend
       104,502,623 instructions              #    1.61  insns per cycle
                                             #    0.28  stalled cycles per insn  ( +-  0.00% )
        34,088,368 branches                  # 1254.587 M/sec                    ( +-  0.00% )
             4,901 branch-misses             #    0.01% of all branches          ( +-  1.32% )

       0.027763015 seconds time elapsed                                          ( +-  3.22% )

And for the new version:

Performance counter stats for './sqrt-new' (10 runs):

          0.496869 task-clock                #    0.519 CPUs utilized            ( +-  2.38% )
                 0 context-switches          #    0.000 K/sec
                 0 cpu-migrations            #    0.403 K/sec                    ( +-100.00% )
               104 page-faults               #    0.209 M/sec                    ( +-  0.15% )
           590,760 cycles                    #    1.189 GHz                      ( +-  2.35% )
           395,053 stalled-cycles-frontend   #   66.87% frontend cycles idle     ( +-  3.67% )
   <not supported> stalled-cycles-backend
           398,963 instructions              #    0.68  insns per cycle
                                             #    0.99  stalled cycles per insn  ( +-  0.39% )
            70,228 branches                  #  141.341 M/sec                    ( +-  0.36% )
             3,364 branch-misses             #    4.79% of all branches          ( +-  5.45% )

       0.000957440 seconds time elapsed                                          ( +-  2.42% )

Furthermore, this saves space in instruction text:

   text    data     bss     dec     hex filename
    111       0       0     111      6f lib/int_sqrt-baseline.o
     89       0       0      89      59 lib/int_sqrt.o

[1] http://en.wikipedia.org/wiki/First_Draft_of_a_Report_on_the_EDVAC

Signed-off-by: Davidlohr Bueso <davidlohr.bueso@hp.com>
Reviewed-by: Jonathan Gonzalez <jgonzlez@linets.cl>
Tested-by: Jonathan Gonzalez <jgonzlez@linets.cl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Francisco Franco <franciscofranco.1990@gmail.com>
Revert "makefile:..."
Linux 3.4.93
Linux 3.4.94
msm: hotplug: Add MSM Hotplug driver
msm: hotplug: merge with latest myfluxy N5 repo
msm: hotplug: remove lcd notifier routine
msm: hotplug: set min cpus online to two
msm: hotplug: Consider load instead of frequency for slowest cpu

--w----r-T root root 4096 2014-04-15 08:22 cpus_boosted // number of cpus onlined after touchscreen event
-rw-rwxr-- root root 4096 2014-04-15 08:22 current_load // current average load across all online cpus (percent), read only
--w----r-T root root 4096 2014-04-15 08:22 down_lock_duration // minimum interval a cpu is kept online (milliseconds)
--w----r-T root root 4096 2014-04-15 08:22 history_size // number of samples taken in consideration for avarage load across cpus (see update rate), lower means quicker/more erratic
--w----r-T root root 4096 2014-04-15 08:22 max_cpus_online // maximum number of cpus to be onlined
--w----r-T root root 4096 2014-04-15 08:22 min_cpus_online // minimum number of cpus to stay online
drwxr-xr-x root root 2014-04-15 08:22 parameters
--w------- root root 4096 2014-04-15 08:22 uevent
--w----r-T root root 4096 2014-04-15 08:22 update_rate // interval between taking samples of load across cpus (milliseconds), lower means quicker/more erratic

--w----r-T root root 4096 2014-04-15 08:22 load_levels // threshold values for each cpu to come on- or offline (<cpu n> <up threshold> <down threshold>),
values should overlap, see struct load, level 0 is obviously a dummy to make it better readable, level 1 is cpu0 but means "one cpu online" etc.

thanks a lot
@myfluxi
msm: hotplug: Revert to original thresholds
msm: hotplug: Protect load stats routine and cleanup
msm: hotplug: Fix licensing issue

I have no idea about licensing and I could care less
but this should be correct.
msm: hotplug: Cleanup probe function

After performing nicely for over a half year this
actually starts looking almost decent...

thanks
@myfluxi
Fantastic Developer
msm: hotplug: two is better than one for cpus
defconfig: Add hotplug