msm: hotplug: remove code related to cpu_killed

Earlier the completion event cpu_killed was used to synchronize
notify to hot plug framework that the CPU is dead. But now it is
replaced with another completion event cpu_died and it is placed
in the hotplug framework itself. So there is no need for a
platform to implement a completion event.

But in msm platform driver the completion event related code
was not removed with the changes in hotplug framework. This
patch removes the unused code.

Change-Id: I4418e5e397821e39a7b6a6efa997c4a866e9b46b
Signed-off-by: Venkat Devarasetty <vdevaras@codeaurora.org>
msm: hotplug: Block hotplug removal of CPU0

Hotplug removal of CPU0 is not currently supported. Attempts to
remove it may result in undefined behaviour. Explicitly block
any such attempts before other hotplug notifiers get the chance
to run by setting the notifier priority to INT_MAX.

Change-Id: I9e1f5b4a0db554295a097220417f2bdf4c690f5f
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
Revert "msm: pm-8x60: Add PNOC request to prevent PNOC clk gating"

This reverts commit 9b186afca6c206ef1e74c138a10b75bdab4ba422.

Change-Id: Ifb0e0af69f6e63cae74ba2c50cb5d126257bc43d
Signed-off-by: Badhri Jagan Sridharan <badhris@codeaurora.org>
msm: pm-8x60: Use dma_alloc_coherent for the saved region

dma_alloc_coherent is the linux standard way of allocating coherent
(i.e. uncached) memory. This API provides more guarantess than the
custom allocate_contiguous_ebi function, including the ability to
specify allocations from the lower 4G of memory. Switch to this API
for allocation of uncached memory. Because using dma_alloc_coherent
may have other setup involved, switch the setup function to be a
later initcall as well (from core_initcall to arch_initcall).

Change-Id: I96ea4575e5ee82ccbf7e691ba75ea1414dc6d81a
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
netfilter: Add of NATTYPE COOKIE Check

Add NATTYPE COOKIE to avoid invalid access of NATTYPE
entry from the conntrack module. This compensates for
possible garbage values in the conntrack entry, which
would cause potential errors.

Change-Id: I1a53fa0dc6961dd3e53d382642b413d4ee781ed6
Signed-off-by: Tyler Wear <twear@codeaurora.org>
Signed-off-by: Devendra Patel <cdevenp@codeaurora.org>
CPU hotplug, debug: detect imbalance between get_online_cpus() and put_online_cpus()

The synchronization between CPU hotplug readers and writers is achieved
by means of refcounting, safeguarded by the cpu_hotplug.lock.

get_online_cpus() increments the refcount, whereas put_online_cpus()
decrements it.  If we ever hit an imbalance between the two, we end up
compromising the guarantees of the hotplug synchronization i.e, for
example, an extra call to put_online_cpus() can end up allowing a
hotplug reader to execute concurrently with a hotplug writer.

So, add a WARN_ON() in put_online_cpus() to detect such cases where the
refcount can go negative, and also attempt to fix it up, so that we can
continue to run.

Change-Id: I144efeaa5899a2e8a3cddd21f010679cbaaa2459
Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Reviewed-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Cc: Jiri Kosina <jkosina@suse.cz>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Git-commit: 075663d19885eb3738fd2d7dbdb8947e12563b68
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Signed-off-by: Osvaldo Banuelos <osvaldob@codeaurora.org>
msm: kgsl: Prevent device start after it is already started

Check if device is already started in high priority workqueue thread,
this check prevents calling device start after it is already started,
thereby avoiding unpredictable behavior.

Change-Id: Iffcd065f8c02746d168c8e5779d10d4b0e2404a9
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
msm: kgsl: Increase fault timer for slower a305 GPU

Slower GPU's need larger fault timer to detect hangs correctly.
we use 50ms fault timer for faster GPU's, a305 GPU is slower
compared to faster GPU, use a larger 200ms fault timer to
prevent false hang detection.

Change-Id: I0f0bf492ae2d9941979893b75b2e1dbc832e1ba8
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
msm: kgsl: Increase fault timer for A305B GPU

Slower GPU's need larger fault timer to detect hangs
correctly. Frodo A305B GPU is slower compared to faster
GPU, hence use a larger 200ms fault timer to prevent
false hang detection.

Signed-off-by: Prabhat Awasthi <pawasthi@codeaurora.org>
Change-Id: I6338cecc3be81700ab10c45fab66daa7a1078e42
msm: kgsl: Fix mem leak when page allocation fails

Page allocation may fail during OOM condition. Update
sglen and size to correct value (allocated) so that
they get freed in kgsl_sharedmem_free().

Change-Id: I1aa0ca77bb767523dfcf0f6cc3a21eac2b6b80e4
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
cpufreq: Fix policy getting stuck when user & kernel min/max don't overlap

