Commit Graph

308 Commits

Author SHA1 Message Date
Dan Carpenter
73048a8325 optee: Fix a NULL vs IS_ERR() check
The tee_shm_get_va() function never returns NULL, it returns error
pointers.  Update the check to match.

Fixes: f0c8431568 ("optee: probe RPMB device using RPMB subsystem")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Link: https://lore.kernel.org/r/f8c12aed-b5d1-4522-bf95-622b8569706d@stanley.mountain
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-09-09 12:22:06 +02:00
Jens Wiklander
edd3183c5c optee: add RPMB dependency
Prevent build error when CONFIG_RPMB=m and CONFIG_OPTEE=y by adding a
dependency to CONFIG_RPMB for CONFIG_OPTEE so the RPMB subsystem always
is reachable if configured. This means that CONFIG_OPTEE automatically
becomes compiled as a module if CONFIG_RPMB is compiled as a module. If
CONFIG_RPMB isn't configured or is configured as built-in, CONFIG_OPTEE
will remain unchanged.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202409021448.RSvcBPzt-lkp@intel.com/
Fixes: f0c8431568 ("optee: probe RPMB device using RPMB subsystem")
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Link: https://lore.kernel.org/r/20240902151231.3705204-2-jens.wiklander@linaro.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-09-03 14:34:45 +02:00
Jens Wiklander
f0c8431568 optee: probe RPMB device using RPMB subsystem
Adds support in the OP-TEE drivers (both SMC and FF-A ABIs) to probe and
use an RPMB device via the RPMB subsystem instead of passing the RPMB
frames via tee-supplicant in user space. A fallback mechanism is kept to
route RPMB frames via tee-supplicant if the RPMB subsystem isn't
available.

The OP-TEE RPC ABI is extended to support iterating over all RPMB
devices until one is found with the expected RPMB key already
programmed.

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Tested-by: Manuel Traut <manut@mecka.net>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Link: https://lore.kernel.org/r/20240814153558.708365-5-jens.wiklander@linaro.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-08-26 13:16:20 +02:00
Jens Wiklander
c30b855e81 tee: add tee_device_set_dev_groups()
Add tee_device_set_dev_groups() to TEE drivers to supply driver specific
attribute groups. The class specific attributes are from now on added
via the tee_class, which currently only consist of implementation_id.

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Link: https://lore.kernel.org/r/20240814153558.708365-4-jens.wiklander@linaro.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2024-08-26 13:16:20 +02:00
Linus Torvalds
c2a96b7f18 Driver core changes for 6.11-rc1
Here is the big set of driver core changes for 6.11-rc1.
 
 Lots of stuff in here, with not a huge diffstat, but apis are evolving
 which required lots of files to be touched.  Highlights of the changes
 in here are:
   - platform remove callback api final fixups (Uwe took many releases to
     get here, finally!)
   - Rust bindings for basic firmware apis and initial driver-core
     interactions.  It's not all that useful for a "write a whole driver
     in rust" type of thing, but the firmware bindings do help out the
     phy rust drivers, and the driver core bindings give a solid base on
     which others can start their work.  There is still a long way to go
     here before we have a multitude of rust drivers being added, but
     it's a great first step.
   - driver core const api changes.  This reached across all bus types,
     and there are some fix-ups for some not-common bus types that
     linux-next and 0-day testing shook out.  This work is being done to
     help make the rust bindings more safe, as well as the C code, moving
     toward the end-goal of allowing us to put driver structures into
     read-only memory.  We aren't there yet, but are getting closer.
   - minor devres cleanups and fixes found by code inspection
   - arch_topology minor changes
   - other minor driver core cleanups
 
 All of these have been in linux-next for a very long time with no
 reported problems.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCZqH+aQ8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+ymoOQCfVBdLcBjEDAGh3L8qHRGMPy4rV2EAoL/r+zKm
 cJEYtJpGtWX6aAtugm9E
 =ZyJV
 -----END PGP SIGNATURE-----

Merge tag 'driver-core-6.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core

Pull driver core updates from Greg KH:
 "Here is the big set of driver core changes for 6.11-rc1.

  Lots of stuff in here, with not a huge diffstat, but apis are evolving
  which required lots of files to be touched. Highlights of the changes
  in here are:

   - platform remove callback api final fixups (Uwe took many releases
     to get here, finally!)

   - Rust bindings for basic firmware apis and initial driver-core
     interactions.

     It's not all that useful for a "write a whole driver in rust" type
     of thing, but the firmware bindings do help out the phy rust
     drivers, and the driver core bindings give a solid base on which
     others can start their work.

     There is still a long way to go here before we have a multitude of
     rust drivers being added, but it's a great first step.

   - driver core const api changes.

     This reached across all bus types, and there are some fix-ups for
     some not-common bus types that linux-next and 0-day testing shook
     out.

     This work is being done to help make the rust bindings more safe,
     as well as the C code, moving toward the end-goal of allowing us to
     put driver structures into read-only memory. We aren't there yet,
     but are getting closer.

   - minor devres cleanups and fixes found by code inspection

   - arch_topology minor changes

   - other minor driver core cleanups

  All of these have been in linux-next for a very long time with no
  reported problems"

* tag 'driver-core-6.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (55 commits)
  ARM: sa1100: make match function take a const pointer
  sysfs/cpu: Make crash_hotplug attribute world-readable
  dio: Have dio_bus_match() callback take a const *
  zorro: make match function take a const pointer
  driver core: module: make module_[add|remove]_driver take a const *
  driver core: make driver_find_device() take a const *
  driver core: make driver_[create|remove]_file take a const *
  firmware_loader: fix soundness issue in `request_internal`
  firmware_loader: annotate doctests as `no_run`
  devres: Correct code style for functions that return a pointer type
  devres: Initialize an uninitialized struct member
  devres: Fix memory leakage caused by driver API devm_free_percpu()
  devres: Fix devm_krealloc() wasting memory
  driver core: platform: Switch to use kmemdup_array()
  driver core: have match() callback in struct bus_type take a const *
  MAINTAINERS: add Rust device abstractions to DRIVER CORE
  device: rust: improve safety comments
  MAINTAINERS: add Danilo as FIRMWARE LOADER maintainer
  MAINTAINERS: add Rust FW abstractions to FIRMWARE LOADER
  firmware: rust: improve safety comments
  ...
2024-07-25 10:42:22 -07:00
Linus Torvalds
cc0f7c3f97 soc: driver updates for 6.11
The updates to the mediatek, allwinner, ti, tegra, microchip, stm32,
 samsung, imx, zynq and amlogic platoforms are farily small maintenance
 changes, either addressing minor mistakes or enabling additional hardware.
 
 The qualcomm platform changes add a number of features and are larger
 than the other ones combined, introducing the use of linux/cleanup.h
 across several drivers, adding support for Snapdragon X1E and other
 SoCs in platform drivers, a new "protection domain mapper" driver, and a
 "shared memory bridge" driver.
 
 The cznic "turris omnia" router based on Marvell Armada gets a platform
 driver that talks to the board specific microcontroller.
 
 The reset and cache subsystems get a few minor updates to SoC specific
 drivers, while the ff-a, scmi and optee firmware drivers get some
 code refactoring and new features.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEiK/NIGsWEZVxh/FrYKtH/8kJUicFAmaVTTUACgkQYKtH/8kJ
 UiegixAAqGfwUtwk2GGZJlEGjUjT4cqrwCTLhNlaNfgN/dZxjk1XBTKvtp2mVDi2
 lJN8TNqa0Csw8XZYPgHi0s1ppmwQl07Unpbc9tUeS4tAeIuputDe+ia0UtQx3Mkd
 GTAKJO6VzLeCnDxB4757OURZO9wYlPdZycQbnSKDyfBIapFuZwozmbAc7BuFGvBv
 2Zt5lca531EJuM5wg25f+F/8XSxZIqjMA6/PTGNCYig1bx5AM2tCWK2xN+BL+dxn
 YVLuRZT7lSgpwivg9OHzJ49g9WeJB7RArnSDg1Ac7sNfC8476UC17BAH4rF7QSTP
 q2GBP2VOdRJA9mJkavtLhE/1LPDJuYTM+nt1xq7jzG2MKN7yLjX0LMrMgKsk0pXZ
 T2qQh7+4MA9lwlpGEwDruMajTJahbMgiAUcSivLsr18LrifAnKVHBDTRmRwNiRX2
 T3/zk90kenJX1NOkc4SrdLd5iCyq0oSN+fukdh3UMgJLnAzaWOe5mKAMF7eefeog
 rMH276W8JwbbmIC4R2aQm6TL7IWBtaCaHuLqYOiTjooir31OgwW4Mztd7okU4v4I
 rOGhV0zJTSVXT+a4O2jOooWppS9xE45/F2DSigSvZjEiahZ0L4feaOrHui5PVVlW
 wmFmobCq6Y0Mjspdk64O1tbUWJ17CmRK1WDrUUk0VgmLy9gn6A8=
 =ChcR
 -----END PGP SIGNATURE-----

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

Pull SoC driver updates from Arnd Bergmann:
 "The updates to the mediatek, allwinner, ti, tegra, microchip, stm32,
  samsung, imx, zynq and amlogic platoforms are fairly small maintenance
  changes, either addressing minor mistakes or enabling additional
  hardware.

  The qualcomm platform changes add a number of features and are larger
  than the other ones combined, introducing the use of linux/cleanup.h
  across several drivers, adding support for Snapdragon X1E and other
  SoCs in platform drivers, a new "protection domain mapper" driver, and
  a "shared memory bridge" driver.

  The cznic "turris omnia" router based on Marvell Armada gets a
  platform driver that talks to the board specific microcontroller.

  The reset and cache subsystems get a few minor updates to SoC specific
  drivers, while the ff-a, scmi and optee firmware drivers get some code
  refactoring and new features"

* tag 'soc-drivers-6.11' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (122 commits)
  firmware: turris-mox-rwtm: Initialize completion before mailbox
  firmware: turris-mox-rwtm: Fix checking return value of wait_for_completion_timeout()
  firmware: turris-mox-rwtm: Do not complete if there are no waiters
  MAINTAINERS: drop riscv list from cache controllers
  platform: cznic: turris-omnia-mcu: fix Kconfig dependencies
  bus: sunxi-rsb: Constify struct regmap_bus
  soc: sunxi: sram: Constify struct regmap_config
  platform: cznic: turris-omnia-mcu: Depend on WATCHDOG
  platform: cznic: turris-omnia-mcu: Depend on OF
  soc: samsung: exynos-pmu: add support for PMU_ALIVE non atomic registers
  arm64: stm32: enable scmi regulator for stm32
  firmware: qcom: tzmem: blacklist more platforms for SHM Bridge
  soc: qcom: wcnss: simplify with cleanup.h
  soc: qcom: pdr: simplify with cleanup.h
  soc: qcom: ocmem: simplify with cleanup.h
  soc: qcom: mdt_loader: simplify with cleanup.h
  soc: qcom: llcc: simplify with cleanup.h
  firmware: qcom: tzmem: simplify returning pointer without cleanup
  soc: qcom: socinfo: Add PM6350 PMIC
  arm64: dts: renesas: rz-smarc: Replace fixed regulator for USB VBUS
  ...
2024-07-16 11:35:27 -07:00
Greg Kroah-Hartman
d69d804845 driver core: have match() callback in struct bus_type take a const *
In the match() callback, the struct device_driver * should not be
changed, so change the function callback to be a const *.  This is one
step of many towards making the driver core safe to have struct
device_driver in read-only memory.

Because the match() callback is in all busses, all busses are modified
to handle this properly.  This does entail switching some container_of()
calls to container_of_const() to properly handle the constant *.

