14 Dec, 2020

2 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
    (cherry picked from commit 41604a3382306b78f1038524a1018647f3cf3f52)

    Cedric Neveux
     
  • 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
    (cherry picked from commit a4c5efa2df07a54ce112206c3ffc8fccf3369c52)

    Silvano di Ninno
     

28 Nov, 2020

1 commit

  • Pull ARM SoC fixes from Arnd Bergmann:
    "Another set of patches for devicetree files and Arm SoC specific
    drivers:

    - A fix for OP-TEE shared memory on non-SMP systems

    - multiple code fixes for the OMAP platform, including one regression
    for the CPSW network driver and a few runtime warning fixes

    - Some DT patches for the Rockchip RK3399 platform, in particular
    fixing the MMC device ordering that recently became
    nondeterministic with async probe.

    - Multiple DT fixes for the Tegra platform, including a regression
    fix for suspend/resume on TX2

    - A regression fix for a user-triggered fault in the NXP dpio driver

    - A regression fix for a bug caused by an earlier bug fix in the
    xilinx firmware driver

    - Two more DTC warning fixes

    - Sylvain Lemieux steps down as maintainer for the NXP LPC32xx
    platform"

    * tag 'arm-soc-fixes-v5.10-3' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (24 commits)
    arm64: tegra: Fix Tegra234 VDK node names
    arm64: tegra: Wrong AON HSP reg property size
    arm64: tegra: Fix USB_VBUS_EN0 regulator on Jetson TX1
    arm64: tegra: Correct the UART for Jetson Xavier NX
    arm64: tegra: Disable the ACONNECT for Jetson TX2
    optee: add writeback to valid memory type
    firmware: xilinx: Use hash-table for api feature check
    firmware: xilinx: Fix SD DLL node reset issue
    soc: fsl: dpio: Get the cpumask through cpumask_of(cpu)
    ARM: dts: dra76x: m_can: fix order of clocks
    bus: ti-sysc: suppress err msg for timers used as clockevent/source
    MAINTAINERS: Remove myself as LPC32xx maintainers
    arm64: dts: qcom: clear the warnings caused by empty dma-ranges
    arm64: dts: broadcom: clear the warnings caused by empty dma-ranges
    ARM: dts: am437x-l4: fix compatible for cpsw switch dt node
    arm64: dts: rockchip: Reorder LED triggers from mmc devices on rk3399-roc-pc.
    arm64: dts: rockchip: Assign a fixed index to mmc devices on rk3399 boards.
    arm64: dts: rockchip: Remove system-power-controller from pmic on Odroid Go Advance
    arm64: dts: rockchip: fix NanoPi R2S GMAC clock name
    ARM: OMAP2+: Manage MPU state properly for omap_enter_idle_coupled()
    ...

    Linus Torvalds
     

25 Nov, 2020

1 commit

  • Only in smp systems the cache policy is setup as write alloc, in
    single cpu systems the cache policy is set as writeback and it is
    normal memory, so, it should pass the is_normal_memory check in the
    share memory registration.

    Add the right condition to make it work in no smp systems.

    Fixes: cdbcf83d29c1 ("tee: optee: check type of registered shared memory")
    Signed-off-by: Rui Miguel Silva
    Signed-off-by: Jens Wiklander

    Rui Miguel Silva
     

13 Nov, 2020

1 commit

  • …/linux-tee into arm/fixes

    AMD-TEE driver bug fixes

    AMD-TEE driver keeps track of shared memory buffers and their
    corresponding buffer id's in a global linked list. These buffers are
    used to share data between x86 and AMD Secure Processor. This pull
    request fixes issues related to maintaining mapped buffers in a shared
    linked list.

    * tag 'amdtee-fixes-for-5.10' of git://git.linaro.org:/people/jens.wiklander/linux-tee:
    tee: amdtee: synchronize access to shm list
    tee: amdtee: fix memory leak due to reset of global shm list

    Link: https://lore.kernel.org/r/20201109080809.GA3862873@jade
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>

    Arnd Bergmann
     

