vidc: 1080p: Reset meta data offset to zero

For multi-resolution clips, the meta data offset used while
doing cache clean of meta data buffer is from the previous
resolution & resulting in kernel panic. Resetting the offset
to zero during meta data buffer initialization for new
resolution fixes the issue.

CRs-fixed: 386245
Signed-off-by: Rajeshwar Kurapaty <rkurapat@codeaurora.org>
(cherry picked from commit 16145bcbd6af8db0eebc0eedec1f01ee1b0b3635)

Change-Id: I0f241ce99df62f02c2440fe3700a70d6c13b1537
Signed-off-by: Sridhar Gujje <sgujje@codeaurora.org>
msm: vidc: Reset data corrupt flag for non-H264 decoder

Core does not set display correctness flag on decoder
output buffers for non H264 video codec. With this change,
we reset the data corrupt flag for non-H264 codec.

CRs-Fixed: 397599
Signed-off-by: Rajeshwar Kurapaty <rkurapat@codeaurora.org>
(cherry picked from commit fde67e239d8ac3a1e983b7d82d0c37af47464138)

Change-Id: I961413acda5b772879de6bc26d0d6d4d60eafcd5
Signed-off-by: Sridhar Gujje <sgujje@codeaurora.org>
msm: kgsl: Add idle after writing SMMU ASID register

Add an idle for synchronization after writing the SMMU ASID register.

Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
(cherry picked from commit be39728459a2b7a9c0a5b1faf11e7406976ddcc7)

Change-Id: I6dedb2ff1c51a3ee0ffe55ce64567e8bcdf03e7f
Signed-off-by: Sridhar Gujje <sgujje@codeaurora.org>
msm: kgsl: Invalidate base pointers when tlb is flushed

Invalidate the base pointer even when tlb is flushed. For
gpummu the base pointers are invalidated even after just
a tlb flush, with IOMMU do the same.

Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
(cherry picked from commit 967c91794d71107053471f33b903176a3522431d)

Conflicts:

	drivers/gpu/msm/adreno.c

Change-Id: Ic2e6d9b323d8aadabfe73b57d82cbe4500d666fe
Signed-off-by: Sridhar Gujje <sgujje@codeaurora.org>
ARM: smp: Fix cpu_up() racing with sys_reboot

Nothing stops a process from hotplugging in a CPU concurrently
with a sys_reboot() call. In such a situation we could have
ipi_cpu_stop() mark a cpu as 'offline' and _cpu_up() ignore the
fact that the CPU is not really offline and call the
CPU_UP_PREPARE notifier. When this happens stop_machine code will
complain that the cpu thread already exists and BUG_ON().

CPU0                      CPU1

sys_reboot()
 kernel_restart()
  machine_restart()
   machine_shutdown()
    smp_send_stop()
    ...                   ipi_cpu_stop()
                           set_cpu_online(1, false)
                            local_irq_disable()
                             while(1)
    <PREEMPT>
cpu_up()
 _cpu_up()
   if (!cpu_online(1))
    __cpu_notify(CPU_UP_PREPARE...)

cpu_stop_cpu_callback()
  BUG_ON(stopper->thread)

This is easily reproducible by hotplugging in and out in a tight
loop while also rebooting.

Since the CPU is not really offline and hasn't gone through the
proper steps to be marked as such, let's mark the CPU as inactive.
This is just as easily testable as online and avoids any possibility
of _cpu_up() trying to bring the CPU back online when it never was
offline to begin with.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
(cherry picked from commit 4a734179d918a4ee42c5fd6d54220eb6dd671ff0)

Change-Id: I03d8ed8226a9a9aab29499afcf052e0434fa2fe0
Signed-off-by: Sridhar Gujje <sgujje@codeaurora.org>
ARM: Fix deadlock scenario with smp_send_stop()

If one process calls sys_reboot and that process then stops other
CPUs while those CPUs are within a spin_lock() region we can
potentially encounter a deadlock scenario like below.

CPU 0                   CPU 1
-----                   -----
                        spin_lock(my_lock)
smp_send_stop()
 send_IPI               handle_IPI()
                         disable_preemption/irqs
                          while(1);
 <PREEMPT>
spin_lock(my_lock) <--- Waits forever

We shouldn't attempt to run any other tasks after we send a stop
IPI to a CPU so disable preemption so that this task runs to
completion.

CRs-Fixed: 396169
Reported-by: Sundarajan Srinivasan <sundaraj@codeaurora.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
(cherry picked from commit 78e9b56740ad789351b6d15cd9a67fe03091a3a1)

Change-Id: I7f9809a36264959d77276ce081b91426cfd9fce8
Signed-off-by: Sridhar Gujje <sgujje@codeaurora.org>
msm: kgsl: Detect and avoid malformed ioctl codes

Because we were using _IO_NR, one could construct a malformed ioctl
code that would avoid allocating memory yet go to a function that
expected that memory. Still use _IO_NR to index the array of ioctls,
but check that the full values match before jumping to the helper
function.

CRs-fixed: 385592
Change-Id: Ic0dedbaded469035bd0a2bb0f20fecb2a3045ca5
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
(cherry picked from commit 1e76f61bb001b93795a227f8f808104b6c10b048)

Signed-off-by: Dhivya Subramanian <dthiru@codeaurora.org>
vidc: fix wrong number of slices in slice delivery mode

The slices completed is not matching with the expected number
of slices in frame done. The fix is available in July firmware
release and this commit will have the corresponding video driver
changes.

CRs-fixed: 380629
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
(cherry picked from commit 909aebf7bd4d89fb5acccd64b27349cf93a736e0)

Change-Id: I7bd0cc4a381039d892ce884189a2e76462f89a19
Signed-off-by: Sridhar Gujje <sgujje@codeaurora.org>