vm: add vm_iomap_memory() helper function

commit b4cbb197c7e7a68dbad0d491242e3ca67420c13e upstream.

Various drivers end up replicating the code to mmap() their memory
buffers into user space, and our core memory remapping function may be
very flexible but it is unnecessarily complicated for the common cases
to use.

Our internal VM uses pfn's ("page frame numbers") which simplifies
things for the VM, and allows us to pass physical addresses around in a
denser and more efficient format than passing a "phys_addr_t" around,
and having to shift it up and down by the page size.  But it just means
that drivers end up doing that shifting instead at the interface level.

It also means that drivers end up mucking around with internal VM things
like the vma details (vm_pgoff, vm_start/end) way more than they really
need to.

So this just exports a function to map a certain physical memory range
into user space (using a phys_addr_t based interface that is much more
natural for a driver) and hides all the complexity from the driver.
Some drivers will still end up tweaking the vm_page_prot details for
things like prefetching or cacheability etc, but that's actually
relevant to the driver, rather than caring about what the page offset of
the mapping is into the particular IO memory region.

Change-Id: Iba49ff18a2d0795464852b69d5a8c678bb0f4a3b
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Reviewed-on: http://gerrit.pcs.mot.com/552624
Submit-Approved: Jira Key <jirakey@motorola.com>
Tested-by: Jira Key <jirakey@motorola.com>
SLT-Approved: Slta Waiver <sltawvr@motorola.com>
Reviewed-by: Klocwork kwcheck <klocwork-kwcheck@sourceforge.mot.com>
Reviewed-by: Jeffrey Carlyle <jeff.carlyle@motorola.com>
arm: msm: fix double mem alloc caused by __va

We have arch specific __phys_to_virt and __virt_to_phys macros
to avoid mapping holes in lowmem. After extraction, the parameter
is placed 3 times and 2 of them are used at runtime. When the
parameter for macro is a memory allocator, it's actually called
twice. For example, in early_alloc_aligned(), we have:
	void *ptr = __va(memblock_alloc(sz, align));
This change updates the macros to use the parameter only once.

(cherry picked from commit 302a691e8fcd0c1ff332a7d326a738c4b25d8726)

Change-Id: I62c9ab95c87489b31be8088bd539915800270e45
Signed-off-by: Yuanyuan Zhong <zyy@motorola.com>
Reviewed-on: http://gerrit.pcs.mot.com/580142
SLTApproved: Slta Waiver <sltawvr@motorola.com>
Tested-by: Jira Key <jirakey@motorola.com>
Reviewed-by: Jason Hrycay <jason.hrycay@motorola.com>
Reviewed-by: Jeffrey Carlyle <jeff.carlyle@motorola.com>
Submit-Approved: Jira Key <jirakey@motorola.com>
power: main: Disable VT switch on suspend/resume

The vt_move_to_console may hang because the console switch complete
event is never received for some cases. This mainly happened when
the console is managed by the userspace application.

Change-Id: Ifbfb36569a7d842a70e5f3ff6322489f0a7895e1
Signed-off-by: Lianwei Wang <lian-wei.wang@motorola.com>
Reviewed-on: http://gerrit.pcs.mot.com/512068
Tested-by: Jira Key <JIRAKEY@motorola.com>
Reviewed-by: Guo-Jian Chen <a21757@motorola.com>
Reviewed-by: Check Patch <CHEKPACH@motorola.com>
Reviewed-by: Klocwork kwcheck <klocwork-kwcheck@sourceforge.mot.com>
Reviewed-by: Ke Lv <a2435c@motorola.com>
Reviewed-by: Srinivas Sripathi <a14759@motorola.com>
Reviewed-by: Jeffrey Carlyle <jeff.carlyle@motorola.com>
Submit-Approved: Jira Key <JIRAKEY@motorola.com>
(cherry picked from commit a2dfeb56f110009d4b4acaa68fe05388883ee26e)

[jason.hrycay@motorola.com: move to main init]
Signed-off-by: Jason Hrycay <jason.hrycay@motorola.com>
sched: Add missing call to calc_load_exit_idle()

commit 749c8814f08f12baa4a9c2812a7c6ede7d69507d upstream.

Azat Khuzhin reported high loadavg in Linux v3.6

After checking the upstream scheduler code, I found Peter's commit:

  5167e8d5417b sched/nohz: Rewrite and fix load-avg computation -- again

not fully applied, missing the call to calc_load_exit_idle().

After that idle exit in sampling window will always be calculated
to non-idle, and the load will be higher than normal.

This patch adds the missing call to calc_load_exit_idle().

Signed-off-by: Charles Wang <muming.wq@taobao.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1345449754-27130-1-git-send-email-muming.wq@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit 48f0f14ffb6ff4852922994d11fbda418d40100e)

