msm: kgsl: Fix several possible problem spots in the dispatcher

Fix a few spots that the compiler warnings missed. Avoid
dereferencing a pointer that may have returned ERR_PTR() without
first checking to see that if it did return ERR_PTR() and correct
an egregious signed / unsigned mixup. Not sure why the compiler
didn't yell at me for that one.

Change-Id: Ic0dedbadf075b34e51a89ce625d2308c5171a58d
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
gpu: msm: Sync with CodeAurora kk_3.5_rb1.15

Change-Id: I3b75d2d4d1aa0d5d14f57a70de2ee19068bab9b0
iommu: msm: Refactor remote spinlock defconfig

Refactor the remote spinlock defconfig to allow it to be used with
subsystems other than GPU. This will enhance the usability of this
feature and minimize the chance of errors when enabling this feature.

CRs-fixed: 517873
Change-Id: I609cd77ece4e8d2e15e1a24d87a23be05a61b60f
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
iommu: msm: Refactor use of remote spinlock

The remote spinlock was originally meant to synchronize access between
GPU and CPU accessing SMMU. However, there are more use cases that
this remote spinlock serves. This change decouples the spinlock from
GPU and adds support for taking the spinlock only for SMMUs that are
specified in the device tree.

CRs-fixed: 517873
Change-Id: Ic50992d0d1a102fbd05855e09e254e627f99ec33
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
iommu: msm: Handle unmapping of PTE properly

The unmap api is currently not handling unmapping of page table
entries (PTE) properly. The generic function that calls the msm
unmap API expects the unmap call to unmap as much as possible
and then return the amount that was unmapped.
In addition the unmap function does not support an arbitrary input
length. However, the function that calls the msm unmap function
assumes that this is supported.

Both these issues can cause mappings to not be unmapped which will
cause subsequent mappings to fail because the mapping already exists.

Change-Id: I638d5c38673abe297a701de9b7209c962564e1f1
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
iommu: msm: Refactor page table code

Move code that is specific to short descriptor page table
format to its own file to allow sharing of header file
between long descriptor format page table and short descriptor
page table format.

Change-Id: Ia072a77a23d21207edb983de47b6fe69029ffdd7
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
msm: kgsl: Restrict the maximum memory entries for bulk cache sync

Restrict the maximum number of memory entries that can be specified
to a single bulk cache sync call to PAGE_SIZE / sizeof(unsigned int)
so that the allocation can always fit within one page.

CRs-fixed: 578062
Change-Id: Ic0dedbad07e1986cd6ccc5b260ffef82b5adb6d3
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
msm: kgsl: Don't enable VBIF counters for targets that don't use them

Only targets with separate bus control need the VBIF counters enabled
by default.

Change-Id: I3a7fcedebf7a7cc80bc1bec5a7fd298b49b9b165
Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
cpufreq: ondemand: Disable freq sync feature in store_powersave_bias

Turn off frequency synchronization of CPUs on thread migrations
when powersave bias is enabled. This is done to prevent re-arming
of the dbs timer work (which is cancelled by store_powersave_bias)
by the sync_thread.

Change-Id: I165dd591845c1d66d01a14e8dfc44c767c677b0d
Signed-off-by: Rohit Gupta <rohgup@codeaurora.org>
cpufreq: ondemand: fix timer-related list corruption in store_powersave_bias()

The dbs_timer_init() call in store_powersave_bias() re-initializes the
dbs_info workqueue, call on dbs_timer_exit() to ensure
outstanding work is cleared prior to making this call. Also, grab the
percpu timer_mutex lock to avoid race conditions with respect to the
dbs timer.

Change-Id: I79f3d43eeb51d2d8e21edd0fe043d6583333951f
Signed-off-by: Osvaldo Banuelos <osvaldob@codeaurora.org>
ondemand: add sysfs entry for down_diff_multi_core

This change adds sysfs entry for the ondemand governor's attribute
down_differential_multi_core. This is required to be able to program
this knob to attain better perf/power for use cases like camcorder.

CRs-fixed: 561456
Change-Id: Ib7c1223215c6b714c286c231ed37f3abfae741c6
Signed-off-by: Krishna Vanka <kvanka@codeaurora.org>
PM: devfreq: Fix the fast ramp case in the adreno governor

Expected behavior of GPU DCVS is to immediately bump the frequency
to turbo upon encountering a long block of busy processing.  The
current code just raises the frequency by one level.

Change-Id: Ida953bb7be8a976da5400328a1c91083499e0fa0
Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
mm: change freepage state correctly in __isolate_free_page

Commit 2e30abd1730751d58463d88bc0844ab8fd7112a9
(mm: cma: skip watermarks check for already isolated blocks
in split_free_page()) changed the ordering of where the watermark
checks go for isolated pages. There was already an 'enhancement'
present in __isolate_free_page to skip the watermark checks for
CMA pages to increase success. The merging of the enhancment and
the aforementioned commit was done incorrectly, resulting in
the free page state never being modified for CMA pages even if
the CMA page was removed from the free list. Add the enhancement
properly by only checking for CMA pages at the watermark level
and allow the page state to be modfied for CMA pages as well.

Change-Id: Iabea982108d98150f54e5c42b7dbf30f0743653a
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>