Add support for two additional offload pipes.
1 new HLOS_HLOS pipes.
1 new HLOS_CPB pipe.
Change-Id: Ia9acf3cbdf9c1f148dbddc9426d51ade0d26ff75
Signed-off-by: Gaurav Kashyap <quic_gaurkash@quicinc.com>
Whenever there is a crypto error, the pipe is reset which
in turn resets the crypto core. When the pipe is reset wait
for it to complete by monitoring the crypto status.
Change-Id: Id79838e517df491b8062ec379baff2407fea500c
Signed-off-by: Gaurav Kashyap <quic_gaurkash@quicinc.com>
Move the securemsm-kernel uapi headers to a uapi include path,
to conform with the uapi requirements.
NOTE: Duplicating qcedev.h & smcinvoke.h temporarily until
clients that manually include the path use the exported headers.
Change-Id: I33d390954ff0e6c721a5fa8256b431020e4f8912
Signed-off-by: Gaurav Kashyap <quic_gaurkash@quicinc.com>
Increase the wait timeout for non-offload requests as
there are no expected failures such as timer or pause
events like in the offload pipes. This way, corner case
race scenarios are avoided.
Change-Id: I0be3a3d1807710bb8f0427f88bfee9144591a685
Signed-off-by: Gaurav Kashyap <quic_gaurkash@quicinc.com>
Support to build qcedev and qrng modules using
Bazel.
Change-Id: I4411d208f294cdc014280d4da1a211b72d862d53
Signed-off-by: Gaurav Kashyap <quic_gaurkash@quicinc.com>
When qcedev module is exiting, it disconnects SPS.
At this times, crypto clocks need to be turned on
or it will cause a synchronous abort.
Tests: rmmod on the qcedev module.
Change-Id: I1721fe408392ef81b07a6c08d2196b2413ba2b2f
Signed-off-by: Gaurav Kashyap <quic_gaurkash@quicinc.com>
qcedev: enable/disable bam irqs during clocks
qcedev: fix null pointer dereference in qcedev_release
qcedev: delete request from list if it gets timed out
qcedev: Fix for some coding errors
Test: OEMCrypto tests.
Change-Id: I3c97890963b113d8287f9159adcd192f7be9790f
Signed-off-by: Gaurav Kashyap <quic_gaurkash@quicinc.com>
req_done is usually scheduled on success scenarios as
it needs to wakeup the sleep thread. However, in the
scenario where sleep has timed out, there is nothing to
wake up, and req_done can be called sequentially instead
of scheduling it (which might cause use after free).
Test: OEMCrypto tests.
Change-Id: I296076fcb43d91d16b00f08819dca45bd9049198
Signed-off-by: Gaurav Kashyap <quic_gaurkash@quicinc.com>
Handle crypto errors and timeouts better leaving room
for lesser sync issues (especially during timeouts).
Also, support the crypto status changes in the v5.8
CE engine.
Tests: oemcrypto tests on pineapple.
Change-Id: I8d381c9a2b80853260bc779afbea58ae600bccaf
Signed-off-by: Gaurav Kashyap <quic_gaurkash@quicinc.com>
Using ksize to calculate buffer sizes during memset
is causing buffer overflows due to incorrect
calculations, replace this to directly use malloced
buffer sizes.
Change-Id: I9bfdfb63022ddd18a7f39450dc96b363fb4d20c3
Signed-off-by: Gaurav Kashyap <quic_gaurkash@quicinc.com>
Add following changes.
Fix switch case
latest compiler throwing error where CASE statement does
not have break or return under all the execution paths.
Rename size_add to size_add_
There is a name collision between this one and one coming from
overflow.h. Hence renaming it.
Modify IRQ handling for qce50 module
Change PDE_DATA to pde_data
Signed-off-by: Smita Ghosh <quic_smitag@quicinc.com>
Change-Id: I4226fb41df12273b45d2e114f1aad2709dc36eb7
Signed-off-by: Smita Ghosh <quic_smitag@quicinc.com>
Currently, there is no lock held when doing crypto
housekeeping when a timeout occurs. Use a lock in this
scenario to avoid concurrent scenario timing errors.
Change-Id: I60c243e0dfde5a716df772177ab4cd75d9b5b7cc
Signed-off-by: Gaurav Kashyap <quic_gaurkash@quicinc.com>
check the num_fds passed into unmap buf ioctl,
or else it can lead to an out of bounds access.
Change-Id: Ief209a60a6b7dc1ea4be485eaf5cf51d2955a980
Signed-off-by: Gaurav Kashyap <quic_gaurkash@quicinc.com>
Support to have multiple qcedev requests at a time in
the driver.
Change-Id: I2ba8f22e2b659db04db348dfa3b06b70bf234d0b
Signed-off-by: Gaurav Kashyap <quic_gaurkash@quicinc.com>
Use DTSI values to vote for clocks instead of using
fixed values. This enables to vote for crypto clocks
on a per target basis.
Change-Id: I05c9e55f4aa0ec876903f1963f859ecf1fc929ab
Signed-off-by: Gaurav Kashyap <quic_gaurkash@quicinc.com>
Current wait times for crypto is too high which might cause
concurerency issues for other EEs. Reduce this to what is
required.
Also, reset the offload error for every new IOCTL call.
Change-Id: I43dd2e59e3f30706c87cdc4f633d8132dc8410c9
Signed-off-by: Gaurav Kashyap <quic_gaurkash@quicinc.com>
With the offload implementation, there are a couple of issues
for non-offload usecases.
1. Set config and offload op parameters correctly for non-cipher
usecases.
2. Due to default wait value, there is a crypto operation irrespective
of previous errors, fix that.
Change-Id: Idba55b3603349b7ad831eccd6ee25c98b1df5de6
1. Currently, each request api sometimes returns 0 even
when an error has occured. This will result in unecessary
crypto requests when failures are expected.
2. The request callback handlers does not check handles to
be NULL before accessing. Fix to add NULL handling.
Change-Id: Ia44e353bdb75434dfbc0e3ec0582abc0208be6a7
1. There is no need to vote for high bandwidth for every
ioctl operation, Instead, vote only when a new device
node is opened (which translates to a new session from
a userspace point of view).
2. Fix the way BAM pipes are reset when there is a crypto
operation by initializing it correctly through the SPS
BAM framework.
3. Checking crypto status for every request is performance
heavy. Remove these checks and read status only on
error conditions.
Change-Id: Ibb3607ecb6919f563b00a9a8cd6f5440a8c3940a
When non-pattern tests are run after pattern tests, there is
stale data from previous tests that never get erased, which
depending on crypto behavior might cause decrypt discrepancies.
Make the change to correctly set the pattern info to the
command descriptors.
Also, convert all debug logs to pr_info to avoid flooding serial
when QCE_DEBUG is enabled.
Change-Id: Ib84f4025263c622d6e51a47fc147856049bd75d4
Add support in the qcedev driver to detect KEY_PAUSE
error conditions and report accordingly to userspace.
Change-Id: Id7bbde02ca4d08917bcf21d6f62e21f3c71abc7b
Add support for HLOS offload data path in the qcedev driver
mainly to support DRM and HDCP usecases.
Changes extend the current driver to support the following.
- Register multiple pipes for different offload usecases.
- Report timer expiry errors back to userspace.
- Support different iv CTR sizes based on userspace input.
- Support new IOCTLS to support encryption, decryption and
copy offload usecases for DRM and HDCP.
Change-Id: Ie9b74c173d0afd7b8c863ed57a68ec6e74baa9b4