Re: [RFC PATCH 1/2] firmware: qcom: scm: Add QSEECOM app loading and shutdown
From: Konrad Dybcio
Date: Mon Nov 02 2026 - 07:33:39 EST
On 11/1/26 5:01 PM, Haozhen Li wrote:
> QSEECOM clients in the kernel can currently only talk to trusted
> applications that some earlier boot stage happened to load:
> qcom_scm_qseecom_app_get_id() looks an app up and
> qcom_scm_qseecom_app_send() talks to it, but nothing lets Linux start
> one itself.
Adding some relevant folks to Cc for awareness
[...]
> + * The image buffer must lie entirely below the 4 GiB physical mark: QTEE
> + * reads the image address as a 32-bit value even under the 64-bit SMC
> + * calling convention, so a buffer above it would be truncated into a wrong
> + * address. Such buffers are rejected here rather than passed on.
I think that only holds for certain versions
> + *
> + * Return: Zero on success, nonzero on failure.
> + */
> +int qcom_scm_qseecom_app_load(void *img, size_t mdt_len, size_t img_len,
> + u32 *app_id)
> +{
> + phys_addr_t img_phys;
> + struct qcom_scm_qseecom_resp res = {};
> + struct qcom_scm_desc desc = {};
> + int status;
nit: please use reverse-Christmas-tree sorting
[...]
> + /* See the comment on the 4 GiB limit in the function doc above. */
> + if (upper_32_bits(img_phys) || (u64)img_phys + img_len > SZ_4G) {
This can overflow on 32b archs, do `|| img_len > SZ_4G - img_phys` instead
(also below)
Konrad