Commit Graph

171 Commits

Author SHA1 Message Date
Sumit Garg
7f565d0ead tee: optee: Fix missing devices unregister during optee_remove
When OP-TEE driver is built as a module, OP-TEE client devices
registered on TEE bus during probe should be unregistered during
optee_remove. So implement optee_unregister_devices() accordingly.

Fixes: c3fa24af92 ("tee: optee: add TEE bus device enumeration support")
Reported-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2021-10-12 13:24:39 +02:00
jing yangyang
88a3856c0a tee/optee/shm_pool: fix application of sizeof to pointer
sizeof when applied to a pointer typed expression gives the size of
the pointer.

./drivers/tee/optee/shm_pool.c:38:28-34: ERROR application of sizeof to pointer

This issue was detected with the help of Coccinelle.

Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org>
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: jing yangyang <jing.yangyang@zte.com.cn>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2021-09-14 07:54:56 +02:00
Sumit Garg
376e4199e3 tee: Correct inappropriate usage of TEE_SHM_DMA_BUF flag
Currently TEE_SHM_DMA_BUF flag has been inappropriately used to not
register shared memory allocated for private usage by underlying TEE
driver: OP-TEE in this case. So rather add a new flag as TEE_SHM_PRIV
that can be utilized by underlying TEE drivers for private allocation
and usage of shared memory.

With this corrected, allow tee_shm_alloc_kernel_buf() to allocate a
shared memory region without the backing of dma-buf.

Cc: stable@vger.kernel.org
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
Co-developed-by: Tyler Hicks <tyhicks@linux.microsoft.com>
Signed-off-by: Tyler Hicks <tyhicks@linux.microsoft.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2021-07-21 07:55:50 +02:00
Jens Wiklander
dc7019b7d0 tee: add tee_shm_alloc_kernel_buf()
Adds a new function tee_shm_alloc_kernel_buf() to allocate shared memory
from a kernel driver. This function can later be made more lightweight
by unnecessary dma-buf export.

Cc: stable@vger.kernel.org
Reviewed-by: Tyler Hicks <tyhicks@linux.microsoft.com>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2021-07-21 07:55:44 +02:00
Tyler Hicks
b5c10dd04b optee: Clear stale cache entries during initialization
The shm cache could contain invalid addresses if
optee_disable_shm_cache() was not called from the .shutdown hook of the
previous kernel before a kexec. These addresses could be unmapped or
they could point to mapped but unintended locations in memory.

Clear the shared memory cache, while being careful to not translate the
addresses returned from OPTEE_SMC_DISABLE_SHM_CACHE, during driver
initialization. Once all pre-cache shm objects are removed, proceed with
enabling the cache so that we know that we can handle cached shm objects
with confidence later in the .shutdown hook.

Cc: stable@vger.kernel.org
Signed-off-by: Tyler Hicks <tyhicks@linux.microsoft.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2021-07-21 07:39:44 +02:00
Allen Pais
f25889f931 optee: fix tee out of memory failure seen during kexec reboot
The following out of memory errors are seen on kexec reboot
from the optee core.

[    0.368428] tee_bnxt_fw optee-clnt0: tee_shm_alloc failed
[    0.368461] tee_bnxt_fw: probe of optee-clnt0 failed with error -22

tee_shm_release() is not invoked on dma shm buffer.

Implement .shutdown() method to handle the release of the buffers
correctly.

More info:
https://github.com/OP-TEE/optee_os/issues/3637

Cc: stable@vger.kernel.org
Signed-off-by: Allen Pais <apais@linux.microsoft.com>
Reviewed-by: Tyler Hicks <tyhicks@linux.microsoft.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2021-07-21 07:39:43 +02:00
Tyler Hicks
adf752af45 optee: Refuse to load the driver under the kdump kernel
Fix a hung task issue, seen when booting the kdump kernel, that is
caused by all of the secure world threads being in a permanent suspended
state:

 INFO: task swapper/0:1 blocked for more than 120 seconds.
       Not tainted 5.4.83 #1
 "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
 swapper/0       D    0     1      0 0x00000028
 Call trace:
  __switch_to+0xc8/0x118
  __schedule+0x2e0/0x700
  schedule+0x38/0xb8
  schedule_timeout+0x258/0x388
  wait_for_completion+0x16c/0x4b8
  optee_cq_wait_for_completion+0x28/0xa8
  optee_disable_shm_cache+0xb8/0xf8
  optee_probe+0x560/0x61c
  platform_drv_probe+0x58/0xa8
  really_probe+0xe0/0x338
  driver_probe_device+0x5c/0xf0
  device_driver_attach+0x74/0x80
  __driver_attach+0x64/0xe0
  bus_for_each_dev+0x84/0xd8
  driver_attach+0x30/0x40
  bus_add_driver+0x188/0x1e8
  driver_register+0x64/0x110
  __platform_driver_register+0x54/0x60
  optee_driver_init+0x20/0x28
  do_one_initcall+0x54/0x24c
  kernel_init_freeable+0x1e8/0x2c0
  kernel_init+0x18/0x118
  ret_from_fork+0x10/0x18

The invoke_fn hook returned OPTEE_SMC_RETURN_ETHREAD_LIMIT, indicating
that the secure world threads were all in a suspended state at the time
of the kernel crash. This intermittently prevented the kdump kernel from
booting, resulting in a failure to collect the kernel dump.

Make kernel dump collection more reliable on systems utilizing OP-TEE by
refusing to load the driver under the kdump kernel.

Cc: stable@vger.kernel.org
Signed-off-by: Tyler Hicks <tyhicks@linux.microsoft.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2021-07-21 07:39:42 +02:00
Tyler Hicks
ec185dd3ab optee: Fix memory leak when failing to register shm pages
Free the previously allocated pages when we encounter an error condition
while attempting to register the pages with the secure world.

Fixes: a249dd200d ("tee: optee: Fix dynamic shm pool allocations")
Fixes: 5a769f6ff4 ("optee: Fix multi page dynamic shm pool alloc")
Cc: stable@vger.kernel.org
Signed-off-by: Tyler Hicks <tyhicks@linux.microsoft.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2021-07-21 07:39:33 +02:00
Linus Torvalds
8ec035ac4a fallthrough fixes for Clang for 5.14-rc1
Hi Linus,
 
 Please, pull the following patches that fix many fall-through warnings
 when building with Clang 12.0.0 and this[1] change reverted. Notice
 that in order to enable -Wimplicit-fallthrough for Clang, such change[1]
 is meant to be reverted at some point. So, these patches help to move
 in that direction.
 
 Thanks!
 
 [1] commit e2079e93f5 ("kbuild: Do not enable -Wimplicit-fallthrough for clang for now")
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEkmRahXBSurMIg1YvRwW0y0cG2zEFAmDaNe8ACgkQRwW0y0cG
 2zFfGA/9G1A/Hrf261/P9olyYe2TRBwLnO1tUDREm3qtJ2JdKpf+7EM3VDm+Ue/A
 qhNmwp5G7nmp7Nqq8MfbdFjeo/rPS67voXiOfO8b0pU+E4XlOc+B1BXL0BWtnP7b
 xvuauklQU6dmCp2u44vsxdBIO6ooR0uQh+7/+1la+mPyEk9mlooQ4lyFcpfA53yt
 zxEGrx0tZBrDXghEI1CkHxOaJaX3qhw4EUYvxe8n2L7Dgx+o2djL/G4/SRYH/xoq
 MZa8TLyCuR3J0Ph4TfDONhMmf8ZLn+j70xBhewcVfZ1JfvGSVw4DQNN44KZCDnrK
 tGsBo5VFksjbmX83LmT8UlqB1rTP4nVQtRmtOPvbQA9kd19yy+Y64Y58FcGU2FHl
 PWt3rQJ1JzBo3TtzQoz7HSJCt9QTil4U7hFbNtcp5BbWQfUPkRgpWcL3FOchZbZ6
 FnLMqHanw2lrKMzZEoyHvg6G7BT67k3rrFgtd/xGSn8ohtfKXaZBYa9PKrQ0LwuG
 o8tQtIX1owj4rbdI1t6Ob4X/tT6Y7DzH8nsF+TsJQ4XeSCD2rURUcYltBMIlEr16
 DFj7iWKIrrX80/JRsBXu7a9h8nn5YptxV12SGRq/Cu/2jfRwjDye4IzsCyqMf67n
 oEN6YC1XYaEUmKXTnI8Z0CxY0qwSTcNjeH5Ci9jWepinsqD3Jxw=
 =Kt2q
 -----END PGP SIGNATURE-----

Merge tag 'fallthrough-fixes-clang-5.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux

Pull fallthrough fixes from Gustavo Silva:
 "Fix many fall-through warnings when building with Clang 12.0.0 and
  '-Wimplicit-fallthrough' so that we at some point will be able to
  enable that warning by default"

* tag 'fallthrough-fixes-clang-5.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux: (26 commits)
  rxrpc: Fix fall-through warnings for Clang
  drm/nouveau/clk: Fix fall-through warnings for Clang
  drm/nouveau/therm: Fix fall-through warnings for Clang
  drm/nouveau: Fix fall-through warnings for Clang
  xfs: Fix fall-through warnings for Clang
  xfrm: Fix fall-through warnings for Clang
  tipc: Fix fall-through warnings for Clang
  sctp: Fix fall-through warnings for Clang
  rds: Fix fall-through warnings for Clang
  net/packet: Fix fall-through warnings for Clang
  net: netrom: Fix fall-through warnings for Clang
  ide: Fix fall-through warnings for Clang
  hwmon: (max6621) Fix fall-through warnings for Clang
  hwmon: (corsair-cpro) Fix fall-through warnings for Clang
  firewire: core: Fix fall-through warnings for Clang
  braille_console: Fix fall-through warnings for Clang
  ipv4: Fix fall-through warnings for Clang
  qlcnic: Fix fall-through warnings for Clang
  bnxt_en: Fix fall-through warnings for Clang
  netxen_nic: Fix fall-through warnings for Clang
  ...
