Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Anvesh Jain P" <anvesh.p@oss.qualcomm.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v4 4/4] remoteproc: qcom: pas: Add Glymur OOBMSS PAS parameters
Date: Thu, 26 Nov 2026 07:28:50 +0000	[thread overview]
Message-ID: <sashiko-outbox-234955@kernel.org> (raw)
In-Reply-To: <20261126-oob-support-glymur-v4-4-ad4ec5dd4b0a@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [Medium] remoteproc: qcom: pas: secondary shutdown errors lost in
  qcom_pas_stop()
- [Medium] remoteproc: qcom: pas: firmware leak after qcom_pas_load() on
  start error
- [Medium] remoteproc: qcom: pas: missing decrypt shutdown poll in
  qcom_pas_start()
--

commit eeb577211ecb1e7bd112a3fc4d396f7f8f51017c
Author: Anvesh Jain P <anvesh.p@oss.qualcomm.com>

remoteproc: qcom: pas: Add Glymur OOBMSS PAS parameters

This commit adds PAS resource parameters and the corresponding OF match
entry for the Glymur OOBMSS subsystem, including primary and secondary
firmware, DTB PAS IDs, and decrypt_shutdown support.

> diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c
> index 1e55b00357c80..a0807615b0e7f 100644
> --- a/drivers/remoteproc/qcom_q6v5_pas.c
> +++ b/drivers/remoteproc/qcom_q6v5_pas.c
> @@ -2194,6 +2194,30 @@ static const struct qcom_pas_data kaanapali_soccp_resource = {
>  	.early_boot = true,
>  };
>  
> +static const struct qcom_pas_data glymur_oobmss_resource = {
> +	.crash_reason_smem = 669,
> +	.firmware_name = "oobmss_tee.mbn",
> +	.dtb_firmware_name = "oobmss_qc_dtb.mbn",
> +	.secondary_firmware_name = "oobmss_ns.mbn",
> +	.secondary_dtb_firmware_name = "oobmss_oem_dtb.mbn",

[Severity: Medium]
Can this leak pas->secondary_dtb_firmware, pas->secondary_firmware, and
pas->dtb_firmware if startup fails after qcom_pas_load() succeeds?

qcom_pas_load() requests those firmware blobs, but
qcom_pas_release_firmware() is only called in qcom_pas_start() under the
disable_irqs label and on successful start.  If rproc_prepare_subdevices()
fails in rproc_start() before rproc->ops->start() is called (where cleanup
only runs qcom_pas_unprepare()), or if qcom_q6v5_prepare() fails at the top
of qcom_pas_start(), the three firmware objects are never released and
pas->firmware is left non-NULL:

drivers/remoteproc/qcom_q6v5_pas.c:qcom_pas_start() {
    ...
	ret = qcom_q6v5_prepare(&pas->q6v5);
	if (ret)
		return ret;
    ...
}

> +	.pas_id = 0x42,
> +	.dtb_pas_id = 0x43,
> +	.secondary_pas_id = 0x44,
> +	.secondary_dtb_pas_id = 0x45,

[Severity: Medium]
Does qcom_pas_stop() drop shutdown errors from pas->secondary_pas_id and
pas->secondary_dtb_pas_id when pas->pas_id shuts down cleanly?

drivers/remoteproc/qcom_q6v5_pas.c:qcom_pas_stop() {
    ...
	if (pas->secondary_pas_id) {
		ret = qcom_pas_shutdown(pas->secondary_pas_id);
		if (ret && pas->decrypt_shutdown)
			ret = qcom_pas_shutdown_poll_decrypt(pas->secondary_pas_id);
		if (ret)
			dev_err(pas->dev, "failed to shutdown secondary: %d\n", ret);

		qcom_pas_unmap_carveout(rproc, pas->secondary_mem_phys,
					pas->secondary_mem_size);
	}

	if (pas->secondary_dtb_pas_id) {
		ret = qcom_pas_shutdown(pas->secondary_dtb_pas_id);
		if (ret)
			dev_err(pas->dev,
				"failed to shutdown secondary dtb: %d\n", ret);

		qcom_pas_unmap_carveout(rproc, pas->secondary_dtb_mem_phys,
					pas->secondary_dtb_mem_size);
	}

	ret = qcom_pas_shutdown(pas->pas_id);
    ...
}

Unlike the pas->dtb_pas_id shutdown below it, which preserves an earlier
error instead of overwriting ret, both secondary shutdown results are
overwritten by qcom_pas_shutdown(pas->pas_id).  During
rproc_boot_recovery(), rproc_stop() returning 0 lets recovery proceed to
qcom_pas_coredump(), which maps and reads pas->secondary_mem_region while
the secondary carveout may still be locked by PAS.

> +	.proxy_pd_names = (char *[]){
> +		"cx",
> +		"mx",
> +		NULL
> +	},
> +	.ssr_name = "oobmss",
> +	.sysmon_name = "oobmss",
> +	.ssctl_id = 0x21,
> +	.auto_boot = true,
> +	.early_boot = true,
> +	.needs_tzmem = true,
> +	.decrypt_shutdown = true,
> +};

[Severity: Medium]
With decrypt_shutdown enabled, do the error paths in qcom_pas_start() leave
pas->pas_id or pas->secondary_pas_id only partially shut down?

drivers/remoteproc/qcom_q6v5_pas.c:qcom_pas_start() {
    ...
	if (ret == -ETIMEDOUT) {
		dev_err(pas->dev, "start timed out\n");
		qcom_pas_shutdown(pas->pas_id);
		goto unmap_carveout;
	}
    ...
	if (pas->secondary_pas_id)
		qcom_pas_shutdown(pas->secondary_pas_id);
unmap_secondary_carveout:
	if (pas->secondary_pas_id)
		qcom_pas_unmap_carveout(rproc, pas->secondary_mem_phys,
					pas->secondary_mem_size);
    ...
}

On platforms with decrypt_shutdown, the first qcom_pas_shutdown() call only
initiates decryption and returns -EINVAL until shutdown completes, which is
why qcom_pas_stop() follows up with qcom_pas_shutdown_poll_decrypt().  If
qcom_q6v5_wait_for_start() times out, or if starting pas->dtb_pas_ctx or
pas->pas_ctx fails after pas->secondary_pas_ctx has been authenticated and
reset, qcom_pas_start() unmaps the carveouts and disables clocks,
regulators, and power domains without polling
qcom_pas_shutdown_poll_decrypt().

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261126-oob-support-glymur-v4-0-ad4ec5dd4b0a@oss.qualcomm.com?part=4

      reply	other threads:[~2026-11-26  7:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26  7:13 [PATCH v4 0/4] Add Glymur OOBMSS support Anvesh Jain P
2026-11-26  7:13 ` [PATCH v4 1/4] dt-bindings: remoteproc: qcom: Add Glymur OOBMSS PAS Anvesh Jain P
2026-11-26  7:20   ` sashiko-bot
2026-11-26  7:13 ` [PATCH v4 2/4] remoteproc: qcom: pas: Support secondary images Anvesh Jain P
2026-11-26  7:29   ` sashiko-bot
2026-11-26  7:13 ` [PATCH v4 3/4] remoteproc: qcom: pas: Add coredump support for secondary processors Anvesh Jain P
2026-11-26  7:37   ` sashiko-bot
2026-11-26  7:13 ` [PATCH v4 4/4] remoteproc: qcom: pas: Add Glymur OOBMSS PAS parameters Anvesh Jain P
2026-11-26  7:28   ` sashiko-bot [this message]

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=sashiko-outbox-234955@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=anvesh.p@oss.qualcomm.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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