ARM: mm: remove IPI broadcasting on ASID rollover

ASIDs are allocated to MMU contexts based on a rolling counter. This
means that after 255 allocations we must invalidate all existing ASIDs
via an expensive IPI mechanism to synchronise all of the online CPUs and
ensure that all tasks execute with an ASID from the new generation.

This patch changes the rollover behaviour so that we rely instead on the
hardware broadcasting of the TLB invalidation to avoid the IPI calls.
This works by keeping track of the active ASID on each core, which is
then reserved in the case of a rollover so that currently scheduled
tasks can continue to run. For cores without hardware TLB broadcasting,
we keep track of pending flushes in a cpumask, so cores can flush their
local TLB before scheduling a new mm.

CRs-Fixed: 623919

Change-Id: I2ed0f2ab6635bf900bcb81e29efbd01991da8e86
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Tested-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Git-commit: b5466f8728527a05a493cc4abe9e6f034a1bbaab
Git-repo: https://android.googlesource.com/kernel/common/
[spathi@codeaurora.org: removed unused function set_asid().
The function cpu_set_reserved_ttbr0() is not available since patch
"ARM: Use TTBR1 instead of reserved context ID" is not merged
so used old functionlity by calling cpu_set_asid(0)]
Signed-off-by: Srinivasarao P <spathi@codeaurora.org>
msm: kgsl: Release process mutex appropriately to avoid deadlock

There is a deadlock situation between
msm_iommu_lock mutex and process_mutex.

In irq context iommu_fault_handler get into
a deadlock by aquiring msm_iommu_lock and waiting
for process mutex. The other thread in
destroy_process_private is waiting for
msm_iommu_lock while holding process mutex leading
to a deadlock. With this change we release the
process mutex well before we call the function
in which msm_iommu_lock is taken.

Change-Id: I674a7512dcd3e7fe202e39b57539cb6c1e29ae0e
Signed-off-by: Sunil Khatri <sunilkh@codeaurora.org>
msm: display: clear sec_active when the pipe is not for secure

Make sure secure memory is unmapped properly

Change-Id: Ie0f2bc586ab4de45ceaaa6834db64ba7b94b2c0b
Signed-off-by: Ken Zhang <kenz@codeaurora.org>
Signed-off-by: c_hharis <hharis@codeaurora.org>
Signed-off-by: Nirmal Abraham <nabrah@codeaurora.org>
lib/scatterlist: error handling in __sg_alloc_table()

I was reviewing code which I suspected might allocate a zero size SG
table.  That will cause memory corruption.  Also we can't return before
doing the memset or we could end up using uninitialized memory in the
cleanup path.

Change-Id: Icee6be8ea22644d7f16264d9d2a0887c7145996b
CRs-Fixed: 611562
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Imre Deak <imre.deak@intel.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Merge "lib/scatterlist: error handling in __sg_alloc_table()"
Merge "msm: display: clear sec_active when the pipe is not for secure"
Merge "Merge "lib/scatterlist: error handling in __sg_alloc_table()""
Merge "Merge "Merge "lib/scatterlist: error handling in __sg_alloc_table()"""
Merge "Merge "msm: display: clear sec_active when the pipe is not for secure""
Merge "Merge "Merge "msm: display: clear sec_active when the pipe is not for secure"""
Merge "Merge "msm: display: clear sec_active when the pipe is not for secure""
Merge "msm: kgsl: Release process mutex appropriately to avoid deadlock"
Merge "Merge "Merge "msm: display: clear sec_active when the pipe is not for secure"""
Merge "Merge "msm: kgsl: Release process mutex appropriately to avoid deadlock""
Merge "Merge "Merge "msm: kgsl: Release process mutex appropriately to avoid deadlock"""
Merge "Merge "msm: kgsl: Release process mutex appropriately to avoid deadlock""
Merge "Merge "Merge "msm: kgsl: Release process mutex appropriately to avoid deadlock"""
Merge "Merge "msm: kgsl: Release process mutex appropriately to avoid deadlock""
Merge "Merge "Merge "msm: kgsl: Release process mutex appropriately to avoid deadlock"""
Merge "Merge "msm: kgsl: Release process mutex appropriately to avoid deadlock""