2021-06-28 20:03:38 -07:00
Olof Johansson
7468bed8f8 OP-TEE use export_uuid() to copy UUID
-----BEGIN PGP SIGNATURE-----
 
 iQJOBAABCgA4FiEEFV+gSSXZJY9ZyuB5LinzTIcAHJcFAmCjhswaHGplbnMud2lr
 bGFuZGVyQGxpbmFyby5vcmcACgkQLinzTIcAHJfM7Q//f4hdxcAb+iLiFwJVj7IL
 0kJ5MUj+4NyxdzxWBsqHE80Vf0MxumAaxLLKLl1SrV1os3nKUQENG7+XAdC/5ozT
 m3Qcw0qTQRQ3eC3wMDM150fmnpadTkeOmwReQrsHBdczP+fuWbw9q+JN9dN3t2y8
 kaym43DtGoIbUfmyqmac5YbO80mE0QAq73wcqYqRcNQk56fS2nsPFEUTqDA9iQTp
 lAVtMoYC65SdHFHsxMe46TMme0vnG99sN2MMLwNDfJdYjQI1Dzn3NRqgVMEmGvNP
 ZShtvePSoaF/GS3axzlE2dxJcHPyC7bLSoTYS4s0FjWQ8AcJMqQrL2YeCJieny4Y
 2SILHN+25xDVyAimW8dQQNJBnDP/zJlnL6FBv6b7I1rynQYy733NbZ8TedHlHptF
 WEV47IyYVvaQs18wg24MD4wjtVDzK8s/r+frpBOrTiRr/AYJqqu8JtKYJHKNRpqZ
 EGN9o54fe4Yo97fkcyqQkE/vYdsRhJfz29gPEMaITSwOEu11xIiM2ia7KyARWbjo
 wJzZJY4AH2Gs0LeoEfMwTyKCH4KGvziBVzd/Dbc8ri1mzpgoRuDN1IkMcbBoZghQ
 1xjlRwZKk4yMKO5Sj4jOd6bp03qpFL+9lD0MKSD70Z86DN8Ods0G2QwgdhdHBe9o
 7gQE8NyvTmHWZ93aS1Fer1k=
 =1uWY
 -----END PGP SIGNATURE-----

Merge tag 'optee-fix-for-v5.13' of git://git.linaro.org/people/jens.wiklander/linux-tee into arm/fixes

OP-TEE use export_uuid() to copy UUID

* tag 'optee-fix-for-v5.13' of git://git.linaro.org/people/jens.wiklander/linux-tee:
  optee: use export_uuid() to copy client UUID

Link: https://lore.kernel.org/r/20210518100712.GA449561@jade
Signed-off-by: Olof Johansson <olof@lixom.net>
2021-06-05 15:43:11 -07:00
Jens Wiklander
673c7aa243 optee: use export_uuid() to copy client UUID
Prior to this patch optee_open_session() was making assumptions about
the internal format of uuid_t by casting a memory location in a
parameter struct to uuid_t *. Fix this using export_uuid() to get a well
defined binary representation and also add an octets field in struct
optee_msg_param in order to avoid casting.

Fixes: c5b4312bea ("tee: optee: Add support for session login client UUID generation")
Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2021-05-18 07:59:27 +02:00
Gustavo A. R. Silva
963cdcc37e tee: Fix fall-through warnings for Clang
In preparation to enable -Wimplicit-fallthrough for Clang, fix a warning
by explicitly adding a break statement instead of letting the code fall
through to the next case.

Link: https://github.com/KSPP/linux/issues/115
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
2021-05-17 18:40:54 -05:00
Arnd Bergmann
8ec51f894b AMD-TEE reference count loaded TAs
-----BEGIN PGP SIGNATURE-----
 
 iQJOBAABCgA4FiEEFV+gSSXZJY9ZyuB5LinzTIcAHJcFAmCSeuwaHGplbnMud2lr
 bGFuZGVyQGxpbmFyby5vcmcACgkQLinzTIcAHJe/rA//QN3OBBD0K2kx8gBD2Lxb
 4oaJEjgJAJPoT8qGLPVZcYDXUkNIjx78fz+IPNVtJamaw9c6jDMXe/wB21QFmruy
 ZcOP0+cfk0ytCcsHAeY9CICjWA7c73fq89VOmT8upv54m1dGSV8Qat5rarJTNJ4T
 7WNybzsUeCOHbxJky4BtnXV/l/9w0gpwrlB47fChGPCvadGeP3LsKkcNIsNWdNQa
 VrYNqXCL2cQIELExeH0ZqaIlQpXFwiJdTseBBL69DwKw/QZuxH2U+Qr1vAUuPKL8
 EzGQnHYcmuzmDsITUAnSnzo8zc9A9yRcR6CTM+wK8Q+n8L8dIWzSjEiQZCisEWzX
 DURJK2oHLhTEovpEhHUEDOmQk892IHIDGAMr5hwXMaALmA+ruGyObMCtAxnFBItw
 hL9FkXcWpXXS0pJZXs60lwBtebC823nVhvZtjA5ek2RSJM8YiQLVP8acDZ/zbt/Q
 AG9ZLuTO2tYUS4qWRW8V7j+gA+CveKbVZH3/RuCBtk1BxupTZ/8EjaQwN5wBkJgP
 ohHog59ZNydCkaJkN9vM/DenG+OAQz6wN6GYGbaeXMV873z/6WSa/pc/WE1dLF/B
 Dpnyafefi9luN1O7vZrbrX+/4CHkeirOYS1kSCxz+PF0RCAXIuWuj6NWJPmyUAnT
 mVOY0V9naDFVYboE5HFdwww=
 =aCPL
 -----END PGP SIGNATURE-----

Merge tag 'amdtee-fixes-for-v5.13' of git://git.linaro.org/people/jens.wiklander/linux-tee into arm/fixes

AMD-TEE reference count loaded TAs

* tag 'amdtee-fixes-for-v5.13' of git://git.linaro.org/people/jens.wiklander/linux-tee:
  tee: amdtee: unload TA only when its refcount becomes 0

Link: https://lore.kernel.org/r/20210505110850.GA3434209@jade
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2021-05-17 16:06:02 +02:00
Rijo Thomas
9f015b3765 tee: amdtee: unload TA only when its refcount becomes 0
Same Trusted Application (TA) can be loaded in multiple TEE contexts.

If it is a single instance TA, the TA should not get unloaded from AMD
Secure Processor, while it is still in use in another TEE context.

Therefore reference count TA and unload it when the count becomes zero.

Fixes: 757cc3e9ff ("tee: add AMD-TEE driver")
Reviewed-by: Devaraj Rangasamy <Devaraj.Rangasamy@amd.com>
Signed-off-by: Rijo Thomas <Rijo-john.Thomas@amd.com>
Acked-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2021-05-05 13:00:11 +02:00
Linus Torvalds
37f00ab4a0 ARM: SoC drivers for v5.13
Updates for SoC specific drivers include a few subsystems that
 have their own maintainers but send them through the soc tree:
 
 TEE/OP-TEE:
  -  Add tracepoints around calls to secure world
 
 Memory controller drivers:
  - Minor fixes for Renesas, Exynos, Mediatek and Tegra platforms
  - Add debug statistics to Tegra20 memory controller
  - Update Tegra bindings and convert to dtschema
 
 ARM SCMI Firmware:
  - Support for modular SCMI protocols and vendor specific extensions
  - New SCMI IIO driver
  - Per-cpu DVFS
 
 The other driver changes are all from the platform maintainers
 directly and reflect the drivers that don't fit into any other
 subsystem as well as treewide changes for a particular platform.
 
 SoCFPGA:
  - Various cleanups contributed by Krzysztof Kozlowski
 
 Mediatek:
  - add MT8183 support to mutex driver
  - MMSYS: use per SoC array to describe the possible routing
  - add MMSYS support for MT8183 and MT8167
  - add support for PMIC wrapper with integrated arbiter
  - add support for MT8192/MT6873
 
 Tegra:
  - Bug fixes to PMC and clock drivers
 
 NXP/i.MX:
  - Update SCU power domain driver to keep console domain power on.
  - Add missing ADC1 power domain to SCU power domain driver.
  - Update comments for single global power domain in SCU power domain
    driver.
  - Add i.MX51/i.MX53 unique id support to i.MX SoC driver.
 
 NXP/FSL SoC driver updates for v5.13
  - Add ACPI support for RCPM driver
  - Use generic io{read,write} for QE drivers after performance optimized
    for PowerPC
  - Fix QBMAN probe to cleanup HW states correctly for kexec
  - Various cleanup and style fix for QBMAN/QE/GUTS drivers
 
 OMAP:
  - Preparation to use devicetree for genpd
  - ti-sysc needs iorange check improved when the interconnect target module
    has no control registers listed
  - ti-sysc needs to probe l4_wkup and l4_cfg interconnects first to avoid
    issues with missing resources and unnecessary deferred probe
  - ti-sysc debug option can now detect more devices
  - ti-sysc now warns if an old incomplete devicetree data is found as we
    now rely on it being complete for am3 and 4
  - soc init code needs to check for prcm and prm nodes for omap4/5 and dra7
  - omap-prm driver needs to enable autoidle retention support for omap4
  - omap5 clocks are missing gpmc and ocmc clock registers
  - pci-dra7xx now needs to use builtin_platform_driver instead of using
    builtin_platform_driver_probe for deferred probe to work
 
 Raspberry Pi:
  - Fix-up all RPi firmware drivers so as for unbind to happen in an
    orderly fashion
  - Support for RPi's PoE hat PWM bus
 
 Qualcomm
  - Improved detection for SCM calling conventions
  - Support for OEM specific wifi firmware path
  - Added drivers for SC7280/SM8350: RPMH, LLCC< AOSS QMP
 
 Signed-off-by: Arnd Bergmann <arnd@arndb.de>
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEo6/YBQwIrVS28WGKmmx57+YAGNkFAmCC2JwACgkQmmx57+YA
 GNkgRg//cBtq2NyDbjiNABxFSkmGCfcc0w0C2wjVzr4cfg6BLTbuvvlpZxI912pu
 P1G2sbsdfQJ8sSeIyZos+PilWK0zHrqlaGZfKI19US45dMjpteDBgsPd7wNZwBjQ
 jbops3YLjztZK1HpY4dIdvMnfxt7yRqhBWaTbPuCwQ35c5KsOM8NHB3cP3BUINWK
 x1uuBCv9svppzwdDiPxneV93WKEzabOUo+WBMPyh5vnyvmW17Iif4BA/VKQxzymm
 mWUi8HHpKBpvntJOKwAD2hnLAdpR3SwX20SLOpyLhnJMotbzNUEqq3LdRxDNPdHk
 ry+rarJ78JGlYfpcfegf2bLf5ITNMfOyRGkjtzeYpcZIXPjufOg9DA9YtAy37k0u
 L0T/9gQ+tQ01WGMca77OyUtIqJKdblZrQMfuH/yGlR99bqFQMV7rNc7GNlX1MXp/
 zw4aOYrRWGtGEeAjx5JJWcYydvMSJpCrqxTz3YhgeJECHB2iA6YkV3NROR4TLW//
 tfxaKqxR/KmSqE6hoVOAuuQ0BLXNlql/+4EE6MKsAOBiKPJclvmJg4CyuY8G21ev
 9Su0zJnXMzai7gNu32v1pizGj26+AOhxCEgAG0mGgk2jlQSn24CKgm5e7kCUewcF
 j/1XksNPT95v/K8MsLpXe5xGvF3jhA1BlFfvjJNZOrcZywBXRxg=
 =iidq
 -----END PGP SIGNATURE-----