09 Nov, 2020

2 commits

  • Synchronize access to shm or shared memory buffer list to prevent
    race conditions due to concurrent updates to shared shm list by
    multiple threads.

    Fixes: 757cc3e9ff1d ("tee: add AMD-TEE driver")
    Reviewed-by: Devaraj Rangasamy
    Signed-off-by: Rijo Thomas
    Signed-off-by: Jens Wiklander

    Rijo Thomas
     
  • The driver maintains a list of shared memory buffers along with their
    mapped buffer id's in a global linked list. These buffers need to be
    unmapped after use by the user-space client.

    The global shared memory list is initialized to zero entries in the
    function amdtee_open(). This clearing of list entries can be a source
    for memory leak on secure side if the global linked list previously
    held some mapped buffer entries allocated from another TEE context.

    Fix potential memory leak issue by moving global shared memory list
    to AMD-TEE driver context data structure.

    Fixes: 757cc3e9ff1d ("tee: add AMD-TEE driver")
    Reviewed-by: Devaraj Rangasamy
    Signed-off-by: Rijo Thomas
    Signed-off-by: Jens Wiklander

    Rijo Thomas
     

26 Oct, 2020

1 commit

  • …ux-tee into arm/fixes

    Reenable kernel login method for kernel TEE client API

    The kernel TEE login method was accidentally disabled previously when
    enabling a few other login methods, so fix that here.

    * tag 'tee-fix-for-v5.10' of git://git.linaro.org:/people/jens.wiklander/linux-tee:
    tee: client UUID: Skip REE kernel login method as well

    Link: https://lore.kernel.org/r/20201013070918.GA3328976@jade
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>

    Arnd Bergmann
     

13 Oct, 2020

1 commit

  • Since the addition of session's client UUID generation via commit [1],
    login via REE kernel method was disallowed. So fix that via passing
    nill UUID in case of TEE_IOCTL_LOGIN_REE_KERNEL method as well.

    Fixes: e33bcbab16d1 ("tee: add support for session's client UUID generation") [1]
    Signed-off-by: Sumit Garg
    Signed-off-by: Jens Wiklander

    Sumit Garg
     

27 Sep, 2020

1 commit

  • …nder/linux-tee into arm/drivers

    Simplify tee_device_register() and friends

    Uses cdev_device_add() instead of the cdev_add() device_add()
    combination.

    Initializes dev->groups instead of direct calls to sysfs_create_group()
    and friends.

    * tag 'tee-dev-cleanup-for-v5.10' of git://git.linaro.org:/people/jens.wiklander/linux-tee:
    tee: avoid explicit sysfs_create/delete_group by initialising dev->groups
    tee: replace cdev_add + device_add with cdev_device_add

    Link: https://lore.kernel.org/r/20200918144130.GB1219771@jade
    Signed-off-by: Olof Johansson <olof@lixom.net>

    Olof Johansson
     

18 Sep, 2020

2 commits


14 Sep, 2020

1 commit


01 Sep, 2020

1 commit

  • When the optee driver is compiled into the kernel while the i2c core
    is configured as a module, the i2c symbols are not available.

    This commit addresses the situation by disabling the i2c support for
    this use case while allowing it in all other scenarios:

    i2c=y, optee=y
    i2c=m, optee=m
    i2c=y, optee=m
    i2c=m, optee=y (not supported)

    Fixes: c05210ab9757 ("drivers: optee: allow op-tee to access devices on the i2c bus")
    Reported-by: kernel test robot
    Signed-off-by: Jorge Ramirez-Ortiz
    Signed-off-by: Jens Wiklander

    Jorge Ramirez-Ortiz
     

27 Aug, 2020

1 commit


25 Aug, 2020

