fix Os, O1, O2 and O3 selection

Change-Id: I19a264cab0bf92c48d2d900104aa62ac2b85f795
config: spade: switch to O2 optimization

Change-Id: Ia78fc5c95cdc66a67cfeed219af015e296020803
fix graphite and LTO flags

Change-Id: Ia5f1fb9ba03bf00b4336f20b23f35d5077d365b2
scripts: fix .gnu.lto_* flood from linker

WARNING: vmlinux.o (.gnu.lto_page_cache_pipe_buf_release.b6e2886f74b88cb9): unexpected non-allocatable section.
Did you forget to use "ax"/"aw" in a .S file?
Note that for example <linux/init.h> contains
section definitions for use in .S files.

WARNING: vmlinux.o (.gnu.lto_spd_release_page.b6e2886f74b88cb9): unexpected non-allocatable section.
Did you forget to use "ax"/"aw" in a .S file?
Note that for example <linux/init.h> contains
section definitions for use in .S files.

WARNING: vmlinux.o (.gnu.lto_user_page_pipe_buf_steal.b6e2886f74b88cb9): unexpected non-allocatable section.
Did you forget to use "ax"/"aw" in a .S file?
Note that for example <linux/init.h> contains
section definitions for use in .S files.

etc.

Change-Id: Idf94282f08509621fc3eda26e94e80e6a23e8c01
Merge branch 'cm-11.0-wip' into cm-11.0
msm: kgsl: Add cache flush for A20x

Adding extra cache flush command to make sure that CP block
gets event from RB all the time to avoid race conditions because of
clock switches. this is to improve stability on 8x25 target.

Signed-off-by: Gopal Goberu <ggober@codeaurora.org>
(cherry picked from commit f4537cf8dd50a78d78ab1664d623c9b6ecf3f240)

Conflicts:

	drivers/gpu/msm/adreno_ringbuffer.c

Change-Id: Ie08148847d33cd3e526e9bf23bf357a55b048e1b
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
msm: kgsl: Log retired timestamps on device wake

Knowing the retired timestamp on wake-up is useful to debug hangs that
are caused due to clock instability. When we request for clock ON, the
clock may/may-not be turned ON, but we go ahead assuming it is ON. This
can be caught by printing the timestamp on wake. The timestamp we print,
can be compared against the timestamp in postmortem dump (assuming a
hang happens).

If there is a difference, we can say that GPU has run for sometime after
wake. So, we needn't suspect clocks.

If there is no difference, we can say that GPU has hung immediately after
wake. So, we can positively suspect the clocks.

Signed-off-by: Ranjhith Kalisamy <ranjhith@codeaurora.org>
(cherry picked from commit d0348f1644a21ae73982f94c442bdf9f17584ebe)

Signed-off-by: Gopal Goberu <ggober@codeaurora.org>
(cherry picked from commit 0184185f274762462738621282dc50815313339d)

Signed-off-by: Gopal Goberu <ggober@codeaurora.org>
(cherry picked from commit 9e5af757c0902544113bba8ac5296d4a5f15aaf7)

Change-Id: I3c02b3a27486073a31b21bc0a49114d1a668ff1d
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
Revert "msm: kgsl: Update pagetable on context destruction for A20x"

This reverts commit f0d1c9b79e05972816b92bd43b29e98f764826ea.

Reverting this change since it corrupts Bin Base Offset between
two draws of a Binning pass, resulting in GPU hang.

(cherry picked from commit 3ec5d2db139d0941ec8360f6cc399223b18469e5)

Change-Id: Ie1853075533e15e6c8020a00e57b1695df81c9ba
Signed-off-by: Rajesh Kemisetti <rajeshk@codeaurora.org>
msm: kgsl: Fix hang detection to be 50ms or more

In current design waittimestamp can trigger hang detection
in less than 50ms. Check if hang detection was called less than
50ms ago, if true do no attempt hang detection.

(cherry picked from commit 2518e02e85f50338dc1f5708c03edabd4215d099)

Change-Id: I97fd14df2c5288810950a33ea305b05b8ad0faa4
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
msm: kgsl: Remove duplicate code for checking timestamps

Event based as well as interruptible based timestamp checks
use the same code, they differ on if the mutex is held or not.
Separate the common code out to avoid confusion.

Signed-off-by: Carter Cooper <ccooper@codeaurora.org>
Signed-off-by: Rajeev Kulkarni <krajeev@codeaurora.org>

Conflicts:

	drivers/gpu/msm/adreno.c

Signed-off-by: Vikram Orre <quic_vorre@quicinc.com>

Change-Id: I343379b6daac24b4e6f7c7ea4c4031671ae150e5
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>

Conflicts:

	drivers/gpu/msm/adreno.c
	drivers/gpu/msm/adreno_ringbuffer.c
	drivers/gpu/msm/adreno_ringbuffer.h
msm: kgsl: Don't silently ignore events that have a retired timestamp