Every __cpufreq_set_policy starts with checking the new policy min/max has
some overlap with the current policy min/max. This works out fine until we
end up with the policy min/max being set to a range that doesn't overlap
with the user policy min/max. Once we get into this situation, the check at
the start of __cpufreq_set_policy fails and prevents us from getting out of
this state.

This only happens when one of the CPUFREQ_ADJUST/CPUFREQ_INCOMPATIBLE
notifiers called inside __cpufreq_set_policy pick a min/max outside the
range of user policy min/max.

The real intent of the check at the start of __cpufreq_set_policy is to
make sure userspace can't set user policy min > user policy max. Since
__cpufreq_set_policy always gets called only with current user policy
min/max except when the actual user space policy min/max is changed, we can
fix the issue by simply checking the new policy min/max against current
user policy min/max.

Change-Id: Iaac805825e64d7985c41fb9052bd96baacdf3d6f
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
msm: clock: Allow msm_clock_init to be invoked multiple times

In preparation for a series of changes that move MSM clock
controllers to the Linux device model, allow msm_clock_init
to be invoked multiple times (once for each clock controller).

Change-Id: I0d56612c660f020ea762feb468234813cff0db22
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
spi_qsd: Add vote for clock path

Currently the spi driver votes for its core clock. However, it is
possible that the core-clock's source will be off. When the source
is off, the spi core is not clocked. This patch adds voting for
the entire clock path, thus guarantee clocking to the spi core.
Voting for the path cost a few msecs. A client may choose when
to pay this overhead. By default the votes takes place in the
runtime-pm callbacks which tie to transaction requests. A client
may choose to invoke these callbacks itself whenever it likes
by directly calling the driver's runtime-pm. A third option is
to set the active_only flag in platform data which results in the
callbacks being called when the application processor power state
changes.

CRs-Fixed: 478465
Change-Id: Ib866399c0e84a875a19a0d1506d77bbe77d5fe61
Signed-off-by: Gilad Avidov <gavidov@codeaurora.org>
msm: acpuclock-cortex: Detect bootloader cpu configuration

Detect which cpu rate is currently selected by the bootloaders during
probe. If the rate is invalid, then set the cpu rate to maximum.

Change-Id: I316d5de76133e76993a47b0d2917fd35bc5dd590
Signed-off-by: Patrick Daly <pdaly@codeaurora.org>
msm: clock-pll: Force PLLs off before reprogramming

PLLs can be enabled by the bootloaders without linux's knowledge. Ensure
the plls are off before changing their rates.

Change-Id: I77d1519117257570a1f3fa2e451d88b20776a013
Signed-off-by: Patrick Daly <pdaly@codeaurora.org>
msm: clock-8226: Fix incorrect voltage limit value

The hw and sw frequency plan rounded the SVS frequency limit for the
vcodec clk to different values.

Change-Id: I721556cbdce7923f287eb733ccf16701ea7d3347
Signed-off-by: Patrick Daly <pdaly@codeaurora.org>
msm: buspm: Enable busPM for targets which support bus scaling.

BusPM module should not depend on individual target configs
as it previously was. Fix this by tying busPM module with
MSM_BUS_SCALING conifg and enable it on all targets where
bus scaling is enabled.

CRs-Fixed: 486454
Change-Id: I5e44b6b63dd8577a5db6fa6f34526af0a4933c82
Signed-off-by: Gagan Mac <gmac@codeaurora.org>
msm: msm_bus: Correct the return value from register-client

On failure, return 0, and not a non-zero value as that can
be interpreted as a valid client ID.

Change-Id: I7a5b448bc398b4a4792170147a5e5317d25f8b3c
CRs-Fixed: 486328
Signed-off-by: Gagan Mac <gmac@codeaurora.org>
msm: subsystem_restart: Change the error ready log message

The error services interrupt log message appears as if it is
reporting an error. So, change it so that it does not appear so.

Change-Id: I84049af9d369d1c87547225813ec6cf1c4a66db5
Signed-off-by: Seemanta Dutta <seemanta@codeaurora.org>
msm: clock-generic: Handle round rate return values greater than LONG_MAX

The return type of clk_round_rate() is long. So, technically it can return
only rates as large as LONG_MAX (~2.1 GHz). But CPU clocks can already go
past 2.1 GHz and any return value greater than LONG_MAX will appear as a
negative number to the caller.

So, make the clock-generic implementation a bit more selective/intelligent
about treating negative return values from clk_round_rate() as errors. If
the returned negative number is not one of the standard error values
(IS_ERR_VALUE), then treat the negative long number as an unsigned long
rate.

Change-Id: I27383bdb74ed6986667fee681005adec7b16bde9
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>