提交線圖

30 次程式碼提交

作者 SHA1 備註 日期
Om Prakash Singh
dd578986f7 qcedev: fix qcedev_async_req status update in req_done
Issue:
  qcedev_async_req status is updated after sending complete signal
  that makes qcedev_ioctl exit and freed the memory.

Fix:
  update qcedev_async_req status before sending complete signal.

Change-Id: I6c224b4775b8860c1c50f9a1f9e3705a6ca76e34
Signed-off-by: Om Prakash Singh <quic_omprsing@quicinc.com>
(cherry picked from commit 582cf8006a08f459573a30821270d72fd8788b15)
2024-02-29 03:51:58 -08:00
Daniel Perez-Zoghbi
fd37da76a2 qcedev: Increase offload timeout
In an offload crypto operation there are some expected errors, e.g.
KeyPauseError. We have a shortened wait time to capture these errors,
however the current wait time of 20ms was too short and some valid
operations were timing out just before the request is completed, causing
a race condition. Here we change to 50ms as a normal operation should
not take this long. Calculated by 8 requests submitted * 4MB (max size)
at about 5Gbps processing rate. This is a conservative estimate.

Change-Id: I5bccd81ca3dda9d4fca1f302b7961dbdb22f9f58
Signed-off-by: Daniel Perez-Zoghbi <quic_dperezzo@quicinc.com>
2024-02-06 00:12:10 -08:00
Gaurav Kashyap
154b6011b0 securemsm-kernel: enable non-qtee modules
Fix compilation issues and enable all modules bound
by TARGET_KERNEL_DLKM_SECURE_MSM_OVERRIDE.

Change-Id: Id8e2d5ecb580d5fd200fe5e5e899202046136976
Signed-off-by: Gaurav Kashyap <quic_gaurkash@quicinc.com>
2023-10-04 11:50:16 -07:00
qctecmdr
1a392c58fd Merge "qcedev: Fix null-ptr-deref in qcedev_cipher_req_cb" 2023-09-13 14:20:49 -07:00
Udit Tiwari
48d10387ac qcedev: Fix null-ptr-deref in qcedev_cipher_req_cb
adding missing NULL check for qcedev_areq in
qcedev_offload_cipher_req_cb and qcedev_cipher_req_cb.

Change-Id: Ibbb037b12b1c6264376fe1f3185bd0b392447a65
Signed-off-by: Udit Tiwari <quic_utiwari@quicinc.com>
2023-08-31 13:02:53 +05:30
Udit Tiwari
f214d2e6b8 securemsm-kernel: remove qcedev_compat support
cleanup qcedev_compat driver support that is not
needed on latest Qualcomm Technologies, Inc. plateforms.

Change-Id: Id61e06a5a3cc1b3e9474c328f26761ffda9a55e0
Signed-off-by: Udit Tiwari <quic_utiwari@quicinc.com>
2023-08-17 21:29:26 -07:00
Gaurav Kashyap
de989fe1a3 qcedev: support for additional offload pipes
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>
2023-06-08 11:34:25 -07:00
Gaurav Kashyap
e0e07de5fd qcedev: check crypto status before unlocking
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>
2023-06-06 10:17:16 -07:00
Gaurav Kashyap
ed0eab9c68 sec-kernel: move uapi securemsm headers to uapi path
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>
2023-06-05 09:47:37 -07:00
Gaurav Kashyap
33d4df25bc qcedev: increase timeout for non-offload requests
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>
2023-05-23 15:24:15 -07:00
Gaurav Kashyap
46f6032141 securemsm-kernel: qcedev & qrng bazel support
Support to build qcedev and qrng modules using
Bazel.

Change-Id: I4411d208f294cdc014280d4da1a211b72d862d53
Signed-off-by: Gaurav Kashyap <quic_gaurkash@quicinc.com>
2023-04-10 11:10:55 -07:00
Gaurav Kashyap
53d80a5fca qcedev: vote for crypto clocks during module close
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>
2023-03-14 11:49:05 -07:00
Gaurav Kashyap
17a1e87fc9 qcedev: Port missing 13.1 changes to 14.0.
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>
2023-02-01 13:00:22 -08:00
Gaurav Kashyap
8f021039d5 qcedev: ensure sequential req_done on error
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>
2023-01-22 15:12:46 -08:00
Gaurav Kashyap
4416896a16 qcedev: better error handling for crypto requests
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>
2023-01-09 10:52:55 -08:00
Gaurav Kashyap
9dd79a02a6 qcedev: replace ksize with buffer sizes
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>
2022-10-28 09:14:20 -07:00
Smita Ghosh
0f28e48cbc secure-kernel: Add support for 5.15 kernel
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>
2022-10-07 14:33:11 -07:00
Gaurav Kashyap
bbca708384 qcedev: hold spinlock while managing crypto errors.
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>
2022-08-25 22:18:49 -07:00
Gaurav Kashyap
94990a445d qcedev: check num_fds during unmap
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>
2022-08-15 17:19:49 -07:00
Gaurav Kashyap
795df801dd qcedev: concurrency support in crypto driver
Support to have multiple qcedev requests at a time in
the driver.

Change-Id: I2ba8f22e2b659db04db348dfa3b06b70bf234d0b
Signed-off-by: Gaurav Kashyap <quic_gaurkash@quicinc.com>
2022-08-01 09:17:50 -07:00
Gaurav Kashyap
79b3d0e377 qcedev: vote for clocks based on dts values
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>
2022-07-18 08:10:30 -07:00
Gaurav Kashyap
63658ee1fd qcedev: reduce wait timeout for crypto operations
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>
2022-07-05 10:47:15 -07:00
Gaurav Kashyap
cc0d815923 qce: changes for non offload usecases
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
2022-06-13 14:54:22 -07:00
Gaurav Kashyap
c7859ce020 qce: add null pointer checks and correct return vals
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
2022-06-10 15:14:11 -07:00
Gaurav Kashyap
ab140f0f11 qce: stability and performance improvements
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
2022-06-07 17:36:18 -07:00
Gaurav Kashyap
3f33efa2c9 qcedev: assign pattern info correctly
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
2022-05-26 12:29:47 -07:00
Gaurav Kashyap
64e85a3b4a qcedev: add gpce key pause error conditions
Add support in the qcedev driver to detect KEY_PAUSE
error conditions and report accordingly to userspace.

Change-Id: Id7bbde02ca4d08917bcf21d6f62e21f3c71abc7b
2022-04-14 22:19:06 -07:00
Gaurav Kashyap
48af421629 qcedev compilation fix
Change-Id: Ib1c531b002faa1bcdc5ab306f629bb1702787a46
2022-04-13 23:37:50 -07:00
Gaurav Kashyap
31f097f988 crypto-qti: qcedev: add support for hlos offload path
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
2022-04-13 21:25:06 -07:00
Smita Ghosh
e190b86556 secuemsm-kernel : Enable DLKM's from vendor
SSG's kernel modules will be loaded through userspace
init instead of kernel.

Change-Id: Ibf88a6a56df65a933d451d39136060967595e5b7
2021-12-14 12:52:18 -08:00