perf/arm: Fix armpmu_map_hw_event()

Fix constraint check in armpmu_map_hw_event().

Reported-and-tested-by: Vince Weaver <vincent.weaver@maine.edu>
Cc: <stable@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Patrick Tjin <pattjin@google.com>
msm: kgsl: Update dispatcher/server-side sync

Refresh the dispatcher/server-side sync code with some general
fixes to functionality, stability and fault tolerance.

Change-Id: Ic0dedbad48161513a2670d3949fccbdbf14b8dff
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Carter Cooper <ccooper@codeaurora.org>
msm: kgsl: Allow sync points to be created on the submitter's context

There are situations where a submitting thread may wish to create a
syncpoint on an already issued timestamp to pause a context until a
previous command has been retired.  Relax the restriction against
submitting a sync point against one's own context and only check to
make sure the user isn't submitting a syncpoint against a future
timestamp (which would be an certain deadlock).

Change-Id: Ic0dedbad883fc228da0d94c8416a88504f5d1377
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
msm: kgsl: consolidate preamble based context switch code

Move logic for handling preamble based context switch
to the core adreno code. This makes it less burdensome
to implement support for newer GPU families that won't
ever support legacy context switching.

Change-Id: Id9ad5936ff91dcdbc9de869baf0d0b9fcf1b5170
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
msm: kgsl: Add IB submission gate for device suspend

Add IB submission gate to stop the system from making requests
while suspend is requested.  This will force users to wait for
the system to resume before making more requests.

Change-Id: I2460ef9b4237b586a31d4cea64b6dd74d30b08d9
Signed-off-by: Carter Cooper <ccooper@codeaurora.org>
msm: kgsl: Do not take active_cnt for events and waittimestamp

In the mists of time it was nessesary to take an active count
for waittimestamp and events because we did not want to run
the risk of suspending while the GPU was active.  Now that we
have the dispatcher we have much better control over the GPU
so the original risk is diminished.

The problem is that holding active_cnt prevents us from going
into nap and suspend and with server-side-sync a lot of the
events we are waiting for might take a very long time before
they even get dispatched on the GPU so we are essentially
keeping the clocks on waiting for other people.

z180 must take active count on its own.

Change-Id: Ic0dedbadcb608115938b198faebe333d19c6a8f6
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
msm: kgsl: always check kgsl_active_count_get() result

Getting an active count can fail if the hardware doesn't
actually wake up. Make active count get functions __mustcheck
to remind people of this and fix existing calls to
handle the error.

Change-Id: I5a0202c824ac7e436b9061da6d8f638e44e8b7f6
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
msm: kgsl: manage active count in adreno_ioctl()

Most of the adreno specific ioctls do not need the hardware
on. The few that do are perfcounter related, it may be
better at some point to optimize them further to shadow
the counters when the hardware is not on rather than
forcing the power on.

Change-Id: I9ea83106e0aaf3d3ac8d261bdec4e4c2e21c4659
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
msm: kgsl: remove KGSL_IOCTL_WAKE from context destruction

Adreno context destruction never needs the hardware on
to destroy the current context.

For z180, always take an active count while destroying.

Since this is the last ioctl to use KGSL_IOCTL_WAKE, remove
it entirely.

Change-Id: I97368c7f3c28f16538cc5f48b802b681d7af96ef
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
msm: kgsl: Run the idle timer while the GPU is not power collapsed

If the GPU is not in its lowest permitted power collapse state,
make sure there is a timer running to get the GPU to that state.

Change-Id: If57aaaf02087036bc4e24725c0cd3de5bc1f1034
Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
msm: kgsl: update kgsl_cmdbatch_destroy with the tip

The kgsl_cmdbatch_destroy function is outdated with the tip and
the difference patch cannot be cherry-picked easily.

Signed-off-by: Jeff Boody <jboody@codeaurora.org>
msm: kgsl: protect syncpoint events with a reference count

Replace the event spinlock with krefs to avoid the possiblity
of calling a sleeping function while holding the spinlock and
to generally make the whole cmdbatch cancel loop a lot more
stable.

