msm: kgsl: Enable protected register mode for A3XX

Turn on protected register mode for the A3XX GPU family and add 0x63
(RBBM_INT_0_MASK) to the list of protected registers.

Change-Id: Ic0dedbad10ebfa6eb6d3d815b5aa9b6b6f0e8e35
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>

Conflicts:
	drivers/gpu/msm/adreno.h
	drivers/gpu/msm/adreno_a3xx.c
msm: kgsl: Remove now uneeded GPU event code

_mark_next_event() stopped being useful when the dispatcher was added.
Remove the last vestiges of the code.

Change-Id: Ic0dedbad7b27122513d93993cad2984989295224
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
msm: kgsl: Add CFF capture for IBs

If CFF is enabled, when an IB is submitted to hardware
parse it to find all objects in it and dump them.

Change-Id: I2caecb6a9c912a59be4c0d2acdd3949c96196653
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
msm: kgsl: Print the register that causes a protected mode error

When we get a protected mode error print out the register information
that caused the exception.

Change-Id: Ic0dedbad4f586c5715669226619b51665ef9681f
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
msm: kgsl: Unprotect the VBIF performance counters

The A3XX protected mode registers are too broad and are protecting
the VBIF performance counters by accident.  Dial back the protection
to just the VBIF configuration registers.

CRs-fixed: 554672
Change-Id: Ic0dedbad210a548a11c953c7601144786174081b
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
msm: kgsl: Restructure type0 packet parsing

Make parsing of type0 packet more generic by creating a
common array of registers that have addresses which need
to be tracked. This makes it easier to add parsing of type0
packet for a new gpu chip. New chips will have new registers
that need to be tracked which can be added to the existing
list and this makes the code more generic.

Change-Id: Ia0d8d5d56b7bf72297e669bfb485b7ebc38e3c7f
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>

Conflicts:
	drivers/gpu/msm/a4xx_reg.h
	drivers/gpu/msm/adreno_cp_parser.c
msm: kgsl: fix build when dma-buf, ashmem and fbdev are not enabled

All of these features can be disabled in the kernel config.
Add appropriate idefs so that the build isn't broken in
this case.

Change-Id: Ife3283c40a87012ab58a679a911090a00e627a61
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
msm: kgsl: Switch to default pagetables in case of NULL context

Switch to default pagetables when context is NULL. This prevents
instances of page faults when switching to default pagetable when
GPU is busy.

CRS-fixed: 550082
Change-Id: I74bab681b823bf50e58b50b6cb819fbf93163bf7
Signed-off-by: Harsh Vardhan Dwivedi <hdwivedi@codeaurora.org>

Conflicts:
	drivers/gpu/msm/adreno.c
msm: kgsl: Change readl to readll for reading 64bit registers

The macro KGSL_IOMMU_GET_CTX_REG_LL  was incorrectly using
readl_relaxed() instead of the correct readll_relaxed().

Change-Id: Ie811161a31257eb58b82d38503c3790528eb8333
Signed-off-by: Shrenuj Bansal <shrenujb@codeaurora.org>
msm: kgsl: Add caching support for DRM GEM allocations

This change adds 3 KGSL DRM ioctls:

DRM_IOCTL_KGSL_GEM_SET_USERDATA
DRM_IOCTL_KGSL_GEM_SET_USERDATA
DRM_IOCTL_KGSL_GEM_CACHE_OPS

Get and set userdata ioctls are used by userspace to
store information like last operation (Read/Write) done
on this DRM object and last mapping (CPU/GPU) done for
this DRM object. This is required to optimize number of
cache operations on DRM GEM objects.

DRM_IOCTL_KGSL_GEM_CACHE_OPS is used by userspace to
perform cache operations on DRM GEM objects.

Change-Id: Id228a52da90cafed6a2b9e0b000117ad7aa8e366
Signed-off-by: Deepak Kumar <dkumar@codeaurora.org>
msm: kgsl: Fix resource leakage in KGSL DRM

Fix DRM object and DRM object private data
structure pointer memory leaks in error
cases in KGSL DRM interface ioctls.

Change-Id: I914e36a2dbb21e642d818dcb0d67c3e605c54c2a
Signed-off-by: Deepak Kumar <dkumar@codeaurora.org>
msm: kgsl: Clean-up KGSL DRM ioctls

