linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Peng Fan <peng.fan@oss.nxp.com>
To: Frank Li <Frank.li@nxp.com>
Cc: 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>,
	Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>,
	Daniel Baluta <daniel.baluta@nxp.com>,
	linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org,
	imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Peng Fan <peng.fan@nxp.com>
Subject: Re: [PATCH v3 4/5] remoteproc: imx_rproc: Add support for System Manager API
Date: Wed, 26 Nov 2025 10:57:15 +0800	[thread overview]
Message-ID: <aSZsixcVpSeVfwQp@shlinux89> (raw)
In-Reply-To: <aSSVoOi3VIn7LefK@lizhi-Precision-Tower-5810>

On Mon, Nov 24, 2025 at 12:28:00PM -0500, Frank Li wrote:
>On Sat, Nov 22, 2025 at 08:58:19AM +0800, Peng Fan (OSS) wrote:
>> From: Peng Fan <peng.fan@nxp.com>
>>
>> i.MX95 features a Cortex-M33 core, six Cortex-A55 cores, and
>> one Cortex-M7 core. The System Control Management Interface(SCMI)
>> firmware runs on the M33 core. The i.MX95 SCMI firmware named System
>> Manager(SM) includes vendor extension protocols, Logical Machine
>> Management(LMM) protocol and CPU protocol and etc.
>>
>> Depending on SM configuration, M7 can be used as follows:
>>  (1) M7 in a separate Logical Machine (LM) from A55 cores, that Linux
>>      can't control
>>  (2) M7 in a separate LM from A55 cores that Linux can control using LMM
>>      protocol.
>>  (3) M7 runs in same Logical Machine as A55 cores, so Linux can control it
>>      using CPU protocol
>>
>> So extend the driver to using LMM and CPU protocol to manage the M7 core.
>>  - Compare linux LM ID(got using scmi_imx_lmm_info) and M7 LM ID(the ID
>>    is fixed as 1 in SM firmware if M7 is in a separate LM),
>>    if Linux LM ID equals M7 LM ID(linux and M7 in same LM), use CPU
>>    protocol to start/stop. Otherwise, use LMM protocol to start/stop.
>>    Whether using CPU or LMM protocol to start/stop, the M7 status
>>    detection could use CPU protocol to detect started or not. So
>>    in imx_rproc_detect_mode, use scmi_imx_cpu_started to check the
>>    status of M7.
>>  - For above case (1) and (2), Use SCMI_IMX_LMM_POWER_ON to detect whether
>>    the M7 LM is under control of A55 LM.
>>  - For above case , after using SCMI_IMX_LMM_POWER_ON to check
>>    permission, SCMI_IMX_LMM_SHUTDOWN API should be called to shutdown
>>    the M7 LM to save power only when M7 LM is going to be started by
>>    remoteproc framework. Otherwise bypass SCMI_IMX_LMM_SHUTDOWN API if
>>    M7 LM is started before booting Linux.
>>
>> Current setup relies on pre-Linux software(U-Boot) to do M7 TCM ECC
>> initialization. In future, we could add the support in Linux to decouple
>> U-Boot and Linux.
>>
>> Signed-off-by: Peng Fan <peng.fan@nxp.com>
>> ---
>>  drivers/remoteproc/Kconfig     |   2 +
>>  drivers/remoteproc/imx_rproc.c | 193 +++++++++++++++++++++++++++++++++++++++++
>>  drivers/remoteproc/imx_rproc.h |   3 +
>>  3 files changed, 198 insertions(+)
>>
>...
>> +
>> +static int imx_rproc_sm_lmm_check(struct rproc *rproc, bool started)
>> +{
>> +	struct imx_rproc *priv = rproc->priv;
>> +	const struct imx_rproc_dcfg *dcfg = priv->dcfg;
>> +	struct device *dev = priv->dev;
>> +	int ret;
>> +
>> +	/*
>> +	 * Use power on to do permission check. If rproc is in different LM,
>> +	 * and linux has permission to handle the LM, set IMX_RPROC_FLAGS_SM_LMM_AVAIL.
>> +	 */
>> +	ret = scmi_imx_lmm_operation(dcfg->lmid, SCMI_IMX_LMM_POWER_ON, 0);
>> +	if (ret != 0) {
>
>if (ret)

Fix in next version.

>
>> +		if (ret == -EACCES) {
>> +			/*
>> +			 * rproc LM is booted before Linux and not under Linux Control, so only
>> +			 * do IPC between RPROC and Linux, not return failure
>> +			 */
>> +			dev_info(dev, "lmm(%d) not under Linux Control\n", dcfg->lmid);
>> +			return 0;
>> +		}
>> +
>> +		dev_err(dev, "power on lmm(%d) failed: %d\n", dcfg->lmid, ret);
>> +		return ret;
>> +	}
>> +
>> +	priv->flags |= IMX_RPROC_FLAGS_SM_LMM_AVAIL;
>> +
>> +	/* rproc was started before boot Linux and under control of Linux, directly return */
>> +	if (started)
>> +		return 0;
>
>should it be before scmi_imx_lmm_operation()? If started, supposed need
>check scmi_imx_lmm_operation()?

No. We need to detect whether M7 is under control of Linux before return.

Thanks,
Peng

>
>Frank
>> +
>> +	/* else shutdown the LM to save power */
>> +	ret = scmi_imx_lmm_operation(dcfg->lmid, SCMI_IMX_LMM_SHUTDOWN, 0);
>> +	if (ret) {
>> +		priv->flags &= ~IMX_RPROC_FLAGS_SM_LMM_AVAIL;
>> +		dev_err(dev, "shutdown lmm(%d) failed: %d\n", dcfg->lmid, ret);
>> +		return ret;
>> +	}
>> +
>> +	return 0;
>> +}
>> +
>...
>>  };
>>
>>  #endif /* _IMX_RPROC_H */
>>
>> --
>> 2.37.1
>>


  reply	other threads:[~2025-11-26  2:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-22  0:58 [PATCH v3 0/5] remoteproc: imx_rproc: Support i.MX95 Peng Fan (OSS)
2025-11-22  0:58 ` [PATCH v3 1/5] dt-bindings: remoteproc: fsl,imx-rproc: Add support for i.MX95 Peng Fan (OSS)
2025-11-22  0:58 ` [PATCH v3 2/5] remoteproc: imx_rproc: Add runtime ops copy to support dynamic behavior Peng Fan (OSS)
2025-11-22  0:58 ` [PATCH v3 3/5] remoteproc: imx_rproc: Introduce prepare ops for imx_rproc_dcfg Peng Fan (OSS)
2025-11-22  0:58 ` [PATCH v3 4/5] remoteproc: imx_rproc: Add support for System Manager API Peng Fan (OSS)
2025-11-24 17:28   ` Frank Li
2025-11-26  2:57     ` Peng Fan [this message]
2025-11-22  0:58 ` [PATCH v3 5/5] remoteproc: imx_rproc: Add support for i.MX95 Peng Fan (OSS)
2025-11-24 15:27 ` [PATCH v3 0/5] remoteproc: imx_rproc: Support i.MX95 Mathieu Poirier

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=aSZsixcVpSeVfwQp@shlinux89 \
    --to=peng.fan@oss.nxp.com \
    --cc=Frank.li@nxp.com \
    --cc=andersson@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=daniel.baluta@nxp.com \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=imx@lists.linux.dev \
    --cc=kernel@pengutronix.de \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    --cc=peng.fan@nxp.com \
    --cc=robh@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).