The tspp driver keeps a list of all the buffers and their current
state. When interrupt occurs to signal new data is available some
buffers state is updated. tspp_get_buffer and tspp_release_buffer
also change the state of buffers. This change adds locking in these
functions to protect against concurrent update which may lead to
an invalid state.
Change-Id: I6331a49bcd0a57e6b9ef8c3860bf8ca9d0e0190b
Signed-off-by: Gilad Broner <gbroner@codeaurora.org>
qseecom.cumulative_mode is used to track the cummulative bus request
mode from all concurrent running clients. It is registered before
send_cmd operation, but is not un-registered after it is complete.
This may cause the bus bandwidth is restored to a wrong mode after
resuming from sleep. Thus, we make change to update it accordingly.
qseecom.current_mode is also updated in suspend/resume function to
ensure timer can scale down bus bw after resume when cumulative_mode
is non-zero. Besides, timer operation is optimized in case there are
multiple unserialized concurrent users of the same timer.
Change-Id: I06043d2b88a47e24da03460fe1ae26a94cb6a608
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
When there are multiple running qseecom clients, ce clock may be disabled
by one client while TZ is still loading another client's app, which will
lead to load app failure. So, we make a change to register bus bandwidth
mode before loading app and avoid to disable clock when current bandwidth
mode is not INACTIVE.
Change-Id: I1727f6fc038baf95da39089e1f0faefe42f3d40c
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
Check for return value of "ion_phys" and handle
the error cases appropriately.
Change-Id: Ib4f24af24de2b2553ed91479f46b2f79e0be0446
Signed-off-by: Hariprasad Dhalinarasimha <hnamgund@codeaurora.org>
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
Set the physical address field of load_req data struct
correctly using the right ion_phys API. Without this,
secure domain is not able to address/dereference memory
where cmnlib image resides.
Change-Id: I9f75e78227e4eee89fff9ad8b19701ff08e5d90a
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
Allocate memory to common lib through kzalloc issues no page errors due to
higher order memory request. So allocate the memory from the heap specially
dedicated to QSEECOM.
Change-Id: Ice4a609d6791ce5adc84b9882231def31674f461
Signed-off-by: AnilKumar Chimata <anilc@codeaurora.org>
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
Reserving the IRQs on driver initialization is redundant and should
be done only when client first uses the driver. Also, it may prevent
transition to power saving modes.
Move IRQ requests to be done when first stream is opened, and free
when last stream is closed.
Change-Id: Ifdb7099139f5eb775fcdd61dc0eece5c9959a050
Signed-off-by: Gilad Broner <gbroner@codeaurora.org>
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>
(cherry picked from commit f12641d6733009c4cd502d3ba25cb3c5d61ab5e2)
Upon receiving qseecom_release() app corresponding to the app id
needs to be shutdown.This is applicable to user space clients as well.
Change-Id: Ie659a9409f8470b7ed4a5088e6779b50c5dc1cca
Signed-off-by: Hariprasad Dhalinarasimha <hnamgund@codeaurora.org>
(cherry picked from commit 1e34cdd714219a4cd0acb3d5b3dfe4280c380699)
Validate cmd_req_buf pointer offset in qseecom_send_modfy_cmd, and
make sure cmd buffer address to be within shared bufffer.
Change-Id: I431511a92ab2cccbc2daebc0cf76cc3872689a97
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
The maximum bus bandwidth mode supported by bus bandwidth setting
function is 3 (i.e., HIGH), then to scale up bus bandwidth based on
cumulative mode may prevent us from updating the bus bandwidth
correctly when cumulative mode is greater than 3 (which is the case
if there are concurrent applications running). Thus, we made a
change to scale up bus bandwidth mode to at most 3 in qseecom
resume function.
Change-Id: I3ec6eedace2fa2ea7de519df307c3ff9b193c910
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
Make a KMS change to support just clear pipe key without deleting it
from ssd storage. Key id definitions for FDE and PDE are also updated.
Change-Id: I7c4804902a7a734087374c81ff0fd95655d84429
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
Add checks for PFE/FDE feature before executing anything
related to the feature.
Change-Id: I575d4d4eea29fd9ae59e47805793f2416a97f5b9
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
Add key management support for crypto HW used for
PFE (per file encryption) features.
Change-Id: Ic0664973d9a4099f76d7b3040f0f81df8465cf71
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
clk access ref count is not updated correctly when issuing a
request that requires enabling clk. this results in leaving the
clk on during regular operation resulting in failure of the
device to go into low power mode.
Change-Id: I80232433ff09277fe83d78142dcec75e7493d96e
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
To ensure ce clock is not disabled before tz operation is completed,
we delete the old timer when tz side operation begins, and then add
a new timer after tz operation is completed.
Change-Id: I4bc8fe3d9305cc1ed5db8e6490832fcc791ef3d7
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
Fix potential integer overflow for ioctl command to avoid incorrect
buffer allocation. Use the stack for data buffering to avoid the
small buffer allocation for improved performance. Increase the fuse
blow timeout in the driver to cover all QFPROM implementations.
CRs-Fixed: 550574,550575
Change-Id: Iee3cc1d38aa5dbf8ef693a43a0ca716fc8724c62
Acked-by: Radhakrishna Popuri <c_rpopur@qti.qualcomm.com>
Signed-off-by: Venkatesh Yadav Abbarapu <quicvenkat@codeaurora.org>
Signed-off-by: Gopal G Goberu <ggober@codeaurora.org>
Do a "IS_ERR_OR_NULL" check for the return value of
ion_import_dma_buf.
Change-Id: Iaac8b59b1f076d002430e0e6aba055bd88c83ed7
Signed-off-by: Hariprasad Dhalinarasimha <hnamgund@codeaurora.org>
Pass the device node with of_node to clk_get(), to get the clock struct.
This patch fixes the issue by passing proper device handle with of_node
to clock APIs to get the appropriate clock node.
Change-Id: I01a2caf7d86a4399b1bb4a455ef8ecbbad5ad9a2
Signed-off-by: AnilKumar Chimata <anilc@codeaurora.org>
The SMSC 3502 HUB has only one USB UICC port. "VBAT only" single
supply configuration is used. A gpio is used to control the
external oscillator which supplies the ref clock to the HUB. USB
UICC card is connected to this HUB on MSM8926. Provide a sysfs
interface for userspace to enable/disable the HUB. This is
required to save the power when a non-supported card is inserted.
The HUB is disabled during boot. If the card is inserted and supports
UICC, HUB is enabled by the userspace.
Change-Id: Ic2b0c5bd2066a2ecae7f18aac2ab8d0bc2f075c0
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
When model-id is passed as 0, interpret it as standalone HSIC
configuration. Add HSIC platform device and don't look for HUB
resources. This is required to support both stand alone and HUB
configurations on different boards based on the same SoC.
Change-Id: Iec081799048dd93ece1472d95a7e1c27f91fb9b9
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Add the missing documentation for some device tree properties. Fix
the regulator supply naming convention. The hub-vbus supply is
optional. Don't call regualtor_get on this supply unconditionally.
This leads to unnecessary multiple probe deferrals.
Change-Id: I866bfb9d87ad274030b7997461e89c6bc42f6d98
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
To ensure ce clock is not disabled before tz operation is completed,
we delete the old timer when tz side operation begins, and then add
a new timer after tz operation is completed.
Change-Id: I4bc8fe3d9305cc1ed5db8e6490832fcc790ef3d7
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
When there are multiple enable/dislable clock operations, ce clock
ref count is not updated correctly when the timer to disable clock
is running. Specifically, the ref count is not decreased when the
old operation is finished and then we reset clock for the new enable
clock. Thus, the ce clock is not disabled after all operation are
completed due to incorrect clk ref count. We make a change to
decrease clock reference count before reset timer, when the timer
is running, then clock is disabled when all ce clock operations
finish and the timer expires.
Change-Id: If71fd526acd9a74bf21731841fae0b98e76a89b5
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
Return -EINVAL if virtual addr of shared buffer is NULL or
shared buffer length is 0
Change-Id: I44369bf12ddafa63b71ee54496eb86b2615d4322
Signed-off-by: Hariprasad Dhalinarasimha <hnamgund@codeaurora.org>
Change warning message to debug message to reduce the excessive logging.
These changes are applicable only if any process is trying to interrupt
the blocking listener services.
Change-Id: Ie1c9af0daf16ef2c39e198f30b0151e2246d79e3
Signed-off-by: AnilKumar Chimata <anilc@codeaurora.org>
Signed-off-by: Hariprasad Dhalinarasimha <hnamgund@codeaurora.org>
If ce clock is not disabled in suspend state, memory may be corrupted and
device can not wake up. Thus,if clock is enabled, we disable it in qseecom
suspend function and re-enable it again in resume function.
Change-Id: I70349ad3070c340add1f3fbe392a4bec2b8af9bf
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
Remove 2 seconds sleep if create_key or update_key fails, and
this delay is now handled by TZ. change errno when maximum
attempt to input password is reached.
Change-Id: I14350219f43094d280ebc1e3717418285063448d
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
Overdrive enablement bit sits at 6th bit of control register 0.
Current shifting overwrites overdrive high bit.
Change-Id: I4cdd435da86a234ccf0465462be7626162cc8a9d
Signed-off-by: Chun Zhang <chunz@codeaurora.org>
With the new ION design all memory allocated from secure heaps is
secured already at allocation time. This commit effectively rolls
back a change introduced to secure this memory at runtime.
Change-Id: I94bf0a7f6d477b04da7ad6786111f8c970516842
Acked-by: Christian Bolis <cbolis@qti.qualcomm.com>
Signed-off-by: Hariprasad Dhalinarasimha <hnamgund@codeaurora.org>
Add support for scaling bus to various level:
LOW, MEDIUM, HIGH. Expose IOCTL to user space
clients to enable selecting a specific bus bandwidth
setting.
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
Validate pointers send from user space and pointers
embedded within the mesasge sent from user space.
Change-Id: I1be54924ef3d301908af6e8d4e6506f2aa7f6428
Signed-off-by: Mona Hossain <mhossain@codeaurora.org>
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
The mechanism to update how a user is tied to an existing key is
added. And the app_access_lock mutex is removed in key management
APIs, as there is no need to lock app access while processing a
key related request.
Signed-off-by: Zhen Kong <zkong@codeaurora.org>