Remove DRM_IOCTL_KGSL_GEM_LOCK_HANDLE,
DRM_IOCTL_KGSL_GEM_UNLOCK_HANDLE and
DRM_IOCTL_KGSL_GEM_UNLOCK_ON_TS ioctls from
KGSL DRM interface as these ioctls are unused.

CRs-fixed: 546856
Change-Id: I91711c3079e964993bb5f47ab62fe5133630ab88
Signed-off-by: Deepak Kumar <dkumar@codeaurora.org>

Conflicts:
	drivers/gpu/msm/kgsl_drm.c
msm: kgsl: Pass an actual pointer to a snapshot callback

Pass an actual pointer to the snapshot_os callback from
kgsl_device_snapshot in lieu of playing a dangerous dereferencing
trick.

Change-Id: Ic0dedbaddbae90f18953582d113170d316a9b7f4
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Shrenuj Bansal <shrenujb@codeaurora.org>
msm: kgsl: Pointer-integer casting and printk fixes

Fixes warnings caused by casting pointers to integers incorrectly.
Also fixes specifiers for print statements.

Change-Id: Ic28e57ec7d106d54c83d6df29de8918efd704623
Signed-off-by: Shrenuj Bansal <shrenujb@codeaurora.org>

Conflicts:
	include/uapi/linux/msm_kgsl.h
msm: kgsl: Change gpuaddr to unsigned long everywhere

gpuaddr was changed to unsigned long in certain structs but not
everywhere. Also fix some print statements to regard gpuaddr as
type long.

Change-Id: I1aefa4f36ba7178e8146175205ce65e091e74c4a
Signed-off-by: Shrenuj Bansal <shrenujb@codeaurora.org>

Conflicts:
	drivers/gpu/msm/kgsl.c
	include/uapi/linux/msm_kgsl.h
msm: kgsl: Add __user attribute to usermode pointers

Change the usermode pointers to use an actual pointer type and
add the __user attribute to them

Change-Id: I0b92298d71064dc1be67a30d2a48659a39c0ff3d
Signed-off-by: Shrenuj Bansal <shrenujb@codeaurora.org>

Conflicts:
	include/uapi/linux/msm_kgsl.h
msm: kgsl: Change prev_padding type in subbuf_start_handler

The .subbuf_start callback expects the prev_padding type to be
size_t. Change the definition of subbuf_start_handler to use
size_t instead of uint.

Change-Id: I572ccf7adceb0c7f1fd24c01ff09abc111981016
Signed-off-by: Shrenuj Bansal <shrenujb@codeaurora.org>
msm: Remove Kconfig options for unsupported platforms

Drop support from mach-msm/Kconfig the following platforms that are no
longer supported as any associated config options related to these
platforms:

MSM7X01A, MSM7X25, MSM7X27, MSM7X30, QSD8X50, MSM8X60, MSM8960, MSM8930,
APQ8064, FSM9XXX, MSM9615, MSM8625, MSM9625, MSM7X27A

Change-Id: I6070ddd7b783a4bb39be27a33dcce47d956c0109
Signed-off-by: Kumar Gala <galak@codeaurora.org>
msm: kgsl: Remove A2XX support

All targets supporting A2XX GPUs were removed from the kernel in
b3270aa98aa7f4d7ccf1eef10e0624409dfe415f. If we left A2XX code
in KGSL it would bitrot that much faster. Farewell old friend.

Change-Id: Ic0dedbad7d31ab1c30e1fabf4f10f867a73299dc
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>

Conflicts:
	drivers/gpu/msm/adreno.c
	drivers/gpu/msm/adreno.h
	drivers/gpu/msm/adreno_a2xx.c
	drivers/gpu/msm/adreno_a3xx.c
	drivers/gpu/msm/adreno_profile.c
	drivers/gpu/msm/adreno_ringbuffer.c
msm: kgsl: Fix the trace output for kgsl_issueibcmds

the ib= field in the kgsl_issueibcmds ftrace event is be the GPU
address of the first indirect buffer. Output it in hex, not decimal.

Change-Id: Ic0dedbad2fab5f280f71c819cdaac03789d90288
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>