Merge tag 'arm-drivers-5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc

Pull ARM SoC driver updates from Arnd Bergmann:
 "Updates for SoC specific drivers include a few subsystems that have
  their own maintainers but send them through the soc tree:

  TEE/OP-TEE:
   - Add tracepoints around calls to secure world

  Memory controller drivers:
   - Minor fixes for Renesas, Exynos, Mediatek and Tegra platforms
   - Add debug statistics to Tegra20 memory controller
   - Update Tegra bindings and convert to dtschema

  ARM SCMI Firmware:
   - Support for modular SCMI protocols and vendor specific extensions
   - New SCMI IIO driver
   - Per-cpu DVFS

  The other driver changes are all from the platform maintainers
  directly and reflect the drivers that don't fit into any other
  subsystem as well as treewide changes for a particular platform.

  SoCFPGA:
   - Various cleanups contributed by Krzysztof Kozlowski

  Mediatek:
   - add MT8183 support to mutex driver
   - MMSYS: use per SoC array to describe the possible routing
   - add MMSYS support for MT8183 and MT8167
   - add support for PMIC wrapper with integrated arbiter
   - add support for MT8192/MT6873

  Tegra:
   - Bug fixes to PMC and clock drivers

  NXP/i.MX:
   - Update SCU power domain driver to keep console domain power on.
   - Add missing ADC1 power domain to SCU power domain driver.
   - Update comments for single global power domain in SCU power domain
     driver.
   - Add i.MX51/i.MX53 unique id support to i.MX SoC driver.

  NXP/FSL SoC driver updates for v5.13
   - Add ACPI support for RCPM driver
   - Use generic io{read,write} for QE drivers after performance
     optimized for PowerPC
   - Fix QBMAN probe to cleanup HW states correctly for kexec
   - Various cleanup and style fix for QBMAN/QE/GUTS drivers

  OMAP:
   - Preparation to use devicetree for genpd
   - ti-sysc needs iorange check improved when the interconnect target
     module has no control registers listed
   - ti-sysc needs to probe l4_wkup and l4_cfg interconnects first to
     avoid issues with missing resources and unnecessary deferred probe
   - ti-sysc debug option can now detect more devices
   - ti-sysc now warns if an old incomplete devicetree data is found as
     we now rely on it being complete for am3 and 4
   - soc init code needs to check for prcm and prm nodes for omap4/5 and
     dra7
   - omap-prm driver needs to enable autoidle retention support for
     omap4
   - omap5 clocks are missing gpmc and ocmc clock registers
   - pci-dra7xx now needs to use builtin_platform_driver instead of
     using builtin_platform_driver_probe for deferred probe to work

  Raspberry Pi:
   - Fix-up all RPi firmware drivers so as for unbind to happen in an
     orderly fashion
   - Support for RPi's PoE hat PWM bus

  Qualcomm
   - Improved detection for SCM calling conventions
   - Support for OEM specific wifi firmware path
   - Added drivers for SC7280/SM8350: RPMH, LLCC< AOSS QMP"

* tag 'arm-drivers-5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (165 commits)
  soc: aspeed: fix a ternary sign expansion bug
  memory: mtk-smi: Add device-link between smi-larb and smi-common
  memory: samsung: exynos5422-dmc: handle clk_set_parent() failure
  memory: renesas-rpc-if: fix possible NULL pointer dereference of resource
  clk: socfpga: fix iomem pointer cast on 64-bit
  soc: aspeed: Adapt to new LPC device tree layout
  pinctrl: aspeed-g5: Adapt to new LPC device tree layout
  ipmi: kcs: aspeed: Adapt to new LPC DTS layout
  ARM: dts: Remove LPC BMC and Host partitions
  dt-bindings: aspeed-lpc: Remove LPC partitioning
  soc: fsl: enable acpi support in RCPM driver
  soc: qcom: mdt_loader: Detect truncated read of segments
  soc: qcom: mdt_loader: Validate that p_filesz < p_memsz
  soc: qcom: pdr: Fix error return code in pdr_register_listener
  firmware: qcom_scm: Fix kernel-doc function names to match
  firmware: qcom_scm: Suppress sysfs bind attributes
  firmware: qcom_scm: Workaround lack of "is available" call on SC7180
  firmware: qcom_scm: Reduce locking section for __get_convention()
  firmware: qcom_scm: Make __qcom_scm_is_call_available() return bool
  Revert "soc: fsl: qe: introduce qe_io{read,write}* wrappers"
  ...
2021-04-26 12:11:52 -07:00
Arnd Bergmann
d6358a6878 OP-TEE skip check of returned memref size
-----BEGIN PGP SIGNATURE-----
 
 iQJOBAABCgA4FiEEFV+gSSXZJY9ZyuB5LinzTIcAHJcFAmBjAY0aHGplbnMud2lr
 bGFuZGVyQGxpbmFyby5vcmcACgkQLinzTIcAHJdfsxAAmIK4ZPSz3spiw2b4N+It
 DBTpjI6MLn+s3njgoBOQ+VQb+uSQIIMzNSEm0r1PEN2ZgcyWtWgcNfupr/0qbQ8V
 P+V1aiuGqxPwG985bJTbKV0PTmMGlemXlcegrSmfVFBFofD+SlRUscK0GAIFHQ5G
 hmXiinOPu4lDMZFDoOKOjxhbB0Co06t7LC8xxccm+Mi5AQXgNzyjjsrQ2xzmK5vf
 tjAIFHgXFIXRJVouaXdqfWt1usHw8IaN8GwoknSq1T/wjtdToLdf5Wn6aWH+d42m
 09zpUTy02/cftdnkqZ1SaoDgE3r72aLk4LsFRtL8Vy/IiW6M02TzBIoYSW1ZUEr7
 wJVZVT6FykwBKfILpssznW6SCZaSspEY4BQTo8S+oAL6miOB7QdrAQpfz2OdlAsB
 dDBC0b+5kdMsqYGq/n6q5sJOb4Uvus1JB8Ye9tpib4c44hWOAG3UH6DXI/IFnicN
 tn2A8k1YCIC/bvAyF57783tzILsCguiPl3e23jl7Zo87P7W7nHs+a4p6OdU/4Mav
 Ti4j05zFIOLwqkkuyp1AS+/KokRez2B/MzxBOdoUf/4+J0HCwx0aAMYhbdqHO3hr
 YOpnEQiYvrJ1Tq/IeWyIBQS/FRK9MTLIph7p3XbxtyqMDPi8M3KVW2dygbJ0/j+v
 iR5///qOtc/ceaB6+N3H6bM=
 =OMHv
 -----END PGP SIGNATURE-----

Merge tag 'optee-memref-size-for-v5.13' of git://git.linaro.org/people/jens.wiklander/linux-tee into arm/drivers

OP-TEE skip check of returned memref size

* tag 'optee-memref-size-for-v5.13' of git://git.linaro.org/people/jens.wiklander/linux-tee:
  tee: optee: do not check memref size on return from Secure World

Link: https://lore.kernel.org/r/20210330110037.GA1166563@jade
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2021-04-01 21:01:18 +02:00
Jerome Forissier
c650b8dc7a tee: optee: do not check memref size on return from Secure World
When Secure World returns, it may have changed the size attribute of the
memory references passed as [in/out] parameters. The GlobalPlatform TEE
Internal Core API specification does not restrict the values that this
size can take. In particular, Secure World may increase the value to be
larger than the size of the input buffer to indicate that it needs more.

