gpu: ion: Add debug information for orphaned handles

It is possible for a buffer to exist only as a dma_buf file
descriptor without it being held in any handles.  When this
occurs it is impossible to track where the buffer is in the
system (without traversing every process in the system and
inspecting its file table).  When buffers are orphaned like
this, copy the task comm and pid of the last client to hold
them into the buffer so we have a debugging hint as to where
this buffer came from.  In practice this will probalby be
the process that allocated the buffer.

Change-Id: I23f88757e36864395f07846384efcea038ca04ee
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
Git-commit: 357e13ef6304c6a7d625789e86c35ef964d8b224
Git-repo: https://android.googlesource.com/kernel/common
[lauraa@codeaurora.org: Conflicts in ion.c due to differences
in debugfs infrastructure]
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
d2: Regenerate defconfigs

 * ..and set the correct ftrace configuration

Change-Id: I5f1e1be284557f0469d31f0884dd46be3d2be227
Revert "msm: iommu: re-use existing buffers for `extra' mappings"

This reverts commit 8e9960a04c96f4455645ff96e94471d9ab344628.
M2: Revert "gpu: ion: Fix flags passed from userspace in COMPAT ioctl"

Large(r) iommu allocations fail with this fix.

This reverts commit cfa1c655930d1760a3c470bb7d87d3198b1470ad.

Change-Id: I9a7932da8a0ebf4a2412eda82c1a7260f50a7661
M2: ion: using client->heap_mask instead of ion_full_heap_mask in COMPAT ioctl
M2: msm: increase video pool for video IOMMU domain

Pool was too small for needed allocations - was causing vidc failures.

Also add back camera related device contexts.

Taken out in:

c691805 msm: camera: Dynamically register domain and attach to device.
M2: camera: Do not register camera domain dynamically

This is basically a revert of
c691805: msm: camera: Dynamically register domain and attach to device.
M2: camera: front sensor: run VFE in turbo mode as with back sensor
M2: camera: vfe: start vfe at 320000000
M2: camera: vfe: no more fake vfe clk rate
M2: camera: vfe: serialize ihist, cs, and rs stats operations using spinlocks

Also ratelimit some error messages.  They were overwhelming the ring
buffer and causing reboots, makingn debugging difficult.
M2: Request the correct ab/ib values for camera.

Various camera usecases show up bus overflows under
regression. Request right ab/ib values to ensure
camera has required bandwidth.

Increased ab, ib values for 8960 pro to run mmfab
at turbo

Change-Id: I1477fae2f0f6081e943d97ee0ffe9d17198a9b7e
Signed-off-by: Nishant Pandit <npandit@codeaurora.org>
Signed-off-by: Lakshmi Narayana Kalavala <lkalaval@codeaurora.org>
Signed-off-by: Praveen Ac <praveenac@codeaurora.org>
M2: camera: Enable pixel line buffer for ispif.

Enable pixel line buffer for ispif to handle fast incoming
data. This provides cusion to dowmstream components such as vfe
and helps in preventing UB buffer overflows.

Change-Id: I0c2a0f8241e08d6cf39732db4ee05b34975b1557
Signed-off-by: Nishant Pandit <npandit@codeaurora.org>
Signed-off-by: Praveen Ac <praveenac@codeaurora.org>
M2: camera: Disable software override for axi wm priority.

Remove the software override for write master priority because
hardware assigns priority to write masters based on data rate.

Change-Id: If16b54f05d41a2d78606ae21983aa3248eb2b1a3
Signed-off-by: Nishant Pandit <npandit@codeaurora.org>
Signed-off-by: Praveen Ac <praveenac@codeaurora.org>
M2: camera: Enable CAMIF SOF in case of non dual camera usecase.

When Dual camera usecase is enabled, the ISPIF PIX SOF is enabled
by default to synchronize with the RDI interfaces.
But in non dual camera usecases, use CAMIF SOF IRQ to increment
the frame IDs being embedded inside the output frames.
Sometimes the SOF IRQs of frame 'n' is clubbed along with the
Output IRQs of the frame 'n-1'. Thus although the output IRQs
are supposed for frame 'n-1' it results in a frame ID of 'n' which
will cause incorrect behaviour downstream. Correct this behaviour
by checking the SOF and Output status bits in the IRQ Mask and
adjust the frame ID accordingly.

*detule: Also add similar checks for camif + stats irqs (as in upstream
driver)

CRs-Fixed: 481721
Change-Id: If7a9db2337febf10e89d44c58b9d980d874c69b6
Signed-off-by: Sai Kumar Sanagavarapu <ssanagav@codeaurora.org>
Signed-off-by: Kiran Kumar H N <hurlisal@codeaurora.org>
M2: camera: reset internal variables on reset interrupt
M2: camera: Recovery through camif stop and overall reset.

Add recovery mechanism in case of bus overflow. As part of the
recovery, stop the CAMIF, reset the VFE and reload the AXI
write masters and then restore the IRQ settings to VFE.

Change-Id: Iba6576777f05135cc13c1ee0c9db764d35c7282a
Signed-off-by: Kevin Chan <ktchan@codeaurora.org>
Signed-off-by: Praveen Ac <praveenac@codeaurora.org>
Signed-off-by: Kiran Kumar H N <hurlisal@codeaurora.org>
M2: camera: Add recovery routine for live snapshot.

During live snapshot, if bus overflow happen, recovery routine will
kick in and reset the hardware. At this point, the live snapshot
might not be completed and application will continue to wait for
the snapshot to complete. This change adds the logic to restart
the snapshot process after recovery is completed.

*detule: we don't use Live Snapshot.  Mangle the patch, and only port
recovery_active pertinent code.

Change-Id: I9ba0a27ce53eb008a4af8d65a3f37a7cded03559
Signed-off-by: Kevin Chan <ktchan@codeaurora.org>
Signed-off-by: Praveen Ac <praveenac@codeaurora.org>
Signed-off-by: Kiran Kumar H N <hurlisal@codeaurora.org>
M2: camera: Move halt logic in case of overflow to ISR.

Move the halt logic which includes AXI HALT and CAMIF Disable
to ISR to start the recovery mechanism sooner.
Add some protection in case of liveshot.

*detule: Again, omit liveshot lines.

Change-Id: I28ec462474524c0064cd7ecd4f77801cd494e514
Signed-off-by: Kevin Chan <ktchan@codeaurora.org>
Signed-off-by: Praveen Ac <praveenac@codeaurora.org>
Signed-off-by: Kiran Kumar H N <hurlisal@codeaurora.org>
M2: msm: Enable MSM_IOMMU for MACH_M2

And enjoy the free ram!