From: David Heidelberg via B4 Relay <devnull+david.ixit.cz@kernel.org>
To: Bjorn Andersson <andersson@kernel.org>,
Mathieu Poirier <mathieu.poirier@linaro.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Sibi Sankar <sibi.sankar@oss.qualcomm.com>,
Konrad Dybcio <konradybcio@kernel.org>,
Abel Vesa <abelvesa@kernel.org>, Miro Mraz <mraz.miro@seznam.cz>
Cc: Richard Acayan <mailingradian@gmail.com>,
linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
phone-devel@vger.kernel.org, David Heidelberg <david@ixit.cz>
Subject: [PATCH v3 2/3] remoteproc: qcom_q6v5_mss: Publish socinfo for Pixel modems
Date: Mon, 16 Nov 2026 16:50:44 +0100 [thread overview]
Message-ID: <20261116-modemsmem-v3-2-24ebc7ed6eb9@ixit.cz> (raw)
In-Reply-To: <20261116-modemsmem-v3-0-24ebc7ed6eb9@ixit.cz>
From: David Heidelberg <david@ixit.cz>
The modem firmware on Google Pixel boards (Pixel 3 through Pixel 5a)
reads the SoC platform type, subtype and revision from the first
vendor-reserved SMEM item (item 134) when it boots, and refuses to
come up unless the application processor has filled it in.
When the "google,require-socinfo" property is present on the MSS
remoteproc node, copy the relevant socinfo fields into that item from
the socinfo SMEM data before starting the modem. The SMEM item id and
layout are a contract between Google's downstream kernel and the modem
firmware rather than hardware, so they are hard-coded in the driver.
The item is written in full: modem_flag, efs_magic and ftm_magic are
left zero. Downstream fills modem_flag from a bootloader-provided
/chosen/cdt/cdb2 property that is not always present, and the two magic
values only matter for factory test mode.
Based on work of: Richard Acayan.
Adapted from the original form using both human & LLM work.
Suggested-by: Bjorn Andersson <andersson@kernel.org>
Signed-off-by: David Heidelberg <david@ixit.cz>
---
drivers/remoteproc/qcom_q6v5_mss.c | 75 ++++++++++++++++++++++++++++++++++++++
1 file changed, 75 insertions(+)
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
@@ -23,27 +23,35 @@
#include <linux/pm_runtime.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
#include <linux/remoteproc.h>
#include <linux/reset.h>
#include <linux/soc/qcom/mdt_loader.h>
#include <linux/iopoll.h>
#include <linux/slab.h>
+#include <linux/soc/qcom/smem.h>
+#include <linux/soc/qcom/socinfo.h>
#include "remoteproc_internal.h"
#include "qcom_common.h"
#include "qcom_pil_info.h"
#include "qcom_q6v5.h"
#include <linux/firmware/qcom/qcom_pas.h>
#include <linux/firmware/qcom/qcom_scm.h>
#define MPSS_CRASH_REASON_SMEM 421
+/*
+ * First vendor-reserved SMEM item; Google's modem firmware reads the SoC
+ * platform information from it when the modem boots.
+ */
+#define SMEM_ID_VENDOR0 134
+
#define MBA_LOG_SIZE SZ_4K
#define MPSS_PAS_ID 5
/* RMB Status Register Values */
#define RMB_PBL_SUCCESS 0x1
#define RMB_MBA_XPU_UNLOCKED 0x1
@@ -247,16 +255,17 @@ struct q6v5 {
bool need_pas_mem_setup;
bool has_alt_reset;
bool has_mba_logs;
bool has_spare_reg;
bool has_qaccept_regs;
bool has_ext_bhs_reg;
bool has_ext_cntl_regs;
bool has_vq6;
+ bool need_socinfo;
u64 mpss_perm;
u64 mba_perm;
const char *hexagon_mdt_image;
int version;
};
enum {
MSS_MDM9607,
@@ -1668,22 +1677,86 @@ static void qcom_q6v5_dump_segment(struct rproc *rproc,
false, true,
qproc->mpss_phys,
qproc->mpss_size);
q6v5_mba_reclaim(qproc);
}
}
}
+/* 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;
+ }
+
ret = q6v5_mba_load(qproc);
if (ret)
return ret;
dev_info(qproc->dev, "MBA booted with%s debug policy, loading mpss\n",
qproc->dp_size ? "" : "out");
ret = q6v5_mpss_load(qproc);
@@ -2127,16 +2200,18 @@ static int q6v5_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, qproc);
qproc->has_qaccept_regs = desc->has_qaccept_regs;
qproc->has_ext_bhs_reg = desc->has_ext_bhs_reg;
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;
ret = q6v5_alloc_memory_region(qproc);
if (ret)
return ret;
--
2.55.0
next prev parent reply other threads:[~2026-11-16 15:50 UTC|newest]
Thread overview: 4+ 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 ` David Heidelberg via B4 Relay [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=20261116-modemsmem-v3-2-24ebc7ed6eb9@ixit.cz \
--to=devnull+david.ixit.cz@kernel.org \
--cc=abelvesa@kernel.org \
--cc=andersson@kernel.org \
--cc=conor+dt@kernel.org \
--cc=david@ixit.cz \
--cc=devicetree@vger.kernel.org \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=mailingradian@gmail.com \
--cc=mathieu.poirier@linaro.org \
--cc=mraz.miro@seznam.cz \
--cc=phone-devel@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sibi.sankar@oss.qualcomm.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
all inboxes | Powered by JetHome®