msm: mdss: call suspend and resume panel events during runtime triggers

Send a panel suspend/resume event to all the MDSS devices to ensure
proper handling of regulators and clocks during the suspend/resume
sequence.

Change-Id: I820f5e4113f599ba53d4fa4726e406f74872f95f
Signed-off-by: Sree Sesha Aravind Vadrevu <svadrevu@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
ARM: dts: Disable RPM notifications for L2 GDHS collapse on Krait targets

Entering vdd minimization is unsupported during L2 GDHS collapse.
Prevent this from happening by not notifying the RPM during the L2
GDHS SPM sequence.

CRs-Fixed: 609356
Change-Id: Iefcb3597df5af104f823fdfb1ad1879f5d1d057e
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
qseecom: Add NULL pointer check in qseecom_ioctl

NULL pointer check is added to the qseecom driver in qseecom_ioctl,
which is required to validate the data pointer before executing any
other code from ioctl's.

Change-Id: I6fecf13769b4d7e94eebd4dc075a5ece79b18e1b
Signed-off-by: AnilKumar Chimata <anilc@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
qseecom: Rename & unifiy some enum definitions.

Move the key management enum values into unified enum
Rename RPMB related enum definitions as per existing pattern.

Change-Id: I542f934ffc399563a587d5016e974a7ce585f0dc
Signed-off-by: Hariprasad Dhalinarasimha <hnamgund@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
qseecom: Fix QSEECOM_IOCTL_UNLOAD_EXTERNAL_ELF_REQ kernel crash

Fixes the kernel crash occuring with IOCTL_UNLOAD_EXTERNAL_ELF_REQ
ioctl by adding unavailable client type to qseecom_client_handle_type
enum, which is required in the driver during qseecom_release().

Change-Id: I73b817255149ffc4a808852feb2954a0ba3c317f
CRs-fixed: 508253
Signed-off-by: AnilKumar Chimata <anilc@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
qseecom: Check for invalid registration of secapp region

Check the validity of response result field returned by QSEE
when issuing a request to register the secure app region
information.

Change-Id: Idc5ee7cf3c0a25ca37f23ef9d1718fdb05af6533
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
qseecom: Add frequency scaling in send_service_cmd()

Addes DFAB and SFAB bus frequency scaling in qseecom send_service
command function. This is required for RPMB listener services

Change-Id: I7496dfafe1fa571de68b30529ee6db49c8200232
Signed-off-by: AnilKumar Chimata <anilc@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
qseecom: Add new IOCTLs to support secure UI feature

User space sends the buffer to TZ to use it for secure UI features.
Buffer shall be protected based on the use case, two APIs are
introduced to support this feature.

- QSEECOM_IOCTL_SEND_MODFD_RESP: is called to modify the listener
response data with physical address replaced at a mentioned offset,
so as to be usable by TZ. Option to protect &/ unprotect the buffer
is provided from user space (based on use case).

- QSEECOM_IOCTL_UNPROTECT_BUF: is called to explicitly unprotect the
protected buffer (use case specific).

Change-Id: If129e7bc0131eee4ec361923c6c1c74de37be130
Signed-off-by: Hariprasad Dhalinarasimha <hnamgund@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
qseecom:  Validate inputs from user space

Validate send_cmd, send_modfd_cmd and send_mdfd_resp
input parameters: cmd and response pointers and buffer
lengths and offsets  issued to modify data.

Change-Id: I381836d08aaa48357486fbdc6a122eb5b42bfa0b
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
qseecom: Remove debug  messages

Remove unnecessary debug  messages.

Change-Id: Ida80fbc1376f15753f8329c44550b14d8f4de163
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
qseecom:  Check for case where listener service is not found

When listerner service is not in the list of registered listeners,
the resulting ptr will a NULL. Check for this case of NULL ptr
to indicate missing listener service.

Change-Id: I0d2c7b01143c40711f71bf434493ac5301314cf2
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
qseecom: Copy userspace buffer into kernel space before dereferencing

ION memory is used for user space to kernel space data passing.
This is directly accessible in kernel. But, if the IOCTL is called
from user space without using User space library, then data might
be pointing to some other memory location, in which case, it would
not be possible to dereference this location in kernel & hence it
would be accessing invalid memory.

Change-Id: Ic50c76ee8b2a696dbb786fce3a68cdc782e15268
Signed-off-by: Hariprasad Dhalinarasimha <hnamgund@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
qseecom: Fix error handling path in receive_req()

This patch fixes the error handling path in receive_req() function
called from userspace. Issue seen if user is calling the receive_req
function without calling the listener registration. qseecom_find_svc()
should return NULL if there are no services found.

Change-Id: Id51d8f48d7266b5acbc845f7b9ac0068d16b1ede
CRs-fixed: 496927
Signed-off-by: AnilKumar Chimata <anilc@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
qseecom: Fix issues with qssecom_remove/exit APIs

Clean-up the qseecom_remove() function by removing the null pointer
dereference. Change the logic by removing the unnecessary code and
also modified the qseecom_exit() function with proper calls.

Change-Id: Ibcca1b3c2c37024661505de2550e202b507703aa
Signed-off-by: AnilKumar Chimata <anilc@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
qseecom: Check input buffer from IOCTL

IOCTL messages come with pointers to buffer, check these
buffer pointers prior to accessing it.

Change-Id: Ibd724a35682a6f8e4f6900c8404854a8b55c0c9a
Signed-off-by: Hariprasad Dhalinarasimha <hnamgund@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
qseecom: Fix issues with failure to release client handle

There exists scenarios when qseecom_release is called,
the client handle type is incorrect; hence proper cleanup
is not done with regards to unloading app or cleaning up
memory allocated for the device handle.
This change addresses all cleanup issues related to qseecom
client in qseecom_release call by ensuring the handle type is
set correctly and cleanup is done properly based on client type.

Change-Id: I126aa431ce635ae98100b774e3d92b704635d199
Signed-off-by: Hariprasad Dhalinarasimha <hnamgund@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
slim_ngd: Add NULL pointer check apart from error check

Check against NULL pointer after allocating
the memory for msm_slim_ctrl structure pointer
dynamically to avoid unexpected crashes.

Earlier this pointer is checked only for error
codes. In this patch NULL pointer check is also
added.

CRs-Fixed: 562417
Change-Id: I5cd731144f88b89ee412d19f110b3df6426186f7
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
coresight: add lpae support for coresight tmc driver

Modify the CoreSight TMC driver for LPAE so that it can support
ETR physical addresses greater than 32 bits when LPAE is enabled.

Change-Id: I6db2c98c4db70262ab45f7ff11fe2a6846259f8a
Signed-off-by: Pushkar Joshi <pushkarj@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
coresight: Add support for byte counter interrupt feature

The CoreSight block can produce an interrupt on transfer of
programmed number of bytes to ETR-memory. Use this feature
to provide an interface to manage the byte counter value and
to collect a continuous data stream from userspace.

Change-Id: Ic00c9b19483be566d0f05005936b4a6ff7ab52f1
Signed-off-by: Pushkar Joshi <pushkarj@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
coresight: use dma_alloc_coherent for allocating tmc-etr memory

The CoreSight TMC driver when configured for ETR requires uncached
memory in RAM to which it routes trace data. In order to allocate
this memory replace existing allocate_contiguous_ebi api with
dma_alloc_coherent api which is the linux standard of allocating
memory.

Change-Id: I59f88009f2abed95fd9b81ea92a7d484b9d6b833
Signed-off-by: Aparna Das <adas@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>