Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "David Heidelberg" <david@ixit.cz>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v3 2/3] remoteproc: qcom_q6v5_mss: Publish socinfo for Pixel modems
Date: Mon, 16 Nov 2026 16:06:43 +0000	[thread overview]
Message-ID: <sashiko-outbox-217338@kernel.org> (raw)
In-Reply-To: <20261116-modemsmem-v3-2-24ebc7ed6eb9@ixit.cz>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] remoteproc: qcom_q6v5_mss: dev_err_probe() used in runtime
  q6v5_start()
It also noticed 1 related pre-existing issue this patch does not
introduce:
- [High] remoteproc: qcom_q6v5_mss: missing need_pas_mem_setup
  assignment in q6v5_probe() [1]
--

commit b9f47173917266b645cba443348a310e5cf36ef0
Author: David Heidelberg <david@ixit.cz>

remoteproc: qcom_q6v5_mss: Publish socinfo for Pixel modems

This commit publishes SoC platform type, subtype, and revision fields from
SMEM socinfo into vendor SMEM item 134 before starting the modem when the
"google,require-socinfo" property is present.

> diff --git a/drivers/remoteproc/qcom_q6v5_mss.c b/drivers/remoteproc/qcom_q6v5_mss.c
> index dd052a62b8583..53deabea62259 100644
> --- a/drivers/remoteproc/qcom_q6v5_mss.c
> +++ b/drivers/remoteproc/qcom_q6v5_mss.c
[ ... ]
> @@ -1673,12 +1682,76 @@ static void qcom_q6v5_dump_segment(struct rproc *rproc,
>  	}
>  }
>  
> +/* Layout of the vendor-defined SMEM item read by the Pixel modem firmware */
> +struct modem_smem_info {
> +	__le32 version;
> +	__le32 modem_flag;
> +	__le32 major_id;
> +	__le32 minor_id;
> +	__le32 subtype;
> +	__le32 platform;
> +	__le32 efs_magic;
> +	__le32 ftm_magic;
> +};
> +
> +#define MODEM_SMEM_VERSION	0
> +#define PLAT_VER_TO_MAJOR_ID(v)	(((v) >> 16) & 0xff)
> +#define PLAT_VER_TO_MINOR_ID(v)	((v) & 0xff)
> +
> +static int q6v5_socinfo_publish(struct q6v5 *qproc)
> +{
> +	struct modem_smem_info *info;
> +	struct socinfo *socinfo;
> +	u32 plat_ver;
> +	int ret;
> +
> +	socinfo = qcom_smem_get(QCOM_SMEM_HOST_ANY, SMEM_HW_SW_BUILD_ID, NULL);
> +	if (IS_ERR(socinfo))
> +		return dev_err_probe(qproc->dev, PTR_ERR(socinfo),
> +				     "could not get socinfo\n");
> +
> +	/* hw_plat_subtype was added in socinfo format 0.6 */
> +	if (le32_to_cpu(socinfo->fmt) < SOCINFO_VERSION(0, 6))
> +		return dev_err_probe(qproc->dev, -EOPNOTSUPP,
> +				     "socinfo format too old\n");
> +
> +	/* -EEXIST: the item survived an earlier boot */
> +	ret = qcom_smem_alloc(QCOM_SMEM_HOST_ANY, SMEM_ID_VENDOR0, sizeof(*info));
> +	if (ret && ret != -EEXIST)
> +		return dev_err_probe(qproc->dev, ret,
> +				     "could not allocate modem smem\n");
> +
> +	info = qcom_smem_get(QCOM_SMEM_HOST_ANY, SMEM_ID_VENDOR0, NULL);
> +	if (IS_ERR(info))
> +		return dev_err_probe(qproc->dev, PTR_ERR(info),
> +				     "could not get modem smem\n");
> +
> +	plat_ver = le32_to_cpu(socinfo->plat_ver);
> +
> +	/* modem_flag, efs_magic and ftm_magic are left zero */
> +	*info = (struct modem_smem_info) {
> +		.version   = cpu_to_le32(MODEM_SMEM_VERSION),
> +		.major_id  = cpu_to_le32(PLAT_VER_TO_MAJOR_ID(plat_ver)),
> +		.minor_id  = cpu_to_le32(PLAT_VER_TO_MINOR_ID(plat_ver)),
> +		.subtype   = socinfo->hw_plat_subtype,
> +		.platform  = socinfo->hw_plat,
> +	};
> +
> +	return 0;
> +}
> +
>  static int q6v5_start(struct rproc *rproc)
>  {
>  	struct q6v5 *qproc = rproc->priv;
>  	int xfermemop_ret;
>  	int ret;
>  
> +	if (qproc->need_socinfo) {
> +		ret = q6v5_socinfo_publish(qproc);
> +		if (ret)
> +			return ret;
> +	}

[Severity: Medium]
Should q6v5_socinfo_publish() use dev_err() instead of dev_err_probe(), or be
called from q6v5_probe()?

Because q6v5_probe() sets rproc->auto_boot = false, q6v5_start() ->
q6v5_socinfo_publish() only runs at runtime when the remoteproc is booted or
recovered.  If qcom_smem_get() or qcom_smem_alloc() returns -EPROBE_DEFER at
that point (q6v5_probe() does not check qcom_smem_is_available()),
dev_err_probe() demotes the log to debug level, returns -EPROBE_DEFER to
rproc_boot(), and allocates qproc->dev->p->deferred_probe_reason, which is
leaked because the already-bound device is never placed on
deferred_probe_pending_list.  If qcom_smem_alloc() returns -ENOMEM when the
SMEM heap is full, dev_err_probe() also suppresses the error message.

> @@ -2132,6 +2205,8 @@ static int q6v5_probe(struct platform_device *pdev)
>  	qproc->has_ext_cntl_regs = desc->has_ext_cntl_regs;
>  	qproc->has_vq6 = desc->has_vq6;
>  	qproc->has_spare_reg = desc->has_spare_reg;
> +	qproc->need_socinfo =
> +		of_property_read_bool(pdev->dev.of_node, "google,require-socinfo");
>  	ret = q6v5_init_mem(qproc, pdev);
>  	if (ret)
>  		return ret;

[Severity: High]
This problem wasn't introduced by this patch, but does q6v5_probe() forget to
copy desc->need_pas_mem_setup into qproc->need_pas_mem_setup [1]?

q6v5_probe() checks desc->need_pas_mem_setup for early probe deferral, but
never assigns it to qproc:

drivers/remoteproc/qcom_q6v5_mss.c:q6v5_probe() {
	...
	if (desc->need_pas_mem_setup && !qcom_pas_is_available())
		return -EPROBE_DEFER;
	...
	qproc->version = desc->version;
	qproc->need_mem_protection = desc->need_mem_protection;
	qproc->has_mba_logs = desc->has_mba_logs;
	...
}

As a result, qproc->need_pas_mem_setup stays false in q6v5_mpss_init_image()
and qcom_scm_pas_mem_setup() is skipped on platforms that set
need_pas_mem_setup (such as SDM632), preventing the modem from authenticating
and booting.

[1] https://sashiko.dev/#/bug/linux-83fcbc28-236c-48e4-a6bd-731f4361f9ae

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261116-modemsmem-v3-0-24ebc7ed6eb9@ixit.cz?part=2

  reply	other threads:[~2026-11-16 16:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 15:50 [PATCH v3 0/3] Add modemsmem for Google phones David Heidelberg via B4 Relay
2026-11-16 15:50 ` [PATCH v3 1/3] dt-bindings: remoteproc: qcom,msm8996-mss-pil: Document google,require-socinfo David Heidelberg via B4 Relay
2026-11-16 15:50 ` [PATCH v3 2/3] remoteproc: qcom_q6v5_mss: Publish socinfo for Pixel modems David Heidelberg via B4 Relay
2026-11-16 16:06   ` sashiko-bot [this message]
2026-11-16 15:50 ` [PATCH v3 3/3] arm64: dts: qcom: sdm845-google: Require modem socinfo David Heidelberg via B4 Relay

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-217338@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=david@ixit.cz \
    --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