12 Feb, 2019

7 commits

  • 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 running

    Signed-off-by: Cedric Neveux
    Acked-by: Peng Fan

    Cedric Neveux
     
  • Modification of the L2 Cache operations to use
    a TEE/Linux Shared mutex

    Signed-off-by: Cedric Neveux

    Cedric Neveux
     
  • 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
    From: https://github.com/linaro-swg/linux.git
    (cherry picked from commit c0b5b087a78777155603b0eb68dd9f9ab971330c)

    Jens Wiklander
     
  • Adds TEE_IOCTL_PARAM_ATTR_META with 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

    Modified from: From: https://github.com/linaro-swg/linux.git
    Conflicts:
    drivers/tee/tee_core.c
    (cherry picked from commit 66d81fcf145fdc55322c0a11764c76a43d90ecad)

    Jens Wiklander
     
  • Reviewed-by: Etienne Carriere
    Signed-off-by: Jens Wiklander
    From: https://github.com/linaro-swg/linux.git
    (cherry picked from commit 747f68059436ac55c330ebffc5176b79006aafcf)

    Jens Wiklander
     
  • Adds a kernel internal TEE client interface to be used by other drivers.

    Signed-off-by: Jens Wiklander
    From: https://github.com/linaro-swg/linux.git
    (cherry picked from commit 860c46087c99c24073cc722b12c0017bb0ce0a79)

    Jens Wiklander
     
  • This change allows userland to create a tee_shm object that refers
    to a dmabuf reference.

    Userland provides a dmabuf file descriptor as buffer reference.
    The created tee_shm object exported as a brand new dmabuf reference
    used to provide a clean fd to userland. Userland shall closed this new
    fd to release the tee_shm object resources. The initial dmabuf resources
    are tracked independently through original dmabuf file descriptor.

    Once the buffer is registered and until it is released, TEE driver
    keeps a refcount on the registered dmabuf structure.

    This change only support dmabuf references that relates to physically
    contiguous memory buffers.

    New tee_shm flag to identify tee_shm objects built from a registered
    dmabuf: TEE_SHM_EXT_DMA_BUF. Such tee_shm structures are flagged both
    TEE_SHM_DMA_BUF and TEE_SHM_EXT_DMA_BUF.

    Signed-off-by: Etienne Carriere
    Reviewed-by: Jens Wiklander
    From: https://github.com/linaro-swg/linux.git
    (cherry picked from commit 41e21e5c405530590dc2dd10b2a8dbe64589840f)

    Etienne Carriere
     

21 Jun, 2018

1 commit

  • [ Upstream commit ab9d3db5b320a052452b9cd035599ee3c84bbee9 ]

    This change prevents userland from referencing TEE shared memory
    outside the area initially allocated by its owner. Prior this change an
    application could not reference or access memory it did not own but
    it could reference memory not explicitly allocated by owner but still
    allocated to the owner due to the memory allocation granule.

    Reported-by: Alexandre Jutras
    Signed-off-by: Etienne Carriere
    Signed-off-by: Jens Wiklander
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Etienne Carriere
     

23 May, 2018

1 commit

  • commit bb765d1c331f62b59049d35607ed2e365802bef9 upstream.

    Bump the file's refcount before moving the reference into the fd table,
    not afterwards. The old code could drop the file's refcount to zero for a
    short moment before calling get_file() via get_dma_buf().

    This code can only be triggered on ARM systems that use Linaro's OP-TEE.

    Fixes: 967c9cca2cc5 ("tee: generic TEE subsystem")
    Signed-off-by: Jann Horn
    Signed-off-by: Jens Wiklander
    Signed-off-by: Greg Kroah-Hartman

    Jann Horn
     

25 Dec, 2017

1 commit

  • commit f044113113dd95ba73916bde10e804d3cdfa2662 upstream.

    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
    Cc:
    Signed-off-by: Greg Kroah-Hartman

    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

    Greg Kroah-Hartman
     

04 Aug, 2017