Change-Id: Ia1a4bdb13a89237041ee7080b572c90a0f082553
Reviewed-on: http://gerrit.pcs.mot.com/519220
Submit-Approved: Jira Key <jirakey@motorola.com>
Tested-by: Jira Key <jirakey@motorola.com>
Reviewed-by: Christopher Fries <qcf001@motorola.com>
Reviewed-by: Check Patch <CHEKPACH@motorola.com>
Reviewed-by: Klocwork kwcheck <klocwork-kwcheck@sourceforge.mot.com>
(cherry picked from commit 78fecdff31e5d9ec69c2b4048fd1252a948831dd)
cgroup: Fix uninitialized 'it' use

Change-Id: I3d64e2330189a6493e9cb265c02b39f6b0d9c38f
Signed-off-by: Chris Fries <C.Fries@motorola.com>
(cherry picked from commit 43d581b64bf704680811b5315b7f1c325c75a16a)
msm: tracing: Fix hang issue on qcom.

Change-Id: Id791730ff6fa55d3b9a1e3bbab6ca8ba069ebe98
Signed-off-by: Dong-Dong Yang <gdb746@motorola.com>
Reviewed-on: http://gerrit.pcs.mot.com/528862
SLT-Approved: Gerrit Code Review <gerrit-blurdev@motorola.com>
Tested-by: Jira Key <jirakey@motorola.com>
Reviewed-by: Check Patch <CHEKPACH@motorola.com>
Reviewed-by: Klocwork kwcheck <klocwork-kwcheck@sourceforge.mot.com>
Reviewed-by: Zhi-Ming Yuan <a14194@motorola.com>
Reviewed-by: Yi-Wei Zhao <gbjc64@motorola.com>
Submit-Approved: Jira Key <jirakey@motorola.com>
(cherry picked from commit 3f4467a20a12015326d6f7457e75179081f792e1)
unset runqueue stats

Change-Id: Iabd0de96015d59a9497d97b2f64f79e962467151
Revert "sched: Add missing call to calc_load_exit_idle()"

This reverts commit b7887765dd16e5e25b79160380ea5c7afcd5defc.
Revert "hwrng: add randomness to system from rng sources"

This reverts commit 4f2a278239621aa1f0d4a9c05abd6307657b2e63.
msm: disable CONFIG_MSM_DCVS and all dependent code

from maxwen

Change-Id: I9656938c33cfa24a200de245ab946a731f73bdbd
defconfig: update

Change-Id: I1fd4ba299b59132780f4d40f6d7293e99596189a
Wake Gestures: add boot time delay for proper initialization of sensors
cpufreq: interactive: fix compiling warnings

The gcc warns like:

  cpufreq_interactive.c:745:6: warning: operation on 'ret' may be
undefined [-Wsequence-point]

It was introduced by commit cf0fad49d17cb8273ce555dd5b7afab67d7923bf.

Since sprintf(...) just return 1 (one character) in this case, ret
should not changed.
Just discarding the result of sprintf(...) leads to the result that
the committer of cf0fad49d17cb8273ce555dd5b7afab67d7923bf wants.

Change-Id: Ifed1cef6d6a31c3ed23dad03a567b3b9eddf3a57
Signed-off-by: Chih-Wei Huang <cwhuang@android-x86.org>
Signed-off-by: Dave Daynard <nardholio@gmail.com>
Signed-off-by: flar2 <asegaert@gmail.com>
thermal-core: Fix invalid sensor request not accounted correctly

Add NULL check for sensor name before using it in sensor_get_id and
return NULL explicitly when sensor id is not valid in get_sensor of
thermal core.

Change-Id: I4200a5691183aa2d40ef8ed64554f0beb8ce6d0d
Signed-off-by: Anji Jonnala <anjir@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
Revert "fix for app-mounted directories (thanks @mkasick)"

This reverts commit 91aabab96a27cb7a5d4ae754c9f630e9de30348f.
ksm: Provide support to use deferred timers for scanner thread

KSM thread to scan pages is getting schedule on definite timeout.
That wakes up CPU from idle state and hence may affect the power
consumption. Provide an optional support to use deferred timer
which suites low-power use-cases.

To enable deferred timers,
$ echo 1 > /sys/kernel/mm/ksm/deferred_timer

Change-Id: I07fe199f97fe1f72f9a9e1b0b757a3ac533719e8
Signed-off-by: Chintan Pandya <cpandya@codeaurora.org>
GPU: merge with CAF kk_3.5

Change-Id: I29af088bc746724501644df1d94e763b16eb2853
devfreq: cpubw: update to CAF kk_3.5

Change-Id: I2c0a066064137af4511972922ea6c40b2c1763b3
crypto: update to kk_3.5

Change-Id: Ia9a9d198eac0eec63e46c5a4dbb5418fec22ff9a
Add gboost

Signed-off-by: flar2 <asegaert@gmail.com>