28 May, 2019
1 commit
-
When allocating pages for share memory with OP-TEE,
the driver checks the page attribute (pte).
The current checks only allow writealloc pages.
i.MX 6SLL sets the page attribute to writeback.
Relax this check to allow writealloc, writeback and writethrough.Signed-off-by: Silvano di Ninno
Reviewed-by: Franck Lenormand
Reviewed-by: Horia Geanta
Acked-by: Leonard Crestez
26 Apr, 2019
1 commit
-
Call request/release busfreq HIGH each time a SMC
is called.
This ensure that OPTEE is running in HIGH frequency mode
until no more SMC runningSigned-off-by: Cedric Neveux
Acked-by: Peng Fan
(cherry picked from commit 41604a3382306b78f1038524a1018647f3cf3f52)
18 Apr, 2019
1 commit
-
Modification of the L2 Cache operations to use
a TEE/Linux Shared mutexSigned-off-by: Cedric Neveux
Signed-off-by: Arulpandiyan Vadivel
13 Feb, 2019
1 commit
-
[ Upstream commit b2d102bd0146d9eb1fa630ca0cd19a15ef2f74c8 ]
This bug occurs when:
- a new request arrives, one thread(let's call it A) is pending in
optee_supp_req() with req->busy is initial value false.- tee-supplicant is killed, then optee_supp_release() is called, this
function calls list_del(&req->link), and set supp->ctx to NULL. And
it also wake up process A.- process A continues, it firstly checks supp->ctx which is NULL,
then checks req->busy which is false, at last run list_del(&req->link).
This triggers double list_del() and results kernel panic.For solve this problem, we rename req->busy to req->in_queue, and
associate it with state of whether req is linked to supp->reqs. So we
can just only check req->in_queue to make decision calling list_del()
or not.Signed-off-by: Zhizhou Zhang
Signed-off-by: Jens Wiklander
Signed-off-by: Sasha Levin
20 Jun, 2018
1 commit
-
This change adds KCONFIG option to set number of pages out of
whole shared memory to be used for OP-TEE driver private data
structures.Signed-off-by: Sahil Malhotra
[jw: fixing trivial merge conflict]
Signed-off-by: Jens Wiklander
19 Jun, 2018
1 commit
-
The two do the same thing, but we want to have a consistent
naming in the kernel.Signed-off-by: Arnd Bergmann
Signed-off-by: Jens Wiklander
06 Mar, 2018
2 commits
-
When the driver initializes, report the following information
about the OP-TEE OS:
- major and minor version,
- build identifier (if available).Signed-off-by: Jerome Forissier
Reviewed-by: Matthias Brugger
Signed-off-by: Jens Wiklander -
In the OPTEE_SMC_CALL_GET_OS_REVISION request, the previously reserved
parameter a2 is now documented as being an optional build identifier
(such as an SCM revision or commit ID, for instance).A new structure optee_smc_call_get_os_revision_result is introduced to
be used when querying the secure OS version, instead of re-using the
struct defined for OPTEE_SMC_CALLS_REVISION.Signed-off-by: Jerome Forissier
Reviewed-by: Matthias Brugger
Signed-off-by: Jens Wiklander
12 Jan, 2018
1 commit
-
…/jens.wiklander/linux-tee into next/drivers
This pull request updates the previous tee-drv-dynamic-shm-for-v4.16 pull
request with five new patches fixing review comments and errors.Apart from three small fixes there's two larger patches that in the end
checks that memory to be registered really is normal cached memory.* tag 'tee-drv-dynamic-shm+fixes-for-v4.16' of https://git.linaro.org/people/jens.wiklander/linux-tee:
tee: shm: Potential NULL dereference calling tee_shm_register()
tee: shm: don't put_page on null shm->pages
tee: shm: make function __tee_shm_alloc static
tee: optee: check type of registered shared memory
tee: add start argument to shm_register callbackSigned-off-by: Olof Johansson <olof@lixom.net>
28 Dec, 2017
2 commits
-
Checks the memory type of the pages to be registered as shared memory.
Only normal cached memory is allowed.Signed-off-by: Jens Wiklander
-
Adds a start argument to the shm_register callback to allow the callback
to check memory type of the passed pages.Signed-off-by: Jens Wiklander
22 Dec, 2017
2 commits
-
The optee driver includes the header files in an unusual order,
with asm/pgtable.h before the linux/*.h headers. For some reason
this seems to trigger a build failure:drivers/tee/optee/call.c: In function 'optee_fill_pages_list':
include/asm-generic/memory_model.h:64:14: error: implicit declaration of function 'page_to_section'; did you mean '__nr_to_section'? [-Werror=implicit-function-declaration]
int __sec = page_to_section(__pg); \
drivers/tee/optee/call.c:494:15: note: in expansion of macro 'page_to_phys'
optee_page = page_to_phys(*pages) +Let's just include linux/mm.h, which will then get the other
header implicitly.Fixes: 3bb48ba5cd60 ("tee: optee: add page list manipulation functions")
Signed-off-by: Arnd Bergmann -
…wiklander/linux-tee into next/drivers
Pull "tee dynamic shm for v4.16" from Jens Wiklander:
This pull request enables dynamic shared memory support in the TEE
subsystem as a whole and in OP-TEE in particular.Global Platform TEE specification [1] allows client applications
to register part of own memory as a shared buffer between
application and TEE. This allows fast zero-copy communication between
TEE and REE. But current implementation of TEE in Linux does not support
this feature.Also, current implementation of OP-TEE transport uses fixed size
pre-shared buffer for all communications with OP-TEE OS. This is okay
in the most use cases. But this prevents use of OP-TEE in virtualized
environments, because:
a) We can't share the same buffer between different virtual machines
b) Physically contiguous memory as seen by VM can be non-contiguous
in reality (and as seen by OP-TEE OS) due to second stage of
MMU translation.
c) Size of this pre-shared buffer is limited.So, first part of this pull request adds generic register/unregister
interface to tee subsystem. The second part adds necessary features into
OP-TEE driver, so it can use not only static pre-shared buffer, but
whole RAM to communicate with OP-TEE OS.This change is backwards compatible allowing older secure world or
user space to work with newer kernels and vice versa.[1] https://www.globalplatform.org/specificationsdevice.asp
* tag 'tee-drv-dynamic-shm-for-v4.16' of https://git.linaro.org/people/jens.wiklander/linux-tee:
tee: shm: inline tee_shm_get_id()
tee: use reference counting for tee_context
tee: optee: enable dynamic SHM support
tee: optee: add optee-specific shared pool implementation
tee: optee: store OP-TEE capabilities in private data
tee: optee: add registered buffers handling into RPC calls
tee: optee: add registered shared parameters handling
tee: optee: add shared buffer registration functions
tee: optee: add page list manipulation functions
tee: optee: Update protocol definitions
tee: shm: add page accessor functions
tee: shm: add accessors for buffer size and page offset
tee: add register user memory
tee: flexible shared memory pool creation
21 Dec, 2017
1 commit
-
…jens.wiklander/linux-tee into next/drivers
Pull "Enable async communication with tee supplicant" from Jens Wiklander:
This pull request enables asynchronous communication with TEE supplicant
by introducing meta parameters in the user space API. The meta
parameters can be used to tag requests with an id that can be matched
against an asynchronous response as is done here in the OP-TEE driver.Asynchronous supplicant communication is needed by OP-TEE to implement
GlobalPlatforms TEE Sockets API Specification v1.0.1. The specification
is available at https://www.globalplatform.org/specificationsdevice.asp.This change is backwards compatible allowing older supplicants to work
with newer kernels and vice versa.* tag 'tee-drv-async-supplicant-for-v4.16' of https://git.linaro.org/people/jens.wiklander/linux-tee:
optee: support asynchronous supplicant requests
tee: add TEE_IOCTL_PARAM_ATTR_META
tee: add tee_param_is_memref() for driver use
15 Dec, 2017
8 commits
-
Previous patches added various features that are needed for dynamic SHM.
Dynamic SHM allows Normal World to share any buffers with OP-TEE.
While original design suggested to use pre-allocated region (usually of
1M to 2M of size), this new approach allows to use all non-secure RAM for
command buffers, RPC allocations and TA parameters.This patch checks capability OPTEE_SMC_SEC_CAP_DYNAMIC_SHM. If it was set
by OP-TEE, then kernel part of OP-TEE will use kernel page allocator
to allocate command buffers. Also it will set TEE_GEN_CAP_REG_MEM
capability to tell userspace that it supports shared memory registration.Signed-off-by: Volodymyr Babchuk
Signed-off-by: Jens Wiklander -
This is simple pool that uses kernel page allocator. This pool can be
used in case OP-TEE supports dynamic shared memory.Signed-off-by: Volodymyr Babchuk
Signed-off-by: Jens Wiklander -
Those capabilities will be used in subsequent patches.
Signed-off-by: Volodymyr Babchuk
Signed-off-by: Jens Wiklander -
With latest changes to OP-TEE we can use any buffers as a shared memory.
Thus, it is possible for supplicant to provide part of own memory
when OP-TEE asks to allocate a shared buffer.This patch adds support for such feature into RPC handling code.
Now when OP-TEE asks supplicant to allocate shared buffer, supplicant
can use TEE_IOC_SHM_REGISTER to provide such buffer. RPC handler is
aware of this, so it will pass list of allocated pages to OP-TEE.Signed-off-by: Volodymyr Babchuk
[jw: fix parenthesis alignment in free_pages_list()]
Signed-off-by: Jens Wiklander -
Now, when client applications can register own shared buffers in OP-TEE,
we need to extend ABI for parameter passing to/from OP-TEE.So, if OP-TEE core detects that parameter belongs to registered shared
memory, it will use corresponding parameter attribute.Signed-off-by: Volodymyr Babchuk
Signed-off-by: Jens Wiklander -
This change adds ops for shm_(un)register functions in tee interface.
Client application can use these functions to (un)register an own shared
buffer in OP-TEE address space. This allows zero copy data sharing between
Normal and Secure Worlds.Please note that while those functions were added to optee code,
it does not report to userspace that those functions are available.
OP-TEE code does not set TEE_GEN_CAP_REG_MEM flag. This flag will be
enabled only after all other features of dynamic shared memory will be
implemented in subsequent patches. Of course user can ignore presence of
TEE_GEN_CAP_REG_MEM flag and try do call those functions. This is okay,
driver will register shared buffer in OP-TEE, but any attempts to use
this shared buffer will fail.Signed-off-by: Volodymyr Babchuk
Signed-off-by: Jens Wiklander -
These functions will be used to pass information about shared
buffers to OP-TEE. ABI between Linux and OP-TEE is defined
in optee_msg.h and optee_smc.h.optee_msg.h defines OPTEE_MSG_ATTR_NONCONTIG attribute
for shared memory references and describes how such references
should be passed. Note that it uses 64-bit page addresses even
on 32 bit systems. This is done to support LPAE and to unify
interface.Signed-off-by: Volodymyr Babchuk
[jw: replacing uint64_t with u64 in optee_fill_pages_list()]
Signed-off-by: Jens Wiklander -
There were changes in REEOP-TEE ABI recently.
Now ABI allows us to pass non-contiguous memory buffers as list of
pages to OP-TEE. This can be achieved by using new parameter attribute
OPTEE_MSG_ATTR_NONCONTIG.OP-TEE also is able to use all non-secure RAM for shared buffers. This
new capability is enabled with OPTEE_SMC_SEC_CAP_DYNAMIC_SHM flag.This patch adds necessary definitions to the protocol definition files at
Linux side.Signed-off-by: Volodymyr Babchuk
Signed-off-by: Jens Wiklander
29 Nov, 2017
3 commits
-
Adds support for asynchronous supplicant requests, meaning that the
supplicant can process several requests in parallel or block in a
request for some time.Acked-by: Etienne Carriere
Tested-by: Etienne Carriere (b2260 pager=y/n)
Signed-off-by: Jens Wiklander -
Adds TEE_IOCTL_PARAM_ATTR_META which can be used to indicate meta
parameters when communicating with user space. These meta parameters can
be used by supplicant support multiple parallel requests at a time.Reviewed-by: Etienne Carriere
Signed-off-by: Jens Wiklander -
The first node supplied to of_find_matching_node() has its reference
counter decreased as part of call to that function. In optee_driver_init()
after calling of_find_matching_node() it's invalid to call of_node_put() on
the supplied node again.So remove the invalid call to of_node_put().
Reported-by: Alex Shi
Signed-off-by: Jens Wiklander
02 Nov, 2017
1 commit
-
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.By default all files without license information are under the default
license of the kernel, which is GPL version 2.Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if
Reviewed-by: Philippe Ombredanne
Reviewed-by: Thomas Gleixner
Signed-off-by: Greg Kroah-Hartman
04 Aug, 2017
4 commits
-
In the latest changes of optee_os, the interrupts' names are
changed to "native" and "foreign" interrupts.Signed-off-by: David Wang
Signed-off-by: Jerome Forissier
Signed-off-by: Jens Wiklander -
Prior to this patch RPC sleep was uninterruptible since msleep() is
uninterruptible. Change to use msleep_interruptible() instead.Signed-off-by: Tiger Yu
Reviewed-by: Joakim Bech
Signed-off-by: Jerome Forissier
Signed-off-by: Jens Wiklander -
Add const to tee_desc structures as they are only passed as an argument
to the function tee_device_alloc. This argument is of type const, so
declare these structures as const too.
Add const to tee_driver_ops structures as they are only stored in the
ops field of a tee_desc structure. This field is of type const, so
declare these structure types as const.Signed-off-by: Bhumika Goyal
Signed-off-by: Jens Wiklander -
Fixes the static checker warning in optee_release().
error: uninitialized symbol 'parg'.Reported-by: Dan Carpenter
Signed-off-by: Jens Wiklander
10 Mar, 2017
1 commit
-
Adds a OP-TEE driver which also can be compiled as a loadable module.
* Targets ARM and ARM64
* Supports using reserved memory from OP-TEE as shared memory
* Probes OP-TEE version using SMCs
* Accepts requests on privileged and unprivileged device
* Uses OPTEE message protocol version 2 to communicate with secure worldAcked-by: Andreas Dannenberg
Tested-by: Jerome Forissier (HiKey)
Tested-by: Volodymyr Babchuk (RCAR H3)
Tested-by: Scott Branden
Reviewed-by: Javier González
Signed-off-by: Jens Wiklander