For some busses, like PCI and USB and HV, the const * is cast away in
the match callback as those busses do want to modify those structures at
this point in time (they have a local lock in the driver structure.)
That will have to be changed in the future if they wish to have their
struct device * in read-only-memory.

Cc: Rafael J. Wysocki <rafael@kernel.org>
Reviewed-by: Alex Elder <elder@kernel.org>
Acked-by: Sumit Garg <sumit.garg@linaro.org>
Link: https://lore.kernel.org/r/2024070136-wrongdoer-busily-01e8@gregkh
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-07-03 15:16:54 +02:00
Arnd Bergmann
56d62dc2ba Fix optee missing-field-initializers warning
-----BEGIN PGP SIGNATURE-----
 
 iQJOBAABCgA4FiEEFV+gSSXZJY9ZyuB5LinzTIcAHJcFAmZ9XhcaHGplbnMud2lr
 bGFuZGVyQGxpbmFyby5vcmcACgkQLinzTIcAHJd3phAAz8Ols0qoPyI4gn28D/NU
 oxcYrrBIQjXEP/Q0zUKcVYRwJ3RdHTlL1RVYUOUk/lb8fLVHydvPBmPIvG7GbI8o
 U4v43JHvCaGbzqFvxPkV0AFflUgFxTxJRGpEOqDYAebbba5/JX1ncNUAivwGA7SM
 Ez+b1fRGWm+GmfydN74Zj+KmPnVlFUyKnmrl78PBqT0MtCzQxt4oBXinhXyrs/HB
 +L/RwZu37Xr01XzzuArml0SaDoy+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49iXbvJH0Dz9v3uiHq3xISy0L6VqaJT5ewxeoTFE
 1xah02KrzvkcgkZc13PimGpBe1WGd940XQr2k/zr+2HXsII8D1aCdbwwzVlaCgTY
 /E9tJxuarUENrB72zdt1TpE21raufF9eIDz4XBsnzZVx6p65gProSOdWMZqeQIUG
 17PuD558u0ZLQbSuSIkySC6o+eskAGvVSeXJVauff1TLN8diz9M=
 =ZZkB
 -----END PGP SIGNATURE-----

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

Fix optee missing-field-initializers warning

* tag 'optee-fix-for-v6.11' of https://git.linaro.org/people/jens.wiklander/linux-tee:
  tee: optee: ffa: Fix missing-field-initializers warning

Link: https://lore.kernel.org/r/20240627125112.GA2674988@rayden
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2024-06-27 17:10:38 +02:00
Arnd Bergmann
30c577a852 optee: add timeout parameter for notification wait
-----BEGIN PGP SIGNATURE-----
 
 iQJOBAABCgA4FiEEFV+gSSXZJY9ZyuB5LinzTIcAHJcFAmZ9M1IaHGplbnMud2lr
 bGFuZGVyQGxpbmFyby5vcmcACgkQLinzTIcAHJdnng/+JR9RDaFSfa02pnHPzSnX
 KQcIRL0YUv2go5RQHXC9lzN+t/oDo/pC4PGmxU3RQX/PQYFwGDWeer30VSdA8Emm
 zDNl+K2YTocGXvKB1dXWOwtNPtDYgKNkpsIk+RZQzsj/6mAsanCHP9cv0kAMPrVt
 Cv9tj7U8PcgD8OujqW0b7rq5CmgGJpGcOtk/I8E97pcBXbpPLLIGHlMFYeQZgelC
 4vd9RzOPGCEtKK79ZAh5rc7z7RymPDA1Ada2MYG/J54iiRe43xgRaCxiq2SuvNHq
 5yKL+ZDBo38ejAQwOV6xUsXo7XaOu6+seyVA/GGqBoB+RAPCjMGqzZmQDEJwYFQW
 2X8ViYXO3MMOPT9kmtt/1oPq50xP3EbvwnaOJws9fbSG+n6cc3ZmCB65ByaO8LbZ
 5/hu6zKZ+b5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BrQXrhIlpdwCg9a0dNs=
 =bm1W
 -----END PGP SIGNATURE-----

Merge tag 'optee-notif-wait-timeout-for-v6.11' of https://git.linaro.org/people/jens.wiklander/linux-tee into soc/drivers

optee: add timeout parameter for notification wait

* tag 'optee-notif-wait-timeout-for-v6.11' of https://git.linaro.org/people/jens.wiklander/linux-tee:
  optee: add timeout value to optee_notif_wait() to support timeout

Link: https://lore.kernel.org/r/20240627095325.GA2585076@rayden
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2024-06-27 16:44:37 +02:00
Mark-PK Tsai
e0556255a5 tee: optee: ffa: Fix missing-field-initializers warning
The 'missing-field-initializers' warning was reported
when building with W=2.
This patch use designated initializers for
'struct ffa_send_direct_data' to suppress the warning
and clarify the initialization intent.

Signed-off-by: ming-jen.chang <ming-jen.chang@mediatek.com>
Signed-off-by: Mark-PK Tsai <mark-pk.tsai@mediatek.com>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2024-06-27 10:27:31 +02:00
Gavin Liu
14ca6401d8 optee: add timeout value to optee_notif_wait() to support timeout
Add timeout value to support self waking when timeout to avoid waiting
indefinitely.

Signed-off-by: Gavin Liu <gavin.liu@mediatek.com>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2024-05-30 10:19:28 +02:00
Arnd Bergmann
40b561e501 TEE driver for Trusted Services
This introduces a TEE driver for Trusted Services [1].
 
 Trusted Services is a TrustedFirmware.org project that provides a
 framework for developing and deploying device Root of Trust services in
 FF-A [2] Secure Partitions. The project hosts the reference
 implementation of Arm Platform Security Architecture [3] for Arm
 A-profile devices.
 
 The FF-A Secure Partitions are accessible through the FF-A driver in
 Linux. However, the FF-A driver doesn't have a user space interface so
 user space clients currently cannot access Trusted Services. The goal of
 this TEE driver is to bridge this gap and make Trusted Services
 functionality accessible from user space.
 
 [1] https://www.trustedfirmware.org/projects/trusted-services/
 [2] https://developer.arm.com/documentation/den0077/
 [3] https://www.arm.com/architecture/security-features/platform-security
 -----BEGIN PGP SIGNATURE-----
 
 iQJOBAABCgA4FiEEFV+gSSXZJY9ZyuB5LinzTIcAHJcFAmYp+8YaHGplbnMud2lr
 bGFuZGVyQGxpbmFyby5vcmcACgkQLinzTIcAHJd3ixAAsWZwTmxavFD1Qh2bN6dR
 XdRfv/4+8CXSN84aETBhlbjjzcUYswl6icyIcpShLcgFF7KvS+H30LRe0SGi9hjl
 xePS0hoYteLtIDN0S9u5kaM8EdYeXKYU3hNqQHKxksCh7jlTEkwC0XcOb18OkyZT
 niCHZ7+dKTmVQhH+MDvvUmeAljzk6vNwBBIBRscUX+JuG3IjWEux8pZedP3RAAS7
 IKNNtcylGB3JJVJ5H11TRF42LeQSohHyKYp1XaMca6lwWi1PoAXKIia1gcsNYLLN
 yaJByAiyGi2olk3SjeDx8Q0H35ezgJLwRBXulCXlCKzzc9ZFoVOw+a3QOI0tCJJ2
 qnUq2YZwEb4yHryPk0/v1mDCkl9MZZTpL85CYFvS84e/Gk26eZAUHwWAlgPZY6Js
 yWmfIAE/qtV48B0vUOxQGZgFAIsgn1TwaiOMWlEAoqlOQb6GosKYkCEHmfMJVMRo
 F3DeD/QOTWr4u91dFgbStL5CNwVu9yhFzgYDekPxBJfv+4IzITUmUPdne/FNqz4G
 P4RgQXstIl2xn58A/p457WSTmu/5N95/IILw0FNsbEiqNou0Wv+HFEEKEhzCSoOp
 gru5xcGrBnx+1IdE2Vw77+XhsKHCUejTrFhWXHQM6zGA1XWr30XwkmgvS1f/xolB
 DFsYhlZNRazhL16BsD4tGgo=
 =RJca
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEiK/NIGsWEZVxh/FrYKtH/8kJUicFAmYwAzkACgkQYKtH/8kJ
 UicRyg/+JKZAg3KJ3lG2uXGvb9a/kqpenroR7AJu4bLgsj/3KdXAVozxV0vzh7dc
 ayQCydMnMnKZDqlFoyDdqJEpFY3HINC6qknFYPF3Juc9R8aOGhMA8gN41vYDUbtS
 PXjIRkoaSUvtaZ4MarU6S/jzi3h5FpdZ1VqBoSgHioG58w+aihN/ElauhLc/qJh4
 Sz4hAsqBKKS107w0mwWaV0YhLbiGoxVBeQi8xLhO15Iy22jMU0NKMn3kGk0I14S8
 maDV64UaVD9qwilp46kbErPXodzzhmwvR53vCEH54CCv4j9GoM80A+UrB7yboZu2
 qY6k4LsyIVN6yHV268bHluNeo+XeTQbkEZxBS3SKe0NkhWY51BHL2vW/TFMr4BNj
 xl9WLf4IaS6GX0NYCyiXqaEh92USHgdl41eTf9P4vnyPSH3cMryw9FK/f/1F7JGS
 SOERoHVuyX0VeqUelWf4/Grux9n+votM49QCrdAICMbRcgiIIv/ITzKiSzYMKC0J
 pS4F9426ZymPkq9CVYBy8yl2atNUjiBZ+tW55eRDAfNKJf/4N4b7ncxVAPoPf2J4
 LhvEnKMAs4GtaF6G+0d2ltxhQdsl3uK9i2XEy+2WY4HceH2FEYctzG44SsIEzlVQ
 D/FyyKpa5aPyybFsdYGXyfyVv5GBFPowPeFXK9k9GH9ODc33xAE=
 =VM1o
 -----END PGP SIGNATURE-----

Merge tag 'tee-ts-for-v6.10' of https://git.linaro.org/people/jens.wiklander/linux-tee into soc/drivers

TEE driver for Trusted Services

This introduces a TEE driver for Trusted Services [1].

Trusted Services is a TrustedFirmware.org project that provides a
framework for developing and deploying device Root of Trust services in
FF-A [2] Secure Partitions. The project hosts the reference
implementation of Arm Platform Security Architecture [3] for Arm
A-profile devices.

The FF-A Secure Partitions are accessible through the FF-A driver in
Linux. However, the FF-A driver doesn't have a user space interface so
user space clients currently cannot access Trusted Services. The goal of
this TEE driver is to bridge this gap and make Trusted Services
functionality accessible from user space.

[1] https://www.trustedfirmware.org/projects/trusted-services/
[2] https://developer.arm.com/documentation/den0077/
[3] https://www.arm.com/architecture/security-features/platform-security

* tag 'tee-ts-for-v6.10' of https://git.linaro.org/people/jens.wiklander/linux-tee:
  MAINTAINERS: tee: tstee: Add entry
  Documentation: tee: Add TS-TEE driver
  tee: tstee: Add Trusted Services TEE driver
  tee: optee: Move pool_op helper functions
  tee: Refactor TEE subsystem header files

Link: https://lore.kernel.org/r/20240425073119.GA3261080@rayden
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2024-04-29 22:29:44 +02:00
Balint Dobszay
c835e5a315 tee: tstee: Add Trusted Services TEE driver
The Trusted Services project provides a framework for developing and
deploying device Root of Trust services in FF-A Secure Partitions. The
FF-A SPs are accessible through the FF-A driver, but this doesn't
provide a user space interface. The goal of this TEE driver is to make
Trusted Services SPs accessible for user space clients.

