From: Claude Code Review Bot <claude-review@example.com>
To: dri-devel-reviews@example.com
Subject: Claude review: firmware: qcom: Add a PAS TEE service
Date: Mon, 25 May 2026 18:55:30 +1000 [thread overview]
Message-ID: <review-patch4-20260522115936.201208-5-sumit.garg@kernel.org> (raw)
In-Reply-To: <20260522115936.201208-5-sumit.garg@kernel.org>
Patch Review
The OP-TEE backend implementation using the TEE bus client driver infrastructure.
**`qcom_pas_tee_get_rsc_table` has a questionable two-call pattern:**
```c
ret = tee_client_invoke_func(data->ctx, &inv_arg, param);
if (ret < 0 || inv_arg.ret != 0) { ... }
if (param[1].u.memref.size) {
/* allocate SHM, copy input, call again */
...
}
```
The first call is made with `param[1].u.memref.shm` being NULL (no shared memory allocated). This appears to be a "query size" call. However, the `attr` is set to `TEE_IOCTL_PARAM_ATTR_TYPE_MEMREF_INOUT` without any backing memory. Whether this is valid depends on the OP-TEE TA implementation. If the TA tries to access the memref on the first call, it could fail. The pattern assumes the TA will return the required size in `param[1].u.memref.size` without accessing the buffer, which should be documented.
**`DEFINE_FREE(shm_free, ...)` scope issue:**
```c
DEFINE_FREE(shm_free, struct tee_shm *, tee_shm_free(_T))
```
This `DEFINE_FREE` macro is defined at file scope but `tee_shm_free` accepts NULL gracefully (it's a no-op for NULL), and `IS_ERR_OR_NULL` is checked. However, when the cleanup runs, if `rt_shm` was set to NULL after the `IS_ERR_OR_NULL` check (`rt_shm = NULL`), `tee_shm_free(NULL)` will be called, which should be fine. But the flow is confusing: `rt_shm` is set to NULL in the error path to prevent the `__free` cleanup from freeing it, but then the function returns `ERR_PTR(-ENOMEM)` which will trigger cleanup... Actually, looking more carefully:
```c
if (IS_ERR_OR_NULL(rt_shm)) {
rt_shm = NULL;
return ERR_PTR(-ENOMEM);
}
```
Setting `rt_shm = NULL` before returning prevents the `__free(shm_free)` cleanup from freeing an error pointer. This is correct but quite subtle.
**TEE probe sets ops without checking for existing registration:**
```c
qcom_pas_ops_tee.dev = dev;
qcom_pas_ops_register(&qcom_pas_ops_tee);
```
If the SCM backend already registered (which it will on platforms with both SCM and OP-TEE), this will just print an error and silently fail. The TEE driver probe still returns success (`return ret` where `ret` is 0). This means the TEE driver will appear to have probed successfully but won't actually be used. Consider returning an error from `qcom_pas_ops_register()` so the TEE probe can handle it, or better yet, design for backend priority/switchover.
**`depends on !CPU_BIG_ENDIAN`**: The Kconfig has this restriction. The commit message doesn't explain why. Presumably it's because the TEE ABI uses `lower_32_bits`/`upper_32_bits` for address splitting which assumes little-endian wire format. This should be documented.
---
Generated by Claude Code Patch Reviewer
next prev parent reply other threads:[~2026-05-25 8:55 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-22 11:59 [PATCH v7 00/15] firmware: qcom: Add OP-TEE PAS service support Sumit Garg
2026-05-22 11:59 ` [PATCH v7 01/15] arm64: dts: qcom: kodiak: Add EL2 overlay Sumit Garg
2026-05-25 8:55 ` Claude review: " Claude Code Review Bot
2026-05-22 11:59 ` [PATCH v7 02/15] firmware: qcom: Add a generic PAS service Sumit Garg
2026-05-25 8:55 ` Claude review: " Claude Code Review Bot
2026-05-22 11:59 ` [PATCH v7 03/15] firmware: qcom_scm: Migrate to " Sumit Garg
2026-05-25 8:55 ` Claude review: " Claude Code Review Bot
2026-05-22 11:59 ` [PATCH v7 04/15] firmware: qcom: Add a PAS TEE service Sumit Garg
2026-05-25 8:55 ` Claude Code Review Bot [this message]
2026-05-22 11:59 ` [PATCH v7 05/15] remoteproc: qcom_q6v5_pas: Switch over to generic PAS TZ APIs Sumit Garg
2026-05-25 8:55 ` Claude review: " Claude Code Review Bot
2026-05-22 11:59 ` [PATCH v7 06/15] remoteproc: qcom_q6v5_mss: Switch " Sumit Garg
2026-05-25 8:55 ` Claude review: " Claude Code Review Bot
2026-05-22 11:59 ` [PATCH v7 07/15] remoteproc: qcom_wcnss: " Sumit Garg
2026-05-25 8:55 ` Claude review: " Claude Code Review Bot
2026-05-22 11:59 ` [PATCH v7 08/15] remoteproc: qcom: Select QCOM_PAS generic service Sumit Garg
2026-05-25 8:55 ` Claude review: " Claude Code Review Bot
2026-05-22 11:59 ` [PATCH v7 09/15] drm/msm: Switch to generic PAS TZ APIs Sumit Garg
2026-05-25 8:55 ` Claude review: " Claude Code Review Bot
2026-05-22 11:59 ` [PATCH v7 10/15] media: qcom: " Sumit Garg
2026-05-25 8:55 ` Claude review: " Claude Code Review Bot
2026-05-22 11:59 ` [PATCH v7 11/15] media: qcom: Pass proper PAS ID to set_remote_state API Sumit Garg
2026-05-25 8:55 ` Claude review: " Claude Code Review Bot
2026-05-22 11:59 ` [PATCH v7 12/15] net: ipa: Switch to generic PAS TZ APIs Sumit Garg
2026-05-25 8:55 ` Claude review: " Claude Code Review Bot
2026-05-22 11:59 ` [PATCH v7 13/15] wifi: ath12k: " Sumit Garg
2026-05-25 8:55 ` Claude review: " Claude Code Review Bot
2026-05-22 11:59 ` [PATCH v7 14/15] firmware: qcom_scm: Remove SCM PAS wrappers Sumit Garg
2026-05-25 8:55 ` Claude review: " Claude Code Review Bot
2026-05-22 11:59 ` [PATCH v7 15/15] MAINTAINERS: Add maintainer entry for Qualcomm PAS TZ service Sumit Garg
2026-05-25 8:55 ` Claude review: " Claude Code Review Bot
2026-05-25 8:55 ` Claude review: firmware: qcom: Add OP-TEE PAS service support Claude Code Review Bot
-- strict thread matches above, loose matches on Subject: below --
2026-05-04 13:05 [PATCH v5 00/16] " Sumit Garg
2026-05-04 13:05 ` [PATCH v5 04/16] firmware: qcom: Add a PAS TEE service Sumit Garg
2026-05-04 22:22 ` Claude review: " Claude Code Review Bot
2026-04-27 9:55 [PATCH v4 00/15] firmware: qcom: Add OP-TEE PAS service support Sumit Garg
2026-04-27 9:55 ` [PATCH v4 04/15] firmware: qcom: Add a PAS TEE service Sumit Garg
2026-04-28 4:49 ` Claude review: " Claude Code Review Bot
2026-03-12 6:27 [PATCH v2 00/15] firmware: qcom: Add OP-TEE PAS service support Sumit Garg
2026-03-12 6:27 ` [PATCH v2 04/15] firmware: qcom: Add a PAS TEE service Sumit Garg
2026-03-13 4:26 ` Claude review: " Claude Code Review Bot
2026-03-06 10:50 [PATCH 00/14] firmware: qcom: Add OP-TEE PAS service support Sumit Garg
2026-03-06 10:50 ` [PATCH 04/14] firmware: qcom: Add a PAS TEE service Sumit Garg
2026-03-08 22:59 ` Claude review: " Claude Code Review Bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=review-patch4-20260522115936.201208-5-sumit.garg@kernel.org \
--to=claude-review@example.com \
--cc=dri-devel-reviews@example.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox