tspp: Vote for msm-bus clocks before enabling tspp clocks

Currently tspp driver votes for its core clocks, however, it is
possible that the source of the core-clocks will be off. When the
source is off, the tspp core is not clocked. This patch adds
voting for the msm-bus clock, thus guarantee clocking to
the tspp core.

The voting is done only when driver is asked to enable TSIF data
path to stream data through TSIF interface, at which the core clocks
are enabled as well.

Change-Id: I08cd25c0a23d1d69afa54cefddc0b2cb25b3dd7d
Signed-off-by: Hamad Kadmany <hkadmany@codeaurora.org>
qseecom: Add cache functionality

Flush the buffers to physical memory before invoking
scm_call to ensure data in buffers is not stale.

Change-Id: If756e12e4cceb29f3d0e1a04618a037494f31cf7
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
Signed-off-by: Hariprasad Dhalinarasimha <hnamgund@codeaurora.org>
tspp: Fix voting for CX rail when TSIF interface is not active

Allow VDD minimization when TSIF is not active.

CRs-Fixed: 504935
Change-Id: I0f8b6d47f5d9a8f572e134e9bbf12d26ef8f956f
Signed-off-by: Hamad Kadmany <hkadmany@codeaurora.org>
qseecom: Fix return path of qseecom load app if app exists

Fixes the issue during the return path of qseecom load_app. If
the application is already up and running then second time load
app should return with proper error. During this process SFAB
disable clock vote is missed, which might create problem. So
this patch adds the appropriate disable call for the SFAB clock
which fixes the issue.

Change-Id: I744a923f7e08fea85ef5bada5538f1a28c52e4e7
CRs-fixed: 498153
Signed-off-by: AnilKumar Chimata <anilc@codeaurora.org>
qseecom: Fix issues in the return path of load external elf

Fixes the issues during the return path of qseecom load external
elf function. Improper return paths are present during the error
handling cases. Wrong goto calls results in unwanted code clean-ups
which might create problems. This patch corrects the return paths
during the error cases.

Change-Id: Icd526448e7be355acb438fff600e3e85664f75f5
CRs-fixed: 498153
Signed-off-by: AnilKumar Chimata <anilc@codeaurora.org>
qseecom: enable ce1 clock when sending RPMB service response to tz

TZ need to do authentication when provisioning RPMB key on secure device,
which requires accessing crypto HW. Hence, the CE clks needs to be enabled
by qseecom prior to sending RPMB response to tz.

Change-Id: I73e3844e758ebddd57639a6d477299fe306bb538
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
qseecom: Ensure incoming "app_name" does not corrupt the kernel stack

Printing a string with that does not have null terminated character,
would lead to overflow, as the print continues until it finds a null
terminated character.
Avoid this issue by explicitly assigning a string with null termination.

Change-Id: I9528db2ba046c514d829097d08c09540588bb1a2
Signed-off-by: Hariprasad Dhalinarasimha <hnamgund@codeaurora.org>
Signed-off-by: Ajay Dudani <adudani@codeaurora.org>
qseecom: Change __copy_from_user to copy_from_user

__copy_from_user does not do address check, so use
copy_from_user instead.

Change-Id: I575c0f3c44b55a521c0d42828988c518c0640a29
Signed-off-by: Hariprasad Dhalinarasimha <hnamgund@codeaurora.org>
Signed-off-by: Ajay Dudani <adudani@codeaurora.org>