1 commit

  • This code was using get_user_pages*(), in a "Case 2" scenario
    (DMA/RDMA), using the categorization from [1]. That means that it's
    time to convert the get_user_pages*() + put_page() calls to
    pin_user_pages*() + unpin_user_pages() calls.

    Factor out a new, small release_registered_pages() function, in
    order to consolidate the logic for discerning between
    TEE_SHM_USER_MAPPED and TEE_SHM_KERNEL_MAPPED pages. This also
    absorbs the kfree() call that is also required there.

    There is some helpful background in [2]: basically, this is a small
    part of fixing a long-standing disconnect between pinning pages, and
    file systems' use of those pages.

    [1] Documentation/core-api/pin_user_pages.rst

    [2] "Explicit pinning of user-space pages":
    https://lwn.net/Articles/807108/

    Cc: Jens Wiklander
    Cc: Sumit Semwal
    Cc: tee-dev@lists.linaro.org
    Cc: linux-media@vger.kernel.org
    Cc: dri-devel@lists.freedesktop.org
    Cc: linaro-mm-sig@lists.linaro.org
    Signed-off-by: John Hubbard
    Signed-off-by: Jens Wiklander

    John Hubbard
     

22 Aug, 2020

1 commit

  • …der/linux-tee into arm/drivers

    Handle NULL pointer indication from tee client

    Adds support to indicate NULL pointers instead of a valid buffer when
    querying the needed size of a buffer.

    * tag 'tee-memref-null-for-v5.10' of git://git.linaro.org/people/jens.wiklander/linux-tee:
    driver: tee: Handle NULL pointer indication from client

    Link: https://lore.kernel.org/r/20200821102535.GA1872111@jade
    Signed-off-by: Olof Johansson <olof@lixom.net>

    Olof Johansson
     

21 Aug, 2020

2 commits

  • Some secure elements like NXP's SE050 sit on I2C buses. For OP-TEE to
    control this type of cryptographic devices it needs coordinated access
    to the bus, so collisions and RUNTIME_PM dont get in the way.

    This trampoline driver allow OP-TEE to access them.

    Signed-off-by: Jorge Ramirez-Ortiz
    Signed-off-by: Jens Wiklander

    Jorge Ramirez-Ortiz
     
  • TEE Client introduce a new capability "TEE_GEN_CAP_MEMREF_NULL"
    to handle the support of the shared memory buffer with a NULL pointer.

    This capability depends on TEE Capabilities and driver support.
    Driver and TEE exchange capabilities at driver initialization.

    Signed-off-by: Michael Whitfield
    Signed-off-by: Cedric Neveux
    Reviewed-by: Joakim Bech
    Tested-by: Joakim Bech (QEMU)
    Signed-off-by: Jens Wiklander

    Cedric Neveux
     

13 Jul, 2020

1 commit

  • …ux-tee into arm/drivers

    Enable multi-stage OP-TEE bus enumeration

    Probes drivers on the OP-TEE bus in two steps. First for drivers which
    do not depend on tee-supplicant. After tee-supplicant has been started
    probe the devices which do depend on tee-supplicant.

    Also introduces driver which uses an OP-TEE based fTPM Trusted
    Application depends on tee-supplicant NV RAM implementation based on
    RPMB secure storage.

    * tag 'optee-bus-for-v5.9' of git://git.linaro.org/people/jens.wiklander/linux-tee:
    tpm_ftpm_tee: register driver on TEE bus
    optee: enable support for multi-stage bus enumeration
    optee: use uuid for sysfs driver entry

    Link: https://lore.kernel.org/r/20200710085230.GA1312913@jade
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>

    Arnd Bergmann
     

10 Jul, 2020