Change-Id: I08ba54fa4c5a11c05e3503dfc6a4ee040733e5a6
Signed-off-by: Jeff Boody <jboody@codeaurora.org>
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
msm: kgsl: fix race condition setting the event->handle

A race condition existed for setting the event->handle since the
async event can signal at any time after it has been registered.
When the event signals the reference count for the synclist and
the async callback are decremented causing the event to be freed.
The kgsl_cmdbatch_add_sync_fence function needs to take another
reference to ensure that the handle can be set before the event
is freed.

Change-Id: I0d8a02246e42dce014661d6f14c685415f1704cd
Signed-off-by: Jeff Boody <jboody@codeaurora.org>
 msm:camera: Fix overflow issue in ioctl_hw_cmds function

'len' is of type signed int 32bit,but the assigned value
 may exceed maximum unsigned int32 range.Add overflow check
 and graceful exit if 'm'exceeds UINT32_MAX value.

Bug: 11518040
Signed-off-by: Apurva Rajguru <arajguru@codeaurora.org>
Signed-off-by: Mekala Natarajan <mekalan@codeaurora.org>
msm:camera: Fix signedness issue in hw_exec_cmds

In hw_exec_cmds()second argument m_cmds should be
of type unsigned interger

Bug: 11518040
Signed-off-by: Apurva Rajguru <arajguru@codeaurora.org>
Signed-off-by: Mekala Natarajan <mekalan@codeaurora.org>
msm: vidc: cache-invalidate encoder output buffers after alloc

Invalidate output buffers explcitly once, during registration.
This ensures any pending CPU writes (eg. memset 0 after allocation)
are not flushed _after_the hardware has written bitstream.

b/ 11149679

Change-Id: I958466011e7d96c7b5e2691403c8386309997429
Signed-off-by: Praveen Chavan <pchavan@codeaurora.org>
Signed-off-by: Ed Tam <etam@google.com>
prima: release v3.2.3.11

	git://codeaurora.org/external/wlan/prima.git

	97b38c1 Revert "wlan: Change regulatory followed customer request"
	8b40611 wlan: Change wlan driver version 3.2.3.10 to 3.2.3.11
	905ce09 wlan: Do not check for mcbc flag to resume.
	41687f0 wlan: Fix race conditions while configuring mc/bc filter

Signed-off-by: Iliyan Malchev <malchev@google.com>
prima: TDLS : Initiate the TDLS setup only when externally configured.

This is an preliminary release including just the below SHA.  It should be
identical to the next official Prima release.

	b7eef93 TDLS : Initiate the TDLS setup only when externally configured.

Signed-off-by: Iliyan Malchev <malchev@google.com>
net-fixes: flow_dissector: prevent an infinite loop (CVE-2013-4348)

Jason Wang found that a malicious packet could make skb_flow_dissect()
loop forever. We must check that IP header has a valid ihl to avoid
this loop. It involves IPIP encapsulation and ihl = 0 to trigger.

Given this bug is critical, I cooked a patch before having
a fix in upstream kernel.

Tested:

 Compiled/booted
 Ran some tests on bnx2x and explicitely disabled hardware provided rxhash
 ethtool -K eth1 rxhash off
 ethtool -K eth2 rxhash off

Google-Bug-Id: 11465355
Effort: net-fixes
Change-Id: I813e4dc48cecb05f8edfa218304e1f13fd764323
Signed-off-by: Ed Tam <etam@google.com>
prima: release v3.2.3.13

This is the official drop containing the patch to fix TDLS initiation only when
externally configured, plus a cherry-pick of the locale-based reverts specific
to mako.

	git://codeaurora.org/external/wlan/prima.git'

	d5c5ae4 Revert "wlan: Change regulatory followed customer request"

	0b344c2 wlan : Revision 3.2.3.13
	7dc90cc TDLS: Enhance TDLS external control operations ( gTDLSExternalControl = 1).
	cebe890 wlan : Revision 3.2.3.12
	7ba7677 [PATCH] TDLS : Initiate the TDLS setup only when externally configured.

Signed-off-by: Iliyan Malchev <malchev@google.com>