Therefore, the size check in optee_from_msg_param() is incorrect and
needs to be removed. This fixes a number of failed test cases in the
GlobalPlatform TEE Initial Configuratiom Test Suite v2_0_0_0-2017_06_09
when OP-TEE is compiled without dynamic shared memory support
(CFG_CORE_DYN_SHM=n).

Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Suggested-by: Jens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: Jerome Forissier <jerome@forissier.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2021-03-30 10:44:50 +02:00
Jisheng Zhang
7ccdcaace8 tee: optee: fix build error caused by recent optee tracepoints feature
If build kernel without "O=dir", below error will be seen:

In file included from drivers/tee/optee/optee_trace.h:67,
                 from drivers/tee/optee/call.c:18:
./include/trace/define_trace.h:95:42: fatal error: ./optee_trace.h: No such file or directory
   95 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
      |                                          ^
compilation terminated.

Fix it by adding below line to Makefile:
CFLAGS_call.o := -I$(src)

Tested with and without "O=dir", both can build successfully.

Fixes: 0101947dbc ("tee: optee: add invoke_fn tracepoints")
Tested-by: Heiko Thiery <heiko.thiery@gmail.com>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Reported-by: Guenter Roeck <linux@roeck-us.net>
Suggested-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2021-03-30 09:33:33 +02:00
Leon Romanovsky
6417f03132 module: remove never implemented MODULE_SUPPORTED_DEVICE
MODULE_SUPPORTED_DEVICE was added in pre-git era and never was
implemented. We can safely remove it, because the kernel has grown
to have many more reliable mechanisms to determine if device is
supported or not.

Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-03-17 13:16:18 -07:00
Jisheng Zhang
0101947dbc tee: optee: add invoke_fn tracepoints
Add tracepoints to retrieve information about the invoke_fn. This would
help to measure how many invoke_fn are triggered and how long it takes
to complete one invoke_fn call.

Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2021-03-15 12:04:01 +01:00
Arnd Bergmann
d0236f17c3 Simplify i2c acess in OP-TEE driver
-----BEGIN PGP SIGNATURE-----
 
 iQJOBAABCgA4FiEEFV+gSSXZJY9ZyuB5LinzTIcAHJcFAmAhMfEaHGplbnMud2lr
 bGFuZGVyQGxpbmFyby5vcmcACgkQLinzTIcAHJcIQBAArhVQWNNouxrFlDZgZ4fV
 0Gowe9tHmDCJDQFpHVsVwIXXGYBfE4keAE5yxTd0mgbPe1/8vua9EjEfpPWoyonH
 UdlxPxWOYJ3aMEe4cU1Ok76wIrYvpEAgeFti1up9vTIaeEuFHgYMPqf42P3q882Y
 gOycRIBTtoLzpSzrxl3H2GkG/362NMpqdLAzhyNA5dxFm6D++7gSai1PPr7exikg
 c1NkDoawK9X9mqtCwnI4jBaCio57P1iuHmIig4abod3+0G2WMja4Gs/fmarJDJx8
 ktBNNsJc1W07024jOr4MS8lvTseQ5wM7csUFwst6fRAEmB578c0XVz4GqPWm3TKP
 /6yYpL/qku2txT5kr2YacfDqnLeJ96y5YtpC9rh18cXs8NIJzJS7QCKDYvsYQxr3
 MLyHF6KS1sQWxi7dej+NOg3fRHigoZTliM7G451eSmEnFF96Gbwb1VIQ9DTFQKwm
 tKwwR5vpo6uSCbZKNh4nelCcrnH7404tqcjkpKo1DtphEXFs4MAs35qitgF+dTBE
 DElz8EDYVvGVxnhADV0OoG5LIWGLsgaIWLiOpuBS8M/M5M+6sI7w+ZFUbQUv2woV
 IOwHChkFqXVtWPa0DxHysYn/6Jo5biydncLxxmGx9KhIt4PL64eajSoBNkiqod1k
 lfyQQbexeU0zUbriKN/PIrM=
 =yi2I
 -----END PGP SIGNATURE-----

Merge tag 'optee-simplify-i2c-access_for-v5.12' of git://git.linaro.org/people/jens.wiklander/linux-tee into arm/drivers

Simplify i2c acess in OP-TEE driver

* tag 'optee-simplify-i2c-access_for-v5.12' of git://git.linaro.org/people/jens.wiklander/linux-tee:
  optee: simplify i2c access

Link: https://lore.kernel.org/soc/20210208125853.GA288348%40jade
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2021-02-09 16:10:49 +01:00
Arnd Bergmann
67bc809752 optee: simplify i2c access
Storing a bogus i2c_client structure on the stack adds overhead and
causes a compile-time warning:

drivers/tee/optee/rpc.c:493:6: error: stack frame size of 1056 bytes in function 'optee_handle_rpc' [-Werror,-Wframe-larger-than=]
void optee_handle_rpc(struct tee_context *ctx, struct optee_rpc_param *param,

Change the implementation of handle_rpc_func_cmd_i2c_transfer() to
open-code the i2c_transfer() call, which makes it easier to read
and avoids the warning.

Fixes: c05210ab97 ("drivers: optee: allow op-tee to access devices on the i2c bus")
Tested-by: Jorge Ramirez-Ortiz <jorge@foundries.io>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2021-02-08 13:42:31 +01:00
Arnd Bergmann
d94bd41a00 Remove unnecessary need_resched() before cond_resched()
-----BEGIN PGP SIGNATURE-----
 
 iQJOBAABCgA4FiEEFV+gSSXZJY9ZyuB5LinzTIcAHJcFAmAajW8aHGplbnMud2lr
 bGFuZGVyQGxpbmFyby5vcmcACgkQLinzTIcAHJeFPA/9HRR+Jdks2lEV04kLJ6s2
 4vmmKWFfa7zva5mtvvfHPKWzdJ5+oqsEk0dcML650KNgc0nRakNQxc8gCmzLhHAA
 nAhuM7EuraF8XPc1a1upLGrm/Fff2DDAJkR5KLWZZxwxknTDXMVSYQflND/PaSSV
 Y7SCY03icm1KX0uMUo3RhiVykEEowuRq94ZciQaQMD7qqWpfudbjBMghx3f7C3fd
 0urWf5OoB9HBov28aGIHcbnXx8UV4kLVGpz5S+kY61WSCZFNQEhh2pFR/xa7GElJ
 kGNhemZoyCwLMKhcYOMCcl403FNVNZtZ8H0x/6lfBqGMAvyealuGJRt+Zt/+m+rU
 eFmGanTOVVWL82mTLOgRA87OZJLFp7EHHYndKm4d7z+sOJFqCch32Gh3tJ6F7wkH
 FQbWJlVbevWRAG0tTIg0wx0Z34TtqKy2bQsr0voPtM+x+wlnvKPdrxevb35DLwI6
 JMPi64Rv/bygmqPkwGas9il3nzTZCXxG59qPSUAto9A5yy20ROp3mlsBu05AWvKn
 Taozl3+5AZFztw/7PNi1hHBntAXI1xVwheWRCcgDS5CkH4nFWyP0VsJKkesEGLah
 CriTU6D3fypV2PxOix1g5NHWSWdoURzzGVN2ZwXJrejsqNziZBioCIcg1Uha+hYO
 Dni/MhvT4FNsq6BUKg/DWYs=
 =vF9G
 -----END PGP SIGNATURE-----

Merge tag 'optee-fix-cond-resched-call-for-v5.12' of git://git.linaro.org:/people/jens.wiklander/linux-tee into arm/drivers

Remove unnecessary need_resched() before cond_resched()

* tag 'optee-fix-cond-resched-call-for-v5.12' of git://git.linaro.org:/people/jens.wiklander/linux-tee:
  tee: optee: remove need_resched() before cond_resched()
  tee: optee: replace might_sleep with cond_resched

Link: https://lore.kernel.org/r/20210203120953.GB3624453@jade
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2021-02-03 13:24:57 +01:00
Jens Wiklander
9585676005 tee: optee: remove need_resched() before cond_resched()
Testing need_resched() before cond_resched() is not needed as an
equivalent test is done internally in cond_resched(). So drop the
need_resched() test.

Fixes: dcb3b06d9c ("tee: optee: replace might_sleep with cond_resched")
Reviewed-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
Tested-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
Tested-by: Sumit Garg <sumit.garg@linaro.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2021-02-03 08:11:11 +01:00
Jens Wiklander
617d8e8b34 optee: sync OP-TEE headers
Pulls in updates in the internal headers from OP-TEE OS [1]. A few
defines has been shortened, hence the changes in rpc.c. Defines not used
by the driver in tee_rpc_cmd.h has been filtered out.

Note that this does not change the ABI.

Link: [1] https://github.com/OP-TEE/optee_os
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2021-02-02 14:50:41 +01:00
Bjorn Helgaas
bed13b5fc4 tee: optee: fix 'physical' typos
Fix misspellings of "physical".

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2021-02-02 14:50:28 +01:00
Tian Tao
fda90b29e2 drivers: optee: use flexible-array member instead of zero-length array
Use flexible-array member introduced in C99 instead of zero-length
array. Most of zero-length array was already taken care in previous
patch [1]. Now modified few more cases which were not handled earlier.

[1]. https://patchwork.kernel.org/patch/11394197/

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2021-02-02 14:50:21 +01:00
Rouven Czerwinski
dcb3b06d9c tee: optee: replace might_sleep with cond_resched
might_sleep() is a debugging aid and triggers rescheduling only for
certain kernel configurations. Replace with an explicit check and
reschedule to work for all kernel configurations. Fixes the following
trace:

  [  572.945146] rcu: INFO: rcu_sched self-detected stall on CPU
  [  572.949275] rcu:     0-....: (2099 ticks this GP) idle=572/1/0x40000002 softirq=7412/7412 fqs=974
  [  572.957964]  (t=2100 jiffies g=10393 q=21)
  [  572.962054] NMI backtrace for cpu 0
  [  572.965540] CPU: 0 PID: 165 Comm: xtest Not tainted 5.8.7 #1
  [  572.971188] Hardware name: STM32 (Device Tree Support)
  [  572.976354] [<c011163c>] (unwind_backtrace) from [<c010b7f8>] (show_stack+0x10/0x14)
  [  572.984080] [<c010b7f8>] (show_stack) from [<c0511e4c>] (dump_stack+0xc4/0xd8)
  [  572.991300] [<c0511e4c>] (dump_stack) from [<c0519abc>] (nmi_cpu_backtrace+0x90/0xc4)
  [  572.999130] [<c0519abc>] (nmi_cpu_backtrace) from [<c0519bdc>] (nmi_trigger_cpumask_backtrace+0xec/0x130)
  [  573.008706] [<c0519bdc>] (nmi_trigger_cpumask_backtrace) from [<c01a5184>] (rcu_dump_cpu_stacks+0xe8/0x110)
  [  573.018453] [<c01a5184>] (rcu_dump_cpu_stacks) from [<c01a4234>] (rcu_sched_clock_irq+0x7fc/0xa88)
  [  573.027416] [<c01a4234>] (rcu_sched_clock_irq) from [<c01acdd0>] (update_process_times+0x30/0x8c)
  [  573.036291] [<c01acdd0>] (update_process_times) from [<c01bfb90>] (tick_sched_timer+0x4c/0xa8)
  [  573.044905] [<c01bfb90>] (tick_sched_timer) from [<c01adcc8>] (__hrtimer_run_queues+0x174/0x358)
  [  573.053696] [<c01adcc8>] (__hrtimer_run_queues) from [<c01aea2c>] (hrtimer_interrupt+0x118/0x2bc)
  [  573.062573] [<c01aea2c>] (hrtimer_interrupt) from [<c09ad664>] (arch_timer_handler_virt+0x28/0x30)
  [  573.071536] [<c09ad664>] (arch_timer_handler_virt) from [<c0190f50>] (handle_percpu_devid_irq+0x8c/0x240)
  [  573.081109] [<c0190f50>] (handle_percpu_devid_irq) from [<c018ab8c>] (generic_handle_irq+0x34/0x44)
  [  573.090156] [<c018ab8c>] (generic_handle_irq) from [<c018b194>] (__handle_domain_irq+0x5c/0xb0)
  [  573.098857] [<c018b194>] (__handle_domain_irq) from [<c052ac50>] (gic_handle_irq+0x4c/0x90)
  [  573.107209] [<c052ac50>] (gic_handle_irq) from [<c0100b0c>] (__irq_svc+0x6c/0x90)
  [  573.114682] Exception stack(0xd90dfcf8 to 0xd90dfd40)
  [  573.119732] fce0:                                                       ffff0004 00000000
  [  573.127917] fd00: 00000000 00000000 00000000 00000000 00000000 00000000 d93493cc ffff0000
  [  573.136098] fd20: d2bc39c0 be926998 d90dfd58 d90dfd48 c09f3384 c01151f0 400d0013 ffffffff
  [  573.144281] [<c0100b0c>] (__irq_svc) from [<c01151f0>] (__arm_smccc_smc+0x10/0x20)
  [  573.151854] [<c01151f0>] (__arm_smccc_smc) from [<c09f3384>] (optee_smccc_smc+0x3c/0x44)
  [  573.159948] [<c09f3384>] (optee_smccc_smc) from [<c09f4170>] (optee_do_call_with_arg+0xb8/0x154)
  [  573.168735] [<c09f4170>] (optee_do_call_with_arg) from [<c09f4638>] (optee_invoke_func+0x110/0x190)
  [  573.177786] [<c09f4638>] (optee_invoke_func) from [<c09f1ebc>] (tee_ioctl+0x10b8/0x11c0)
  [  573.185879] [<c09f1ebc>] (tee_ioctl) from [<c029f62c>] (ksys_ioctl+0xe0/0xa4c)
  [  573.193101] [<c029f62c>] (ksys_ioctl) from [<c0100060>] (ret_fast_syscall+0x0/0x54)
  [  573.200750] Exception stack(0xd90dffa8 to 0xd90dfff0)
  [  573.205803] ffa0:                   be926bf4 be926a78 00000003 8010a403 be926908 004e3cf8
  [  573.213987] ffc0: be926bf4 be926a78 00000000 00000036 be926908 be926918 be9269b0 bffdf0f8
  [  573.222162] ffe0: b6d76fb0 be9268fc b6d66621 b6c7e0d8

seen on STM32 DK2 with CONFIG_PREEMPT_NONE.

Fixes: 9f02b8f61f ("tee: optee: add might_sleep for RPC requests")
Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
Tested-by: Sumit Garg <sumit.garg@linaro.org>
[jw: added fixes tag + small adjustments in the code]
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2021-01-21 10:36:48 +01:00
Linus Torvalds
48c1c40ab4 ARM: SoC drivers for v5.11
There are a couple of subsystems maintained by other people that
 merge their drivers through the SoC tree, those changes include:
 
  - The SCMI firmware framework gains support for sensor notifications
    and for controlling voltage domains.
 
  - A large update for the Tegra memory controller driver, integrating
    it better with the interconnect framework
 
  - The memory controller subsystem gains support for Mediatek MT8192
 
  - The reset controller framework gains support for sharing pulsed
    resets
 
 For Soc specific drivers in drivers/soc, the main changes are
 
  - The Allwinner/sunxi MBUS gets a rework for the way it handles
    dma_map_ops and offsets between physical and dma address spaces.
 
  - An errata fix plus some cleanups for Freescale Layerscape SoCs
 
  - A cleanup for renesas drivers regarding MMIO accesses.
 
  - New SoC specific drivers for Mediatek MT8192 and MT8183 power domains
 
  - New SoC specific drivers for Aspeed AST2600 LPC bus control
    and SoC identification.
 
  - Core Power Domain support for Qualcomm MSM8916, MSM8939, SDM660
    and SDX55.
 
  - A rework of the TI AM33xx 'genpd' power domain support to use
    information from DT instead of platform data
 
  - Support for TI AM64x SoCs
 
  - Allow building some Amlogic drivers as modules instead of built-in
 
 Finally, there are numerous cleanups and smaller bug fixes for
 Mediatek, Tegra, Samsung, Qualcomm, TI OMAP, Amlogic, Rockchips,
 Renesas, and Xilinx SoCs.
 
 There is a trivial conflict in the cedrus driver, with two branches
 adding the same CEDRUS_CAPABILITY_H265_DEC flag, and another trivial
 remove/remove conflict in linux/dma-mapping.h.
 
 Signed-off-by: Arnd Bergmann <arnd@arndb.de>
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEo6/YBQwIrVS28WGKmmx57+YAGNkFAl/alSUACgkQmmx57+YA
 GNm7GRAAlNMVi7F0f4Ixf1bEh+J2QUonYIpZfrdxOLFwISGQ+nstGrFW2He/OeQv
 KAi027tZLl6Sdzjy809cLDPA4Z2IKwjVWhEbBHybvy1+irPYjnixtLd0x3YvPhjH
 iadlcjQ3uaGue8PvubK6CVnBEy82A+Pp29n9i4A4wX/8w+BVIhVsxwQWUBF8pFXE
 3La2UZYZMVMvVZMrpTOqwCgdmLDCk+RLMVZ1IiRqBEBq5/DVq03uIXgjGEOrq8tl
 PXC89w7K510Is891mbBdBThQf+pZkU1vwORuknDcEJKWs9ngbEha7ebVgp32kbFl
 pi8DEK205d106WQgfn0Zxkpbsp8XD058wDILwkhBcteXlBaUEL6btGVLDTUCJZuv
 /pkH8tL4lNGpThQFbCEXC8oHZBp2xk55P+SW9RRZOoA5tAp+sz7hlf3y3YKdCSxv
 4xybeeVOAgjl01WtbEC7CuIkqcKVSQ7njhLhC8r5ASteNywDThqxLT6nd0VegcQc
 YH3Eu9QRXpvFwQ35zMkTMWa27bMG5d60fp90bWT0R5amXZpxJJot87w8trFCxv74
 mE5KvCbefCRNsTt8GOBA/WR7hVaG369g07qOvs7g4LjJEM3Nl2h/A4/zVFef9O0t
 yq3Nm4YCGfDSAQXzGR2SJ3nxiqbDknzJTAtZPf4BmbaMuPOIJ5k=
 =BjJf
 -----END PGP SIGNATURE-----

Merge tag 'arm-soc-drivers-5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc

Pull ARM SoC driver updates from Arnd Bergmann:
 "There are a couple of subsystems maintained by other people that merge
  their drivers through the SoC tree, those changes include:

   - The SCMI firmware framework gains support for sensor notifications
     and for controlling voltage domains.

   - A large update for the Tegra memory controller driver, integrating
     it better with the interconnect framework

   - The memory controller subsystem gains support for Mediatek MT8192

   - The reset controller framework gains support for sharing pulsed
     resets

  For Soc specific drivers in drivers/soc, the main changes are

   - The Allwinner/sunxi MBUS gets a rework for the way it handles
     dma_map_ops and offsets between physical and dma address spaces.

   - An errata fix plus some cleanups for Freescale Layerscape SoCs

   - A cleanup for renesas drivers regarding MMIO accesses.

   - New SoC specific drivers for Mediatek MT8192 and MT8183 power
     domains

   - New SoC specific drivers for Aspeed AST2600 LPC bus control and SoC
     identification.

   - Core Power Domain support for Qualcomm MSM8916, MSM8939, SDM660 and
     SDX55.

   - A rework of the TI AM33xx 'genpd' power domain support to use
     information from DT instead of platform data

   - Support for TI AM64x SoCs

   - Allow building some Amlogic drivers as modules instead of built-in

  Finally, there are numerous cleanups and smaller bug fixes for
  Mediatek, Tegra, Samsung, Qualcomm, TI OMAP, Amlogic, Rockchips,
  Renesas, and Xilinx SoCs"

* tag 'arm-soc-drivers-5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (222 commits)
  soc: mediatek: mmsys: Specify HAS_IOMEM dependency for MTK_MMSYS
  firmware: xilinx: Properly align function parameter
  firmware: xilinx: Add a blank line after function declaration
  firmware: xilinx: Remove additional newline
  firmware: xilinx: Fix kernel-doc warnings
  firmware: xlnx-zynqmp: fix compilation warning
  soc: xilinx: vcu: add missing register NUM_CORE
  soc: xilinx: vcu: use vcu-settings syscon registers
  dt-bindings: soc: xlnx: extract xlnx, vcu-settings to separate binding
  soc: xilinx: vcu: drop useless success message
  clk: samsung: mark PM functions as __maybe_unused
  soc: samsung: exynos-chipid: initialize later - with arch_initcall
  soc: samsung: exynos-chipid: order list of SoCs by name
  memory: jz4780_nemc: Fix potential NULL dereference in jz4780_nemc_probe()
  memory: ti-emif-sram: only build for ARMv7
  memory: tegra30: Support interconnect framework
  memory: tegra20: Support hardware versioning and clean up OPP table initialization
  dt-bindings: memory: tegra20-emc: Document opp-supported-hw property
  soc: rockchip: io-domain: Fix error return code in rockchip_iodomain_probe()
  reset-controller: ti: force the write operation when assert or deassert
  ...
2020-12-16 16:38:41 -08:00
Linus Torvalds
9e4b0d55d8 Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Pull crypto updates from Herbert Xu:
 "API:
   - Add speed testing on 1420-byte blocks for networking

  Algorithms:
   - Improve performance of chacha on ARM for network packets
   - Improve performance of aegis128 on ARM for network packets

  Drivers:
   - Add support for Keem Bay OCS AES/SM4
   - Add support for QAT 4xxx devices
   - Enable crypto-engine retry mechanism in caam
   - Enable support for crypto engine on sdm845 in qce
   - Add HiSilicon PRNG driver support"

* 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (161 commits)
  crypto: qat - add capability detection logic in qat_4xxx
  crypto: qat - add AES-XTS support for QAT GEN4 devices
  crypto: qat - add AES-CTR support for QAT GEN4 devices
  crypto: atmel-i2c - select CONFIG_BITREVERSE
  crypto: hisilicon/trng - replace atomic_add_return()
  crypto: keembay - Add support for Keem Bay OCS AES/SM4
  dt-bindings: Add Keem Bay OCS AES bindings
  crypto: aegis128 - avoid spurious references crypto_aegis128_update_simd
  crypto: seed - remove trailing semicolon in macro definition
  crypto: x86/poly1305 - Use TEST %reg,%reg instead of CMP $0,%reg
  crypto: x86/sha512 - Use TEST %reg,%reg instead of CMP $0,%reg
  crypto: aesni - Use TEST %reg,%reg instead of CMP $0,%reg
  crypto: cpt - Fix sparse warnings in cptpf
  hwrng: ks-sa - Add dependency on IOMEM and OF
  crypto: lib/blake2s - Move selftest prototype into header file
  crypto: arm/aes-ce - work around Cortex-A57/A72 silion errata
  crypto: ecdh - avoid unaligned accesses in ecdh_set_secret()
  crypto: ccree - rework cache parameters handling
  crypto: cavium - Use dma_set_mask_and_coherent to simplify code
  crypto: marvell/octeontx - Use dma_set_mask_and_coherent to simplify code
  ...
2020-12-14 12:18:19 -08:00
Linus Torvalds
303bc93472 ARM: SoC fixes for v5.10, part 3
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
 
 Signed-off-by: Arnd Bergmann <arnd@arndb.de>
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEo6/YBQwIrVS28WGKmmx57+YAGNkFAl/BZkEACgkQmmx57+YA
 GNkl/xAAiFj6+N5iTVv/l1p28x+YhID/A9ahCCexEpvq+sU/PCFmGub0chw/ns6W
 xIM2+YAFcuIbfPt7J/eYG+q1FkQl3N+hsJ5yi9NOC4ugQZtq8Ag7ZKEzlLMCtBUU
 XD7Y6cz7BD/4FZ4XIn9w84qh7LoehOgH1MKW/wt+sCBpkwMroqmVmF/N9XzcruaB
 LX4M9bt5Ibt+fc+rkC4ka03jq41DCquQsSjSroLzSuFNkAy+OwvrOTJH2fLgqqlM
 Eu6//AYQzE8hz+2kHkpc5mCqfxvRN6HcITwgopQwMhXn092WoPu5zRPiUrILw2CK
 TtEhMDfJ1Q60A2NSuCDAho98rTsPEf4zMrql7rzDwo0M0wdv0xE6hWKglAVhPywT
 Hs1SFmd1Z3+7n5IcwufU3JHVJ9VViJxXJK3WrLU9skm+CfZQpGOmXrmqVTfNtkb2
 BK58guf11APvojzZ0nb8FGkxn/mCgCgNCMwRna1rjvtzQsnL+d8t7Cz5hXDABgpy
 QVXDhrGT2cLTizGGRcMIuHMs2pNB25Hj4mgLsuarDwofZktFOWtRARoz6ialv/MI
 H6ff5/8nOxgVFyE7GYjuVz69igBfnb4NYN/O3A0d6MroiTzZbwNXbq3B2vVWmVa5
 hBSqj54n6Me2Bk/q0KPJlpL8qRKUuoU9lKTzY7ZyaQVHZzEO5+c=
 =yGOq
 -----END PGP SIGNATURE-----

Merge tag 'arm-soc-fixes-v5.10-3' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc

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()
  ...
2020-11-27 14:48:03 -08:00
Arnd Bergmann
718e43b5f8 Linux 5.10-rc2
-----BEGIN PGP SIGNATURE-----
 
 iQFSBAABCAA8FiEEq68RxlopcLEwq+PEeb4+QwBBGIYFAl+fOigeHHRvcnZhbGRz
 QGxpbnV4LWZvdW5kYXRpb24ub3JnAAoJEHm+PkMAQRiGoQ0H/RLJU2FMIjO0mzLX
 9LqePQ9QmNWG4KeqxwWaKq90MinIbnSG3CDPKruu8RNh2Rr6nsEJmqg1DWyEiFRB
 8gzsBXMAC1i2aPfOrOnCJEfP+L+svKlbSii475tNdZw2DhP+/FBT0RVCt3rRhrRs
 atc8+dM7ViGLnlvRJ4LlVqA3d1kjOr5bsPYcIcnGIHY8mYWBLFzTSVgDdrcB9+3l
 7lZud/zMhJ3dS0bcnbIUS1YpBxHCsgEaMFQYmcv3RruIaaFbh5THkfQUSmbmrAru
 /EeVjwVMuvpvb2jxS1ofLx2in7t4tsNgItu4AfMmV0BurM5NhpqKo7mo/1nmR/X9
 Q4tjPRc=
 =cUbb
 -----END PGP SIGNATURE-----

Backmerge tag 'v5.10-rc2' into arm/drivers

The SCMI pull request for the arm/drivers branch requires v5.10-rc2
because of dependencies with other git trees, so merge that in here.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2020-11-27 21:04:53 +01:00
Rui Miguel Silva
853735e404 optee: add writeback to valid memory type
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: cdbcf83d29 ("tee: optee: check type of registered shared memory")
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2020-11-25 12:51:52 +01:00
Eric Biggers
a24d22b225 crypto: sha - split sha.h into sha1.h and sha2.h
Currently <crypto/sha.h> contains declarations for both SHA-1 and SHA-2,
and <crypto/sha3.h> contains declarations for SHA-3.

This organization is inconsistent, but more importantly SHA-1 is no
longer considered to be cryptographically secure.  So to the extent
possible, SHA-1 shouldn't be grouped together with any of the other SHA
versions, and usage of it should be phased out.

Therefore, split <crypto/sha.h> into two headers <crypto/sha1.h> and
<crypto/sha2.h>, and make everyone explicitly specify whether they want
the declarations for SHA-1, SHA-2, or both.

This avoids making the SHA-1 declarations visible to files that don't
want anything to do with SHA-1.  It also prepares for potentially moving
sha1.h into a new insecure/ or dangerous/ directory.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Acked-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2020-11-20 14:45:33 +11:00
Arnd Bergmann
0461a1ae98 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.
 -----BEGIN PGP SIGNATURE-----
 
 iQJOBAABCgA4FiEEFV+gSSXZJY9ZyuB5LinzTIcAHJcFAl+o9ugaHGplbnMud2lr
 bGFuZGVyQGxpbmFyby5vcmcACgkQLinzTIcAHJevIA/7BGyE7xPy7oNh+0LPX4NH
 sUr7OUFvQ/XcHtFtGIF4UwFnA22mKq1hHGjITSphucW9TJZHKQFt++B+wB+XoUWk
 LCSaQR1zr3/LS5O4fIhAaKenEQmfSz2DCaMuGcV5dhlmsegsWQUWQe06ttoFNsR1
 VTFIVvLGVdWPDVwSk/LsdJgESnBMalB+eDORIdyC5Gt6MaJxO/okQAWqC1T9VM7I
 HYS1xfczKjfmz8jlcR3S1Ea1oB9yK87LiUsI3wIYbi5TpcbHFS7eL5H6n2tIDh4N
 57bBqwwV6qdLixWqSFA+3lIADf+vU5HkZPqbSxOPo9aiMXp6tYEE9zbtxJI8i4G9
 pKVdUN905OCLPxFxo8TsVREUfAc8iMifF/YMtFqh3nVQeWbv7RknRRADbMs1m7Np
 72nEWeIfZYINqDPcJFzD+gWbUfiqHrApkfL+dRZZrVbRN6hNPbjarzKMmltZRkKy
 FRQChnDf6BlVAl4Cb9vXllMUTqDaIPmhcNa22S4XQI32dRxOOTkHF1zEcELZSNr+
 RfdKwb/u75uW5r0mze8TsuZdCIfvIXLpi4Am6ECwOAQ42vb41axeESKWNhl8E1Y6
 bXG0SAnWX9gqy7ewJtCz7eQb6UasVrXmjkU22x38f6qsa5Xw7SAB1E+7cXeZozPg
 2hlyomINmI/5IjoyLtvjHgg=
 =kkLP
 -----END PGP SIGNATURE-----

Merge tag 'amdtee-fixes-for-5.10' of git://git.linaro.org:/people/jens.wiklander/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>
2020-11-13 13:44:05 +01:00
Rijo Thomas
be353be278 tee: amdtee: synchronize access to shm list
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: 757cc3e9ff ("tee: add AMD-TEE driver")
Reviewed-by: Devaraj Rangasamy <Devaraj.Rangasamy@amd.com>
Signed-off-by: Rijo Thomas <Rijo-john.Thomas@amd.com>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2020-11-09 08:59:00 +01:00
Rijo Thomas
ff1f855804 tee: amdtee: fix memory leak due to reset of global shm list
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: 757cc3e9ff ("tee: add AMD-TEE driver")
Reviewed-by: Devaraj Rangasamy <Devaraj.Rangasamy@amd.com>
Signed-off-by: Rijo Thomas <Rijo-john.Thomas@amd.com>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2020-11-09 08:58:54 +01:00
Arnd Bergmann
6bc9d7391a Use UUID API to export the UUID
Uses export_uuid() to export and uuid_t to an u8 array instead of depending
 on the internals of uuid_t.
 -----BEGIN PGP SIGNATURE-----
 
 iQJOBAABCgA4FiEEFV+gSSXZJY9ZyuB5LinzTIcAHJcFAl+FROAaHGplbnMud2lr
 bGFuZGVyQGxpbmFyby5vcmcACgkQLinzTIcAHJcn5RAAhqcPJAzUYcD+Tx1N95Wj
 KJf6WLflUzIV1ur8HE4nrppl/oOhS/PPl0sLNCWJ9zYZeJWQlsHpLONs4h4/Xxp2
 t1VbLvdOV5FvymtlgKNX4GvCggOvNcca4qpbKx41b2xZEoTLRgln4bbBudCLq5I4
 mrQwPLQeVHMA3nFaFsADmTW3UUG3TjlUPYa1S8MyJ6STVnZwTQuMyk/JkYKfu++9
 P7LUs09/uQWGYAE9g5EuuJPUSd/40Ww5tSlaFtl3fKfPsAawz+oVtaAHYQnNXYmO
 qqLbV7vQJ0sW7HuG6mcA4q3q7mogv+dprOCjyuJ3uvtsCt5VnjNpCkayjV0eBRUA
 YzTtwZlpAfVhw/8BynojR5uy3SIQuOUnAQyJYRZwjKB6fnGjXjQWdFgSuMrOccYg
 5W/MwoOsVAc34yXIlw2k+BjifXZPuTi/G8WuuTloA3CENg5jekkqQkPHHDP1SZn4
 0JMW3R5RQ17ccq2CA2nETy5FU+p4wZzwROTGcFyXeg8SeZcLK1webWFdxM1lKf5p
 UZ4ibd1kmXCAz2/nScCVzSm6MIBIS2pyMcywxyijeIbrAxdSnYS1R9Pm1b37M5as
 66kQjYAHbxbMd/rf8qNAa6vnhHUPYGkF30yKGlkHlEju6n1QPF4Bdz+uBUHaKiPS
 PeJ1cpicESGQQcYoR4kRxBc=
 =tsJ3
 -----END PGP SIGNATURE-----

Merge tag 'optee-use-uuid-api-for-v5.10' of git://git.linaro.org:/people/jens.wiklander/linux-tee into arm/drivers

Use UUID API to export the UUID

Uses export_uuid() to export and uuid_t to an u8 array instead of depending
on the internals of uuid_t.

* tag 'optee-use-uuid-api-for-v5.10' of git://git.linaro.org:/people/jens.wiklander/linux-tee:
  tee: optee: Use UUID API for exporting the UUID

Link: https://lore.kernel.org/r/20201013063612.GA3325842@jade
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2020-10-26 15:38:16 +01:00
Arnd Bergmann
9774dd6853 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.
 -----BEGIN PGP SIGNATURE-----
 
 iQJOBAABCgA4FiEEFV+gSSXZJY9ZyuB5LinzTIcAHJcFAl+FTz4aHGplbnMud2lr
 bGFuZGVyQGxpbmFyby5vcmcACgkQLinzTIcAHJeHQA//TRf/ggtkMFB38Zl119/Z
 IAOqC5BohMaqf2hdOlGsnvl3bq+RDJeJQSAXuNkWA9q5UwBbzsT5f1jQGWvEu3HP
 de7L1lZM9PlC0vbB5G5LjX5P0SNwWIDRg3QSvUNoL2XUqFD28TzC6VDRIgZOXCWZ
 QzkpSLb7nr0z38F41F1O84KaiA0++/IdalV+SIN4o4eMa+WtX0Sm9/0vdWFlIOGV
 IrJV2GlmDQSBiRSQWUI4uzQ9MOp+NWD5gSCECMjP5Xh2m5G70HTJWAOayvAzQ3Hq
 aEo/wElu4gbiCeMxUgUQTULNCNPfiEkLYivLqV4u8YAmNzF+qOWbUDUZopnwxNLU
 pVl9RSFBzlF9QAyLe35BHi8lWKzmTWKLhNjII/2iB+4wpDjNhjlAUSe9RMn5qHGF
 09FZ8LYV4Bi3JU/RHFTwU31IOFMSf/827j16QAVu9V3Sp732pZ7HM3MxcRlA+hMn
 S4v/tHcF1zSpeBu9ab3E8qMpkaiVbhKfpenLAfQg+FISyLElGMg0JuxLR4y8Vb5O
 fnp7yqaReEKv5Imsch96WJgtcFrwPpqSbkZ/lY4mVFQR8zKScyacrrYRlmupVVm0
 w1WbMHTV+uG9bH+lNdrGvCnoL0B+73okGaqan2zdSljFjeITC835u5gno556H+aS
 0g3o4r47gxQ1C/f7IZCOFzE=
 =aCZO
 -----END PGP SIGNATURE-----

Merge tag 'tee-fix-for-v5.10' of git://git.linaro.org:/people/jens.wiklander/linux-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>
2020-10-26 10:55:56 +01:00
Sumit Garg
722939528a tee: client UUID: Skip REE kernel login method as well
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: e33bcbab16 ("tee: add support for session's client UUID generation") [1]
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2020-10-13 08:42:11 +02:00
Andy Shevchenko
57222a1be2 tee: optee: Use UUID API for exporting the UUID
There is export_uuid() function which exports uuid_t to the u8 array.
Use it instead of open coding variant.

This allows to hide the uuid_t internals.

Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2020-10-13 08:03:18 +02:00
Olof Johansson
5746b3b886 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.
 -----BEGIN PGP SIGNATURE-----
 
 iQJOBAABCgA4FiEEFV+gSSXZJY9ZyuB5LinzTIcAHJcFAl9kdqUaHGplbnMud2lr
 bGFuZGVyQGxpbmFyby5vcmcACgkQLinzTIcAHJcnsBAAysa3ggeat7K/Y8Sw9Ewh
 J5Kxbvn3BQ0DXOlOtrQIuNcRr4kSmJWCPJ8E0IxiB2q01QLldOFqwE0zOKDmWYb9
 eGe/CuDlbFM2vbaTrPfXX6uhCjWd5VexF2K11oJc9TuH5u/ZEycGIO+/BRE7u758
 YY5puPwP82wbDesR+sDg7/115aRJ36fQFwWMm4LRCd8fLtrFgB6RSngdBxLr+Ue7
 Bya9+fmHsBhlUCBOvxCoFOy/PLMruYzJwXg0IFt+V7SDS+1KPErdn6TTCIeWeWbX
 oYPn07bChU5/pdAi6gch9y5WUesG7mRnN8m58A3G3Cg6WFr4RZKJqIFYLb3R+z26
 RCLWmhf3ldqF/a3KW/UBuTXRwFZB0WnxuAhBgptkvYAxyC2/qEfjTnXdXLiIP+2F
 0HWtEaPU1rkZWLHEjsw3H8hVLGcwBNSTS8k6qtDI17pLoWFQ794u9OrRiMhtiOlz
 wcdhzWjSkQcFL3Wiq3I+eYmzIMtnRVqFbisEBMR5iB+0fYznEtIKNJHassivsdxf
 7njcHo+jQ0ayEOIft/v+Ob13U8fIrC3dVdPVDNSE5rzH2FcTL9eEqSfdhaqicoLv
 7OqfmCOZQ7b9uvbPWV2ils3BKF679g5iRcrqQr6193V8TxRNIlScuqWTsBVzd+Vd
 Q4ecnuA/1BA1j2bz5uB8ZP8=
 =Knzl
 -----END PGP SIGNATURE-----

Merge tag 'tee-dev-cleanup-for-v5.10' of git://git.linaro.org:/people/jens.wiklander/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>
2020-09-26 12:39:08 -07:00
Sudeep Holla
8c05f50fe8 tee: avoid explicit sysfs_create/delete_group by initialising dev->groups
If the dev->groups is initialised, the sysfs group is created as part
of device_add call. There is no need to call sysfs_create/delete_group
explicitly.

Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2020-09-18 10:44:45 +02:00
Sudeep Holla
ab3d8e1baa tee: replace cdev_add + device_add with cdev_device_add
Commit 233ed09d7f ("chardev: add helper function to register char devs
with a struct device") added a helper function 'cdev_device_add'.

Make use of cdev_device_add in tee_device_register to replace cdev_add
and device_add. Since cdev_device_add takes care of setting the
kobj->parent, drop explicit initialisation in tee_device_alloc.

Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2020-09-18 10:44:40 +02:00
Olof Johansson
0bd1937ad8 Make sure I2C functions used in OP-TEE are reachable with IS_REACHABLE()
-----BEGIN PGP SIGNATURE-----
 
 iQJOBAABCgA4FiEEFV+gSSXZJY9ZyuB5LinzTIcAHJcFAl9OHZUaHGplbnMud2lr
 bGFuZGVyQGxpbmFyby5vcmcACgkQLinzTIcAHJc8Jg/9EMdZ0icG/r1yeMMqPrGL
 YlKGok2PtJ79XqvSpUsVJmHfMKQ+O0j18zHAPkVHEgmC8zkHdaiXE50qRM8tx3IH
 /eDvH1sgCTytHaGn6O9VnM0K/QAp6uKPfc4zKaxjbxPsovgGs7sPrUUbpfso34fE
 KXwC9MaFVwoAayuuGE2zOkx5AAPYuIxEyrFtY4NDj/wg+5gHclknfiBJrbUKhUNB
 oaBmtqe5kEAgyjG2lPBPrJyO5u8DvWk11dQtmYsNjVzDljRq6YOwdpQ5nCLsmS5N
 7XlFEFS+VF17G8iwmq/xD5jOj6MFWrETTvDA+vVztumqVGsxAmIjdXYYZoBmHQ+b
 wJVoZfG2TFfWrsYma+Dl7vbDZBxfYlRlW557ixgoVMYZkQ8JFUuDMWya10gdzkPC
 2ncMTiVMLFQmin9SY6A3iKLvShcbfZ+VsdO9l6WQGBq8Lc9pAfEiGNwf7S1PO7fq
 7XZRE5FKzscREJ9pZ/APy9o+aHGzpRW+N91UspEFSkwfVrnKoULyE5ZZodsdVBC3
 FEL/nse2yy0ynP5rvPaXGC/yqBoQY1NG2yMn0hNU2JKBDVTD/wutcadBUaqUxzYl
 CqccN77MFJ4vqHNgptLAcwpyKCajUSxLu+DHDlqKmh0Jn8WWhKQQqMq1yMnmfveV
 qf2Bb2M7u3Q/hwLUAZfSqx0=
 =tNe4
 -----END PGP SIGNATURE-----

Merge tag 'optee-i2c-fix-for-v5.10' of git://git.linaro.org:/people/jens.wiklander/linux-tee into arm/drivers

Make sure I2C functions used in OP-TEE are reachable with IS_REACHABLE()

* tag 'optee-i2c-fix-for-v5.10' of git://git.linaro.org:/people/jens.wiklander/linux-tee:
  drivers: optee: fix i2c build issue

Link: https://lore.kernel.org/r/20200901101806.GA3286324@jade
Signed-off-by: Olof Johansson <olof@lixom.net>
2020-09-13 11:16:40 -07:00
Jorge Ramirez-Ortiz
539f8fc253 drivers: optee: fix i2c build issue
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: c05210ab97 ("drivers: optee: allow op-tee to access devices on the i2c bus")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2020-09-01 12:03:16 +02:00
Olof Johansson
aa10e3cfdb Converts tee subsystem to use pin_user_pages() instead of get_user_pages()
-----BEGIN PGP SIGNATURE-----
 
 iQJOBAABCgA4FiEEFV+gSSXZJY9ZyuB5LinzTIcAHJcFAl9E09QaHGplbnMud2lr
 bGFuZGVyQGxpbmFyby5vcmcACgkQLinzTIcAHJdlFhAAkz1UuhSN4/vkPuAO7zXD
 e1T+Z/3jioZOIHUH82ZB6QYTHtO4S1zjY516RXOQA3F+Lot1ikUQArHgITD4nbmN
 YtAY+hnlMcsHJLeLu55MNCZXVLHdT/kG0oDQfmt9l9xzXYVxl14sZcLL5Q96E++Z
 reb4oxwdrr4Fecz8WJUdAPfPlvl91s/tLLizmTwHI6Ex0Lgin5Db+PxkiQmv3tKB
 2ByvE85ZoMh7OWHB6X0edRAqTVTHGGUZfIH7eGWuXBJqFvRMODEFc4j1VvVD0CSA
 XTag12PJWqFOGUrGQ8t/YD/3kQpahq3fNET4QL6K/LWejHnolankCpd9ZsV+GhKU
 FeLdreZzpeWMzIM42MTBbLnfoJBOi7ik5ExexXQ+t3GRGl0uBqq4dyJv6pQDcKzD
 rbLemh0F4myYbHenVNkzTBl9km0Jo+Ts10eqyupRKMB4ZLRs9qTzqZPYhAsoenFc
 PQdyrQcSx88WogqoHm1Lr9qf2ssTV8j968859t2U0XbAodo9YBWofIt3bp5y4cSY
 RRQZLwTu2nU5+Go3XhYcyCJbHdcDP+PWZ/dA8fkiBKVQKvfUqqeSivbQ7Anuvift
 9hC3tJ419Hn04/ze9A7D8CFs8afueMinyx1rhx1y1QQN88jW7KlrTeFdyoMgsKct
 QVqGObdEREvgwJpJqlIfTRk=
 =MyeM
 -----END PGP SIGNATURE-----

Merge tag 'tee-pin-user-pages-for-5.10' of git://git.linaro.org/people/jens.wiklander/linux-tee into arm/drivers

Converts tee subsystem to use pin_user_pages() instead of get_user_pages()

* tag 'tee-pin-user-pages-for-5.10' of git://git.linaro.org/people/jens.wiklander/linux-tee:
  tee: convert get_user_pages() --> pin_user_pages()

Link: https://lore.kernel.org/r/20200825090715.GA2370775@jade
Signed-off-by: Olof Johansson <olof@lixom.net>
2020-08-27 02:04:32 -07:00
John Hubbard
4300cd6374 tee: convert get_user_pages() --> pin_user_pages()
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 <jens.wiklander@linaro.org>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
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 <jhubbard@nvidia.com>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2020-08-25 11:01:06 +02:00
Olof Johansson
d4ee2d3500 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.
 -----BEGIN PGP SIGNATURE-----
 
 iQJOBAABCgA4FiEEFV+gSSXZJY9ZyuB5LinzTIcAHJcFAl8/ncEaHGplbnMud2lr
 bGFuZGVyQGxpbmFyby5vcmcACgkQLinzTIcAHJfiMw//cH0FRlBW9rT/vU+cBJEG
 7SbxiW8r0Yz7apfV0u4mufR7ouKBjCHDYKevqAZff1lJnjj2uP11MFOKktm8mfQS
 k2qMI7WVMtqulThcfI8SZW7bqkJcycGD2UyrnGDpWjP3qhDT3oPxVo6mtHJcKJZR
 E9v1/lh5q1tS4twqPtXXTf7f0PxEmd6IE0wi3RjYR0JWyQtBDVz8cC+nVdXeeIwL
 0MkGWZsPYsjn/bnztM72cS21+r1OFcVfSumYFyPLk7rTxdzbKk0yy0IZXaULJn4D
 r+/uCEoJrOS2iG3kIwSZeLZScPcM/F0Xci1krVxDmkq+f2w2aDeCqhjozCHvrvpF
 U9Hrc4DUyzEVKk2A1oYa9TUAUsHpOtLqwYNE7eFY46W8XqYDr0lTzKKqZxe134OS
 jrinLBZJiEPOjTh8uSB46lni9rQx4wT6El7FoFjfofV5K6VEkvds9Ch+lCBA7JGT
 8KfIfHhapjuQBnz/XsQtL4cb19C2FELEryfDRUmlGZHrCSmHADsGufU+YeqGifag
 wPWJ7wzwIrGK4wk8KVNxm6r6sNnTCcqCSFXnsvN6hXU4C4/fEmGHIV8T5/fCl3pJ
 X4mZxJuU/tlAUXWx9jzUvb48vQx2hNpxBbqjpCA87M3d2dF7dUpX47yRQC6m4TuR
 vp2svTA7QFq89zhswYMM4D8=
 =wZ1T
 -----END PGP SIGNATURE-----

Merge tag 'tee-memref-null-for-v5.10' of git://git.linaro.org/people/jens.wiklander/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>
2020-08-21 09:20:30 -07:00
Jorge Ramirez-Ortiz
c05210ab97 drivers: optee: allow op-tee to access devices on the i2c bus
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 <jorge@foundries.io>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2020-08-21 11:41:45 +02:00