2 commits

  • Some drivers (like ftpm) can operate only after tee-supplicant
    runs because of tee-supplicant provides things like storage
    services (rpmb, shm).  This patch splits probe of non tee-supplicant
    dependable drivers to the early stage, and after tee-supplicant run
    probe other drivers.

    Signed-off-by: Maxim Uvarov
    Suggested-by: Sumit Garg
    Suggested-by: Arnd Bergmann
    Reviewed-by: Sumit Garg
    Acked-by: Jarkko Sakkinen
    Tested-by: Sumit Garg
    Signed-off-by: Jens Wiklander

    Maxim Uvarov
     
  • With the evolving use-cases for TEE bus, now it's required to support
    multi-stage enumeration process. But using a simple index doesn't
    suffice this requirement and instead leads to duplicate sysfs entries.
    So instead switch to use more informative device UUID for sysfs entry
    like:
    /sys/bus/tee/devices/optee-ta-

    Signed-off-by: Maxim Uvarov
    Reviewed-by: Sumit Garg
    Reviewed-by: Jarkko Sakkinen
    Tested-by: Sumit Garg
    Signed-off-by: Jens Wiklander

    Maxim Uvarov
     

10 Jun, 2020

1 commit

  • This change converts the existing mmap_sem rwsem calls to use the new mmap
    locking API instead.

    The change is generated using coccinelle with the following rule:

    // spatch --sp-file mmap_lock_api.cocci --in-place --include-headers --dir .

    @@
    expression mm;
    @@
    (
    -init_rwsem
    +mmap_init_lock
    |
    -down_write
    +mmap_write_lock
    |
    -down_write_killable
    +mmap_write_lock_killable
    |
    -down_write_trylock
    +mmap_write_trylock
    |
    -up_write
    +mmap_write_unlock
    |
    -downgrade_write
    +mmap_write_downgrade
    |
    -down_read
    +mmap_read_lock
    |
    -down_read_killable
    +mmap_read_lock_killable
    |
    -down_read_trylock
    +mmap_read_trylock
    |
    -up_read
    +mmap_read_unlock
    )
    -(&mm->mmap_sem)
    +(mm)

    Signed-off-by: Michel Lespinasse
    Signed-off-by: Andrew Morton
    Reviewed-by: Daniel Jordan
    Reviewed-by: Laurent Dufour
    Reviewed-by: Vlastimil Babka
    Cc: Davidlohr Bueso
    Cc: David Rientjes
    Cc: Hugh Dickins
    Cc: Jason Gunthorpe
    Cc: Jerome Glisse
    Cc: John Hubbard
    Cc: Liam Howlett
    Cc: Matthew Wilcox
    Cc: Peter Zijlstra
    Cc: Ying Han
    Link: http://lkml.kernel.org/r/20200520052908.204642-5-walken@google.com
    Signed-off-by: Linus Torvalds

    Michel Lespinasse
     

28 May, 2020

1 commit

  • When selecting a crypto cipher, we also need to select the
    subsystem itself:

    WARNING: unmet direct dependencies detected for CRYPTO_SHA1
    Depends on [m]: CRYPTO [=m]
    Selected by [y]:
    - TEE [=y] && (HAVE_ARM_SMCCC [=n] || COMPILE_TEST [=y] || CPU_SUP_AMD [=y])
    Selected by [m]:
    - CRYPTO_DEV_QAT [=m] && CRYPTO [=m] && CRYPTO_HW [=y]
    - CRYPTO_DEV_MEDIATEK [=m] && CRYPTO [=m] && CRYPTO_HW [=y] && (ARM && ARCH_MEDIATEK || COMPILE_TEST [=y])
    - CRYPTO_DEV_SAFEXCEL [=m] && CRYPTO [=m] && CRYPTO_HW [=y] && (OF [=y] || PCI [=y] || COMPILE_TEST [=y]) && HAS_IOMEM [=y]
    - CRYPTO_DEV_CCREE [=m] && CRYPTO [=m] && CRYPTO_HW [=y] && OF [=y] && HAS_DMA [=y]
    - CRYPTO_DEV_SP_CCP [=y] && CRYPTO [=m] && CRYPTO_HW [=y] && CRYPTO_DEV_CCP [=y] && CRYPTO_DEV_CCP_DD [=m] && DMADEVICES [=y]

    Link: https://lore.kernel.org/r/20200527133924.724819-1-arnd@arndb.de
    Fixes: e33bcbab16d1 ("tee: add support for session's client UUID generation")
    Signed-off-by: Arnd Bergmann
    Reviewed-by: Vesa Jääskeläinen
    Signed-off-by: Arnd Bergmann

    Arnd Bergmann
     