All TS SPs have the same FF-A UUID, it identifies the RPC protocol used
by TS. A TS SP can host one or more services, a service is identified by
its service UUID. The same type of service cannot be present twice in
the same SP. During SP boot each service in an SP is assigned an
interface ID, this is just a short ID to simplify message addressing.
There is 1:1 mapping between TS SPs and TEE devices, i.e. a separate TEE
device is registered for each TS SP. This is required since contrary to
the generic TEE design where memory is shared with the whole TEE
implementation, in case of FF-A, memory is shared with a specific SP. A
user space client has to be able to separately share memory with each SP
based on its endpoint ID.

Acked-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Balint Dobszay <balint.dobszay@arm.com>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2024-04-03 14:03:09 +02:00
Balint Dobszay
cf4441503e tee: optee: Move pool_op helper functions
Move the pool alloc and free helper functions from the OP-TEE driver to
the TEE subsystem, since these could be reused in other TEE drivers.
This patch is not supposed to change behavior, it's only reorganizing
the code.

Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Suggested-by: Jens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: Balint Dobszay <balint.dobszay@arm.com>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2024-04-03 13:58:20 +02:00
Sumit Garg
0439fcff30 tee: Refactor TEE subsystem header files
Since commit 25559c22ce ("tee: add kernel internal client interface"),
it has been a common include/linux/tee_drv.h header file which is shared
to hold TEE subsystem internal bits along with the APIs exposed to the
TEE client drivers. However, this practice is prone to TEE subsystem
internal APIs abuse and especially so with the new TEE implementation
drivers being added to reuse existing functionality.

In order to address this split TEE subsystem internal bits as a separate
header file: include/linux/tee_core.h which should be the one used by
TEE implementation drivers. With that include/linux/tee_drv.h lists only
APIs exposed by TEE subsystem to the TEE client drivers.

Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Balint Dobszay <balint.dobszay@arm.com>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2024-04-03 09:19:31 +02:00
Uwe Kleine-König
5c794301eb tee: optee: smc: Convert to platform remove callback returning void
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2024-03-25 11:51:06 +01:00
Linus Torvalds
2184dbcde4 ARM: SoC drivers for 6.9
This is the usual mix of updates for drivers that are used on (mostly
 ARM) SoCs with no other top-level subsystem tree, including:
 
  - The SCMI firmware subsystem gains support for version 3.2 of the
    specification and updates to the notification code.
 
  - Feature updates for Tegra and Qualcomm platforms for added
    hardware support.
 
  - A number of platforms get soc_device additions for identifying newly
    added chips from Renesas, Qualcomm, Mediatek and Google.
 
  - Trivial improvements for firmware and memory drivers amongst
    others, in particular 'const' annotations throughout multiple
    subsystems.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEiK/NIGsWEZVxh/FrYKtH/8kJUicFAmXvgbsACgkQYKtH/8kJ
 UieH8Q/+LRzESrScIwFq0/V7lE1AadmhwMwcEf1Fsq8aMrelvPm/SWvHgIWIHTvV
 IZ/g3XS/CnBxr1JG3nbyMMe/2otEY7JxsUOOqixIuZ2gdzJvzZOBHMi54xDwbFRx
 4NbP0CRTy8K35XNnOkJO3TnwBFP+q2Fu6qHY90as8M2GIxQpWb8OONJHh8N2qPq+
 Hi3H0jjKXMInnOKpNIEQI60N4F2djGMHWkDySwFtHu40RaJjCIfmVd3PWQGz7RHl
 WQHjZ6CB+/BDgqfG0ccQ7Cikc4BLorZsjKCn8bsaLtdp4HvRCTp2ZpuFFTRq6vay
 IxqJCXrgpKjM1k9plehObEhMv4lNMbD1djG8Y6hqC+PPKbDfOLvlcat3xUK2AGgb
 ROJtKDQMXfAeSnLpw9n4Ox+BZRmwMIOcTU/20N72hlcZKY1jq/KuSqQn+LPVKIrW
 pJIhWd1B8R+2O1TewuIe3fjvfQwgATMBHBUVNRkSrzqkpcZNGQ3M5koMpClVvY6T
 Z/+hdAg58EQw0K6ukJLyrevxs1pHHhYXLCECIoU/xPs4NX4hDk7rKTFv6fdLS4Y2
 24qzjhIGYdhRXmhRQdVq+06cr3cvtm1z7Fqna3tW1+J6wtBnHO/xZ63M9n5saPcm
 NgKMAN7YLLMYuUNrd39W7U2wLGQCgknjhrbH8ZmxPypk467v08k=
 =bV/K
 -----END PGP SIGNATURE-----

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

Pull ARM SoC driver updates from Arnd Bergmann:
 "This is the usual mix of updates for drivers that are used on (mostly
  ARM) SoCs with no other top-level subsystem tree, including:

   - The SCMI firmware subsystem gains support for version 3.2 of the
     specification and updates to the notification code

   - Feature updates for Tegra and Qualcomm platforms for added hardware
     support

   - A number of platforms get soc_device additions for identifying
     newly added chips from Renesas, Qualcomm, Mediatek and Google

   - Trivial improvements for firmware and memory drivers amongst
     others, in particular 'const' annotations throughout multiple
     subsystems"

* tag 'soc-drivers-6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (96 commits)
  tee: make tee_bus_type const
  soc: qcom: aoss: add missing kerneldoc for qmp members
  soc: qcom: geni-se: drop unused kerneldoc struct geni_wrapper param
  soc: qcom: spm: fix building with CONFIG_REGULATOR=n
  bus: ti-sysc: constify the struct device_type usage
  memory: stm32-fmc2-ebi: keep power domain on
  memory: stm32-fmc2-ebi: add MP25 RIF support
  memory: stm32-fmc2-ebi: add MP25 support
  memory: stm32-fmc2-ebi: check regmap_read return value
  dt-bindings: memory-controller: st,stm32: add MP25 support
  dt-bindings: bus: imx-weim: convert to YAML
  watchdog: s3c2410_wdt: use exynos_get_pmu_regmap_by_phandle() for PMU regs
  soc: samsung: exynos-pmu: Add regmap support for SoCs that protect PMU regs
  MAINTAINERS: Update SCMI entry with HWMON driver
  MAINTAINERS: samsung: gs101: match patches touching Google Tensor SoC
  memory: tegra: Fix indentation
  memory: tegra: Add BPMP and ICC info for DLA clients
  memory: tegra: Correct DLA client names
  dt-bindings: memory: renesas,rpc-if: Document R-Car V4M support
  firmware: arm_scmi: Update the supported clock protocol version
  ...
