Commit Graph

131 Commitit

Tekijä SHA1 Viesti Päivämäärä
Nitin LNU
b87455c99c securemsm-kernel: smcinvoke: Call object release sync once before adding to queue
call release tz object in sync manner
only in case of EBUSY add
object in to post process list, so that we can retry
and process it later in a seprate kthread.

Change-Id: I2158b3faa5c41d2f10ed532c50c9c6b113961c57
2023-02-28 03:11:03 -08:00
qctecmdr
9b418d37e6 Merge "securemsm-kernel: Meet external module dependency with bazel" 2023-02-27 17:06:47 -08:00
Smita Ghosh
d45cf2d3bf securemsm-kernel: Meet external module dependency with bazel
Make required changes to satisfy external module dependency.
This gives flexibilty for external modules to include
*.h
linux/*.h

Change-Id: I68c5a5842f84622b85da0056f998775f89e6eebf
2023-02-24 14:44:34 -08:00
Indranil Pradhan
af72396c96 sec-kernel:Removed name from log message.
Removed name from log message
Test:Compiled and boot up tested.

Change-Id: Ia5c21710a63bb2e461259cf07951c579c3c95bee
Signed-off-by: Indranil Pradhan <quic_ipradhan@quicinc.com>
2023-02-24 08:48:26 -08:00
qctecmdr
e5d8b50bfd Merge "smcinvoke: ADCI methods call on rootEnv" 2023-02-22 08:33:06 -08:00
Pawan Rai
d0ede8a88c smcinvoke: ADCI methods call on rootEnv
Change adci methods call on rootEnv from clientEnv as per
QTEE implementation.

Change-Id: Ib1ca4312844f6f3dedbfb639e5b83f71d97ecc68
2023-02-22 10:49:11 +05:30
qctecmdr
05197c5c16 Merge "securemsm: Add support for Bazel/Kleaf" 2023-02-17 09:43:39 -08:00
qctecmdr
ef1d604ba1 Merge "securemsm-kernel: Add the base SMMU proxy driver" 2023-02-16 12:09:40 -08:00
qctecmdr
d6fffd66ea Merge "securemsm-kernel: Add the UAPI headers for the SMMU proxy driver" 2023-02-16 10:42:42 -08:00
Smita Ghosh
3c9e16a3e9 securemsm: Add support for Bazel/Kleaf
Steps to test

1. Create symlink
    cd kernel_platform
    mkdir techpacks
    cd techpacks
    mkdir securemsm-kernel
    cd securemsm-kernel
    ln /vendor/qcom/open-source/securemsm-kernel/* .

2. To compile

    cd kernel_platfrom

    tools/bazel run  --lto=thin //techpacks/securemsm-kernel:pineapple_consolidate_securemsm-kernel_dist

3. Test done:

   Able to compile smcinvoke/tz_log/qseecom DLKM and able to install it
   at
   out/target/product/<target>/dlkm/lib/modules

Change-Id: I8258a1351281a0acb05a2e909bbc421d576b4ee0
2023-02-16 09:23:37 -08:00
Manjunatha Madana
4924ac3c04 securemsm-kernel:Fix Compilation errors for Android U Auto gen3
Test : Tested build compilation.

Change-Id: I3640f42467fbfb6fa1b139974654f20d9b1b9f48
2023-02-07 00:30:34 -08:00
Chris Goldsworthy
e9c5417cdd securemsm-kernel: Add the base SMMU proxy driver
Add the base of the SMMU proxy driver for Android. The proxy driver
will take memory from the PVM, share it with the TVM and map it into
an S1 context bank on the TVM, before returning an IOVA for the mapped
buffer.

This patch intended to create the driver to allow other kenrel modules
to compile against it.

Change-Id: Id2951fbf467fcce0a3f1a1c45eba5b041f76f080
Signed-off-by: Chris Goldsworthy <quic_cgoldswo@quicinc.com>
2023-02-02 17:43:53 -08:00
Chris Goldsworthy
08b1eb82e2 securemsm-kernel: Add the UAPI headers for the SMMU proxy driver
Add the UAPI headers for the SMMU proxy driver and make them usable in
Android.

Change-Id: Ibea130d79631f4d973e957a43dffde27fc472035
Signed-off-by: Chris Goldsworthy <quic_cgoldswo@quicinc.com>
2023-02-02 17:41:37 -08: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
Pawan Rai
ca9f562c5a smcinvoke: adci interface adaptation as per QTEE
Adapted the latest IClientEnv adci and other
interface methods from QTEE.
Change-Id: I05730e56d656977fbc53a2d3dedb04426474be1c
2023-01-29 10:58:20 -08:00
qctecmdr
703d2a9e9d Merge "qcedev: ensure sequential req_done on error" 2023-01-27 11:50:36 -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
Anmolpreet Kaur
1177b17bdb smcinvoke: Handle suspend and resume issues in smcinvoke driver
This change makes changes to smcinvoke driver to handle suspend and resume
scenarios. If the accept thread gets interrupted, do not set the server state
as defunct if the thread is in freezing state, i.e. if the thread is going in
suspend. In such cases, increase timeout of that server so that invoke thread
waits indefinitely for response from userspace until the system resumes back.

Tests:
1. Stability testing has been done on kalama.
2. smcinvoke vendor client testing is done on pineapple.

Change-Id: Iaa7b91d6ed484305349c04468263919e26a3316d
Signed-off-by: Anmolpreet Kaur <quic_anmolpre@quicinc.com>
2023-01-18 17:10:02 +05:30
Reut Zysman
a7350ce560 SMCInvoke: memory object optimization
Add support for map objects to be written into the async
side channel rather than have to be explicitly asked for
by QTEE.

Change-Id: Ia1c56555dc3a6422f4fb448f94f73fef661ac89d
Signed-off-by: Reut Zysman <quic_rzysman@quicinc.com>
2023-01-12 08:48:09 -08:00
Amirreza Zarrabi
e354297278 smcinvoke: remove global lock around the call to QTEE.
Change-Id: I741c44fce96e168e69eb4ee9d3ca5081ee6af89b
Signed-off-by: Amirreza Zarrabi <quic_azarrabi@quicinc.com>
2023-01-10 16:04:51 -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
Pawan Rai
ef2c3ba718 smcinvoke: ADCI changes for SMCInvoke Driver
Change consists creation of ADCI thread at SMCInvoke
driver initialization

 Change consists creation of ADCI thread at SMCInvoke driver initialization
 Following scenario have been tested for this change
  (1) ADCI thread creation and QTEE invocation during driver initialization
  (2) Backward Compatibility - IF ADCI feature is not supported (OBJECT_ERROR_INVALID)
        then exit the ADCI thread gracefully after cleaning up all the resources
  (3) Leak Test: All the resources held by ADCI thread should be released if ADCI feature
      is not supported by QTEE
      (i) adci task_struct state and exit state:
            state =  TASK_RUNNING , exit_state = 0 (While ADCI thread execution)
            state =  TASK_DEAD , exit_state = EXIT_DEAD (During ADCI thread termination)
     (ii) adci task_struct = NULL (fetched based on adci thread_id) which make sure
             task_struct has been deallocated
  (4) SMCInvoke related Test: All the internal(suuported),memobj and cbo testing has been performed.

Change-Id: I2916ce260fae293b88fbc8b9d24baccdee1ea89f
Signed-off-by: Pawan Rai <quic_pawarai@quicinc.com>
2023-01-09 00:50:26 -08:00
Ashish Pratap Singh Bhadoria
4ed6950035 smcinvoke: Avoid marshalling user args if Callback invocation fails.
Avoid marshalling user args in kernel driver if the corresponding CallBack
invocation fails in userspace.

Change-Id: I1dc5ca562c5a67e1ac2273a1ff2a854f2010c1d3
2023-01-08 22:10:20 -08:00
Ashish Pratap Singh Bhadoria
6d3f76fb88 smcinvoke: Flush cache contents before invalidating
during smcinvoke callback response handling.

Add Cache flush before invalidating out_buf during cb
response handling in smcinvoke driver.

Change-Id: I68b70c078675f1841690c93048cbba3589a388f3
2022-12-23 02:28:27 -08:00
Anmolpreet Kaur
d5c0b30e00 smcinvoke: Wait for new requests in case of invalid cbtxn
In case the accept thread has invalid cbtxn, start waiting
for new requests instead of going to userspace and then coming
back.

Change-Id: I2cce16ebb0481d184fed636a559e73adaacdcf0f
Signed-off-by: Anmolpreet Kaur <quic_anmolpre@quicinc.com>
2022-12-22 10:32:17 -08:00
qctecmdr
2fd3c58e76 Merge "securemsm-kernel: exposing smcinvoke headers" 2022-12-20 22:39:35 -08:00
qctecmdr
08a6ab5aef Merge "Remove private iommu/dma header" 2022-12-20 21:50:37 -08:00
Spencer Willett
9cd99dbb79 securemsm-kernel: exposing smcinvoke headers
We are exposing headers present in "include/linux" for the rest of the kernel DLKM's.
Aallow other kernel teams to access these headers.

Change-Id: I19c5591d885c7042ba3acd312ce9cb2bddc995c9
CRS-Fixed: 3338788
2022-12-16 19:07:58 -08:00
jianzhou
30c349cfd4 Remove private iommu/dma header
iommu/dma header was made to be private, need to remove it.

Change-Id: Ibf2f0dfcec7c0c771d28c4022b47a108c8b6694a
2022-12-13 06:30:28 -08:00
Anmolpreet Kaur
8456ddc256 securemsm-kernel: Add support for qseecom proxy module
A new module named qseecom_proxy has been defined in kernel
which acts as a forwarder for calls received from kernel clients
of qseecom and smcinvoke. This change adds the support for calling
that module from the vendor dlkm modules smcinvoke and qseecom.

Change-Id: I0d1aa93b9cea9e6a6e1fee17c33c78e14deb8ecf
Signed-off-by: Anmolpreet Kaur <quic_anmolpre@quicinc.com>
2022-12-09 03:56:15 +05:30
Sheik Anwar Shabic Y
32a90722f5 securemsm-kernel: Resolved NULL pointer dereference in hdcp driver
Hdcp2p2 TA handle is getting accessed after freed in hdcp_stop_command
which is causing device crash while running hdcp2p2 use cases. So avoided
hdcp handle access after hdcp_stop call.

Change-Id: I8dc08451e51077b4f3ab086bb0c878d5df4f7f58
2022-12-08 15:40:47 +05:30
qctecmdr
77a5daed43 Merge "Revert "securemsm-kernel: exposing smcinvoke headers"" 2022-12-06 14:18:38 -08:00
Spencer Willett
a785a207a2 Revert "securemsm-kernel: exposing smcinvoke headers"
This reverts commit 796ae71391.

This commit is being reverted due to build conflicts
with other teams

CRS-Fixed: 3354563

Change-Id: I915cc5bd0e718a1b82641ac02d2f0184f2fa1f37
2022-12-06 13:38:24 -08:00
Anmolpreet Kaur
b38291450d smcinvoke: Make memory objects release inline with callback objects
Release memory object from userspace when a call to release comes in
kernel to prevent the memory leaks in the cases where mem objects
are passed as a response inside a callback call.

Change-Id: I5ce57b6be90e71e255a890895d5f2859312ba1e4
Signed-off-by: Anmolpreet Kaur <quic_anmolpre@quicinc.com>
2022-11-29 12:51:24 -08:00
qctecmdr
399c8f65d0 Merge "securemsm-kernel: exposing smcinvoke headers" 2022-11-23 20:54:37 -08:00
Spencer Willett
796ae71391 securemsm-kernel: exposing smcinvoke headers
We are exposing headers present in "include/linux" for the rest of the kernel DLKM's.
These changes allow for other kernel teams to access these headers.

CRS-Fixed: 3338788

Change-Id: I5926ddeee8541398b32010db0b01af529b19fa3e
2022-11-23 09:49:37 -08:00
Smita Ghosh
111af59f67 smcinvoke: update process_tzcb_req to be more responsive
1. While waiting for callback response instead of waiting uninterruptibly for
  1sec split wait timeout to 100ms and increase number of retries to 50.

2. If a wait is interrupted due to signal, continue to wait if callback server
   is in a good state.

Change-Id: I15faf27ebdb98e2df4a0c75695643a611ad9889d
2022-11-23 09:09:12 -08:00
Spencer Willett
01bb45918b securemsm-kernel : expose ITrustedCameraDriver header file
expose ITrustedCameraDriver header file to camera so that
camera kernel driver can trigger protect/unprotect call.

CRS-Fixed: 3343680

Change-Id: I011f17a93f9d7c32140835406488def34429f983
2022-11-22 15:09:19 -08:00
Gaurav Kashyap
ecc83d4090 Revert "securemsm-kernel: Disable crypto driver"
This reverts commit 5e668ad0274363663328f06b3b272802178ed175.

Change-Id: I28838e318db59bb60473f18b88cb2ad03fcf6d16
Signed-off-by: Gaurav Kashyap <quic_gaurkash@quicinc.com>
2022-11-21 09:21:52 -08:00
Smita Ghosh
5233220e29 smcinvoke: Fix compilation error
With Bazel some of the warnings are now error.

Change-Id: Ie195c8bc993dce27cf5f2353a8965605ac50ae72
2022-11-16 09:09:05 -08:00
Smita Ghosh
81cf72e4ab smcinvoke: Print retry_count value
This is important to estimate how long each clients are waiting
for secure side.

Signed-off-by: Smita Ghosh <quic_smitag@quicinc.com>
2022-11-04 09:18:12 -07:00
qctecmdr
cb0e64e092 Merge "securemsm-kernel: Disable crypto driver" 2022-11-02 16:08:35 -07:00
Smita Ghosh
d85ee4d347 securemsm-kernel: Disable crypto driver
Disable the driver until sps-bam is available.

Change-Id: Ib8b52e722ce763be0292993f43c72b2dcb996cdf
2022-10-28 17:26:46 -07: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
qctecmdr
6552bef2e0 Merge "securemsm-kernel: Expose smcinvoke header files" 2022-10-25 10:54:24 -07:00
Spencer Willett
1633f747b3 securemsm-kernel: Move header files from securemsm-kernel/smcinvoke to securemsm-kernel/linux
Relocating three header files to the linux folder.
Updated SPDX-License-Identifier comment in each file.

CRS-Fixed: 3317072

Change-Id: I4fe6b46c9f97c0d32b573a1488c5ab48120d3b0b
2022-10-21 12:19:23 -07:00
Spencer Willett
b5191f1c61 securemsm-kernel: Expose smcinvoke header files
Using genrule and cc_library_headers we expose three smcinvoke headers.
We use Android.bp edits to accomplish this.

CRS-Fixed: 3317072

Change-Id: I1d946d5a23e22e3b525c99c7223e6109aab8c059
2022-10-21 11:49:27 -07:00
Spencer Willett
50845e2d72 securemsm-kernel: smcinvoke: update error code for Invoke failed
Return OBJECT_ERROR_BUSY if the Object is busy.
Return OBJECT_ERROR_KMEM if Out of memory.
Return OBJECT_ERROR_UNAVAIL if the request could not be processed.

Change-Id: I17b9ecd7dd817b445d84cb7d01b019497248a2a3
2022-10-19 13:55:52 -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
qctecmdr
8a7364d25d Merge "smcinvoke: Increase MAX_RETRY" 2022-09-14 09:03:37 -07:00