26 May, 2020

1 commit

  • …x-tee into arm/drivers

    Adds utility function in TEE subsystem for client UUID generation. This
    function is also used in the optee driver.

    * tag 'tee-login-for-5.8' of git://git.linaro.org/people/jens.wiklander/linux-tee:
    tee: optee: Add support for session login client UUID generation
    tee: add support for session's client UUID generation

    Link: https://lore.kernel.org/r/20200512131243.GA10028@jade
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>

    Arnd Bergmann
     

25 May, 2020

1 commit


11 May, 2020

2 commits

  • Adds support for client UUID generation for OP-TEE. For group based session
    logins membership is verified.

    Signed-off-by: Vesa Jääskeläinen
    Signed-off-by: Jens Wiklander

    Vesa Jääskeläinen
     
  • TEE Client API defines that from user space only information needed for
    specified login operations is group identifier for group based logins.

    REE kernel is expected to formulate trustworthy client UUID and pass that
    to TEE environment. REE kernel is required to verify that provided group
    identifier for group based logins matches calling processes group
    memberships.

    TEE specification only defines that the information passed from REE
    environment to TEE environment is encoded into on UUID.

    In order to guarantee trustworthiness of client UUID user space is not
    allowed to freely pass client UUID.

    UUIDv5 form is used encode variable amount of information needed for
    different login types.

    Signed-off-by: Vesa Jääskeläinen
    [jw: remove unused variable application_id]
    Signed-off-by: Jens Wiklander

    Vesa Jääskeläinen
     

20 Apr, 2020

3 commits

  • There are use-cases where user-space shouldn't be allowed to communicate
    directly with a TEE device which is dedicated to provide a specific
    service for a kernel client. So add a private login method for kernel
    clients and disallow user-space to open-session using GP implementation
    defined login method range: (0x80000000 - 0xBFFFFFFF).

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

    Sumit Garg
     
  • Enable support to register kernel memory reference with TEE. This change
    will allow TEE bus drivers to register memory references.

    Signed-off-by: Sumit Garg
    Signed-off-by: Jens Wiklander

    Sumit Garg
     
  • Smatch complains that "ctx" isn't checked consistently:

    drivers/tee/tee_shm.c:164 tee_shm_alloc()
    warn: variable dereferenced before check 'ctx' (see line 95)

    I audited the callers and "ctx" can't be NULL so the check can be
    removed.

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

    Dan Carpenter
     

04 Apr, 2020

1 commit

  • Pull ARM driver updates from Arnd Bergmann:
    "These are the usual updates for SoC specific device drivers and
    related subsystems that don't have their own top-level maintainers:

    - ARM SCMI/SCPI updates to allow pluggable transport layers

    - TEE subsystem cleanups

    - A new driver for the Amlogic secure power domain controller

    - Various driver updates for the NXP Layerscape DPAA2, NXP i.MX SCU
    and TI OMAP2+ sysc drivers.

    - Qualcomm SoC driver updates, including a new library module for
    "protection domain" notifications

    - Lots of smaller bugfixes and cleanups in other drivers"

    * tag 'arm-drivers-5.7' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (70 commits)
    soc: fsl: qe: fix sparse warnings for ucc_slow.c
    soc: fsl: qe: ucc_slow: remove 0 assignment for kzalloc'ed structure
    soc: fsl: qe: fix sparse warnings for ucc_fast.c
    soc: fsl: qe: fix sparse warnings for qe_ic.c
    soc: fsl: qe: fix sparse warnings for ucc.c
    soc: fsl: qe: fix sparse warning for qe_common.c
    soc: fsl: qe: fix sparse warnings for qe.c
    soc: qcom: Fix QCOM_APR dependencies
    soc: qcom: pdr: Avoid uninitialized use of found in pdr_indication_cb
    soc: imx: drop COMPILE_TEST for IMX_SCU_SOC
    firmware: imx: add COMPILE_TEST for IMX_SCU driver
    soc: imx: gpc: fix power up sequencing
    soc: imx: increase build coverage for imx8m soc driver
    soc: qcom: apr: Add avs/audio tracking functionality
    dt-bindings: soc: qcom: apr: Add protection domain bindings
    soc: qcom: Introduce Protection Domain Restart helpers
    devicetree: bindings: firmware: add ipq806x to qcom_scm
    memory: tegra: Correct debugfs clk rate-range on Tegra124
    memory: tegra: Correct debugfs clk rate-range on Tegra30
    memory: tegra: Correct debugfs clk rate-range on Tegra20
    ...

    Linus Torvalds
     

