* Re: [PATCH v2 1/6] soc: qcom: ice: Add TZ agnostic re-direction functions @ 2026-11-18 20:52 kernel test robot 0 siblings, 0 replies; 3+ messages in thread From: kernel test robot @ 2026-11-18 20:52 UTC (permalink / raw) To: oe-kbuild; +Cc: lkp :::::: :::::: Manual check reason: "linux-review patch is more than 7 days old, verify it wasn't already superseded" :::::: BCC: lkp@intel.com CC: llvm@lists.linux.dev CC: oe-kbuild-all@lists.linux.dev In-Reply-To: <20261111-ice-migrate-tee-svc-v2-1-29d19f6c92ab@oss.qualcomm.com> References: <20261111-ice-migrate-tee-svc-v2-1-29d19f6c92ab@oss.qualcomm.com> TO: Harshal Dev <harshal.dev@oss.qualcomm.com> TO: Eric Biggers <ebiggers@kernel.org> TO: Bjorn Andersson <andersson@kernel.org> TO: Konrad Dybcio <konradybcio@kernel.org> TO: Abel Vesa <abelvesa@kernel.org> TO: Kuldeep Singh <kuldeep.singh@oss.qualcomm.com> TO: Neeraj Soni <neeraj.soni@oss.qualcomm.com> TO: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com> TO: Sumit Garg <sumit.garg@oss.qualcomm.com> TO: Selvam Sathappan Periakaruppan <selvam.periakaruppan@oss.qualcomm.com> CC: Basant Kumar <basantk@qti.qualcomm.com> CC: linux-kernel@vger.kernel.org CC: linux-arm-msm@vger.kernel.org CC: linux-crypto@vger.kernel.org CC: Harshal Dev <harshal.dev@oss.qualcomm.com> Hi Harshal, kernel test robot noticed the following build errors: [auto build test ERROR on 8f7df005a7564bd7ffa75da9c3085d5b996f1e16] url: https://github.com/intel-lab-lkp/linux/commits/Harshal-Dev/soc-qcom-ice-Add-TZ-agnostic-re-direction-functions/20261111-194701 base: 8f7df005a7564bd7ffa75da9c3085d5b996f1e16 patch link: https://lore.kernel.org/r/20261111-ice-migrate-tee-svc-v2-1-29d19f6c92ab%40oss.qualcomm.com patch subject: [PATCH v2 1/6] soc: qcom: ice: Add TZ agnostic re-direction functions :::::: branch date: 7 days ago :::::: commit date: 7 days ago config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20261119/202611190323.Wc1KGP93-lkp@intel.com/config) compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project 67ab6538dff0ed2593b90166214d93e992c74905) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261119/202611190323.Wc1KGP93-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/r/202611190323.Wc1KGP93-lkp@intel.com/ All errors (new ones prefixed by >>): >> drivers/soc/qcom/ice.c:225:5: error: redefinition of 'qcom_ice_tz_ops_register' 225 | int qcom_ice_tz_ops_register(struct qcom_ice_tz_ops *ops) | ^ include/soc/qcom/ice.h:79:19: note: previous definition is here 79 | static inline int qcom_ice_tz_ops_register(struct qcom_ice_tz_ops *__unused) | ^ >> drivers/soc/qcom/ice.c:237:6: error: redefinition of 'qcom_ice_tz_ops_unregister' 237 | void qcom_ice_tz_ops_unregister(struct qcom_ice_tz_ops *ops) | ^ include/soc/qcom/ice.h:85:6: note: previous definition is here 85 | void qcom_ice_tz_ops_unregister(struct qcom_ice_tz_ops *__unused) | ^ 2 errors generated. vim +/qcom_ice_tz_ops_register +225 drivers/soc/qcom/ice.c a3b7cfa9a5a3a11 Harshal Dev 2026-11-11 224 a3b7cfa9a5a3a11 Harshal Dev 2026-11-11 @225 int qcom_ice_tz_ops_register(struct qcom_ice_tz_ops *ops) a3b7cfa9a5a3a11 Harshal Dev 2026-11-11 226 { a3b7cfa9a5a3a11 Harshal Dev 2026-11-11 227 if (!qcom_ice_tz_ops_registered()) a3b7cfa9a5a3a11 Harshal Dev 2026-11-11 228 /* Paired with smp_load_acquire() in qcom_ice_tz_ops_registered() */ a3b7cfa9a5a3a11 Harshal Dev 2026-11-11 229 smp_store_release(&ice_tz_ops, ops); a3b7cfa9a5a3a11 Harshal Dev 2026-11-11 230 else a3b7cfa9a5a3a11 Harshal Dev 2026-11-11 231 return -EBUSY; a3b7cfa9a5a3a11 Harshal Dev 2026-11-11 232 a3b7cfa9a5a3a11 Harshal Dev 2026-11-11 233 return 0; a3b7cfa9a5a3a11 Harshal Dev 2026-11-11 234 } a3b7cfa9a5a3a11 Harshal Dev 2026-11-11 235 EXPORT_SYMBOL_GPL(qcom_ice_tz_ops_register); a3b7cfa9a5a3a11 Harshal Dev 2026-11-11 236 a3b7cfa9a5a3a11 Harshal Dev 2026-11-11 @237 void qcom_ice_tz_ops_unregister(struct qcom_ice_tz_ops *ops) a3b7cfa9a5a3a11 Harshal Dev 2026-11-11 238 { a3b7cfa9a5a3a11 Harshal Dev 2026-11-11 239 if (READ_ONCE(ice_tz_ops) == ops) a3b7cfa9a5a3a11 Harshal Dev 2026-11-11 240 /* Paired with smp_load_acquire() in qcom_ice_tz_ops_registered() */ a3b7cfa9a5a3a11 Harshal Dev 2026-11-11 241 smp_store_release(&ice_tz_ops, NULL); a3b7cfa9a5a3a11 Harshal Dev 2026-11-11 242 } a3b7cfa9a5a3a11 Harshal Dev 2026-11-11 243 EXPORT_SYMBOL_GPL(qcom_ice_tz_ops_unregister); a3b7cfa9a5a3a11 Harshal Dev 2026-11-11 244 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki ^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2 0/6] Add support for a TEE agnostic Inline Crypto Engine service
@ 2026-11-11 14:17 Harshal Dev
2026-11-11 14:17 ` [PATCH v2 1/6] soc: qcom: ice: Add TZ agnostic re-direction functions Harshal Dev
0 siblings, 1 reply; 3+ messages in thread
From: Harshal Dev @ 2026-11-11 14:17 UTC (permalink / raw)
To: Eric Biggers, Bjorn Andersson, Konrad Dybcio, Abel Vesa,
Kuldeep Singh, Neeraj Soni, Manivannan Sadhasivam, Sumit Garg,
Selvam Sathappan Periakaruppan
Cc: Basant Kumar, linux-kernel, linux-arm-msm, linux-crypto,
Harshal Dev
Qualcomm platforms such as the IQ-9075 EVK now boot with both Qualcomm
Trusted Execution Environment (QTEE) and OP-TEE [1]. However, the Qualcomm
Inline Crypto Engine (ICE) driver currently only makes SCM calls into QTEE.
With the arrival of ICE support on OPTEE [2,3] for Qualcomm platforms,
there is a need for TrustZone (TZ) agnostic APIs which re-direct the call
to the correct TZ at runtime to request programming of the secure interfaces
on the ICE hardware block.
This patch series adds such TZ agnostic APIs to the ICE driver for
requesting secure services from either QTEE or OP-TEE depending on whether
an SCM driver back-end or a TEE client driver back-end is registered with
it at runtime. This series is logically similar to the one introduced for
Peripheral Authentication Service (PAS) [3] which was recently merged to
provide a generic PAS service for both QTEE and OP-TEE.
Apart from introducing a TEE bus based client driver for ICE, this series
also adds support for optionally registering a TEE device which represents
a particular TEE (QTEE or OPTEE) on the platform bus to enable drivers such
as ICE which poll on the availability of a TEE interface to be notified.
The ICE driver is an independent platform driver which polls on the
availability of a TEE interface (SCM driver) before checking if the ICE
secure service is supported by QTEE by querying qcom_scm_is_available().
The TEE subsystem currently does not provide any mechanism to notify the
availability of a TEE interface, i.e. whether QCOMTEE or OPTEE have probed.
Without the introduction of such a notification mechanism the ICE driver
would indefinitely defer probe until the OPTEE ICE Pseudo TA becomes available
on the TEE bus implying that for OPTEE builds without the ICE PTA enabled,
the dependent UFS/SDHC storage driver will fail to come online.
The TEE bus based client driver introduced in this series which registers
with the ICE driver has an ABI with OP-TEE that is 1-1 identical with the
SCM driver's ICE ABI with QTEE. This is because both TEEs implement logically
similar drivers with the exception that OP-TEE currently does not have
Hardware Key Manager v2 support and so the inline encryption functionality
with OP-TEE is currently limited to Qualcomm platforms with only Hardware
Key Manager v1.
Validation:
This series has been validated on a LeMans IQ-9075 EVK device by attempting
file system encryption via the fscrypt tool.
Merge Strategy:
All patches in this series except one touch Qualcomm firmware and soc drivers.
Hence, it should go via the QCOM-SoC tree. Request the TEE subsystem maintainers
to provide an Acknowledgement for this.
[1] https://ldts.github.io/qcom-buildroot/index.html
[2] https://github.com/OP-TEE/optee_os/pull/7906 (In review)
[3] https://github.com/OP-TEE/optee_os/pull/8137 (Draft, depends on PR#7906)
[4] https://lore.kernel.org/all/20260702115835.167602-1-sumit.garg@kernel.org/
Signed-off-by: Harshal Dev <harshal.dev@oss.qualcomm.com>
---
Changes in v2:
- Merged the furnctionality of the middleware ICE service into the ICE
driver as requested by Eric.
- Introduced tee_platform_device_register() to fix the issue of indefinite
probe defer in the ICE driver when ICE PTA is not enabled in OPTEE as
pointed out by Eric.
- Fixed type "Psuedo" in ICE TEE back-end commit.
- Fixed space based indentation with tab in ICE back-end Kconfig.
- Ensure tee_shm_get_va() failure is checked and ERR_PTR() returned.
- Validate out_shm size everywhere in qcom_ice_tee.c
- Zero the memory holding the key when TEE invoke call fails.
- Check failure from qcom_ice_tz_ops_register() during probe.
- Cross-check out_size and lt_key_size in qcom_ice_tee_generate_key().
- Always return 0 when qcom_ice_tee_probe() is success.
- Did not collect tags from Abel since significant rework undertaken.
- Link to v1: https://lore.kernel.org/r/20261021-ice-migrate-tee-svc-v1-0-b035be7aab0a@oss.qualcomm.com
---
Harshal Dev (6):
soc: qcom: ice: Add TZ agnostic re-direction functions
firmware: qcom_scm: Transition to ICE TZ agnostic operations
firmware: qcom: Add a TEE bus based ICE back-end
tee: optee: Register TEE devices on the platform bus
soc: qcom: ice: Migrate to the TZ agnostic ICE APIs
firmware: qcom: scm: Drop exported ICE wrapper functions
MAINTAINERS | 8 +
drivers/firmware/qcom/Kconfig | 9 +
drivers/firmware/qcom/Makefile | 1 +
drivers/firmware/qcom/qcom_ice_tee.c | 443 +++++++++++++++++++++++++++++
drivers/firmware/qcom/qcom_scm.c | 90 +++---
drivers/soc/qcom/Kconfig | 1 +
drivers/soc/qcom/ice.c | 173 +++++++++--
drivers/tee/optee/ffa_abi.c | 8 +
drivers/tee/optee/smc_abi.c | 8 +
drivers/tee/tee_core.c | 21 ++
include/linux/firmware/qcom/qcom_ice_tee.h | 10 +
include/linux/firmware/qcom/qcom_scm.h | 20 --
include/linux/tee_core.h | 9 +
include/soc/qcom/ice.h | 56 ++++
14 files changed, 784 insertions(+), 73 deletions(-)
---
base-commit: 8f7df005a7564bd7ffa75da9c3085d5b996f1e16
change-id: 20261021-ice-migrate-tee-svc-a5cd6959ae36
Best regards,
--
Harshal Dev <harshal.dev@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH v2 1/6] soc: qcom: ice: Add TZ agnostic re-direction functions 2026-11-11 14:17 [PATCH v2 0/6] Add support for a TEE agnostic Inline Crypto Engine service Harshal Dev @ 2026-11-11 14:17 ` Harshal Dev 2026-11-11 14:37 ` sashiko-bot 0 siblings, 1 reply; 3+ messages in thread From: Harshal Dev @ 2026-11-11 14:17 UTC (permalink / raw) To: Eric Biggers, Bjorn Andersson, Konrad Dybcio, Abel Vesa, Kuldeep Singh, Neeraj Soni, Manivannan Sadhasivam, Sumit Garg, Selvam Sathappan Periakaruppan Cc: Basant Kumar, linux-kernel, linux-arm-msm, linux-crypto, Harshal Dev Qualcomm platforms such as the IQ-9075 EVK now boot with both QTEE and OPTEE. However, the Qualcomm Inline Crypto Engine (ICE) driver currently only makes SCM calls into QTEE. With the arrival of ICE support on OPTEE for Qualcomm platforms the ICE driver should call into the correct Trust Zone (TZ) at runtime to request programming of the secure interfaces on the hardware block. Add TZ agnostic re-direction functions for all the current QTEE SCM calls which can route the calls to either an SCM or TEE bus-based secure back end when registered with ICE. Signed-off-by: Harshal Dev <harshal.dev@oss.qualcomm.com> --- drivers/soc/qcom/ice.c | 124 +++++++++++++++++++++++++++++++++++++++++++++++++ include/soc/qcom/ice.h | 56 ++++++++++++++++++++++ 2 files changed, 180 insertions(+) diff --git a/drivers/soc/qcom/ice.c b/drivers/soc/qcom/ice.c index e256595b9826..452896b1858f 100644 --- a/drivers/soc/qcom/ice.c +++ b/drivers/soc/qcom/ice.c @@ -118,6 +118,130 @@ struct qcom_ice { static DEFINE_XARRAY(ice_handles); static DEFINE_MUTEX(ice_mutex); +static struct qcom_ice_tz_ops *ice_tz_ops; + +static bool qcom_ice_tz_ops_registered(void) +{ + /* + * The barrier is intended to synchronize the data stores for the + * ice_tz_ops data structure when client drivers (UFS/SDHC) are in + * parallel checking for ICE service availability. + */ + return !!smp_load_acquire(&ice_tz_ops); +} + +static bool qcom_ice_tz_is_available(void) +{ + return qcom_scm_is_available(); +} + +static int qcom_ice_tz_invalidate_key(u32 index) +{ + struct qcom_ice_tz_ops *ops; + + ops = ice_tz_ops; + if (!ops) + return -ENODEV; + + return ops->ice_invalidate_key(ops->dev, index); +} + +static int qcom_ice_tz_set_key(u32 index, const u8 *key, u32 key_size, + enum qcom_ice_cipher cipher, + u32 data_unit_size) +{ + struct qcom_ice_tz_ops *ops; + + ops = ice_tz_ops; + if (!ops) + return -ENODEV; + + return ops->ice_set_key(ops->dev, index, key, key_size, cipher, + data_unit_size); +} + +static bool qcom_ice_tz_has_wrapped_key_support(void) +{ + struct qcom_ice_tz_ops *ops; + + ops = ice_tz_ops; + if (!ops) + return -ENODEV; + + return ops->ice_has_wrapped_key_support(ops->dev); +} + +static int qcom_ice_tz_derive_sw_secret(const u8 *eph_key, + size_t eph_key_size, u8 *sw_secret, + size_t sw_secret_size) +{ + struct qcom_ice_tz_ops *ops; + + ops = ice_tz_ops; + if (!ops) + return -ENODEV; + + return ops->ice_derive_sw_secret(ops->dev, eph_key, eph_key_size, + sw_secret, sw_secret_size); +} + +static int qcom_ice_tz_generate_key(u8 *lt_key, size_t lt_key_size) +{ + struct qcom_ice_tz_ops *ops; + + ops = ice_tz_ops; + if (!ops) + return -ENODEV; + + return ops->ice_generate_key(ops->dev, lt_key, lt_key_size); +} + +static int qcom_ice_tz_prepare_key(const u8 *lt_key, size_t lt_key_size, + u8 *eph_key, size_t eph_key_size) +{ + struct qcom_ice_tz_ops *ops; + + ops = ice_tz_ops; + if (!ops) + return -ENODEV; + + return ops->ice_prepare_key(ops->dev, lt_key, lt_key_size, eph_key, + eph_key_size); +} + +static int qcom_ice_tz_import_key(const u8 *raw_key, size_t raw_key_size, + u8 *lt_key, size_t lt_key_size) +{ + struct qcom_ice_tz_ops *ops; + + ops = ice_tz_ops; + if (!ops) + return -ENODEV; + + return ops->ice_import_key(ops->dev, raw_key, raw_key_size, lt_key, + lt_key_size); +} + +int qcom_ice_tz_ops_register(struct qcom_ice_tz_ops *ops) +{ + if (!qcom_ice_tz_ops_registered()) + /* Paired with smp_load_acquire() in qcom_ice_tz_ops_registered() */ + smp_store_release(&ice_tz_ops, ops); + else + return -EBUSY; + + return 0; +} +EXPORT_SYMBOL_GPL(qcom_ice_tz_ops_register); + +void qcom_ice_tz_ops_unregister(struct qcom_ice_tz_ops *ops) +{ + if (READ_ONCE(ice_tz_ops) == ops) + /* Paired with smp_load_acquire() in qcom_ice_tz_ops_registered() */ + smp_store_release(&ice_tz_ops, NULL); +} +EXPORT_SYMBOL_GPL(qcom_ice_tz_ops_unregister); + static bool qcom_ice_check_supported(struct qcom_ice *ice) { u32 regval = qcom_ice_readl(ice, QCOM_ICE_REG_VERSION); diff --git a/include/soc/qcom/ice.h b/include/soc/qcom/ice.h index 4bee553f0a59..89e62e151b85 100644 --- a/include/soc/qcom/ice.h +++ b/include/soc/qcom/ice.h @@ -10,6 +10,47 @@ #include <linux/types.h> struct qcom_ice; +struct device; + +enum qcom_ice_cipher { + QCOM_ICE_CIPHER_AES_128_XTS = 0, + QCOM_ICE_CIPHER_AES_128_CBC = 1, + QCOM_ICE_CIPHER_AES_256_XTS = 3, + QCOM_ICE_CIPHER_AES_256_CBC = 4, +}; + +/** + * struct qcom_ice_tz_ops - Qcom ICE TZ operations + * @drv_name: ICE TZ backend driver name. + * @dev: ICE TZ backend device. + * @ice_invalidate_key: Invalidate keyslot callback. + * @ice_set_key: Program keyslot callback. + * @ice_has_wrapped_key_support: Wrapped-key support callback. + * @ice_derive_sw_secret: Derive software secret callback. + * @ice_generate_key: Generate wrapped key callback. + * @ice_prepare_key: Prepare wrapped key callback. + * @ice_import_key: Import wrapped key callback. + */ +struct qcom_ice_tz_ops { + const char *drv_name; + struct device *dev; + int (*ice_invalidate_key)(struct device *dev, u32 index); + int (*ice_set_key)(struct device *dev, u32 index, const u8 *key, + u32 key_size, enum qcom_ice_cipher cipher, + u32 data_unit_size); + bool (*ice_has_wrapped_key_support)(struct device *dev); + int (*ice_derive_sw_secret)(struct device *dev, const u8 *eph_key, + size_t eph_key_size, u8 *sw_secret, + size_t sw_secret_size); + int (*ice_generate_key)(struct device *dev, u8 *lt_key, + size_t lt_key_size); + int (*ice_prepare_key)(struct device *dev, const u8 *lt_key, + size_t lt_key_size, u8 *eph_key, + size_t eph_key_size); + int (*ice_import_key)(struct device *dev, const u8 *raw_key, + size_t raw_key_size, u8 *lt_key, + size_t lt_key_size); +}; int qcom_ice_enable(struct qcom_ice *ice); int qcom_ice_resume(struct qcom_ice *ice); @@ -31,4 +72,19 @@ int qcom_ice_import_key(struct qcom_ice *ice, u8 lt_key[BLK_CRYPTO_MAX_HW_WRAPPED_KEY_SIZE]); struct qcom_ice *devm_of_qcom_ice_get(struct device *dev); +#ifdef CONFIG_QCOM_INLINE_CRYPTO_ENGINE +int qcom_ice_tz_ops_register(struct qcom_ice_tz_ops *ops); +void qcom_ice_tz_ops_unregister(struct qcom_ice_tz_ops *ops); +#else +static inline int qcom_ice_tz_ops_register(struct qcom_ice_tz_ops *__unused) +{ + return 0; +} + +static inline +void qcom_ice_tz_ops_unregister(struct qcom_ice_tz_ops *__unused) +{ +} +#endif /* CONFIG_QCOM_INLINE_CRYPTO_ENGINE */ + #endif /* __QCOM_ICE_H__ */ -- 2.34.1 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2 1/6] soc: qcom: ice: Add TZ agnostic re-direction functions 2026-11-11 14:17 ` [PATCH v2 1/6] soc: qcom: ice: Add TZ agnostic re-direction functions Harshal Dev @ 2026-11-11 14:37 ` sashiko-bot 0 siblings, 0 replies; 3+ messages in thread From: sashiko-bot @ 2026-11-11 14:37 UTC (permalink / raw) To: Harshal Dev, Eric Biggers, Bjorn Andersson, Konrad Dybcio, Abel Vesa, Kuldeep Singh, Neeraj Soni, Manivannan Sadhasivam, Sumit Garg, Selvam Sathappan Periakaruppan Cc: Basant Kumar, linux-crypto Thank you for your contribution! Sashiko AI review found 4 potential issues to consider: - [High] soc: qcom: ice: broken CONFIG_QCOM_INLINE_CRYPTO_ENGINE=m guard in ice.h - [High] soc: qcom: ice: broken TZ availability check in qcom_ice_tz_is_available() - [Medium] soc: qcom: ice: qcom_ice_tz_has_wrapped_key_support() returns -ENODEV as bool - [Low] soc: qcom: ice: non-atomic check-then-store in qcom_ice_tz_ops_register() -- commit aaede1b942c524f288e35421c3d46bb0baa718ed Author: Harshal Dev <harshal.dev@oss.qualcomm.com> soc: qcom: ice: Add TZ agnostic re-direction functions This commit adds TrustZone-agnostic redirection functions and a backend operations registration interface so the Qualcomm ICE driver can route calls to either QTEE SCM or an OP-TEE backend. > diff --git a/drivers/soc/qcom/ice.c b/drivers/soc/qcom/ice.c > index e256595b9826f..452896b1858f1 100644 > --- a/drivers/soc/qcom/ice.c > +++ b/drivers/soc/qcom/ice.c > @@ -118,6 +118,130 @@ struct qcom_ice { > static DEFINE_XARRAY(ice_handles); > static DEFINE_MUTEX(ice_mutex); > > +static struct qcom_ice_tz_ops *ice_tz_ops; > + > +static bool qcom_ice_tz_ops_registered(void) > +{ > + /* > + * The barrier is intended to synchronize the data stores for the > + * ice_tz_ops data structure when client drivers (UFS/SDHC) are in > + * parallel checking for ICE service availability. > + */ > + return !!smp_load_acquire(&ice_tz_ops); > +} > + > +static bool qcom_ice_tz_is_available(void) > +{ > + return qcom_scm_is_available(); > +} [Severity: High] As reported by Eric Biggers on v1 [1], does qcom_ice_tz_is_available() cause qcom_ice_create() to return -EPROBE_DEFER indefinitely on QTEE-only platforms? Later in this series, commit "tee: optee: Register TEE devices on the platform bus" updates qcom_ice_tz_is_available() to return (qcom_scm_is_available() & qcom_ice_tee_is_available()), and commit "soc: qcom: ice: Migrate to the TZ agnostic ICE APIs" makes qcom_ice_create() return -EPROBE_DEFER when qcom_ice_tz_is_available() is false before checking qcom_ice_tz_ops_registered(). Because qcom_ice_tee_is_available() only becomes true after an OP-TEE platform device probes, it stays false on QTEE-only platforms (or when CONFIG_OPTEE is disabled). Since ufs_qcom_ice_init() and sdhci_msm_ice_init() only fall back to running without inline encryption on -EOPNOTSUPP and propagate -EPROBE_DEFER, UFS and eMMC/SDHC controllers never finish probing on those platforms. [ ... ] > +static bool qcom_ice_tz_has_wrapped_key_support(void) > +{ > + struct qcom_ice_tz_ops *ops; > + > + ops = ice_tz_ops; > + if (!ops) > + return -ENODEV; > + > + return ops->ice_has_wrapped_key_support(ops->dev); > +} [Severity: Medium] Does returning -ENODEV from a bool function evaluate to true when ice_tz_ops is NULL? Besides triggering a -Wint-in-bool-context compiler warning, this reports that wrapped keys are supported when no TZ backend is registered. [ ... ] > +int qcom_ice_tz_ops_register(struct qcom_ice_tz_ops *ops) > +{ > + if (!qcom_ice_tz_ops_registered()) > + /* Paired with smp_load_acquire() in qcom_ice_tz_ops_registered() */ > + smp_store_release(&ice_tz_ops, ops); > + else > + return -EBUSY; > + > + return 0; > +} > +EXPORT_SYMBOL_GPL(qcom_ice_tz_ops_register); > + > +void qcom_ice_tz_ops_unregister(struct qcom_ice_tz_ops *ops) > +{ > + if (READ_ONCE(ice_tz_ops) == ops) > + /* Paired with smp_load_acquire() in qcom_ice_tz_ops_registered() */ > + smp_store_release(&ice_tz_ops, NULL); > +} > +EXPORT_SYMBOL_GPL(qcom_ice_tz_ops_unregister); [Severity: Low] Can two backends probing in parallel on the platform and TEE buses both pass !qcom_ice_tz_ops_registered() and overwrite ice_tz_ops instead of returning -EBUSY? Using cmpxchg() or a mutex across register and unregister would make the check and update atomic. > diff --git a/include/soc/qcom/ice.h b/include/soc/qcom/ice.h > index 4bee553f0a59d..89e62e151b85b 100644 > --- a/include/soc/qcom/ice.h > +++ b/include/soc/qcom/ice.h [ ... ] > @@ -31,4 +72,19 @@ int qcom_ice_import_key(struct qcom_ice *ice, > u8 lt_key[BLK_CRYPTO_MAX_HW_WRAPPED_KEY_SIZE]); > struct qcom_ice *devm_of_qcom_ice_get(struct device *dev); > > +#ifdef CONFIG_QCOM_INLINE_CRYPTO_ENGINE > +int qcom_ice_tz_ops_register(struct qcom_ice_tz_ops *ops); > +void qcom_ice_tz_ops_unregister(struct qcom_ice_tz_ops *ops); > +#else > +static inline int qcom_ice_tz_ops_register(struct qcom_ice_tz_ops *__unused) > +{ > + return 0; > +} > + > +static inline > +void qcom_ice_tz_ops_unregister(struct qcom_ice_tz_ops *__unused) > +{ > +} > +#endif /* CONFIG_QCOM_INLINE_CRYPTO_ENGINE */ > + > #endif /* __QCOM_ICE_H__ */ [Severity: High] Does #ifdef CONFIG_QCOM_INLINE_CRYPTO_ENGINE break the build when CONFIG_QCOM_INLINE_CRYPTO_ENGINE=m? QCOM_INLINE_CRYPTO_ENGINE is a tristate symbol (and defaults to =m in arm64 defconfig), so when built as a module only CONFIG_QCOM_INLINE_CRYPTO_ENGINE_MODULE is defined. The header then exposes the static inline stubs, which conflict with the non-static definitions in drivers/soc/qcom/ice.c and cause TZ backends to call no-op stubs. Also, if CONFIG_QCOM_SCM=y while CONFIG_QCOM_INLINE_CRYPTO_ENGINE=m, built-in qcom_scm cannot link against symbols exported by qcom_ice.ko. [1] https://lore.kernel.org/r/20261024185602.GF2553@quark -- Sashiko AI review · https://sashiko.dev/#/patchset/20261111-ice-migrate-tee-svc-v2-0-29d19f6c92ab@oss.qualcomm.com?part=1 ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-18 20:53 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-11-18 20:52 [PATCH v2 1/6] soc: qcom: ice: Add TZ agnostic re-direction functions kernel test robot -- strict thread matches above, loose matches on Subject: below -- 2026-11-11 14:17 [PATCH v2 0/6] Add support for a TEE agnostic Inline Crypto Engine service Harshal Dev 2026-11-11 14:17 ` [PATCH v2 1/6] soc: qcom: ice: Add TZ agnostic re-direction functions Harshal Dev 2026-11-11 14:37 ` sashiko-bot
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.