2024-03-12 10:35:24 -07:00
Ricardo B. Marliere
469f6acd9a tee: make tee_bus_type const
Since commit d492cc2573 ("driver core: device.h: make struct
bus_type a const *"), the driver core can properly handle constant
struct bus_type, move the tee_bus_type variable to be a constant
structure as well, placing it into read-only memory which can not be
modified at runtime.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2024-03-04 17:25:09 +01:00
Sumit Garg
95915ba4b9 tee: optee: Fix kernel panic caused by incorrect error handling
The error path while failing to register devices on the TEE bus has a
bug leading to kernel panic as follows:

[   15.398930] Unable to handle kernel paging request at virtual address ffff07ed00626d7c
[   15.406913] Mem abort info:
[   15.409722]   ESR = 0x0000000096000005
[   15.413490]   EC = 0x25: DABT (current EL), IL = 32 bits
[   15.418814]   SET = 0, FnV = 0
[   15.421878]   EA = 0, S1PTW = 0
[   15.425031]   FSC = 0x05: level 1 translation fault
[   15.429922] Data abort info:
[   15.432813]   ISV = 0, ISS = 0x00000005, ISS2 = 0x00000000
[   15.438310]   CM = 0, WnR = 0, TnD = 0, TagAccess = 0
[   15.443372]   GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
[   15.448697] swapper pgtable: 4k pages, 48-bit VAs, pgdp=00000000d9e3e000
[   15.455413] [ffff07ed00626d7c] pgd=1800000bffdf9003, p4d=1800000bffdf9003, pud=0000000000000000
[   15.464146] Internal error: Oops: 0000000096000005 [#1] PREEMPT SMP

Commit 7269cba53d ("tee: optee: Fix supplicant based device enumeration")
lead to the introduction of this bug. So fix it appropriately.

Reported-by: Mikko Rapeli <mikko.rapeli@linaro.org>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218542
Fixes: 7269cba53d ("tee: optee: Fix supplicant based device enumeration")
Cc: stable@vger.kernel.org
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2024-03-04 09:49:03 +01:00
Linus Torvalds
5b9b41617b Another moderately busy cycle for documentation, including:
- The minimum Sphinx requirement has been raised to 2.4.4, following a
   warning that was added in 6.2.
 
 - Some reworking of the Documentation/process front page to, hopefully,
   make it more useful.
 
 - Various kernel-doc tweaks to, for example, make it deal properly with
   __counted_by annotations.
 
 - We have also restored a warning for documentation of nonexistent
   structure members that disappeared a while back.  That had the delightful
   consequence of adding some 600 warnings to the docs build.  A sustained
   effort by Randy, Vegard, and myself has addressed almost all of those,
   bringing the documentation back into sync with the code.  The fixes are
   going through the appropriate maintainer trees.
 
 - Various improvements to the HTML rendered docs, including automatic links
   to Git revisions and a nice new pulldown to make translations easy to
   access.
 
 - Speaking of translations, more of those for Spanish and Chinese.
 
 ...plus the usual stream of documentation updates and typo fixes.
 -----BEGIN PGP SIGNATURE-----
 
 iQFDBAABCAAtFiEEIw+MvkEiF49krdp9F0NaE2wMflgFAmWcRKMPHGNvcmJldEBs
 d24ubmV0AAoJEBdDWhNsDH5YTKIH/AxBt/3iWt40dPf18arZHLU6tdUbmg01ttef
 CNKWkniCmABGKc//KYDXvjZMRDt0YlrS0KgUzrb8nIQTBlZG40D+88EwjXE0HeGP
 xt1Fk7OPOiJEqBZ3HEe0PDVfOiA+4yR6CmDKklCJuKg77X9atklneBwPUw/cOASk
 CWj+BdbwPBiSNQv48Lp87rGusKwnH/g0MN2uS0z9MPr1DYjM1K8+ngZjGW24lZHt
 qs5yhP43mlZGBF/lwNJXQp/xhnKAqJ9XwylBX9Wmaoxaz9yyzNVsADGvROMudgzi
 9YB+Jdy7Z0JSrVoLIRhUuDOv7aW8vk+8qLmGJt2aTIsqehbQ6pk=
 =fCtT
 -----END PGP SIGNATURE-----

Merge tag 'docs-6.8' of git://git.lwn.net/linux

Pull documentation update from Jonathan Corbet:
 "Another moderately busy cycle for documentation, including:

   - The minimum Sphinx requirement has been raised to 2.4.4, following
     a warning that was added in 6.2

   - Some reworking of the Documentation/process front page to,
     hopefully, make it more useful

   - Various kernel-doc tweaks to, for example, make it deal properly
     with __counted_by annotations

   - We have also restored a warning for documentation of nonexistent
     structure members that disappeared a while back. That had the
     delightful consequence of adding some 600 warnings to the docs
     build. A sustained effort by Randy, Vegard, and myself has
     addressed almost all of those, bringing the documentation back into
     sync with the code. The fixes are going through the appropriate
     maintainer trees

   - Various improvements to the HTML rendered docs, including automatic
     links to Git revisions and a nice new pulldown to make translations
     easy to access

   - Speaking of translations, more of those for Spanish and Chinese

  ... plus the usual stream of documentation updates and typo fixes"

* tag 'docs-6.8' of git://git.lwn.net/linux: (57 commits)
  MAINTAINERS: use tabs for indent of CONFIDENTIAL COMPUTING THREAT MODEL
  A reworked process/index.rst
  ring-buffer/Documentation: Add documentation on buffer_percent file
  Translated the RISC-V architecture boot documentation.
  Docs: remove mentions of fdformat from util-linux
  Docs/zh_CN: Fix the meaning of DEBUG to pr_debug()
  Documentation: move driver-api/dcdbas to userspace-api/
  Documentation: move driver-api/isapnp to userspace-api/
  Documentation/core-api : fix typo in workqueue
  Documentation/trace: Fixed typos in the ftrace FLAGS section
  kernel-doc: handle a void function without producing a warning
  scripts/get_abi.pl: ignore some temp files
  docs: kernel_abi.py: fix command injection
  scripts/get_abi: fix source path leak
  CREDITS, MAINTAINERS, docs/process/howto: Update man-pages' maintainer
  docs: translations: add translations links when they exist
  kernel-doc: Align quick help and the code
  MAINTAINERS: add reviewer for Spanish translations
  docs: ignore __counted_by attribute in structure definitions
  scripts: kernel-doc: Clarify missing struct member description
  ..
2024-01-11 19:46:52 -08:00
Arnd Bergmann
db0a7c09b2 TEE: improve shared buffer registration compatibility
-----BEGIN PGP SIGNATURE-----
 
 iQJOBAABCgA4FiEEFV+gSSXZJY9ZyuB5LinzTIcAHJcFAmV7AjYaHGplbnMud2lr
 bGFuZGVyQGxpbmFyby5vcmcACgkQLinzTIcAHJd5yA//STz2/LtQta0ucC9h1w3X
 +7mU8rWA2Ccmb7yQCyLGG9yXQNXzVn8bcRUsaLCU4YSKoLZdjeFgOD7dwz5uvtsN
 SwRVUoQpo02YZWjs+0WxKV+PuPBcJS6/Yiw8iomuk+3IE4I+V+hcJSiYLxfVZwWZ
 602VDtyEzkFgaLHQZkIf9F0uZKfzPY6F2VJYTD9bipFw3D6rDjIgWP89tuk5RgBi
 pcKBZry2F95/mesJFXGF6jlYcCpD1OZJZ9nk/SbyoVB/2koviAUnMMMfe9MQPDgs
 JSGx1ycF6DwShl5o4SyD36uS3gi93iaVzQpHF5XDRfhoX+pyvqAmt4hbOIjOgcj8
 mbTg39vYUVikOM741cYfkjvydIOwTi3jQrFmVBWSIHy529h4CJPmNXhFhSGYKm4Y
 SNIsZgGnU6VeKtgNgaQuSlg1/t/WwOIHtJWGtlRhj6g8PKW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NxCLtel20w=
 =v/vB
 -----END PGP SIGNATURE-----

Merge tag 'tee-iov-iter-for-v6.8' of https://git.linaro.org/people/jens.wiklander/linux-tee into soc/drivers

TEE: improve shared buffer registration compatibility

* tag 'tee-iov-iter-for-v6.8' of https://git.linaro.org/people/jens.wiklander/linux-tee:
  tee: Use iov_iter to better support shared buffer registration

Link: https://lore.kernel.org/r/20231214134139.GA3098718@rayden
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2023-12-22 11:38:03 +00:00
Arnd Bergmann
3408005e30 OP-TEE cleanup
- Remove a redundant custom workqueue in the OP-TEE driver.
 - Fix a missing description of an argument to optee_handle_rpc().
 -----BEGIN PGP SIGNATURE-----
 
 iQJOBAABCgA4FiEEFV+gSSXZJY9ZyuB5LinzTIcAHJcFAmV6/wIaHGplbnMud2lr
 bGFuZGVyQGxpbmFyby5vcmcACgkQLinzTIcAHJezhg//alxgaOOJABnzWxBwEUc6
 /gAEmt5qOt68JyeMN2f/I5XARlrmFM93QIOM7KLFNpQ1GoMxLm8kEgz6glUSfi1Z
 lncCD7F+egn3ix4bwvbhMMmhVE4doyg+aof4m5628mFTj7MIesFGjAgffhAP+Cla
 R5clf/JDohl5NKgISwZjKIIK+QtT61hzy8TvPtiPkrMcLB2G03yhv6X5M5Lkz73V
 m4JRlMbs/RBoKwlEgFJYTC4PTQboKLlUZ0gyfTHTTR5LQpq2aR4SMRLQcc/uMphn
 1o4falN7zcCar0Is8AD92ja0Uy2J4HyC52u8nvkhIZVbnU9eP5P/vR053CwIfJMj
 WGogOdAFTbunp/fvjImuUbxfyOjHKfOoMGpzYCS3DiNusP8mmHyw+SctPGGFWkqQ
 Rd8qz11e/FmD1vq0e0Xm4TAXDWitbJDTCi/noN8X59ShXPIFsRBf6ooeNwbtwHgV
 fNiU8x5r0QjuV7iuEIVvBokMg883zb6njPEwiez5axblkYthxtXfgPi8cNtiA347
 8s/NFtuxMiyK74TE+Wfkb+iURC/MpHDelTOXyYT3D9ZGIGF5x6rS6nOgs0+gEZ5J
 19S6pPxvNs6UaDSlDta60qzGOB9WqULkI2QGDwqZ1M5PX49q+z/aM3m/Lim7FiUD
 Ee3FJpbSXyKNeKOX+per0Qg=
 =wAS6
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEiK/NIGsWEZVxh/FrYKtH/8kJUicFAmWFdOYACgkQYKtH/8kJ
 UicH7RAApoSj4P686Hbjph7hFISEkICUHjnQ+gk2piQ6PRXTsaBuleI/8qtbk1Fd
 Qv6viRmslinxrd/ghovamjlv10W/IdCv+gC7Pjg3IHWiIW379H0aVKAiT//vFQQX
 +ioMjcVdFnoKZuimsrsmWPGKEE/DMVTArIK6vFIS6JSOBnZiIEtMYEecV2As2icx
 JjaLEBJQjW91PCjsN07jnkvKu/JepuVM6sZBrdf99i8HTtjVK6CpsaxEEBwPPq/r
 TpS8MekJwvszbng0P5zXUIrqEslEXwJO4bkJSptcvPKGN+Whn559ItL9fMo0lQU0
 d7FWzyxlKZUKU5MpUr3ZET4ukovLYzTdOnux/4qpB/Y7cQWusI1EkLvMmStoFJG5
 SYJH4OwpKLLZ3Mgvqgy1Rmjrp5NkWpCKrLu2PMZ948ag8zc5g/KFJitLK0AyT1ut
 havT0GTQRyl1w/7Tw6z9aCepUU9gyWfjHxV6Ej6izK656fD6O+TLgk2y5Zsrx9RY
 Slu3UA8DijXRpp95JBmoxxLh0hxxt+8DryU9RRADa8v//6lkJ0Gr8QzO4SVmDNr/
 fl0he2CmyOyd3QEV+AG2/eobVSr4/Ka0nZEiu++zr7uar68uQgsi3i5XwjcTR5SX
 4VtdTjeL/Orhdr6aRqtTIO56kI6jaRG5YHmpq4A3xQJUqncnMO4=
 =Ae+Z
 -----END PGP SIGNATURE-----

Merge tag 'optee-cleanup-for-v6.8' of https://git.linaro.org/people/jens.wiklander/linux-tee into soc/drivers

OP-TEE cleanup

- Remove a redundant custom workqueue in the OP-TEE driver.
- Fix a missing description of an argument to optee_handle_rpc().

* tag 'optee-cleanup-for-v6.8' of https://git.linaro.org/people/jens.wiklander/linux-tee:
  optee: add missing description of RPC argument reference
  tee: optee: Remove redundant custom workqueue
  tee: optee: Fix supplicant based device enumeration

Link: https://lore.kernel.org/r/20231214132237.GA3092763@rayden
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2023-12-22 11:37:09 +00:00
Arnd Bergmann
daa554ab04 OP-TEE kernel private shared memory optimizations
Optimize OP-TEE driver private shared memory allocated as dynamic shared
 memory. Both to handle larger than one page allocations and for more
 efficient memory usage.
 -----BEGIN PGP SIGNATURE-----
 
 iQJOBAABCgA4FiEEFV+gSSXZJY9ZyuB5LinzTIcAHJcFAmV29qAaHGplbnMud2lr
 bGFuZGVyQGxpbmFyby5vcmcACgkQLinzTIcAHJfvQA/+IV16Zsa5C2VIJXXrfQH/
 p+sc97bsK+waY/Qmn0s6vR6LyCQPSKZPFsZafPv7rxNsYxPrcAzHIKUaEttg2GrL
 86zdZuRjQOgGNccLhBg6C6iaFR6OXWGUNgrdu1/i8Vt61bMpzz8IkrfXZJM6eGtu
 T5jP9QS3T9WmQJI4l3RcjzGrkdFrC6WHcovq2KkFiwCy+7WQhsBDy2aQupwolm3O
 +20UjBKuBmi71qaKMYnwjHz5ECBWG6xRKgf/Xy68r2rFwjZm5yKIuFCLSOQgkuAx
 yYjF1rblCTiZuQ4t4XTIFYNRCsL/ADKCELpnRH5+HcgsipIprDrM+Q9RWJzIzLz4
 p4ebgRHfR7LYe6cD4xDebaI/hzD3ishyCkhpx0f644m+qow1j1BoyVfHrZANl1fy
 5QwmfqT4b3UQWYdx8elaOClzIgL+Coah8Q4/hO13Yg4y5+VjFbITokVnT3ArOJMQ
 Y0SydhPmwrP8E8st85OYKu4QcyB9lNyttqXO0fXQuNj6R7QUJXYKNWAkGpHnrVG6
 DRC+K7JDWbwfhA+BWA0FFb/dOD9iZL+sqTO1r9MHlSCTmM51wGa+4ZP0qiZFE3SG
 wf4FLolGThaauA059piWdXfTI71oVmTEeVrm+Jd8Dv8FOj6fA9v0KneaYbzSKGwO
 NuRsUzVbHj+6cDMM/zGsbcM=
 =Dlu/
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEiK/NIGsWEZVxh/FrYKtH/8kJUicFAmWFaIAACgkQYKtH/8kJ
 Uif45Q//VAiPtqwPMYXpTsoO/WEbi/FTjDZ2dKTHgYBx1Vog0IF9cR3n+htzczEu
 gs4Xcdw9EEw/kGYRq/vqLJjyfJo6+qput6eucjsEk0V2KX7CDASvUQe32s//zhBn
 fIYjzgWr0dbvAMgg1THNF7EQiAybawPVG3IG1utEKsluw63CIEjnnqddE9xFfuzG
 XxG0lu0MChLh5YB+AT3bgYqKND/P69eqVZKxAOdOkahSAVZ3eXz+GS2p14G+90eW
 hNE+5UKNtrpCIYxSeG+fwKfandsvgC2eivkExtdTPZKdDW20LGQaS3VsxNIvk1+r
 Oxt/N7fSEafzjrkv+Kv4VulDD7zfZzaNe2yaDXkUcVDizW4ZOIlfjCCf2QKj1Kgr
 NCHZmtb9g+WNfeW7K54bkbPUhUDcVTOcil33JZETqAfGxDTvfj8VHUtcDmEEaNIs
 MVQaDgOVFCC3zO1cPTAUI2h4I6u5664b4ncRXGQDYm/nEt7YWGioSCmGc8o+oCVD
 mkEeWsalUWDvlWuHeCcBXUQtqSqB25AiCh4LNyZRpxBrUAM26UaXC3QCiHTCWQBk
 uUOSVFiaaLYfj9E3350MrnYU10NPmczB+Q2COBKPODv5LNFO/u4cnsqCKIZ5cd9W
 h6MAcjmux1hQegAGOQJxPc8EfqDLcIgMszpDG5hEZATL0dYTjJk=
 =HSTy
 -----END PGP SIGNATURE-----

Merge tag 'kern-priv-shm-for-v6.8' of https://git.linaro.org/people/jens.wiklander/linux-tee into soc/drivers

OP-TEE kernel private shared memory optimizations

Optimize OP-TEE driver private shared memory allocated as dynamic shared
memory. Both to handle larger than one page allocations and for more
efficient memory usage.

* tag 'kern-priv-shm-for-v6.8' of https://git.linaro.org/people/jens.wiklander/linux-tee:
  optee: allocate shared memory with alloc_pages_exact()
  optee: add page list to kernel private shared memory

Link: https://lore.kernel.org/r/20231211115815.GA616539@rayden
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2023-12-22 10:44:16 +00:00
Arnaud Pouliquen
7bdee41575 tee: Use iov_iter to better support shared buffer registration
Currently it's not possible to register kernel buffers with TEE
which are allocated via vmalloc.

Use iov_iter and associated helper functions to manage the page
registration for all type of memories.

Suggested-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2023-12-13 07:23:22 +01:00
Etienne Carriere
b19773a1c6 optee: add missing description of RPC argument reference
Adds missing inline description comment for RPC optional arguments
reference.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/lkml/202310192021.fvb6JDOY-lkp@intel.com/
Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2023-12-11 15:02:12 +01:00
Sumit Garg
50709576d8 Documentation: Destage TEE subsystem documentation
Add a separate documentation directory for TEE subsystem since it is a
standalone subsystem which already offers devices consumed by multiple
different subsystem drivers.

Split overall TEE subsystem documentation modularly where:
- The userspace API has been moved to Documentation/userspace-api/tee.rst.
- The driver API has been moved to Documentation/driver-api/tee.rst.
- The first module covers the overview of TEE subsystem.
- The further modules are dedicated to different TEE implementations like:
  - OP-TEE
  - AMD-TEE
  - and so on for future TEE implementation support.

Acked-by: Rijo Thomas <Rijo-john.Thomas@amd.com>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Link: https://lore.kernel.org/r/20231128072352.866859-1-sumit.garg@linaro.org
2023-12-08 15:45:10 -07:00
Jens Wiklander
225a36b963 optee: allocate shared memory with alloc_pages_exact()
Allocate memory to share with the secure world using alloc_pages_exact()
instead of alloc_pages() for more efficient memory usage.

Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2023-12-04 14:48:42 +01:00
Jens Wiklander
69724b3eac optee: add page list to kernel private shared memory
Until now has kernel private shared memory allocated as dynamic shared
memory (not from the static shared memory pool) been returned without a
list of physical pages on allocations via RPC. To support allocations
larger than one page add a list of physical pages.

Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2023-12-04 14:47:17 +01:00
Jens Wiklander
d0476a59de optee: ffa_abi: add asynchronous notifications
Adds support for asynchronous notifications from OP-TEE in secure world
when communicating via FF-A. In principle from OP-TEE and kernel driver
point of view this works in the same way as for the SMC ABI based
implementation.

The OP-TEE FF-A ABI is expanded in OPTEE_FFA_EXCHANGE_CAPABILITIES with
the capability OPTEE_FFA_SEC_CAP_ASYNC_NOTIF to indicate that OP-TEE
supports asynchronous notifications. OPTEE_FFA_ENABLE_ASYNC_NOTIF is
also added to tell that the driver has successfully initialized these
notifications.

Notification capability is negotiated while the driver is initialized.
If both sides supports these notifications then they are enabled.

The notification concept in this driver is merged with the FF-A concept,
the lower 64 values are reserved for FF-A as asynchronous notifications
while the synchronous notifications use the higher values.

So a FF-A notification has to be allocated for each discrete
asynchronous notification value needed. Only one asynchronous
notification value is used at the moment, the "do bottom half"
notification.

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Tested-by: Sudeep Holla <sudeep.holla@arm.com>
2023-11-17 15:55:41 +01:00
Jens Wiklander
6dea6352be optee: provide optee_do_bottom_half() as a common function
Provides optee_do_bottom_half() and optee_stop_async_notif() as common
functions callable from the FF-A ABI part of the driver too.

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
2023-11-17 15:55:38 +01:00
Etienne Carriere
45bc2c9b5b tee: optee: support tracking system threads
Adds support in the OP-TEE driver to keep track of reserved system
threads. The logic allows one OP-TEE thread to be reserved to TEE system
sessions.

The optee_cq_*() functions are updated to handle this if enabled,
that is when TEE describes how many thread context it supports
and when at least 1 session has registered as a system session
(using tee_client_system_session()).

For sake of simplicity, initialization of call queue management
is factorized into new helper function optee_cq_init().

The SMC ABI part of the driver enables this tracking, but the
FF-A ABI part does not.

Co-developed-by: Jens Wiklander <jens.wiklander@linaro.org>
Co-developed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2023-11-17 15:48:03 +01:00
Etienne Carriere
a9214a8883 tee: system session
Adds kernel client API function tee_client_system_session() for a client
to request a system service entry in TEE context.

This feature is needed to prevent a system deadlock when several TEE
client applications invoke TEE, consuming all TEE thread contexts
available in the secure world. The deadlock can happen in the OP-TEE
driver for example if all these TEE threads issue an RPC call from TEE
to Linux OS to access an eMMC RPMB partition (TEE secure storage) which
device clock or regulator controller is accessed through an OP-TEE SCMI
services. In that case, Linux SCMI driver must reach OP-TEE SCMI service
without waiting until one of the consumed TEE threads is freed.

Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Co-developed-by: Jens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2023-11-17 15:48:03 +01:00
Etienne Carriere
077798da02 tee: optee: system thread call property
Adds an argument to do_call_with_arg() handler to tell whether the call
is a system thread call or not. This change always sets this info to false
hence no functional change.

This change prepares management of system invocation proposed in a later
change.

Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Co-developed-by: Jens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
[jw: clarified that it's system thread calls]
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2023-11-17 15:48:03 +01:00
Sumit Garg
cab4a9bc06 tee: optee: Remove redundant custom workqueue
Global system workqueue is sufficient to suffice OP-TEE bus scanning work
needs. So drop redundant usage of the custom workqueue.

Tested-by: Jan Kiszka <jan.kiszka@siemens.com>
Tested-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2023-11-14 11:02:21 +01:00
Sumit Garg
7269cba53d tee: optee: Fix supplicant based device enumeration
Currently supplicant dependent optee device enumeration only registers
devices whenever tee-supplicant is invoked for the first time. But it
forgets to remove devices when tee-supplicant daemon stops running and
closes its context gracefully. This leads to following error for fTPM
driver during reboot/shutdown:

[   73.466791] tpm tpm0: ftpm_tee_tpm_op_send: SUBMIT_COMMAND invoke error: 0xffff3024

Fix this by adding an attribute for supplicant dependent devices so that
the user-space service can detect and detach supplicant devices before
closing the supplicant:

$ for dev in /sys/bus/tee/devices/*; do if [[ -f "$dev/need_supplicant" && -f "$dev/driver/unbind" ]]; \
      then echo $(basename "$dev") > $dev/driver/unbind; fi done

Reported-by: Jan Kiszka <jan.kiszka@siemens.com>
Closes: https://github.com/OP-TEE/optee_os/issues/6094
Fixes: 5f178bb71e ("optee: enable support for multi-stage bus enumeration")
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
[jw: fixed up Date documentation]
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2023-11-03 09:27:20 +01:00
Greg Kroah-Hartman
066eaa69b0 tee: make tee_class constant
Now that the driver core allows for struct class to be in read-only
memory, we should make all 'class' structures declared at build time
placing them into read-only memory, instead of having to be dynamically
allocated at runtime.

Cc: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Link: https://lore.kernel.org/r/2023100613-lustiness-affiliate-7dcb@gregkh
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-18 10:01:34 +02:00
Linus Torvalds
9a5a149485 ARM: SoC fixes for 6.6, part 2
AngeloGioacchino Del Regno is stepping in as co-maintainer for the
 MediaTek SoC platform and starts by sending some dts fixes for
 the mt8195 platform that had been pending for a while.
 
 On the ixp4xx platform, Krzysztof Halasa steps down as co-maintainer,
 reflecting that Linus Walleij has been handling this on his own
 for the past few years.
 
 Generic RISC-V kernels are now marked as incompatible with the
 RZ/Five platform that requires custom hacks both for managing
 its DMA bounce buffers and for addressing low virtual memory.
 
 Finally, there is one bugfix for the AMDTEE firmware driver
 to prevent a use-after-free bug.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEiK/NIGsWEZVxh/FrYKtH/8kJUicFAmUn5QgACgkQYKtH/8kJ
 UicWRw/+J+gYuPbjAO5A34KjcvE0/oHoX0CartiJLjGMSboXqjvlJOL2V37q9cTO
 kt/all/wWYnyvr3L09jPKZY8J9stw6wgMpkPZpcAORkF/Vc8KNEvBBVVnTIZSlie
 G6HSNW1S3qMPdt2mxjPWeO7aoKqq/lIuQoJDDAh3XQWYowy7++o6TreLs14UsGfv
 +PRNm5dR+SGe5QC/vIJIn0U7bTD7PRQ7xEdv2LC+ANto+mbtdyVOKh16kcTnzO+2
 NUHmBQvHqGS0Q1uN1hiXQocL9WA7vreVLk7ARbq/SLr1ccOsxJrxKj9LYPhoLq68
 8oJCHR8RBAXxYInhiw2xR62KczTEVickNWlHR7aiWlQ+Bxha/YhpmUAzh/hrlvWg
 edCBUSIxQW1CyLmbMxAqyHQn72F+sMM/LulhmftHuBcbF1YwNseAV67MKjoMSTr0
 rjSiXpzdomCvgZxhJYujHLjugKh6jfLMRwPx+0P6qKebdm/y1a17kGtUf/NQ24bn
 nDAeOAKWRRdEu4CjcoYkzVLgE6MlXUiSbSmpsPpDevge1qbcrfHgIATHech4oyDd
 h2o8xIO37H4QB3s9w18g05OQRToRlBHPMxQhD+vlRy77Zd9BE7wZqKcwR9XjkyyX
 +qPcNHVN0khxf+/NYiIE/Wn5Z57PL2vvgYoSp2L2Wi+UiYEZ0Ek=
 =Ukoh
 -----END PGP SIGNATURE-----

Merge tag 'soc-fixes-6.6-2' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc

Pull ARM SoC fixes from Arnd Bergmann:
 "AngeloGioacchino Del Regno is stepping in as co-maintainer for the
  MediaTek SoC platform and starts by sending some dts fixes for the
  mt8195 platform that had been pending for a while.

  On the ixp4xx platform, Krzysztof Halasa steps down as co-maintainer,
  reflecting that Linus Walleij has been handling this on his own for
  the past few years.

  Generic RISC-V kernels are now marked as incompatible with the RZ/Five
  platform that requires custom hacks both for managing its DMA bounce
  buffers and for addressing low virtual memory.

 Finally, there is one bugfix for the AMDTEE firmware driver to prevent
 a use-after-free bug"

* tag 'soc-fixes-6.6-2' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc:
  IXP4xx MAINTAINERS entries
  arm64: dts: mediatek: mt8195: Set DSU PMU status to fail
  arm64: dts: mediatek: fix t-phy unit name
  arm64: dts: mediatek: mt8195-demo: update and reorder reserved memory regions
  arm64: dts: mediatek: mt8195-demo: fix the memory size to 8GB
  MAINTAINERS: Add Angelo as MediaTek SoC co-maintainer
  soc: renesas: Make ARCH_R9A07G043 (riscv version) depend on NONPORTABLE
  tee: amdtee: fix use-after-free vulnerability in amdtee_close_session
2023-10-12 11:52:23 -07:00
Rijo Thomas
f4384b3e54 tee: amdtee: fix use-after-free vulnerability in amdtee_close_session
There is a potential race condition in amdtee_close_session that may
cause use-after-free in amdtee_open_session. For instance, if a session
has refcount == 1, and one thread tries to free this session via:

    kref_put(&sess->refcount, destroy_session);

the reference count will get decremented, and the next step would be to
call destroy_session(). However, if in another thread,
amdtee_open_session() is called before destroy_session() has completed
execution, alloc_session() may return 'sess' that will be freed up
later in destroy_session() leading to use-after-free in
amdtee_open_session.

To fix this issue, treat decrement of sess->refcount and removal of
'sess' from session list in destroy_session() as a critical section, so
that it is executed atomically.

Fixes: 757cc3e9ff ("tee: add AMD-TEE driver")
Cc: stable@vger.kernel.org
Signed-off-by: Rijo Thomas <Rijo-john.Thomas@amd.com>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2023-10-03 19:13:53 +02:00
Yue Haibing
069969d6c5 tee: Remove unused declarations
Commit 4fb0a5eb36 ("tee: add OP-TEE driver") declared but never implemented
optee_supp_read()/optee_supp_write().
Commit 967c9cca2c ("tee: generic TEE subsystem") never implemented tee_shm_init().

Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2023-09-13 08:16:24 +02:00
Linus Torvalds
e4c8d01865 ARM: SoC drivers for 6.5
Nothing surprising in the SoC specific drivers, with the usual updates:
 
  * Added or improved SoC driver support for Tegra234, Exynos4121, RK3588,
    as well as multiple Mediatek and Qualcomm chips
 
  * SCMI firmware gains support for multiple SMC/HVC transport and version
    3.2 of the protocol
 
  * Cleanups amd minor changes for the reset controller, memory controller,
    firmware and sram drivers
 
  * Minor changes to amd/xilinx, samsung, tegra, nxp, ti, qualcomm,
    amlogic and renesas SoC specific drivers
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEiK/NIGsWEZVxh/FrYKtH/8kJUicFAmSdmbIACgkQYKtH/8kJ
 UicewQ/6Aq8j5pBFYBimZoyQ0bi9z+prGrHoDDYLew2vKjtOXJl5z7ZnM3J1oyPt
 Zvis3IaGkHJCuuqotPdsquZrzHq8slzXzwkHPfHORJBC4gV0V/vMS8w32tO5FfTq
 ULrMyWnbsU7Udeywc2xuEpAoC9+bXX9brnCpa3H41peIGZKM+0g7EE6FASt3YaOk
 O+ZMSGqF8QbCqSQrUH3GudFlFMy/VxIvwuUsbLt8aNkRACunQZXVgUdArvLV49nX
 SElFN7hOVRoVDv0rgYMxlwElymrta/kMyjLba8GU1GIhzyDGozVqIJQAnsQ3f6CC
 yyzaJm27zzJH0mx9jx4W+JLBdjqDL4ctE2WyllRVIpTGYMHiMQtutHNwtNupIuD5
 j9j/fIVQWZqOdWXnA6V/CHYN1MZBRTH3KQcnLlYPC01dWKThPDnrHGfwOkfsrwtN
 zuERJJ+gd5b8KW4dmy1ueDOSB8162LxbS7iHxpOBGySmqVOYj3XUqACZhKRfXfIQ
 BVj9punCE/gO2fMb9IZByjeOzgtV+PBRmPxoglyaGkT4fVfL06kEbpKFYbXXq9b/
 aAS/U84gGr8ebWsOXszwDnBzTZRzjMVv/T9KDTTJuWbBEPNyCR7fUG0cZ50rSKnJ
 2cTPe3a0sS6LaBt71qfExCIfxG+cJ2c3N1U5/jb2C49Aob45obs=
 =zvLr
 -----END PGP SIGNATURE-----

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

Pull ARM SoC driver updates from Arnd Bergmann:
 "Nothing surprising in the SoC specific drivers, with the usual
  updates:

   - Added or improved SoC driver support for Tegra234, Exynos4121,
     RK3588, as well as multiple Mediatek and Qualcomm chips

   - SCMI firmware gains support for multiple SMC/HVC transport and
     version 3.2 of the protocol

   - Cleanups amd minor changes for the reset controller, memory
     controller, firmware and sram drivers

   - Minor changes to amd/xilinx, samsung, tegra, nxp, ti, qualcomm,
     amlogic and renesas SoC specific drivers"

* tag 'soc-drivers-6.5' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (118 commits)
  dt-bindings: interrupt-controller: Convert Amlogic Meson GPIO interrupt controller binding
  MAINTAINERS: add PHY-related files to Amlogic SoC file list
  drivers: meson: secure-pwrc: always enable DMA domain
  tee: optee: Use kmemdup() to replace kmalloc + memcpy
  soc: qcom: geni-se: Do not bother about enable/disable of interrupts in secondary sequencer
  dt-bindings: sram: qcom,imem: document qdu1000
  soc: qcom: icc-bwmon: Fix MSM8998 count unit
  dt-bindings: soc: qcom,rpmh-rsc: Require power-domains
  soc: qcom: socinfo: Add Soc ID for IPQ5300
  dt-bindings: arm: qcom,ids: add SoC ID for IPQ5300
  soc: qcom: Fix a IS_ERR() vs NULL bug in probe
  soc: qcom: socinfo: Add support for new fields in revision 19
  soc: qcom: socinfo: Add support for new fields in revision 18
  dt-bindings: firmware: scm: Add compatible for SDX75
  soc: qcom: mdt_loader: Fix split image detection
  dt-bindings: memory-controllers: drop unneeded quotes
  soc: rockchip: dtpm: use C99 array init syntax
  firmware: tegra: bpmp: Add support for DRAM MRQ GSCs
  soc/tegra: pmc: Use devm_clk_notifier_register()
  soc/tegra: pmc: Simplify debugfs initialization
  ...
2023-06-29 15:22:19 -07:00
Jiapeng Chong
6a8b7e8010 tee: optee: Use kmemdup() to replace kmalloc + memcpy
Use kmemdup rather than duplicating its implementation.

./drivers/tee/optee/smc_abi.c:1542:12-19: WARNING opportunity for kmemdup.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=5480
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2023-06-15 08:49:55 +02:00
Arnd Bergmann
abd649fdf9 AMDTEE add return origin to load TA command
-----BEGIN PGP SIGNATURE-----
 
 iQJOBAABCgA4FiEEFV+gSSXZJY9ZyuB5LinzTIcAHJcFAmR+4agaHGplbnMud2lr
 bGFuZGVyQGxpbmFyby5vcmcACgkQLinzTIcAHJe8Jw//ccNGhzOrZrDHgHc/nx19
 PitJyk1eaGNIwMzKx/ZqP7mj2JlnQMuylPWGvxQYmzLYwNupraWJfK2El+mysAnS
 yMqXo51jKkiYS+z4MugctZClbr8BuAwHfCvRbvJjOTI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C0Fciw
 7yZoNcMPws3l0xECNTxXIMuLBcRGpdbTof8fFwn++ckNoybFJmPe4LzLgiKJ+B72
 glnsKdUglIOcZea4WUIp/ya3CkgUHbAGhy42P5Tbd5hJBCnNZ+hheFDbrUCc9/K/
 xOZswe+DKstPB2KOMxJgkjH8zQv5Ua959zy8Jfg8uq5MsHUV0PVxc03rp4FjDdD8
 gaENrW7GQzxAStb/+YrBYoeMIFr9f9zA0yv0y92G3gBERupOc0VcFNopPFnHxvn+
 +pum0SVSsqU1o9dwT9pchjwX7TQr/yKJvejvGFEoC4vSVgytdso=
 =8LYO
 -----END PGP SIGNATURE-----

Merge tag 'amdtee-fix-for-v6.5' of https://git.linaro.org/people/jens.wiklander/linux-tee into arm/fixes

AMDTEE add return origin to load TA command

* tag 'amdtee-fix-for-v6.5' of https://git.linaro.org/people/jens.wiklander/linux-tee:
  tee: amdtee: Add return_origin to 'struct tee_cmd_load_ta'

Link: https://lore.kernel.org/r/20230606075843.GA2792442@rayden
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2023-06-07 12:58:22 +02:00
Arnd Bergmann
9bafc2bb46 Fixes an uninitialized variable in OP-TEE driver
-----BEGIN PGP SIGNATURE-----
 
 iQJOBAABCgA4FiEEFV+gSSXZJY9ZyuB5LinzTIcAHJcFAmRCPoAaHGplbnMud2lr
 bGFuZGVyQGxpbmFyby5vcmcACgkQLinzTIcAHJfRtRAAnwxN3aeCg7i8I6CML4P3
 7PintdfApyFC0TwqkB1vGWBbS+Qp31P7AtmKSHXLinoGK7fRDDlgAmEHFRaCJRYK
 FZMHmoTt8Jn7VpBUGw1J+/+pRc6D7ALCPyYrXcLOi5NX6vCoLFhZuJHhJI4NcppA
 YKQVI9lFQmigj0n3imiGTVvLodC682j7UCQAT1yMavu6R/VNtV1nf4TusqnXD1DC
 Ko9ixUnB6kVrNN9NaebjH2PCYe4iMhJ2FTUn8Ba3Hbif20rOKknIHY28l0C6xV2b
 7RGJt6F3S/4Sgup0OLzYHAhg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OrW8tKQscAjkXj/vNBYcV7aAv9
 kRrzZkxK3RydzTzruX3qv3wee3cwDl2PT1TqnfR6qt85fqi2hFUZRQhSHi1A7HNq
 tmwQvuSicgRW52HUkiHw85/zsGXG3ERsLxmfNvlmOW6XVl2QR+o=
 =R1qj
 -----END PGP SIGNATURE-----

Merge tag 'optee-async-notif-fix-for-v6.3' of https://git.linaro.org/people/jens.wiklander/linux-tee into arm/fixes

Fixes an uninitialized variable in OP-TEE driver

* tag 'optee-async-notif-fix-for-v6.3' of https://git.linaro.org/people/jens.wiklander/linux-tee:
  optee: fix uninited async notif value

Link: https://lore.kernel.org/r/20230421075443.GA3136581@rayden
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2023-05-25 17:16:52 +02:00
Rijo Thomas
436eeae041 tee: amdtee: Add return_origin to 'struct tee_cmd_load_ta'
After TEE has completed processing of TEE_CMD_ID_LOAD_TA, set proper
value in 'return_origin' argument passed by open_session() call. To do
so, add 'return_origin' field to the structure tee_cmd_load_ta. The
Trusted OS shall update return_origin as part of TEE processing.

This change to 'struct tee_cmd_load_ta' interface requires a similar update
in AMD-TEE Trusted OS's TEE_CMD_ID_LOAD_TA interface.

This patch has been verified on Phoenix Birman setup. On older APUs,
return_origin value will be 0.

Cc: stable@vger.kernel.org
Fixes: 757cc3e9ff ("tee: add AMD-TEE driver")
Tested-by: Sourabh Das <sourabh.das@amd.com>
Signed-off-by: Rijo Thomas <Rijo-john.Thomas@amd.com>
Acked-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2023-05-15 08:29:52 +02:00
Linus Torvalds
556eb8b791 Driver core changes for 6.4-rc1
Here is the large set of driver core changes for 6.4-rc1.
 
 Once again, a busy development cycle, with lots of changes happening in
 the driver core in the quest to be able to move "struct bus" and "struct
 class" into read-only memory, a task now complete with these changes.
 
 This will make the future rust interactions with the driver core more
 "provably correct" as well as providing more obvious lifetime rules for
 all busses and classes in the kernel.
 
 The changes required for this did touch many individual classes and
 busses as many callbacks were changed to take const * parameters
 instead.  All of these changes have been submitted to the various
 subsystem maintainers, giving them plenty of time to review, and most of
 them actually did so.
 
 Other than those changes, included in here are a small set of other
 things:
   - kobject logging improvements
   - cacheinfo improvements and updates
   - obligatory fw_devlink updates and fixes
   - documentation updates
   - device property cleanups and const * changes
   - firwmare loader dependency fixes.
 
 All of these have been in linux-next for a while with no reported
 problems.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCZEp7Sw8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+ykitQCfamUHpxGcKOAGuLXMotXNakTEsxgAoIquENm5
 LEGadNS38k5fs+73UaxV
 =7K4B
 -----END PGP SIGNATURE-----

Merge tag 'driver-core-6.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core

Pull driver core updates from Greg KH:
 "Here is the large set of driver core changes for 6.4-rc1.

  Once again, a busy development cycle, with lots of changes happening
  in the driver core in the quest to be able to move "struct bus" and
  "struct class" into read-only memory, a task now complete with these
  changes.

  This will make the future rust interactions with the driver core more
  "provably correct" as well as providing more obvious lifetime rules
  for all busses and classes in the kernel.

  The changes required for this did touch many individual classes and
  busses as many callbacks were changed to take const * parameters
  instead. All of these changes have been submitted to the various
  subsystem maintainers, giving them plenty of time to review, and most
  of them actually did so.

  Other than those changes, included in here are a small set of other
  things:

   - kobject logging improvements

   - cacheinfo improvements and updates

   - obligatory fw_devlink updates and fixes

   - documentation updates

   - device property cleanups and const * changes

   - firwmare loader dependency fixes.

  All of these have been in linux-next for a while with no reported
  problems"

* tag 'driver-core-6.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (120 commits)
  device property: make device_property functions take const device *
  driver core: update comments in device_rename()
  driver core: Don't require dynamic_debug for initcall_debug probe timing
  firmware_loader: rework crypto dependencies
  firmware_loader: Strip off \n from customized path
  zram: fix up permission for the hot_add sysfs file
  cacheinfo: Add use_arch[|_cache]_info field/function
  arch_topology: Remove early cacheinfo error message if -ENOENT
  cacheinfo: Check cache properties are present in DT
  cacheinfo: Check sib_leaf in cache_leaves_are_shared()
  cacheinfo: Allow early level detection when DT/ACPI info is missing/broken
  cacheinfo: Add arm64 early level initializer implementation
  cacheinfo: Add arch specific early level initializer
  tty: make tty_class a static const structure
  driver core: class: remove struct class_interface * from callbacks
  driver core: class: mark the struct class in struct class_interface constant
  driver core: class: make class_register() take a const *
  driver core: class: mark class_release() as taking a const *
  driver core: remove incorrect comment for device_create*
  MIPS: vpe-cmp: remove module owner pointer from struct class usage.
  ...
2023-04-27 11:53:57 -07:00
Linus Torvalds
733f7e9c18 This update includes the following changes:
API:
 
 - Total usage stats now include all that returned error (instead of some).
 - Remove maximum hash statesize limit.
 - Add cloning support for hmac and unkeyed hashes.
 - Demote BUG_ON in crypto_unregister_alg to a WARN_ON.
 
 Algorithms:
 
 - Use RIP-relative addressing on x86 to prepare for PIE build.
 - Add accelerated AES/GCM stitched implementation on powerpc P10.
 - Add some test vectors for cmac(camellia).
 - Remove failure case where jent is unavailable outside of FIPS mode in drbg.
 - Add permanent and intermittent health error checks in jitter RNG.
 
 Drivers:
 
 - Add support for 402xx devices in qat.
 - Add support for HiSTB TRNG.
 - Fix hash concurrency issues in stm32.
 - Add OP-TEE firmware support in caam.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEn51F/lCuNhUwmDeSxycdCkmxi6cFAmRGCjcACgkQxycdCkmx
 i6d6JA//ZmwgEqAKA8qWpHnNKZylTLqFhLxnKZwr4Hhp1KzManh/T9pepXiD2zAY
 D92wU60v0hfGAazeUWQRmrIZxcjyd3b3Tr7WiFuNoZbkPsuXWZAoz8iHgMq69dqb
 DXZhKJnlmVlcr+qTSk9MP8HODL5kU6Ug2pk+r8hL/WsBI+JGfZEXKcJhhMqYLYls
 nl+NN4fkE5tgcTh2lp/9dQsQRylhESZuqb8L2wItQmripSbhPGwYf24I7B7xcGrn
 o7X4XG//cQO6zQErgnOJOosIgJEEynW27CN4ZiHB8WhRAk0YLXydQBs6EjZgNA8H
 EvZC/bIx2YOt8ngG99q4kRg4OgKp4c7UnV6l1pxuJWbIyXrFh4djxHdq9pTYr3UB
 P3pVEX38Wu7U5Tfgy3y1QqZzsvrPjmnI3NQ8QBrcFzNRDan5K6nH4kQyk9Cv7LQm
 GlE1JOThU5U2G33ZWKCluJUjVUCRceMWQYla1X5R4uWMCwSqRMpmx8Ib9QvbYlWe
 iUI+RatLnlIobx+lgaC8mtij9dQddFjk6YwFYhQcD3Bl30DhTeIlbnOUY9YOTXps
 H6V9X2inVUjyZr1uJ4a7rPdCUuzQxR6HWPyp6fXMlbLrEhL8e6c4/QbEoTubRQeS
 WTtoIFt4ezd2SG6hI6dTCscgFc5EAyEMDD5GtQmJeyozu0Gqtpo=
 =ITkW
 -----END PGP SIGNATURE-----

Merge tag 'v6.4-p1' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6

Pull crypto updates from Herbert Xu:
 "API:
   - Total usage stats now include all that returned errors (instead of
     just some)
   - Remove maximum hash statesize limit
   - Add cloning support for hmac and unkeyed hashes
   - Demote BUG_ON in crypto_unregister_alg to a WARN_ON

  Algorithms:
   - Use RIP-relative addressing on x86 to prepare for PIE build
   - Add accelerated AES/GCM stitched implementation on powerpc P10
   - Add some test vectors for cmac(camellia)
   - Remove failure case where jent is unavailable outside of FIPS mode
     in drbg
   - Add permanent and intermittent health error checks in jitter RNG

  Drivers:
   - Add support for 402xx devices in qat
   - Add support for HiSTB TRNG
   - Fix hash concurrency issues in stm32
   - Add OP-TEE firmware support in caam"

* tag 'v6.4-p1' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (139 commits)
  i2c: designware: Add doorbell support for Mendocino
  i2c: designware: Use PCI PSP driver for communication
  powerpc: Move Power10 feature PPC_MODULE_FEATURE_P10
  crypto: p10-aes-gcm - Remove POWER10_CPU dependency
  crypto: testmgr - Add some test vectors for cmac(camellia)
  crypto: cryptd - Add support for cloning hashes
  crypto: cryptd - Convert hash to use modern init_tfm/exit_tfm
  crypto: hmac - Add support for cloning
  crypto: hash - Add crypto_clone_ahash/shash
  crypto: api - Add crypto_clone_tfm
  crypto: api - Add crypto_tfm_get
  crypto: x86/sha - Use local .L symbols for code
  crypto: x86/crc32 - Use local .L symbols for code
  crypto: x86/aesni - Use local .L symbols for code
  crypto: x86/sha256 - Use RIP-relative addressing
  crypto: x86/ghash - Use RIP-relative addressing
  crypto: x86/des3 - Use RIP-relative addressing
  crypto: x86/crc32c - Use RIP-relative addressing
  crypto: x86/cast6 - Use RIP-relative addressing
  crypto: x86/cast5 - Use RIP-relative addressing
  ...
2023-04-26 08:32:52 -07:00
Linus Torvalds
a907047732 ARM: SoC drivers for v6.4
The most notable updates this time are for Qualcomm Snapdragon platforms.
 The Inline-Crypto-Engine gets a new DT binding and driver. A number of
 drivers now support additional Snapdragon variants, in particular the
 rsc, scm, geni, bwm, glink and socinfo, while the llcc (edac) and rpm
 drivers get notable functionality updates.
 
 Updates on other platforms include:
 
  - Various updates to the Mediatek mutex and mmsys drivers, including
    support for the Helio X10 SoC
 
  - Support for unidirectional mailbox channels in Arm SCMI firmware
 
  - Support for per cpu asynchronous notification in OP-TEE firmware
 
  - Minor updates for memory controller drivers.
 
  - Minor updates for Renesas, TI, Amlogic, Apple, Broadcom, Tegra,
    Allwinner, Versatile Express, Canaan, Microchip, Mediatek and i.MX
    SoC drivers, mainly updating the use of MODULE_LICENSE() macros and
    obsolete DT driver interfaces.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEiK/NIGsWEZVxh/FrYKtH/8kJUicFAmRGmncACgkQYKtH/8kJ
 Uif6ghAAw1TiPTJzJLLCNx+txOVFB62WDglv3T1CufjfcWp0Eh0RJSCcsCOPV+/7
 UHi4+X4nPAcudeOFMFtslCR8ExLRWY4j7t2ZYo/k+VI3jdB8Qkbr6NAQgAuRdLYX
 WZ1cV6o76B3bhO2HqSVNVZ8/3Z7OAYw4j9VDD/4AbW+l3GyentlQTjabpJNREvSS
 5HzT3ZI33o7M8mM4uYmmEXVrg8sCupbRyL9S7jTiFXRLcfqujclhfezJ4UrJJv7b
 wxGf+e2YNMqKH6PiKYufzN1TYI2D0YQeB1m56Y9FsAKxgAyHh2xWpsHeyVnaw0jc
 KaKjRN/H3JDlW/VCMAjQOIShCZdAs02xHnEXxY6pKLMM6i8/FkzzNIxNQwXrx5KH
 zYESXVd6suOI0eCZT8zkKKLHRT5EJRaliUv5Z+Qp2BBe3vJVZD0JqSlZ7lOznplF
 lviwL6ydAMr2cfTgfMxbRiYQVDzncFkfnR3t55SC6rYjGt6QWjeS0dDbGHf4WVC4
 FDbnST4JaBmi+frh55VooX7EpzIv9wa0/taayaChd9qvXnh22uqaqho1sPYKZ6BI
 OXduHQ3qojJhKKKK1VJKzN5Ef3OHLQLNrvcc1DsKILrrES4w4LX1C9dmyh2CLXLo
 q5cX6L1iB1Hx5tujalDYBsHBBmbiT/1tNM2S7pAGigiGy4KEc28=
 =r6jm
 -----END PGP SIGNATURE-----

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

Pull ARM SoC driver updates from Arnd Bergmann:
 "The most notable updates this time are for Qualcomm Snapdragon
  platforms. The Inline-Crypto-Engine gets a new DT binding and driver,
  and a number of drivers now support additional Snapdragon variants, in
  particular the rsc, scm, geni, bwm, glink and socinfo, while the llcc
  (edac) and rpm drivers get notable functionality updates.

  Updates on other platforms include:

   - Various updates to the Mediatek mutex and mmsys drivers, including
     support for the Helio X10 SoC

   - Support for unidirectional mailbox channels in Arm SCMI firmware

   - Support for per cpu asynchronous notification in OP-TEE firmware

   - Minor updates for memory controller drivers.

   - Minor updates for Renesas, TI, Amlogic, Apple, Broadcom, Tegra,
     Allwinner, Versatile Express, Canaan, Microchip, Mediatek and i.MX
     SoC drivers, mainly updating the use of MODULE_LICENSE() macros and
     obsolete DT driver interfaces"

* tag 'soc-drivers-6.4' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (165 commits)
  soc: ti: smartreflex: Simplify getting the opam_sr pointer
  bus: vexpress-config: Add explicit of_platform.h include
  soc: mediatek: Kconfig: Add MTK_CMDQ dependency to MTK_MMSYS
  memory: mtk-smi: mt8365: Add SMI Support
  dt-bindings: memory-controllers: mediatek,smi-larb: add mt8365
  dt-bindings: memory-controllers: mediatek,smi-common: add mt8365
  memory: tegra: read values from correct device
  dt-bindings: crypto: Add Qualcomm Inline Crypto Engine
  soc: qcom: Make the Qualcomm UFS/SDCC ICE a dedicated driver
  dt-bindings: firmware: document Qualcomm QCM2290 SCM
  soc: qcom: rpmh-rsc: Support RSC v3 minor versions
  soc: qcom: smd-rpm: Use GFP_ATOMIC in write path
  soc/tegra: fuse: Remove nvmem root only access
  soc/tegra: cbb: tegra194: Use of_address_count() helper
  soc/tegra: cbb: Remove MODULE_LICENSE in non-modules
  ARM: tegra: Remove MODULE_LICENSE in non-modules
  soc/tegra: flowctrl: Use devm_platform_get_and_ioremap_resource()
  soc: tegra: cbb: Drop empty platform remove function
  firmware: arm_scmi: Add support for unidirectional mailbox channels
  dt-bindings: firmware: arm,scmi: Support mailboxes unidirectional channels
  ...
2023-04-25 12:02:16 -07:00
Etienne Carriere
654d031000 optee: fix uninited async notif value
Fixes an uninitialized variable in irq_handler() that could lead to
unpredictable behavior in case OP-TEE fails to handle SMC function ID
OPTEE_SMC_GET_ASYNC_NOTIF_VALUE. This change ensures that in that case
get_async_notif_value() properly reports there are no notification
event.

Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/r/202304200755.OoiuclDZ-lkp@intel.com/
Reported-by: Dan Carpenter <error27@gmail.com>
Link: https://lore.kernel.org/all/d9b7f69b-c737-4cb3-8e74-79fe00c934f9@kili.mountain/
Fixes: 6749e69c4d ("optee: add asynchronous notifications")
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
2023-04-20 14:52:25 +02:00
Arnd Bergmann
283480f0ce Add SMC for OP-TEE image loading
Adds an SMC call for loading OP-TEE by the kernel.
 -----BEGIN PGP SIGNATURE-----
 
 iQJOBAABCgA4FiEEFV+gSSXZJY9ZyuB5LinzTIcAHJcFAmQtD1YaHGplbnMud2lr
 bGFuZGVyQGxpbmFyby5vcmcACgkQLinzTIcAHJeQ5Q//TVvz/RVC+gWh2Bppyo3A
 WARXP8LYODsFQ6EZOBVXbEtesDYFUMWUEcYVDGWxFvhUs6w4qX8XpjX8OWpS4frj
 VDVj5Sm2QYcvCcWN5s6vNG6LcFQPywgBCLCnfgzLeNoFHpKznMOYTC2YT9sPudKS
 1rqep4po7NoH1N09RGLwYYQijHaoIKE4pfqRS5FOLNGkcMS5fuIwvvOZrRosC+vi
 sGlERX8SFjSLmgH+IuLSYTLMA7GwsDwnRTzZD+E1OaJquLoYrWunTIk+LwJvTXWM
 L2fpFODzLGpkvylsEGFVqXOIogjrxcXw7ze2RkS5DJQIuF1ZXGLwwESgQQrTyrPZ
 v3y+8ASxO9l82vPd7rEG9lt4LDWtLEDdVLSCOTVTzdNh+ZbdhzT1giSFuO/gqrOM
 IzJy0Gg+nqUNH+9Z0xdRnZYpNOxmVDADx/QR1A8AFS0v8t44orqjyJ07Sqq9UCUy
 2MCXVp4lgODNTpjqgw06uo3hkwQ/0d0oezr+t0niaYGWVnwlRM/XFrp4Pr+VLe56
 d2HS4zTbQNAmVx+ZdbropSNjAr52/ouG9VDXjmHZ7zIRxeDGsIhI4IYVZuSeLB6J
 t4oAM2bkfmuP4B8V+2Qehdh5/d6PDgePT624hMt1FXfHaaujlblIYF89lcDI/wQ9
 fm7hDvKVuHAofFiSU6fWu7g=
 =TODn
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEo6/YBQwIrVS28WGKmmx57+YAGNkFAmQugJUACgkQmmx57+YA
 GNkU2xAAmEFtp5ZkRArbE0CJ/k0evCfOmS8TxBBmqYXbSMJ0+SrMJEfTh74HhKB6
 iucNHC0ORs2k/41u67WWLrKm0P0cS6pgQx7HJrkXviJ/OEClq9sJTZgmONbvXbrw
 smUCmjPrbG2mIj8QHEI2I0QugTRNmZGQjg8PLRul77N5rmuPpYcOpQ3puq/NkNE8
 kOgNcCVqOX2uZGW7ONFXpsw39JdwuZZunWj3OqrN5VHJx79FF1wU5bqmVTWGFPmN
 2ou+iZpg+06oEcIoO5BJ4F+4LMfQRbl4YnWExVOdhj0O2LzN+TjLXVkB7ixC3EjV
 HFpAgRDPEFwRGBH6OzrFh8EeKZ2uyuu1auhbgmeg8lZoZPbXTO9xXy8G5po+mr30
 2VGqYl2tKThAgFixQj3Vfdbz/9q0LniFWTLk4SwdoowZNiyhlR706EleHPRW8i4g
 0pwZvTeXDu/h3UBi3hWlapxCjAF8Y81bF392oFORyGNlKLmmgJjeMtwwWqV6mM0R
 ipZjKb0Um7cLeUa1uPTXHR+UrEsJMg5QiE1sLneb+jjy2iYiYqo0niuEJV5NSbxD
 I0+dplMa5tNngW8Z6hLYK+r2aQ1eG68LlVGnb98DQiIOAbSVwlmBy8l0KnL/qF/E
 JqWuDVGbY781pHBrgh3cotdzx88DKpc6NW2ATxafsyw3QnqURAw=
 =gDeP
 -----END PGP SIGNATURE-----

Merge tag 'optee-load-for-v6.4' of https://git.linaro.org/people/jens.wiklander/linux-tee into soc/drivers

Add SMC for OP-TEE image loading

Adds an SMC call for loading OP-TEE by the kernel.

* tag 'optee-load-for-v6.4' of https://git.linaro.org/people/jens.wiklander/linux-tee:
  tee: optee: Add SMC for loading OP-TEE image

Link: https://lore.kernel.org/r/20230405062701.GA3391925@rayden
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2023-04-06 10:19:33 +02:00
Arnd Bergmann
a3c40af4a7 Add explicit cast to (void *) for virt_to_page() argument
-----BEGIN PGP SIGNATURE-----
 
 iQJOBAABCgA4FiEEFV+gSSXZJY9ZyuB5LinzTIcAHJcFAmQlfjcaHGplbnMud2lr
 bGFuZGVyQGxpbmFyby5vcmcACgkQLinzTIcAHJdc8A//S10Skr5sxDCtdO+4OW54
 3NK1yZvUgL3nqKDTrvfuc1LOGwAfnau3clcvBybm1rYh1laF3q+cmDovWcCJ3d/P
 Jtfa450IaL61wFOVmRDmchVXehNuiElJolhaFdUgjESAEDjyFSR0cCvLgSsmQzVf
 F3J0AJA8nJGMmZmnaHqAiFrs4S1dO0wH5UVmX/3/sqtR+Ox3BYzo8OtEHp8uvBBM
 fyrv7s48H3jC0XwDbTac4bdntbwkTnbn11GWXi98GVG8pj4xlZW4LPNVL52/JpOL
 ff/14yhJobz2NXQjbFPOlIBCBm9ejAllX//LrM+f3LRzt1TTZ6ih4gWaJUjM2YVG
 j2WZZYpfKUfxM6dy8iuuv2MdatIp+0z0wniTNLevrRgXb7D54P2rX8wzilyzD97M
 JMGFqt8zywLw/tA7tVTJbcpRuvN0nmASVrn9WF5PMxd3ogDcdC4bYoNqkd4qylSe
 1hMe1QMF+j/CCS8fwCCbhfuqIvTnfCca7akWsljuln5VgS0xuBbvsX6l1iN6bvSf
 m6Qcolt+tk4QQGZFXCQiN3oXr6ZZu39BfvjonSFVdA1VYMtBECp1XF/fTR/TlD/I
 YY03D+E8GtIVkgD7fCLZsSJP1oQJ2FtaRk4GZghQdqNEb5JKtxd0YILAFNtbGVnv
 IlOIvqS4YXli84aHnrlidZE=
 =tCCS
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEo6/YBQwIrVS28WGKmmx57+YAGNkFAmQq9pkACgkQmmx57+YA
 GNlRvBAAtxMWsNm+/FD+rqroxTiCriW3i18oq+0DM9rXeKojrVQ0SZQzf7/RgJ43
 UuqVfWP9fyjbU/HcYS7IJh9Zw2FDEeITw2HHGjo5NHksU/yq2hOMRMV0yVbTA6rh
 XJTplsfOHLmhI5rZRU7GI+Q2H8nutI0yDeajscMbTJiVBhGvord3+45DtrwsyylY
 YyHkpU1F6kzpruv+lNG5UV062eXnNcbkPhZufoeQv6rCfalhlFBZ4Ks4xeV5gg00
 EjVS0xWXnlkyZolMtnldSele7qp0d7RaGAO1nHjZZGSJPwZ/dMYeH0iaWm4haAVp
 6A37I/RD+hWnWfywDPRBJZ4nqZKsQhlTXJ19aywktLuTiBCxVREmvunWmvr/tDxm
 Wb+cQAjpZRopsQy5/MC81FD7VQR8/6Hze/ygeC8yCM2psnzm8004DSzQyo0iYL23
 4ILQ6/IzFj++fZ3YSd1InWXAm8NsDchPl2hWdOvb8LaOhNiO+ef1twxAQ2gBrTRn
 vy3essMDIRYhEpCNOVAW3cPrf2mwORFjhuYo4D9DSy0+fOPr0B97iqT+LIHqY8fO
 RY0LBl9l+8aFNAuIL0iSfl1LAg+e/bwpjKuq50emLyTQSQlytJv6cvnxJ/JAJbJq
 yqIdcwqfhR6vMvxlxwcPA6faJKcO+WO0Yhf464ZOQlNNaGcW2rg=
 =uXgt
 -----END PGP SIGNATURE-----

Merge tag 'tee-fix-for-v6.3' of https://git.linaro.org/people/jens.wiklander/linux-tee into arm/fixes

Add explicit cast to (void *) for virt_to_page() argument

* tag 'tee-fix-for-v6.3' of https://git.linaro.org/people/jens.wiklander/linux-tee:
  tee: Pass a pointer to virt_to_page()

Link: https://lore.kernel.org/r/20230330124804.GA1943242@rayden
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2023-04-03 17:54:01 +02:00