27 Mar, 2020

1 commit

  • …linux-tee into arm/drivers

    Cleanup shared memory handing in TEE subsystem
    The highlights are:
    - Removing redundant or unused fields in struct tee_shm
    - Only assign userspace shm IDs for shared memory objects originating from
    user space

    * tag 'tee-cleanup-for-5.7' of https://git.linaro.org/people/jens.wiklander/linux-tee:
    tee: tee_shm_op_mmap(): use TEE_SHM_USER_MAPPED
    tee: remove redundant teedev in struct tee_shm
    tee: don't assign shm id for private shms
    tee: remove unused tee_shm_priv_alloc()
    tee: remove linked list of struct tee_shm

    Link: https://lore.kernel.org/r/20200228140925.GA12393@jade
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>

    Arnd Bergmann
     

25 Mar, 2020

1 commit


10 Mar, 2020

1 commit

  • The "index" is a user provided value from 0-USHRT_MAX. If it's over
    TEE_NUM_SESSIONS (31) then it results in an out of bounds read when we
    call test_bit(index, sess->sess_mask).

    Fixes: 757cc3e9ff1d ("tee: add AMD-TEE driver")
    Acked-by: Rijo Thomas
    Signed-off-by: Dan Carpenter
    Signed-off-by: Jens Wiklander

    Dan Carpenter
     

04 Mar, 2020

1 commit

  • …rnel/git/dinguyen/linux into arm/fixes

    arm64: dts: agilex: fix gmac compatible
    - The compatible for Agilex GMAC should be "altr,socfpga-stmmac-a10-s10"

    * tag 'socfpga_dts_fix_for_v5.6_v2' of git://git.kernel.org/pub/scm/linux/kernel/git/dinguyen/linux: (578 commits)
    arm64: dts: socfpga: agilex: Fix gmac compatible
    Linux 5.6-rc4
    KVM: VMX: check descriptor table exits on instruction emulation
    ext4: potential crash on allocation error in ext4_alloc_flex_bg_array()
    macintosh: therm_windtunnel: fix regression when instantiating devices
    jbd2: fix data races at struct journal_head
    kvm: x86: Limit the number of "kvm: disabled by bios" messages
    KVM: x86: avoid useless copy of cpufreq policy
    KVM: allow disabling -Werror
    KVM: x86: allow compiling as non-module with W=1
    KVM: Pre-allocate 1 cpumask variable per cpu for both pv tlb and pv ipis
    KVM: Introduce pv check helpers
    KVM: let declaration of kvm_get_running_vcpus match implementation
    KVM: SVM: allocate AVIC data structures based on kvm_amd module parameter
    MAINTAINERS: Correct Cadence PCI driver path
    io_uring: fix 32-bit compatability with sendmsg/recvmsg
    net: dsa: mv88e6xxx: Fix masking of egress port
    mlxsw: pci: Wait longer before accessing the device after reset
    sfc: fix timestamp reconstruction at 16-bit rollover points
    vsock: fix potential deadlock in transport->release()
    ...

    Link: https://lore.kernel.org/r/20200303153509.28248-1-dinguyen@kernel.org
    Signed-off-by: Olof Johansson <olof@lixom.net>

    Olof Johansson
     

28 Feb, 2020

4 commits