After all the current events are processed in the main loop, the next
pending event is marked to fire an interrupt to start the cycle anew.
When the event is marked, we check the timestamp again to make sure that
we are always caught up with the GPU.  If the timestamp for the next
event happens to be retired when we get to this point, we silently leave
the function.

If there are no other subsequent events or waittimestamp requests, then
it is possible that another interrupt might never be fired for that context
and then the event gets missed.  Return a 1 in this case all the way back
up the stack and make the event code keep processing events until we are
positive that none are past.

CRs-fixed: 447655
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
(cherry picked from commit f64ee0494159e61dbac2868162878d5e9a618587)

Change-Id: I0c83d8370098357fdc28d8b995a132593bab2ebd
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
msm: kgsl: Use the correct units for ADRENO_IDLE_TIMEOUT

In a few spots the ADRENO_IDLE_TIMEOUT value (measured in milliseconds)
was used directly for jiffy calculations resulting in timeouts that were
1000/HZ times longer than they should have been.  Use msecs_to_jiffies
for these situations.

CRs-Fixed: 448226
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
(cherry picked from commit 0bcdb735fb0ffa524638ab75acf76d3ddfe38616)

Change-Id: Ic2cd7eaf949d5c69c803fd109f206629de56ef9f
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
msm: kgsl: Don't change the sglen of the memdesc if allocation fails

If the page_alloc loop fails, we changed the length of the scatterlist
for the memdesc to the last good page so we could have an efficient
loop through kgsl_sharedmem_free.  Unfortunately, we were also using
the sglen to decide between using kmem or vmalloc memory for the sg
list in the first place. There is a chance that one could start out
with a large sg list from vmalloc, but if it failed early, then we
could truncate the size and attempt to kfree it.

Zero the stlist at init time and use a length == 0 as an indicator
that the list might be truncated.
CRs-Fixed: 443441

Signed-off-by: Dhivya Subramanian <dthiru@codeaurora.org>
(cherry picked from commit 24866eefe7db32ab8f32ba69518f65f1c74c66c2)

Change-Id: Id1d2052ae034db78f42cc5fe6bb742ae8130f391
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
msm: kgsl: Move events to context specific lists

Move the event accounting from a master list on the device to individual
context lists. This makes the management code more simple and reduces
the amount of extra cycles taken trying to walk a single largish list.
The new added code makes the event code slightly bigger than kgsl.c can
bear. As events become more commonplace this code will be more important
and it will be easier to maintain in a dedicated file so move all the event
related code into kgsl_events.c

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
(cherry picked from commit ef3456c4552ab55e8b5882afe0c58062bcbeeba5)

Conflicts:

	drivers/gpu/msm/kgsl.c

Change-Id: If8109ebf81e542e952e14581a30d034ed4d53596
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>

Conflicts:

	drivers/gpu/msm/kgsl_events.c
msm: kgsl: Increase IDLE_TIMEOUT for 2D core to 20secs

Increasing the hang detection time for 2D core from
10 secs to 20 secs to avoid False GPU Hangs.
Some c2d test cases are taking more than 10 secs
to process which results in a False GPU Hang.

Change-Id: Ice5e4b719adb44cd13fb8164bafedce1049416f7
CRs-Fixed: 454439
Signed-off-by: Vikram Orre <vorre@codeaurora.org>
msm: kgsl: Replace 10secs timeout with Z180_IDLE_TIMEOUT for 2D.

Use Z180_IDLE_TIMEOUT macro for 2D hang detection instead
of hardcoded value of 10 secs.

Change-Id: I39f9d3ff9ef00df2f3d399454279045fe68e471a
CRs-Fixed: 454439
Signed-off-by: Vikram Orre <vorre@codeaurora.org>
msm: kgsl: Add CP_WAIT_FOR_IDLE packet before updating timestamp

HW workaround to resolve MMU pagefault caused by memory
freeing early before GPU completes it.

This is race condition where timestamp is getting updated
and the event handler runs before the GPU actually got done
with the timestamp, hence freeing the buffer early while GPU
still not completed with it.

Signed-off-by: Anshuman Dani <adani@codeaurora.org>
(cherry picked from commit faf69cfeeede0883b9556e532d720ab4dc95b01d)

Signed-off-by: Gopal Goberu <ggober@codeaurora.org>
(cherry picked from commit 03c88f958a62e4bcea0640faef0766d6d10e787a)

Change-Id: Id4553255322a5e6eb729f1790fcc09d654da01e3
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
net: wireless: bcmdhd: add Ghana to broken_ccodes

Change-Id: If8a446b055c14e84ea11697e7bf7221df0dcefab
Merge branch 'cm-11.0-wip' into cm-11.0
msm:kgsl: Remove NORETRY flag in memory allocations

With NORETRY flag kernel will not try to reclaim memory
incase of memory allocation failures.With NORETRY flag
being removed, kernel makes mutliple attempts in order to make memory
allocation sucessfull, before returning failure.

Change-Id: I7d71954eba723ce6a8a79b63f54bea1e5b6618f1
Signed-off-by: Rajeev Kulkarni <krajeev@codeaurora.org>