6 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

    David Wang
     
  • Mirrors the TEE_DESC_PRIVILEGED bit of struct tee_desc:flags into struct
    tee_ioctl_version_data:gen_caps as TEE_GEN_CAP_PRIVILEGED in
    tee_ioctl_version()

    Reviewed-by: Jerome Forissier
    Signed-off-by: Jens Wiklander

    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

    tiger-yu99
     
  • 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

    Bhumika Goyal
     
  • dma_buf_ops are not supposed to change at runtime. All functions
    working with dma_buf_ops provided by work with
    const dma_buf_ops. So mark the non-const structs as const.

    File size before:
    text data bss dec hex filename
    2026 112 0 2138 85a drivers/tee/tee_shm.o

    File size After adding 'const':
    text data bss dec hex filename
    2138 0 0 2138 85a drivers/tee/tee_shm.o

    Signed-off-by: Arvind Yadav
    Signed-off-by: Jens Wiklander

    Arvind Yadav
     
  • Fixes the static checker warning in optee_release().
    error: uninitialized symbol 'parg'.

    Reported-by: Dan Carpenter
    Signed-off-by: Jens Wiklander

    Jens Wiklander
     

19 May, 2017

1 commit


11 May, 2017

2 commits

  • For the moment, the tee subsystem only makes sense in combination with
    the op-tee driver that depends on ARM_SMCCC, so let's hide the subsystem
    from users that can't select that.

    Suggested-by: Linus Torvalds
    Signed-off-by: Arnd Bergmann

    Arnd Bergmann
     
  • Pull TEE driver infrastructure and OP-TEE drivers from Arnd Bergmann:
    "This introduces a generic TEE framework in the kernel, to handle
    trusted environemtns (security coprocessor or software implementations
    such as OP-TEE/TrustZone). I'm sending it separately from the other
    arm-soc driver changes to give it a little more visibility, once the
    subsystem is merged, we will likely keep this in the arm₋soc drivers
    branch or have the maintainers submit pull requests directly,
    depending on the patch volume.

    I have reviewed earlier versions in the past, and have reviewed the
    latest version in person during Linaro Connect BUD17.

    Here is my overall assessment of the subsystem:

    - There is clearly demand for this, both for the generic
    infrastructure and the specific OP-TEE implementation.

    - The code has gone through a large number of reviews, and the review
    comments have all been addressed, but the reviews were not coming
    up with serious issues any more and nobody volunteered to vouch for
    the quality.

    - The user space ioctl interface is sufficient to work with the
    OP-TEE driver, and it should in principle work with other TEE
    implementations that follow the GlobalPlatform[1] standards, but it
    might need to be extended in minor ways depending on specific
    requirements of future TEE implementations

    - The main downside of the API to me is how the user space is tied to
    the TEE implementation in hardware or firmware, but uses a generic
    way to communicate with it. This seems to be an inherent problem
    with what it is trying to do, and I could not come up with any
    better solution than what is implemented here.

    For a detailed history of the patch series, see

    https://lkml.org/lkml/2017/3/10/1277"

    * tag 'armsoc-tee' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc:
    arm64: dt: hikey: Add optee node
    Documentation: tee subsystem and op-tee driver
    tee: add OP-TEE driver
    tee: generic TEE subsystem
    dt/bindings: add bindings for optee

    Linus Torvalds
     

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 world

    Acked-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

    Jens Wiklander
     

09 Mar, 2017

1 commit

  • Initial patch for generic TEE subsystem.
    This subsystem provides:
    * Registration/un-registration of TEE drivers.
    * Shared memory between normal world and secure world.
    * Ioctl interface for interaction with user space.
    * Sysfs implementation_id of TEE driver

    A TEE (Trusted Execution Environment) driver is a driver that interfaces
    with a trusted OS running in some secure environment, for example,
    TrustZone on ARM cpus, or a separate secure co-processor etc.

    The TEE subsystem can serve a TEE driver for a Global Platform compliant
    TEE, but it's not limited to only Global Platform TEEs.

    This patch builds on other similar implementations trying to solve
    the same problem:
    * "optee_linuxdriver" by among others
    Jean-michel DELORME and
    Emmanuel MICHEL
    * "Generic TrustZone Driver" by Javier González

    Acked-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

    Jens Wiklander