* [PATCH v3 0/5] remoteproc: imx_rproc: Support i.MX95
@ 2025-06-25 2:23 Peng Fan (OSS)
2025-06-25 2:23 ` [PATCH v3 1/5] dt-bindings: remoteproc: fsl,imx-rproc: Add support for i.MX95 Peng Fan (OSS)
` (6 more replies)
0 siblings, 7 replies; 23+ messages in thread
From: Peng Fan (OSS) @ 2025-06-25 2:23 UTC (permalink / raw)
To: Bjorn Andersson, Mathieu Poirier, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Frank Li, Daniel Baluta,
Iuliana Prodan
Cc: linux-remoteproc, devicetree, imx, linux-arm-kernel, linux-kernel,
Peng Fan
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.
There are three cases for M7:
(1) M7 in a separate Logical Machine(LM) that Linux couldn't control it.
(2) M7 in a separate Logical Machine that Linux could control it using
LMM protocol
(3) M7 runs in same Logical Machine as A55, so Linux could control it
using CPU protocol
In patch 2, Use LMM and CPU protocol to manage M7. More info could be
found in the patch commit log
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.
Patchset was tested with below boot images when the patchset based on next-20250526:
imx-boot-variant-rpmsg-imx95-19x19-lpddr5-evk-sd.bin-flash_lpboot_sm_a55 (Use LMM protocol)
imx-boot-variant-alt-imx95-19x19-lpddr5-evk-sd.bin-flash_alt (Use CPU protocol)
imx-boot-imx95-19x19-lpddr5-evk-sd.bin-flash_a55 (M7 not under A55 control)
imx-boot-imx95-19x19-lpddr5-evk-sd.bin-flash_all (M7 not under A55 control)
Patchset was tested again with rebase on next-20250623
Patchset is re-based on next-20250603.
Thanks for Daniel/Frank helping review the patchset before posting out to list.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
Changes in v3:
- Drop fsl,lmm-id and fsl,cpu-id for binding in patch 1
- Add lmid and cpuid in driver patch 2.
- Add i.MX95 lmid and cpuid in patch 3
- Rebased to linux-next-6-23 and tested with this new rebased version
- Add dtsi/dts patch 4,5 to give people a view on how it is used per Krzysztof
- Daniel's R-b are still kept after talk with Daniel
- Link to v2: https://lore.kernel.org/r/20250606-imx95-rproc-1-v2-0-a2bd64438be9@nxp.com
Changes in v2:
- Typo fix in patch 2 commit message
- Move the m7 address mapping array from patch 2 to patch 3
- Add R-b from Daniel to patch 3
- Link to v1: https://lore.kernel.org/r/20250604-imx95-rproc-1-v1-0-a6e5f512731c@nxp.com
---
Peng Fan (5):
dt-bindings: remoteproc: fsl,imx-rproc: Add support for i.MX95
remoteproc: imx_rproc: Add support for System Manager API
remoteproc: imx_rproc: Add support for i.MX95
arm64: dts: imx95: Add SCMI LMM/CPU nodes
arm64: dts: imx95-19x19-evk: Add CM7 nodes and vdev related memory regions
.../bindings/remoteproc/fsl,imx-rproc.yaml | 1 +
arch/arm64/boot/dts/freescale/imx95-19x19-evk.dts | 45 +++++++
arch/arm64/boot/dts/freescale/imx95.dtsi | 8 ++
drivers/remoteproc/imx_rproc.c | 138 ++++++++++++++++++++-
drivers/remoteproc/imx_rproc.h | 5 +
5 files changed, 195 insertions(+), 2 deletions(-)
---
base-commit: fda740558acb4303fcf377e5cf9139f795b1d85b
change-id: 20250525-imx95-rproc-1-20bb74ddc8af
Best regards,
--
Peng Fan <peng.fan@nxp.com>
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH v3 1/5] dt-bindings: remoteproc: fsl,imx-rproc: Add support for i.MX95
2025-06-25 2:23 [PATCH v3 0/5] remoteproc: imx_rproc: Support i.MX95 Peng Fan (OSS)
@ 2025-06-25 2:23 ` Peng Fan (OSS)
2025-06-26 18:45 ` Frank Li
2025-06-27 7:06 ` Krzysztof Kozlowski
2025-06-25 2:23 ` [PATCH v3 2/5] remoteproc: imx_rproc: Add support for System Manager API Peng Fan (OSS)
` (5 subsequent siblings)
6 siblings, 2 replies; 23+ messages in thread
From: Peng Fan (OSS) @ 2025-06-25 2:23 UTC (permalink / raw)
To: Bjorn Andersson, Mathieu Poirier, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Frank Li, Daniel Baluta,
Iuliana Prodan
Cc: linux-remoteproc, devicetree, imx, linux-arm-kernel, linux-kernel,
Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Add compatible string for the Cortex-M7 core in i.MX95
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml b/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml
index 57d75acb0b5e52ca49d1361176fdebc18a0bf7a2..ce8ec0119469c8fc0979a192b6e3d3a03108d7d2 100644
--- a/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml
+++ b/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml
@@ -28,6 +28,7 @@ properties:
- fsl,imx8qxp-cm4
- fsl,imx8ulp-cm33
- fsl,imx93-cm33
+ - fsl,imx95-cm7
clocks:
maxItems: 1
--
2.37.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v3 2/5] remoteproc: imx_rproc: Add support for System Manager API
2025-06-25 2:23 [PATCH v3 0/5] remoteproc: imx_rproc: Support i.MX95 Peng Fan (OSS)
2025-06-25 2:23 ` [PATCH v3 1/5] dt-bindings: remoteproc: fsl,imx-rproc: Add support for i.MX95 Peng Fan (OSS)
@ 2025-06-25 2:23 ` Peng Fan (OSS)
2025-06-26 18:48 ` Frank Li
2025-07-08 16:32 ` Mathieu Poirier
2025-06-25 2:23 ` [PATCH v3 3/5] remoteproc: imx_rproc: Add support for i.MX95 Peng Fan (OSS)
` (4 subsequent siblings)
6 siblings, 2 replies; 23+ messages in thread
From: Peng Fan (OSS) @ 2025-06-25 2:23 UTC (permalink / raw)
To: Bjorn Andersson, Mathieu Poirier, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Frank Li, Daniel Baluta,
Iuliana Prodan
Cc: linux-remoteproc, devicetree, imx, linux-arm-kernel, linux-kernel,
Peng Fan
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.
There are three cases for M7:
(1) M7 in a separate Logical Machine(LM) that Linux can't control it.
(2) M7 in a separate Logical Machine that Linux can control it using
LMM protocol
(3) M7 runs in same Logical Machine as A55, so Linux can control it
using CPU protocol
So extend the driver to using LMM and CPU protocol to manage the M7 core.
- Add IMX_RPROC_SM to indicate the remote core runs on a SoC that
has System Manager.
- 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 seprate 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.
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.
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/remoteproc/imx_rproc.c | 113 ++++++++++++++++++++++++++++++++++++++++-
drivers/remoteproc/imx_rproc.h | 5 ++
2 files changed, 116 insertions(+), 2 deletions(-)
diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
index 74299af1d7f10a0db794de494c52304b2323b89f..b1a117ca5e5795554b67eb7092db2a25fc7de13b 100644
--- a/drivers/remoteproc/imx_rproc.c
+++ b/drivers/remoteproc/imx_rproc.c
@@ -8,6 +8,7 @@
#include <linux/clk.h>
#include <linux/err.h>
#include <linux/firmware/imx/sci.h>
+#include <linux/firmware/imx/sm.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/mailbox_client.h>
@@ -21,6 +22,7 @@
#include <linux/reboot.h>
#include <linux/regmap.h>
#include <linux/remoteproc.h>
+#include <linux/scmi_imx_protocol.h>
#include <linux/workqueue.h>
#include "imx_rproc.h"
@@ -91,6 +93,11 @@ struct imx_rproc_mem {
#define ATT_CORE_MASK 0xffff
#define ATT_CORE(I) BIT((I))
+/* Logical Machine Operation */
+#define IMX_RPROC_FLAGS_SM_LMM_OP BIT(0)
+/* Linux has permission to handle the Logical Machine of remote cores */
+#define IMX_RPROC_FLAGS_SM_LMM_AVAIL BIT(1)
+
static int imx_rproc_xtr_mbox_init(struct rproc *rproc, bool tx_block);
static void imx_rproc_free_mbox(struct rproc *rproc);
@@ -115,6 +122,8 @@ struct imx_rproc {
u32 entry; /* cpu start address */
u32 core_index;
struct dev_pm_domain_list *pd_list;
+ /* For i.MX System Manager based systems */
+ u32 flags;
};
static const struct imx_rproc_att imx_rproc_att_imx93[] = {
@@ -393,6 +402,30 @@ static int imx_rproc_start(struct rproc *rproc)
case IMX_RPROC_SCU_API:
ret = imx_sc_pm_cpu_start(priv->ipc_handle, priv->rsrc_id, true, priv->entry);
break;
+ case IMX_RPROC_SM:
+ if (priv->flags & IMX_RPROC_FLAGS_SM_LMM_OP) {
+ if (!(priv->flags & IMX_RPROC_FLAGS_SM_LMM_AVAIL))
+ return -EACCES;
+
+ ret = scmi_imx_lmm_reset_vector_set(dcfg->lmid, dcfg->cpuid, 0, 0);
+ if (ret) {
+ dev_err(dev, "Failed to set reset vector lmid(%u), cpuid(%u): %d\n",
+ dcfg->lmid, dcfg->cpuid, ret);
+ }
+
+ ret = scmi_imx_lmm_operation(dcfg->lmid, SCMI_IMX_LMM_BOOT, 0);
+ if (ret)
+ dev_err(dev, "Failed to boot lmm(%d): %d\n", ret, dcfg->lmid);
+ } else {
+ ret = scmi_imx_cpu_reset_vector_set(dcfg->cpuid, 0, true, false, false);
+ if (ret) {
+ dev_err(dev, "Failed to set reset vector cpuid(%u): %d\n",
+ dcfg->cpuid, ret);
+ }
+
+ ret = scmi_imx_cpu_start(dcfg->cpuid, true);
+ }
+ break;
default:
return -EOPNOTSUPP;
}
@@ -435,6 +468,16 @@ static int imx_rproc_stop(struct rproc *rproc)
case IMX_RPROC_SCU_API:
ret = imx_sc_pm_cpu_start(priv->ipc_handle, priv->rsrc_id, false, priv->entry);
break;
+ case IMX_RPROC_SM:
+ if (priv->flags & IMX_RPROC_FLAGS_SM_LMM_OP) {
+ if (priv->flags & IMX_RPROC_FLAGS_SM_LMM_AVAIL)
+ ret = scmi_imx_lmm_operation(dcfg->lmid, SCMI_IMX_LMM_SHUTDOWN, 0);
+ else
+ ret = -EACCES;
+ } else {
+ ret = scmi_imx_cpu_start(dcfg->cpuid, false);
+ }
+ break;
default:
return -EOPNOTSUPP;
}
@@ -549,9 +592,11 @@ static int imx_rproc_prepare(struct rproc *rproc)
{
struct imx_rproc *priv = rproc->priv;
struct device_node *np = priv->dev->of_node;
+ const struct imx_rproc_dcfg *dcfg = priv->dcfg;
struct of_phandle_iterator it;
struct rproc_mem_entry *mem;
struct reserved_mem *rmem;
+ int ret;
u32 da;
/* Register associated reserved memory regions */
@@ -592,6 +637,38 @@ static int imx_rproc_prepare(struct rproc *rproc)
rproc_add_carveout(rproc, mem);
}
+ switch (dcfg->method) {
+ case IMX_RPROC_SM:
+ if (!(priv->flags & IMX_RPROC_FLAGS_SM_LMM_OP))
+ break;
+ /*
+ * Power on the Logical Machine to make sure TCM is available.
+ * Also serve as permission check. If in different Logical
+ * Machine, and linux has permission to handle the Logical
+ * Machine, set IMX_RPROC_FLAGS_SM_LMM_AVAIL.
+ */
+ ret = scmi_imx_lmm_operation(dcfg->lmid, SCMI_IMX_LMM_POWER_ON, 0);
+ if (ret == 0) {
+ dev_info(priv->dev, "lmm(%d) powered on\n", dcfg->lmid);
+ priv->flags |= IMX_RPROC_FLAGS_SM_LMM_AVAIL;
+ } else if (ret == -EACCES) {
+ dev_info(priv->dev, "lmm(%d) not under Linux Control\n", dcfg->lmid);
+ /*
+ * If remote cores boots up in detached mode, continue;
+ * else linux has no permission, return -EACCES.
+ */
+ if (priv->rproc->state != RPROC_DETACHED)
+ return -EACCES;
+ } else if (ret) {
+ dev_err(priv->dev, "Failed to power on lmm(%d): %d\n", ret, dcfg->lmid);
+ return ret;
+ }
+
+ break;
+ default:
+ break;
+ };
+
return 0;
}
@@ -911,13 +988,41 @@ static int imx_rproc_detect_mode(struct imx_rproc *priv)
struct regmap_config config = { .name = "imx-rproc" };
const struct imx_rproc_dcfg *dcfg = priv->dcfg;
struct device *dev = priv->dev;
+ struct scmi_imx_lmm_info info;
struct regmap *regmap;
struct arm_smccc_res res;
+ bool started = false;
int ret;
u32 val;
u8 pt;
switch (dcfg->method) {
+ case IMX_RPROC_SM:
+ /* Get current Linux Logical Machine ID */
+ ret = scmi_imx_lmm_info(LMM_ID_DISCOVER, &info);
+ if (ret) {
+ dev_err(dev, "Failed to get current LMM ID err: %d\n", ret);
+ return ret;
+ }
+
+ /*
+ * Check whether remote processor is in same Logical Machine as Linux.
+ * If no, need use Logical Machine API to manage remote processor, and
+ * set IMX_RPROC_FLAGS_SM_LMM_OP.
+ * If yes, use CPU protocol API to manage remote processor.
+ */
+ if (dcfg->lmid != info.lmid) {
+ priv->flags |= IMX_RPROC_FLAGS_SM_LMM_OP;
+ dev_info(dev, "Using LMM Protocol OPS\n");
+ } else {
+ dev_info(dev, "Using CPU Protocol OPS\n");
+ }
+
+ scmi_imx_cpu_started(dcfg->cpuid, &started);
+ if (started)
+ priv->rproc->state = RPROC_DETACHED;
+
+ return 0;
case IMX_RPROC_NONE:
priv->rproc->state = RPROC_DETACHED;
return 0;
@@ -1029,8 +1134,12 @@ static int imx_rproc_clk_enable(struct imx_rproc *priv)
struct device *dev = priv->dev;
int ret;
- /* Remote core is not under control of Linux */
- if (dcfg->method == IMX_RPROC_NONE)
+ /*
+ * IMX_RPROC_NONE indicates not under control of Linux.
+ * System Manager(SM) firmware automatically configures clock,
+ * so bypass the clk settings for IMX_RPROC_SM.
+ */
+ if (dcfg->method == IMX_RPROC_NONE || dcfg->method == IMX_RPROC_SM)
return 0;
priv->clk = devm_clk_get(dev, NULL);
diff --git a/drivers/remoteproc/imx_rproc.h b/drivers/remoteproc/imx_rproc.h
index cfd38d37e1467d1d9e6f89be146c0b53262b92a0..6fe8d975ed302967f27b7a4319a899e6f0822976 100644
--- a/drivers/remoteproc/imx_rproc.h
+++ b/drivers/remoteproc/imx_rproc.h
@@ -26,6 +26,8 @@ enum imx_rproc_method {
IMX_RPROC_SCU_API,
/* Through Reset Controller API */
IMX_RPROC_RESET_CONTROLLER,
+ /* Through System Manager */
+ IMX_RPROC_SM,
};
/* dcfg flags */
@@ -42,6 +44,9 @@ struct imx_rproc_dcfg {
size_t att_size;
enum imx_rproc_method method;
u32 flags;
+ /* For System Manager(SM) based SoCs, the IDs are from SM firmware */
+ u32 cpuid;
+ u32 lmid;
};
#endif /* _IMX_RPROC_H */
--
2.37.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v3 3/5] remoteproc: imx_rproc: Add support for i.MX95
2025-06-25 2:23 [PATCH v3 0/5] remoteproc: imx_rproc: Support i.MX95 Peng Fan (OSS)
2025-06-25 2:23 ` [PATCH v3 1/5] dt-bindings: remoteproc: fsl,imx-rproc: Add support for i.MX95 Peng Fan (OSS)
2025-06-25 2:23 ` [PATCH v3 2/5] remoteproc: imx_rproc: Add support for System Manager API Peng Fan (OSS)
@ 2025-06-25 2:23 ` Peng Fan (OSS)
2025-06-26 18:50 ` Frank Li
2025-07-08 16:39 ` Mathieu Poirier
2025-06-25 2:23 ` [PATCH v3 4/5] arm64: dts: imx95: Add SCMI LMM/CPU nodes Peng Fan (OSS)
` (3 subsequent siblings)
6 siblings, 2 replies; 23+ messages in thread
From: Peng Fan (OSS) @ 2025-06-25 2:23 UTC (permalink / raw)
To: Bjorn Andersson, Mathieu Poirier, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Frank Li, Daniel Baluta,
Iuliana Prodan
Cc: linux-remoteproc, devicetree, imx, linux-arm-kernel, linux-kernel,
Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Add imx_rproc_cfg_imx95_m7 and address(TCM and DDR) mapping.
Add i.MX95 of_device_id entry.
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/remoteproc/imx_rproc.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
index b1a117ca5e5795554b67eb7092db2a25fc7de13b..c226f78c84ad180c69804116d6cfcab19db6aaa5 100644
--- a/drivers/remoteproc/imx_rproc.c
+++ b/drivers/remoteproc/imx_rproc.c
@@ -73,6 +73,10 @@
#define IMX_SC_IRQ_GROUP_REBOOTED 5
+/* Must align with System Manager Firmware */
+#define IMX95_M7_CPUID 1
+#define IMX95_M7_LMID 1
+
/**
* struct imx_rproc_mem - slim internal memory structure
* @cpu_addr: MPU virtual address of the memory region
@@ -126,6 +130,18 @@ struct imx_rproc {
u32 flags;
};
+static const struct imx_rproc_att imx_rproc_att_imx95_m7[] = {
+ /* dev addr , sys addr , size , flags */
+ /* TCM CODE NON-SECURE */
+ { 0x00000000, 0x203C0000, 0x00040000, ATT_OWN | ATT_IOMEM },
+
+ /* TCM SYS NON-SECURE*/
+ { 0x20000000, 0x20400000, 0x00040000, ATT_OWN | ATT_IOMEM },
+
+ /* DDR */
+ { 0x80000000, 0x80000000, 0x50000000, 0 },
+};
+
static const struct imx_rproc_att imx_rproc_att_imx93[] = {
/* dev addr , sys addr , size , flags */
/* TCM CODE NON-SECURE */
@@ -372,6 +388,14 @@ static const struct imx_rproc_dcfg imx_rproc_cfg_imx93 = {
.method = IMX_RPROC_SMC,
};
+static const struct imx_rproc_dcfg imx_rproc_cfg_imx95_m7 = {
+ .att = imx_rproc_att_imx95_m7,
+ .att_size = ARRAY_SIZE(imx_rproc_att_imx95_m7),
+ .method = IMX_RPROC_SM,
+ .cpuid = IMX95_M7_CPUID,
+ .lmid = IMX95_M7_LMID,
+};
+
static int imx_rproc_start(struct rproc *rproc)
{
struct imx_rproc *priv = rproc->priv;
@@ -1301,6 +1325,7 @@ static const struct of_device_id imx_rproc_of_match[] = {
{ .compatible = "fsl,imx8qm-cm4", .data = &imx_rproc_cfg_imx8qm },
{ .compatible = "fsl,imx8ulp-cm33", .data = &imx_rproc_cfg_imx8ulp },
{ .compatible = "fsl,imx93-cm33", .data = &imx_rproc_cfg_imx93 },
+ { .compatible = "fsl,imx95-cm7", .data = &imx_rproc_cfg_imx95_m7 },
{},
};
MODULE_DEVICE_TABLE(of, imx_rproc_of_match);
--
2.37.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v3 4/5] arm64: dts: imx95: Add SCMI LMM/CPU nodes
2025-06-25 2:23 [PATCH v3 0/5] remoteproc: imx_rproc: Support i.MX95 Peng Fan (OSS)
` (2 preceding siblings ...)
2025-06-25 2:23 ` [PATCH v3 3/5] remoteproc: imx_rproc: Add support for i.MX95 Peng Fan (OSS)
@ 2025-06-25 2:23 ` Peng Fan (OSS)
2025-06-26 18:50 ` Frank Li
2025-06-25 2:23 ` [PATCH v3 5/5] arm64: dts: imx95-19x19-evk: Add CM7 nodes and vdev related memory regions Peng Fan (OSS)
` (2 subsequent siblings)
6 siblings, 1 reply; 23+ messages in thread
From: Peng Fan (OSS) @ 2025-06-25 2:23 UTC (permalink / raw)
To: Bjorn Andersson, Mathieu Poirier, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Frank Li, Daniel Baluta,
Iuliana Prodan
Cc: linux-remoteproc, devicetree, imx, linux-arm-kernel, linux-kernel,
Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Add SCMI LMM/CPU nodes which is for remoteproc to handle remote cores.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
arch/arm64/boot/dts/freescale/imx95.dtsi | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/arch/arm64/boot/dts/freescale/imx95.dtsi b/arch/arm64/boot/dts/freescale/imx95.dtsi
index f142c743f786fb5dbd67f8e52c8061bd2815a492..45b5408cbccc1e17240839c3c0c81ac3399a44e3 100644
--- a/arch/arm64/boot/dts/freescale/imx95.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx95.dtsi
@@ -350,10 +350,18 @@ scmi_iomuxc: protocol@19 {
reg = <0x19>;
};
+ scmi_lmm: protocol@80 {
+ reg = <0x80>;
+ };
+
scmi_bbm: protocol@81 {
reg = <0x81>;
};
+ scmi_cpu: protocol@82 {
+ reg = <0x82>;
+ };
+
scmi_misc: protocol@84 {
reg = <0x84>;
};
--
2.37.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v3 5/5] arm64: dts: imx95-19x19-evk: Add CM7 nodes and vdev related memory regions
2025-06-25 2:23 [PATCH v3 0/5] remoteproc: imx_rproc: Support i.MX95 Peng Fan (OSS)
` (3 preceding siblings ...)
2025-06-25 2:23 ` [PATCH v3 4/5] arm64: dts: imx95: Add SCMI LMM/CPU nodes Peng Fan (OSS)
@ 2025-06-25 2:23 ` Peng Fan (OSS)
2025-06-26 18:52 ` Frank Li
2025-06-25 20:25 ` [PATCH v3 0/5] remoteproc: imx_rproc: Support i.MX95 Rob Herring (Arm)
2025-07-03 5:01 ` Peng Fan
6 siblings, 1 reply; 23+ messages in thread
From: Peng Fan (OSS) @ 2025-06-25 2:23 UTC (permalink / raw)
To: Bjorn Andersson, Mathieu Poirier, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Frank Li, Daniel Baluta,
Iuliana Prodan
Cc: linux-remoteproc, devicetree, imx, linux-arm-kernel, linux-kernel,
Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Add CM7 nodes, vdev related memory regions for remoteproc.
Enable MU7.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
arch/arm64/boot/dts/freescale/imx95-19x19-evk.dts | 45 +++++++++++++++++++++++
1 file changed, 45 insertions(+)
diff --git a/arch/arm64/boot/dts/freescale/imx95-19x19-evk.dts b/arch/arm64/boot/dts/freescale/imx95-19x19-evk.dts
index 6886ea7666550605d6c2aa3d81ff270164e5796f..70f000b1c4032a449cbf9ceb746c16c9f3062a61 100644
--- a/arch/arm64/boot/dts/freescale/imx95-19x19-evk.dts
+++ b/arch/arm64/boot/dts/freescale/imx95-19x19-evk.dts
@@ -75,6 +75,37 @@ linux_cma: linux,cma {
linux,cma-default;
reusable;
};
+
+ vdev0vring0: memory@88000000 {
+ reg = <0 0x88000000 0 0x8000>;
+ no-map;
+ };
+
+ vdev0vring1: memory@88008000 {
+ reg = <0 0x88008000 0 0x8000>;
+ no-map;
+ };
+
+ vdev1vring0: memory@88010000 {
+ reg = <0 0x88010000 0 0x8000>;
+ no-map;
+ };
+
+ vdev1vring1: memory@88018000 {
+ reg = <0 0x88018000 0 0x8000>;
+ no-map;
+ };
+
+ rsc_table: memory@88220000 {
+ reg = <0 0x88220000 0 0x1000>;
+ no-map;
+ };
+
+ vdevbuffer: memory@88020000 {
+ compatible = "shared-dma-pool";
+ reg = <0 0x88020000 0 0x100000>;
+ no-map;
+ };
};
reg_3p3v: regulator-3p3v {
@@ -202,6 +233,20 @@ sound-wm8962 {
"IN3R", "AMIC",
"IN1R", "AMIC";
};
+
+ remoteproc-cm7 {
+ compatible = "fsl,imx95-cm7";
+ mbox-names = "tx", "rx", "rxdb";
+ mboxes = <&mu7 0 1>,
+ <&mu7 1 1>,
+ <&mu7 3 1>;
+ memory-region = <&vdevbuffer>, <&vdev0vring0>, <&vdev0vring1>,
+ <&vdev1vring0>, <&vdev1vring1>, <&rsc_table>;
+ };
+};
+
+&mu7 {
+ status = "okay";
};
&enetc_port0 {
--
2.37.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* Re: [PATCH v3 0/5] remoteproc: imx_rproc: Support i.MX95
2025-06-25 2:23 [PATCH v3 0/5] remoteproc: imx_rproc: Support i.MX95 Peng Fan (OSS)
` (4 preceding siblings ...)
2025-06-25 2:23 ` [PATCH v3 5/5] arm64: dts: imx95-19x19-evk: Add CM7 nodes and vdev related memory regions Peng Fan (OSS)
@ 2025-06-25 20:25 ` Rob Herring (Arm)
2025-06-26 3:56 ` Peng Fan
2025-07-03 5:01 ` Peng Fan
6 siblings, 1 reply; 23+ messages in thread
From: Rob Herring (Arm) @ 2025-06-25 20:25 UTC (permalink / raw)
To: Peng Fan (OSS)
Cc: Conor Dooley, Shawn Guo, Peng Fan, Bjorn Andersson, devicetree,
linux-remoteproc, Frank Li, Sascha Hauer, Mathieu Poirier,
linux-kernel, imx, Iuliana Prodan, linux-arm-kernel,
Daniel Baluta, Fabio Estevam, Pengutronix Kernel Team,
Krzysztof Kozlowski
On Wed, 25 Jun 2025 10:23:26 +0800, Peng Fan (OSS) wrote:
> 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.
>
> There are three cases for M7:
> (1) M7 in a separate Logical Machine(LM) that Linux couldn't control it.
> (2) M7 in a separate Logical Machine that Linux could control it using
> LMM protocol
> (3) M7 runs in same Logical Machine as A55, so Linux could control it
> using CPU protocol
>
> In patch 2, Use LMM and CPU protocol to manage M7. More info could be
> found in the patch commit log
>
> 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.
>
> Patchset was tested with below boot images when the patchset based on next-20250526:
> imx-boot-variant-rpmsg-imx95-19x19-lpddr5-evk-sd.bin-flash_lpboot_sm_a55 (Use LMM protocol)
> imx-boot-variant-alt-imx95-19x19-lpddr5-evk-sd.bin-flash_alt (Use CPU protocol)
> imx-boot-imx95-19x19-lpddr5-evk-sd.bin-flash_a55 (M7 not under A55 control)
> imx-boot-imx95-19x19-lpddr5-evk-sd.bin-flash_all (M7 not under A55 control)
>
> Patchset was tested again with rebase on next-20250623
>
> Patchset is re-based on next-20250603.
>
> Thanks for Daniel/Frank helping review the patchset before posting out to list.
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
> Changes in v3:
> - Drop fsl,lmm-id and fsl,cpu-id for binding in patch 1
> - Add lmid and cpuid in driver patch 2.
> - Add i.MX95 lmid and cpuid in patch 3
> - Rebased to linux-next-6-23 and tested with this new rebased version
> - Add dtsi/dts patch 4,5 to give people a view on how it is used per Krzysztof
> - Daniel's R-b are still kept after talk with Daniel
> - Link to v2: https://lore.kernel.org/r/20250606-imx95-rproc-1-v2-0-a2bd64438be9@nxp.com
>
> Changes in v2:
> - Typo fix in patch 2 commit message
> - Move the m7 address mapping array from patch 2 to patch 3
> - Add R-b from Daniel to patch 3
> - Link to v1: https://lore.kernel.org/r/20250604-imx95-rproc-1-v1-0-a6e5f512731c@nxp.com
>
> ---
> Peng Fan (5):
> dt-bindings: remoteproc: fsl,imx-rproc: Add support for i.MX95
> remoteproc: imx_rproc: Add support for System Manager API
> remoteproc: imx_rproc: Add support for i.MX95
> arm64: dts: imx95: Add SCMI LMM/CPU nodes
> arm64: dts: imx95-19x19-evk: Add CM7 nodes and vdev related memory regions
>
> .../bindings/remoteproc/fsl,imx-rproc.yaml | 1 +
> arch/arm64/boot/dts/freescale/imx95-19x19-evk.dts | 45 +++++++
> arch/arm64/boot/dts/freescale/imx95.dtsi | 8 ++
> drivers/remoteproc/imx_rproc.c | 138 ++++++++++++++++++++-
> drivers/remoteproc/imx_rproc.h | 5 +
> 5 files changed, 195 insertions(+), 2 deletions(-)
> ---
> base-commit: fda740558acb4303fcf377e5cf9139f795b1d85b
> change-id: 20250525-imx95-rproc-1-20bb74ddc8af
>
> Best regards,
> --
> Peng Fan <peng.fan@nxp.com>
>
>
>
My bot found new DTB warnings on the .dts files added or changed in this
series.
Some warnings may be from an existing SoC .dtsi. Or perhaps the warnings
are fixed by another series. Ultimately, it is up to the platform
maintainer whether these warnings are acceptable or not. No need to reply
unless the platform maintainer has comments.
If you already ran DT checks and didn't see these error(s), then
make sure dt-schema is up to date:
pip3 install dtschema --upgrade
This patch series was applied (using b4) to base:
Base: base-commit fda740558acb4303fcf377e5cf9139f795b1d85b not known, ignoring
Base: attempting to guess base-commit...
Base: tags/next-20250625 (exact match)
If this is not the correct base, please add 'base-commit' tag
(or use b4 which does this automatically)
New warnings running 'make CHECK_DTBS=y for arch/arm64/boot/dts/freescale/' for 20250625-imx95-rproc-1-v3-0-699031f5926d@nxp.com:
arch/arm64/boot/dts/freescale/imx95-tqma9596sa-mb-smarc-2.dtb: scmi (arm,scmi): Unevaluated properties are not allowed ('protocol@80', 'protocol@81', 'protocol@82', 'protocol@84' were unexpected)
from schema $id: http://devicetree.org/schemas/firmware/arm,scmi.yaml#
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v3 0/5] remoteproc: imx_rproc: Support i.MX95
2025-06-25 20:25 ` [PATCH v3 0/5] remoteproc: imx_rproc: Support i.MX95 Rob Herring (Arm)
@ 2025-06-26 3:56 ` Peng Fan
0 siblings, 0 replies; 23+ messages in thread
From: Peng Fan @ 2025-06-26 3:56 UTC (permalink / raw)
To: Rob Herring (Arm)
Cc: Conor Dooley, Shawn Guo, Peng Fan, Bjorn Andersson, devicetree,
linux-remoteproc, Frank Li, Sascha Hauer, Mathieu Poirier,
linux-kernel, imx, Iuliana Prodan, linux-arm-kernel,
Daniel Baluta, Fabio Estevam, Pengutronix Kernel Team,
Krzysztof Kozlowski
Hi Rob,
On Wed, Jun 25, 2025 at 03:25:18PM -0500, Rob Herring (Arm) wrote:
>
>On Wed, 25 Jun 2025 10:23:26 +0800, Peng Fan (OSS) wrote:
>> 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.
>>
>> There are three cases for M7:
>> (1) M7 in a separate Logical Machine(LM) that Linux couldn't control it.
>> (2) M7 in a separate Logical Machine that Linux could control it using
>> LMM protocol
>> (3) M7 runs in same Logical Machine as A55, so Linux could control it
>> using CPU protocol
>>
>> In patch 2, Use LMM and CPU protocol to manage M7. More info could be
>> found in the patch commit log
>>
>> 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.
>>
>> Patchset was tested with below boot images when the patchset based on next-20250526:
>> imx-boot-variant-rpmsg-imx95-19x19-lpddr5-evk-sd.bin-flash_lpboot_sm_a55 (Use LMM protocol)
>> imx-boot-variant-alt-imx95-19x19-lpddr5-evk-sd.bin-flash_alt (Use CPU protocol)
>> imx-boot-imx95-19x19-lpddr5-evk-sd.bin-flash_a55 (M7 not under A55 control)
>> imx-boot-imx95-19x19-lpddr5-evk-sd.bin-flash_all (M7 not under A55 control)
>>
>> Patchset was tested again with rebase on next-20250623
>>
>> Patchset is re-based on next-20250603.
>>
>> Thanks for Daniel/Frank helping review the patchset before posting out to list.
>>
>> Signed-off-by: Peng Fan <peng.fan@nxp.com>
>> ---
>> Changes in v3:
>> - Drop fsl,lmm-id and fsl,cpu-id for binding in patch 1
>> - Add lmid and cpuid in driver patch 2.
>> - Add i.MX95 lmid and cpuid in patch 3
>> - Rebased to linux-next-6-23 and tested with this new rebased version
>> - Add dtsi/dts patch 4,5 to give people a view on how it is used per Krzysztof
>> - Daniel's R-b are still kept after talk with Daniel
>> - Link to v2: https://lore.kernel.org/r/20250606-imx95-rproc-1-v2-0-a2bd64438be9@nxp.com
>>
>> Changes in v2:
>> - Typo fix in patch 2 commit message
>> - Move the m7 address mapping array from patch 2 to patch 3
>> - Add R-b from Daniel to patch 3
>> - Link to v1: https://lore.kernel.org/r/20250604-imx95-rproc-1-v1-0-a6e5f512731c@nxp.com
>>
>> ---
>> Peng Fan (5):
>> dt-bindings: remoteproc: fsl,imx-rproc: Add support for i.MX95
>> remoteproc: imx_rproc: Add support for System Manager API
>> remoteproc: imx_rproc: Add support for i.MX95
>> arm64: dts: imx95: Add SCMI LMM/CPU nodes
>> arm64: dts: imx95-19x19-evk: Add CM7 nodes and vdev related memory regions
>>
>> .../bindings/remoteproc/fsl,imx-rproc.yaml | 1 +
>> arch/arm64/boot/dts/freescale/imx95-19x19-evk.dts | 45 +++++++
>> arch/arm64/boot/dts/freescale/imx95.dtsi | 8 ++
>> drivers/remoteproc/imx_rproc.c | 138 ++++++++++++++++++++-
>> drivers/remoteproc/imx_rproc.h | 5 +
>> 5 files changed, 195 insertions(+), 2 deletions(-)
>> ---
>> base-commit: fda740558acb4303fcf377e5cf9139f795b1d85b
>> change-id: 20250525-imx95-rproc-1-20bb74ddc8af
>>
>> Best regards,
>> --
>> Peng Fan <peng.fan@nxp.com>
>>
>>
>>
>
>
>My bot found new DTB warnings on the .dts files added or changed in this
>series.
>
>Some warnings may be from an existing SoC .dtsi. Or perhaps the warnings
>are fixed by another series. Ultimately, it is up to the platform
>maintainer whether these warnings are acceptable or not. No need to reply
>unless the platform maintainer has comments.
>
>If you already ran DT checks and didn't see these error(s), then
>make sure dt-schema is up to date:
>
> pip3 install dtschema --upgrade
>
>
>This patch series was applied (using b4) to base:
> Base: base-commit fda740558acb4303fcf377e5cf9139f795b1d85b not known, ignoring
> Base: attempting to guess base-commit...
> Base: tags/next-20250625 (exact match)
>
>If this is not the correct base, please add 'base-commit' tag
>(or use b4 which does this automatically)
>
>New warnings running 'make CHECK_DTBS=y for arch/arm64/boot/dts/freescale/' for 20250625-imx95-rproc-1-v3-0-699031f5926d@nxp.com:
>
>arch/arm64/boot/dts/freescale/imx95-tqma9596sa-mb-smarc-2.dtb: scmi (arm,scmi): Unevaluated properties are not allowed ('protocol@80', 'protocol@81', 'protocol@82', 'protocol@84' were unexpected)
> from schema $id: http://devicetree.org/schemas/firmware/arm,scmi.yaml#
This is because [1] is still not picked, not because of my patchset.
[1]https://lore.kernel.org/imx/20250513-whimsical-almond-quoll-e3ad5b@sudeepholla/
Thanks,
Peng
>
>
>
>
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v3 1/5] dt-bindings: remoteproc: fsl,imx-rproc: Add support for i.MX95
2025-06-25 2:23 ` [PATCH v3 1/5] dt-bindings: remoteproc: fsl,imx-rproc: Add support for i.MX95 Peng Fan (OSS)
@ 2025-06-26 18:45 ` Frank Li
2025-06-27 7:06 ` Krzysztof Kozlowski
1 sibling, 0 replies; 23+ messages in thread
From: Frank Li @ 2025-06-26 18:45 UTC (permalink / raw)
To: Peng Fan (OSS)
Cc: Bjorn Andersson, Mathieu Poirier, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Daniel Baluta,
Iuliana Prodan, linux-remoteproc, devicetree, imx,
linux-arm-kernel, linux-kernel, Peng Fan
On Wed, Jun 25, 2025 at 10:23:27AM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.com>
>
> Add compatible string for the Cortex-M7 core in i.MX95
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> ---
> Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml b/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml
> index 57d75acb0b5e52ca49d1361176fdebc18a0bf7a2..ce8ec0119469c8fc0979a192b6e3d3a03108d7d2 100644
> --- a/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml
> +++ b/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml
> @@ -28,6 +28,7 @@ properties:
> - fsl,imx8qxp-cm4
> - fsl,imx8ulp-cm33
> - fsl,imx93-cm33
> + - fsl,imx95-cm7
>
> clocks:
> maxItems: 1
>
> --
> 2.37.1
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v3 2/5] remoteproc: imx_rproc: Add support for System Manager API
2025-06-25 2:23 ` [PATCH v3 2/5] remoteproc: imx_rproc: Add support for System Manager API Peng Fan (OSS)
@ 2025-06-26 18:48 ` Frank Li
2025-07-08 16:32 ` Mathieu Poirier
1 sibling, 0 replies; 23+ messages in thread
From: Frank Li @ 2025-06-26 18:48 UTC (permalink / raw)
To: Peng Fan (OSS)
Cc: Bjorn Andersson, Mathieu Poirier, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Daniel Baluta,
Iuliana Prodan, linux-remoteproc, devicetree, imx,
linux-arm-kernel, linux-kernel, Peng Fan
On Wed, Jun 25, 2025 at 10:23:28AM +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.
>
> There are three cases for M7:
> (1) M7 in a separate Logical Machine(LM) that Linux can't control it.
> (2) M7 in a separate Logical Machine that Linux can control it using
> LMM protocol
> (3) M7 runs in same Logical Machine as A55, so Linux can control it
> using CPU protocol
>
> So extend the driver to using LMM and CPU protocol to manage the M7 core.
> - Add IMX_RPROC_SM to indicate the remote core runs on a SoC that
> has System Manager.
> - 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 seprate 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.
>
> 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.
>
> Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> drivers/remoteproc/imx_rproc.c | 113 ++++++++++++++++++++++++++++++++++++++++-
> drivers/remoteproc/imx_rproc.h | 5 ++
> 2 files changed, 116 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
> index 74299af1d7f10a0db794de494c52304b2323b89f..b1a117ca5e5795554b67eb7092db2a25fc7de13b 100644
> --- a/drivers/remoteproc/imx_rproc.c
> +++ b/drivers/remoteproc/imx_rproc.c
> @@ -8,6 +8,7 @@
> #include <linux/clk.h>
> #include <linux/err.h>
> #include <linux/firmware/imx/sci.h>
> +#include <linux/firmware/imx/sm.h>
> #include <linux/interrupt.h>
> #include <linux/kernel.h>
> #include <linux/mailbox_client.h>
> @@ -21,6 +22,7 @@
> #include <linux/reboot.h>
> #include <linux/regmap.h>
> #include <linux/remoteproc.h>
> +#include <linux/scmi_imx_protocol.h>
> #include <linux/workqueue.h>
>
> #include "imx_rproc.h"
> @@ -91,6 +93,11 @@ struct imx_rproc_mem {
> #define ATT_CORE_MASK 0xffff
> #define ATT_CORE(I) BIT((I))
>
> +/* Logical Machine Operation */
> +#define IMX_RPROC_FLAGS_SM_LMM_OP BIT(0)
> +/* Linux has permission to handle the Logical Machine of remote cores */
> +#define IMX_RPROC_FLAGS_SM_LMM_AVAIL BIT(1)
> +
> static int imx_rproc_xtr_mbox_init(struct rproc *rproc, bool tx_block);
> static void imx_rproc_free_mbox(struct rproc *rproc);
>
> @@ -115,6 +122,8 @@ struct imx_rproc {
> u32 entry; /* cpu start address */
> u32 core_index;
> struct dev_pm_domain_list *pd_list;
> + /* For i.MX System Manager based systems */
> + u32 flags;
> };
>
> static const struct imx_rproc_att imx_rproc_att_imx93[] = {
> @@ -393,6 +402,30 @@ static int imx_rproc_start(struct rproc *rproc)
> case IMX_RPROC_SCU_API:
> ret = imx_sc_pm_cpu_start(priv->ipc_handle, priv->rsrc_id, true, priv->entry);
> break;
> + case IMX_RPROC_SM:
> + if (priv->flags & IMX_RPROC_FLAGS_SM_LMM_OP) {
> + if (!(priv->flags & IMX_RPROC_FLAGS_SM_LMM_AVAIL))
> + return -EACCES;
> +
> + ret = scmi_imx_lmm_reset_vector_set(dcfg->lmid, dcfg->cpuid, 0, 0);
> + if (ret) {
> + dev_err(dev, "Failed to set reset vector lmid(%u), cpuid(%u): %d\n",
> + dcfg->lmid, dcfg->cpuid, ret);
> + }
> +
> + ret = scmi_imx_lmm_operation(dcfg->lmid, SCMI_IMX_LMM_BOOT, 0);
> + if (ret)
> + dev_err(dev, "Failed to boot lmm(%d): %d\n", ret, dcfg->lmid);
> + } else {
> + ret = scmi_imx_cpu_reset_vector_set(dcfg->cpuid, 0, true, false, false);
> + if (ret) {
> + dev_err(dev, "Failed to set reset vector cpuid(%u): %d\n",
> + dcfg->cpuid, ret);
> + }
> +
> + ret = scmi_imx_cpu_start(dcfg->cpuid, true);
> + }
> + break;
> default:
> return -EOPNOTSUPP;
> }
> @@ -435,6 +468,16 @@ static int imx_rproc_stop(struct rproc *rproc)
> case IMX_RPROC_SCU_API:
> ret = imx_sc_pm_cpu_start(priv->ipc_handle, priv->rsrc_id, false, priv->entry);
> break;
> + case IMX_RPROC_SM:
> + if (priv->flags & IMX_RPROC_FLAGS_SM_LMM_OP) {
> + if (priv->flags & IMX_RPROC_FLAGS_SM_LMM_AVAIL)
> + ret = scmi_imx_lmm_operation(dcfg->lmid, SCMI_IMX_LMM_SHUTDOWN, 0);
> + else
> + ret = -EACCES;
> + } else {
> + ret = scmi_imx_cpu_start(dcfg->cpuid, false);
> + }
> + break;
> default:
> return -EOPNOTSUPP;
> }
> @@ -549,9 +592,11 @@ static int imx_rproc_prepare(struct rproc *rproc)
> {
> struct imx_rproc *priv = rproc->priv;
> struct device_node *np = priv->dev->of_node;
> + const struct imx_rproc_dcfg *dcfg = priv->dcfg;
> struct of_phandle_iterator it;
> struct rproc_mem_entry *mem;
> struct reserved_mem *rmem;
> + int ret;
> u32 da;
>
> /* Register associated reserved memory regions */
> @@ -592,6 +637,38 @@ static int imx_rproc_prepare(struct rproc *rproc)
> rproc_add_carveout(rproc, mem);
> }
>
> + switch (dcfg->method) {
> + case IMX_RPROC_SM:
> + if (!(priv->flags & IMX_RPROC_FLAGS_SM_LMM_OP))
> + break;
> + /*
> + * Power on the Logical Machine to make sure TCM is available.
> + * Also serve as permission check. If in different Logical
> + * Machine, and linux has permission to handle the Logical
> + * Machine, set IMX_RPROC_FLAGS_SM_LMM_AVAIL.
> + */
> + ret = scmi_imx_lmm_operation(dcfg->lmid, SCMI_IMX_LMM_POWER_ON, 0);
> + if (ret == 0) {
> + dev_info(priv->dev, "lmm(%d) powered on\n", dcfg->lmid);
> + priv->flags |= IMX_RPROC_FLAGS_SM_LMM_AVAIL;
> + } else if (ret == -EACCES) {
> + dev_info(priv->dev, "lmm(%d) not under Linux Control\n", dcfg->lmid);
> + /*
> + * If remote cores boots up in detached mode, continue;
> + * else linux has no permission, return -EACCES.
> + */
> + if (priv->rproc->state != RPROC_DETACHED)
> + return -EACCES;
> + } else if (ret) {
> + dev_err(priv->dev, "Failed to power on lmm(%d): %d\n", ret, dcfg->lmid);
> + return ret;
> + }
> +
> + break;
> + default:
> + break;
> + };
> +
> return 0;
> }
>
> @@ -911,13 +988,41 @@ static int imx_rproc_detect_mode(struct imx_rproc *priv)
> struct regmap_config config = { .name = "imx-rproc" };
> const struct imx_rproc_dcfg *dcfg = priv->dcfg;
> struct device *dev = priv->dev;
> + struct scmi_imx_lmm_info info;
> struct regmap *regmap;
> struct arm_smccc_res res;
> + bool started = false;
> int ret;
> u32 val;
> u8 pt;
>
> switch (dcfg->method) {
> + case IMX_RPROC_SM:
> + /* Get current Linux Logical Machine ID */
> + ret = scmi_imx_lmm_info(LMM_ID_DISCOVER, &info);
> + if (ret) {
> + dev_err(dev, "Failed to get current LMM ID err: %d\n", ret);
> + return ret;
> + }
> +
> + /*
> + * Check whether remote processor is in same Logical Machine as Linux.
> + * If no, need use Logical Machine API to manage remote processor, and
> + * set IMX_RPROC_FLAGS_SM_LMM_OP.
> + * If yes, use CPU protocol API to manage remote processor.
> + */
> + if (dcfg->lmid != info.lmid) {
> + priv->flags |= IMX_RPROC_FLAGS_SM_LMM_OP;
> + dev_info(dev, "Using LMM Protocol OPS\n");
> + } else {
> + dev_info(dev, "Using CPU Protocol OPS\n");
> + }
> +
> + scmi_imx_cpu_started(dcfg->cpuid, &started);
> + if (started)
> + priv->rproc->state = RPROC_DETACHED;
> +
> + return 0;
> case IMX_RPROC_NONE:
> priv->rproc->state = RPROC_DETACHED;
> return 0;
> @@ -1029,8 +1134,12 @@ static int imx_rproc_clk_enable(struct imx_rproc *priv)
> struct device *dev = priv->dev;
> int ret;
>
> - /* Remote core is not under control of Linux */
> - if (dcfg->method == IMX_RPROC_NONE)
> + /*
> + * IMX_RPROC_NONE indicates not under control of Linux.
> + * System Manager(SM) firmware automatically configures clock,
> + * so bypass the clk settings for IMX_RPROC_SM.
> + */
> + if (dcfg->method == IMX_RPROC_NONE || dcfg->method == IMX_RPROC_SM)
> return 0;
>
> priv->clk = devm_clk_get(dev, NULL);
> diff --git a/drivers/remoteproc/imx_rproc.h b/drivers/remoteproc/imx_rproc.h
> index cfd38d37e1467d1d9e6f89be146c0b53262b92a0..6fe8d975ed302967f27b7a4319a899e6f0822976 100644
> --- a/drivers/remoteproc/imx_rproc.h
> +++ b/drivers/remoteproc/imx_rproc.h
> @@ -26,6 +26,8 @@ enum imx_rproc_method {
> IMX_RPROC_SCU_API,
> /* Through Reset Controller API */
> IMX_RPROC_RESET_CONTROLLER,
> + /* Through System Manager */
> + IMX_RPROC_SM,
> };
>
> /* dcfg flags */
> @@ -42,6 +44,9 @@ struct imx_rproc_dcfg {
> size_t att_size;
> enum imx_rproc_method method;
> u32 flags;
> + /* For System Manager(SM) based SoCs, the IDs are from SM firmware */
> + u32 cpuid;
> + u32 lmid;
> };
>
> #endif /* _IMX_RPROC_H */
>
> --
> 2.37.1
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v3 3/5] remoteproc: imx_rproc: Add support for i.MX95
2025-06-25 2:23 ` [PATCH v3 3/5] remoteproc: imx_rproc: Add support for i.MX95 Peng Fan (OSS)
@ 2025-06-26 18:50 ` Frank Li
2025-07-08 16:39 ` Mathieu Poirier
1 sibling, 0 replies; 23+ messages in thread
From: Frank Li @ 2025-06-26 18:50 UTC (permalink / raw)
To: Peng Fan (OSS)
Cc: Bjorn Andersson, Mathieu Poirier, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Daniel Baluta,
Iuliana Prodan, linux-remoteproc, devicetree, imx,
linux-arm-kernel, linux-kernel, Peng Fan
On Wed, Jun 25, 2025 at 10:23:29AM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.com>
>
> Add imx_rproc_cfg_imx95_m7 and address(TCM and DDR) mapping.
nit: generally, need empty line between two segments
> Add i.MX95 of_device_id entry.
>
> Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> drivers/remoteproc/imx_rproc.c | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
> index b1a117ca5e5795554b67eb7092db2a25fc7de13b..c226f78c84ad180c69804116d6cfcab19db6aaa5 100644
> --- a/drivers/remoteproc/imx_rproc.c
> +++ b/drivers/remoteproc/imx_rproc.c
> @@ -73,6 +73,10 @@
>
> #define IMX_SC_IRQ_GROUP_REBOOTED 5
>
> +/* Must align with System Manager Firmware */
> +#define IMX95_M7_CPUID 1
> +#define IMX95_M7_LMID 1
> +
> /**
> * struct imx_rproc_mem - slim internal memory structure
> * @cpu_addr: MPU virtual address of the memory region
> @@ -126,6 +130,18 @@ struct imx_rproc {
> u32 flags;
> };
>
> +static const struct imx_rproc_att imx_rproc_att_imx95_m7[] = {
> + /* dev addr , sys addr , size , flags */
> + /* TCM CODE NON-SECURE */
> + { 0x00000000, 0x203C0000, 0x00040000, ATT_OWN | ATT_IOMEM },
> +
> + /* TCM SYS NON-SECURE*/
> + { 0x20000000, 0x20400000, 0x00040000, ATT_OWN | ATT_IOMEM },
> +
> + /* DDR */
> + { 0x80000000, 0x80000000, 0x50000000, 0 },
> +};
> +
> static const struct imx_rproc_att imx_rproc_att_imx93[] = {
> /* dev addr , sys addr , size , flags */
> /* TCM CODE NON-SECURE */
> @@ -372,6 +388,14 @@ static const struct imx_rproc_dcfg imx_rproc_cfg_imx93 = {
> .method = IMX_RPROC_SMC,
> };
>
> +static const struct imx_rproc_dcfg imx_rproc_cfg_imx95_m7 = {
> + .att = imx_rproc_att_imx95_m7,
> + .att_size = ARRAY_SIZE(imx_rproc_att_imx95_m7),
> + .method = IMX_RPROC_SM,
> + .cpuid = IMX95_M7_CPUID,
> + .lmid = IMX95_M7_LMID,
> +};
> +
> static int imx_rproc_start(struct rproc *rproc)
> {
> struct imx_rproc *priv = rproc->priv;
> @@ -1301,6 +1325,7 @@ static const struct of_device_id imx_rproc_of_match[] = {
> { .compatible = "fsl,imx8qm-cm4", .data = &imx_rproc_cfg_imx8qm },
> { .compatible = "fsl,imx8ulp-cm33", .data = &imx_rproc_cfg_imx8ulp },
> { .compatible = "fsl,imx93-cm33", .data = &imx_rproc_cfg_imx93 },
> + { .compatible = "fsl,imx95-cm7", .data = &imx_rproc_cfg_imx95_m7 },
> {},
> };
> MODULE_DEVICE_TABLE(of, imx_rproc_of_match);
>
> --
> 2.37.1
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v3 4/5] arm64: dts: imx95: Add SCMI LMM/CPU nodes
2025-06-25 2:23 ` [PATCH v3 4/5] arm64: dts: imx95: Add SCMI LMM/CPU nodes Peng Fan (OSS)
@ 2025-06-26 18:50 ` Frank Li
0 siblings, 0 replies; 23+ messages in thread
From: Frank Li @ 2025-06-26 18:50 UTC (permalink / raw)
To: Peng Fan (OSS)
Cc: Bjorn Andersson, Mathieu Poirier, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Daniel Baluta,
Iuliana Prodan, linux-remoteproc, devicetree, imx,
linux-arm-kernel, linux-kernel, Peng Fan
On Wed, Jun 25, 2025 at 10:23:30AM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.com>
>
> Add SCMI LMM/CPU nodes which is for remoteproc to handle remote cores.
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
> ---
> arch/arm64/boot/dts/freescale/imx95.dtsi | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/freescale/imx95.dtsi b/arch/arm64/boot/dts/freescale/imx95.dtsi
> index f142c743f786fb5dbd67f8e52c8061bd2815a492..45b5408cbccc1e17240839c3c0c81ac3399a44e3 100644
> --- a/arch/arm64/boot/dts/freescale/imx95.dtsi
> +++ b/arch/arm64/boot/dts/freescale/imx95.dtsi
> @@ -350,10 +350,18 @@ scmi_iomuxc: protocol@19 {
> reg = <0x19>;
> };
>
> + scmi_lmm: protocol@80 {
> + reg = <0x80>;
> + };
> +
> scmi_bbm: protocol@81 {
> reg = <0x81>;
> };
>
> + scmi_cpu: protocol@82 {
> + reg = <0x82>;
> + };
> +
> scmi_misc: protocol@84 {
> reg = <0x84>;
> };
>
> --
> 2.37.1
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v3 5/5] arm64: dts: imx95-19x19-evk: Add CM7 nodes and vdev related memory regions
2025-06-25 2:23 ` [PATCH v3 5/5] arm64: dts: imx95-19x19-evk: Add CM7 nodes and vdev related memory regions Peng Fan (OSS)
@ 2025-06-26 18:52 ` Frank Li
2025-06-27 3:21 ` Peng Fan
0 siblings, 1 reply; 23+ messages in thread
From: Frank Li @ 2025-06-26 18:52 UTC (permalink / raw)
To: Peng Fan (OSS)
Cc: Bjorn Andersson, Mathieu Poirier, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Daniel Baluta,
Iuliana Prodan, linux-remoteproc, devicetree, imx,
linux-arm-kernel, linux-kernel, Peng Fan
On Wed, Jun 25, 2025 at 10:23:31AM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.com>
>
> Add CM7 nodes, vdev related memory regions for remoteproc.
> Enable MU7.
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
> arch/arm64/boot/dts/freescale/imx95-19x19-evk.dts | 45 +++++++++++++++++++++++
> 1 file changed, 45 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/freescale/imx95-19x19-evk.dts b/arch/arm64/boot/dts/freescale/imx95-19x19-evk.dts
> index 6886ea7666550605d6c2aa3d81ff270164e5796f..70f000b1c4032a449cbf9ceb746c16c9f3062a61 100644
> --- a/arch/arm64/boot/dts/freescale/imx95-19x19-evk.dts
> +++ b/arch/arm64/boot/dts/freescale/imx95-19x19-evk.dts
> @@ -75,6 +75,37 @@ linux_cma: linux,cma {
> linux,cma-default;
> reusable;
> };
> +
> + vdev0vring0: memory@88000000 {
> + reg = <0 0x88000000 0 0x8000>;
> + no-map;
> + };
> +
> + vdev0vring1: memory@88008000 {
> + reg = <0 0x88008000 0 0x8000>;
> + no-map;
> + };
> +
> + vdev1vring0: memory@88010000 {
> + reg = <0 0x88010000 0 0x8000>;
> + no-map;
> + };
> +
> + vdev1vring1: memory@88018000 {
> + reg = <0 0x88018000 0 0x8000>;
> + no-map;
> + };
> +
> + rsc_table: memory@88220000 {
> + reg = <0 0x88220000 0 0x1000>;
> + no-map;
> + };
> +
> + vdevbuffer: memory@88020000 {
> + compatible = "shared-dma-pool";
> + reg = <0 0x88020000 0 0x100000>;
> + no-map;
> + };
> };
>
> reg_3p3v: regulator-3p3v {
> @@ -202,6 +233,20 @@ sound-wm8962 {
> "IN3R", "AMIC",
> "IN1R", "AMIC";
> };
> +
> + remoteproc-cm7 {
> + compatible = "fsl,imx95-cm7";
> + mbox-names = "tx", "rx", "rxdb";
> + mboxes = <&mu7 0 1>,
> + <&mu7 1 1>,
> + <&mu7 3 1>;
> + memory-region = <&vdevbuffer>, <&vdev0vring0>, <&vdev0vring1>,
> + <&vdev1vring0>, <&vdev1vring1>, <&rsc_table>;
> + };
> +};
> +
> +&mu7 {
> + status = "okay";
> };
can you keep &mu7 as order, at least it should be after &enetc_port0
Frank
>
> &enetc_port0 {
>
> --
> 2.37.1
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* RE: [PATCH v3 5/5] arm64: dts: imx95-19x19-evk: Add CM7 nodes and vdev related memory regions
2025-06-26 18:52 ` Frank Li
@ 2025-06-27 3:21 ` Peng Fan
0 siblings, 0 replies; 23+ messages in thread
From: Peng Fan @ 2025-06-27 3:21 UTC (permalink / raw)
To: Frank Li, Peng Fan (OSS)
Cc: Bjorn Andersson, Mathieu Poirier, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Daniel Baluta,
Iuliana Prodan, linux-remoteproc@vger.kernel.org,
devicetree@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
> Subject: Re: [PATCH v3 5/5] arm64: dts: imx95-19x19-evk: Add CM7
> nodes and vdev related memory regions
>
> On Wed, Jun 25, 2025 at 10:23:31AM +0800, Peng Fan (OSS) wrote:
> > From: Peng Fan <peng.fan@nxp.com>
> >
> > Add CM7 nodes, vdev related memory regions for remoteproc.
> > Enable MU7.
> >
> > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > ---
> > arch/arm64/boot/dts/freescale/imx95-19x19-evk.dts | 45
> +++++++++++++++++++++++
> > 1 file changed, 45 insertions(+)
> >
> > diff --git a/arch/arm64/boot/dts/freescale/imx95-19x19-evk.dts
> b/arch/arm64/boot/dts/freescale/imx95-19x19-evk.dts
> > index
> 6886ea7666550605d6c2aa3d81ff270164e5796f..70f000b1c4032a449
> cbf9ceb746c16c9f3062a61 100644
> > --- a/arch/arm64/boot/dts/freescale/imx95-19x19-evk.dts
> > +++ b/arch/arm64/boot/dts/freescale/imx95-19x19-evk.dts
> > @@ -75,6 +75,37 @@ linux_cma: linux,cma {
> > linux,cma-default;
> > reusable;
> > };
> > +
> > + vdev0vring0: memory@88000000 {
> > + reg = <0 0x88000000 0 0x8000>;
> > + no-map;
> > + };
> > +
> > + vdev0vring1: memory@88008000 {
> > + reg = <0 0x88008000 0 0x8000>;
> > + no-map;
> > + };
> > +
> > + vdev1vring0: memory@88010000 {
> > + reg = <0 0x88010000 0 0x8000>;
> > + no-map;
> > + };
> > +
> > + vdev1vring1: memory@88018000 {
> > + reg = <0 0x88018000 0 0x8000>;
> > + no-map;
> > + };
> > +
> > + rsc_table: memory@88220000 {
> > + reg = <0 0x88220000 0 0x1000>;
> > + no-map;
> > + };
> > +
> > + vdevbuffer: memory@88020000 {
> > + compatible = "shared-dma-pool";
> > + reg = <0 0x88020000 0 0x100000>;
> > + no-map;
> > + };
> > };
> >
> > reg_3p3v: regulator-3p3v {
> > @@ -202,6 +233,20 @@ sound-wm8962 {
> > "IN3R", "AMIC",
> > "IN1R", "AMIC";
> > };
> > +
> > + remoteproc-cm7 {
> > + compatible = "fsl,imx95-cm7";
> > + mbox-names = "tx", "rx", "rxdb";
> > + mboxes = <&mu7 0 1>,
> > + <&mu7 1 1>,
> > + <&mu7 3 1>;
> > + memory-region = <&vdevbuffer>, <&vdev0vring0>,
> <&vdev0vring1>,
> > + <&vdev1vring0>, <&vdev1vring1>,
> <&rsc_table>;
> > + };
> > +};
> > +
> > +&mu7 {
> > + status = "okay";
> > };
>
> can you keep &mu7 as order, at least it should be after &enetc_port0
Oops! I will fix it. BTW:
I will wait for remoteproc maintainers to check patch 1,2,3 to see
whether I need post V4 for the whole patchset.
Thanks,
Peng.
>
> Frank
> >
> > &enetc_port0 {
> >
> > --
> > 2.37.1
> >
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v3 1/5] dt-bindings: remoteproc: fsl,imx-rproc: Add support for i.MX95
2025-06-25 2:23 ` [PATCH v3 1/5] dt-bindings: remoteproc: fsl,imx-rproc: Add support for i.MX95 Peng Fan (OSS)
2025-06-26 18:45 ` Frank Li
@ 2025-06-27 7:06 ` Krzysztof Kozlowski
1 sibling, 0 replies; 23+ messages in thread
From: Krzysztof Kozlowski @ 2025-06-27 7:06 UTC (permalink / raw)
To: Peng Fan (OSS)
Cc: Bjorn Andersson, Mathieu Poirier, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Frank Li, Daniel Baluta,
Iuliana Prodan, linux-remoteproc, devicetree, imx,
linux-arm-kernel, linux-kernel, Peng Fan
On Wed, Jun 25, 2025 at 10:23:27AM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.com>
>
> Add compatible string for the Cortex-M7 core in i.MX95
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
> Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml | 1 +
> 1 file changed, 1 insertion(+)
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v3 0/5] remoteproc: imx_rproc: Support i.MX95
2025-06-25 2:23 [PATCH v3 0/5] remoteproc: imx_rproc: Support i.MX95 Peng Fan (OSS)
` (5 preceding siblings ...)
2025-06-25 20:25 ` [PATCH v3 0/5] remoteproc: imx_rproc: Support i.MX95 Rob Herring (Arm)
@ 2025-07-03 5:01 ` Peng Fan
6 siblings, 0 replies; 23+ messages in thread
From: Peng Fan @ 2025-07-03 5:01 UTC (permalink / raw)
To: Bjorn Andersson, Mathieu Poirier, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Frank Li, Daniel Baluta,
Iuliana Prodan
Cc: linux-remoteproc, devicetree, imx, linux-arm-kernel, linux-kernel,
Peng Fan
Hi Mathieu,
On Wed, Jun 25, 2025 at 10:23:26AM +0800, Peng Fan (OSS) wrote:
>i.MX95 features a Cortex-M33 core, six Cortex-A55 cores, and
>---
>Peng Fan (5):
> dt-bindings: remoteproc: fsl,imx-rproc: Add support for i.MX95
> remoteproc: imx_rproc: Add support for System Manager API
> remoteproc: imx_rproc: Add support for i.MX95
> arm64: dts: imx95: Add SCMI LMM/CPU nodes
> arm64: dts: imx95-19x19-evk: Add CM7 nodes and vdev related memory regions
Except patch 5 with a small comment, other patches have got R-b.
Would you give a look on the patch 1-3?
Thanks,
Peng
>
> .../bindings/remoteproc/fsl,imx-rproc.yaml | 1 +
> arch/arm64/boot/dts/freescale/imx95-19x19-evk.dts | 45 +++++++
> arch/arm64/boot/dts/freescale/imx95.dtsi | 8 ++
> drivers/remoteproc/imx_rproc.c | 138 ++++++++++++++++++++-
> drivers/remoteproc/imx_rproc.h | 5 +
> 5 files changed, 195 insertions(+), 2 deletions(-)
>---
>base-commit: fda740558acb4303fcf377e5cf9139f795b1d85b
>change-id: 20250525-imx95-rproc-1-20bb74ddc8af
>
>Best regards,
>--
>Peng Fan <peng.fan@nxp.com>
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v3 2/5] remoteproc: imx_rproc: Add support for System Manager API
2025-06-25 2:23 ` [PATCH v3 2/5] remoteproc: imx_rproc: Add support for System Manager API Peng Fan (OSS)
2025-06-26 18:48 ` Frank Li
@ 2025-07-08 16:32 ` Mathieu Poirier
2025-07-09 9:02 ` Peng Fan
1 sibling, 1 reply; 23+ messages in thread
From: Mathieu Poirier @ 2025-07-08 16:32 UTC (permalink / raw)
To: Peng Fan (OSS)
Cc: Bjorn Andersson, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Frank Li, Daniel Baluta, Iuliana Prodan, linux-remoteproc,
devicetree, imx, linux-arm-kernel, linux-kernel, Peng Fan
Good day,
On Wed, Jun 25, 2025 at 10:23:28AM +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.
>
> There are three cases for M7:
> (1) M7 in a separate Logical Machine(LM) that Linux can't control it.
> (2) M7 in a separate Logical Machine that Linux can control it using
> LMM protocol
> (3) M7 runs in same Logical Machine as A55, so Linux can control it
> using CPU protocol
>
> So extend the driver to using LMM and CPU protocol to manage the M7 core.
> - Add IMX_RPROC_SM to indicate the remote core runs on a SoC that
> has System Manager.
> - 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 seprate 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.
>
Thanks for the context, it really helps.
> 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.
>
> Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
> drivers/remoteproc/imx_rproc.c | 113 ++++++++++++++++++++++++++++++++++++++++-
> drivers/remoteproc/imx_rproc.h | 5 ++
> 2 files changed, 116 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
> index 74299af1d7f10a0db794de494c52304b2323b89f..b1a117ca5e5795554b67eb7092db2a25fc7de13b 100644
> --- a/drivers/remoteproc/imx_rproc.c
> +++ b/drivers/remoteproc/imx_rproc.c
> @@ -8,6 +8,7 @@
> #include <linux/clk.h>
> #include <linux/err.h>
> #include <linux/firmware/imx/sci.h>
> +#include <linux/firmware/imx/sm.h>
> #include <linux/interrupt.h>
> #include <linux/kernel.h>
> #include <linux/mailbox_client.h>
> @@ -21,6 +22,7 @@
> #include <linux/reboot.h>
> #include <linux/regmap.h>
> #include <linux/remoteproc.h>
> +#include <linux/scmi_imx_protocol.h>
> #include <linux/workqueue.h>
>
> #include "imx_rproc.h"
> @@ -91,6 +93,11 @@ struct imx_rproc_mem {
> #define ATT_CORE_MASK 0xffff
> #define ATT_CORE(I) BIT((I))
>
> +/* Logical Machine Operation */
> +#define IMX_RPROC_FLAGS_SM_LMM_OP BIT(0)
> +/* Linux has permission to handle the Logical Machine of remote cores */
> +#define IMX_RPROC_FLAGS_SM_LMM_AVAIL BIT(1)
> +
> static int imx_rproc_xtr_mbox_init(struct rproc *rproc, bool tx_block);
> static void imx_rproc_free_mbox(struct rproc *rproc);
>
> @@ -115,6 +122,8 @@ struct imx_rproc {
> u32 entry; /* cpu start address */
> u32 core_index;
> struct dev_pm_domain_list *pd_list;
> + /* For i.MX System Manager based systems */
> + u32 flags;
> };
>
> static const struct imx_rproc_att imx_rproc_att_imx93[] = {
> @@ -393,6 +402,30 @@ static int imx_rproc_start(struct rproc *rproc)
> case IMX_RPROC_SCU_API:
> ret = imx_sc_pm_cpu_start(priv->ipc_handle, priv->rsrc_id, true, priv->entry);
> break;
> + case IMX_RPROC_SM:
> + if (priv->flags & IMX_RPROC_FLAGS_SM_LMM_OP) {
> + if (!(priv->flags & IMX_RPROC_FLAGS_SM_LMM_AVAIL))
> + return -EACCES;
> +
> + ret = scmi_imx_lmm_reset_vector_set(dcfg->lmid, dcfg->cpuid, 0, 0);
> + if (ret) {
> + dev_err(dev, "Failed to set reset vector lmid(%u), cpuid(%u): %d\n",
> + dcfg->lmid, dcfg->cpuid, ret);
> + }
> +
> + ret = scmi_imx_lmm_operation(dcfg->lmid, SCMI_IMX_LMM_BOOT, 0);
> + if (ret)
> + dev_err(dev, "Failed to boot lmm(%d): %d\n", ret, dcfg->lmid);
> + } else {
> + ret = scmi_imx_cpu_reset_vector_set(dcfg->cpuid, 0, true, false, false);
> + if (ret) {
> + dev_err(dev, "Failed to set reset vector cpuid(%u): %d\n",
> + dcfg->cpuid, ret);
> + }
> +
> + ret = scmi_imx_cpu_start(dcfg->cpuid, true);
> + }
> + break;
> default:
> return -EOPNOTSUPP;
> }
> @@ -435,6 +468,16 @@ static int imx_rproc_stop(struct rproc *rproc)
> case IMX_RPROC_SCU_API:
> ret = imx_sc_pm_cpu_start(priv->ipc_handle, priv->rsrc_id, false, priv->entry);
> break;
> + case IMX_RPROC_SM:
> + if (priv->flags & IMX_RPROC_FLAGS_SM_LMM_OP) {
> + if (priv->flags & IMX_RPROC_FLAGS_SM_LMM_AVAIL)
> + ret = scmi_imx_lmm_operation(dcfg->lmid, SCMI_IMX_LMM_SHUTDOWN, 0);
> + else
> + ret = -EACCES;
> + } else {
> + ret = scmi_imx_cpu_start(dcfg->cpuid, false);
> + }
> + break;
> default:
> return -EOPNOTSUPP;
> }
> @@ -549,9 +592,11 @@ static int imx_rproc_prepare(struct rproc *rproc)
> {
> struct imx_rproc *priv = rproc->priv;
> struct device_node *np = priv->dev->of_node;
> + const struct imx_rproc_dcfg *dcfg = priv->dcfg;
> struct of_phandle_iterator it;
> struct rproc_mem_entry *mem;
> struct reserved_mem *rmem;
> + int ret;
> u32 da;
>
> /* Register associated reserved memory regions */
> @@ -592,6 +637,38 @@ static int imx_rproc_prepare(struct rproc *rproc)
> rproc_add_carveout(rproc, mem);
> }
>
> + switch (dcfg->method) {
> + case IMX_RPROC_SM:
> + if (!(priv->flags & IMX_RPROC_FLAGS_SM_LMM_OP))
> + break;
> + /*
> + * Power on the Logical Machine to make sure TCM is available.
> + * Also serve as permission check. If in different Logical
> + * Machine, and linux has permission to handle the Logical
> + * Machine, set IMX_RPROC_FLAGS_SM_LMM_AVAIL.
> + */
> + ret = scmi_imx_lmm_operation(dcfg->lmid, SCMI_IMX_LMM_POWER_ON, 0);
> + if (ret == 0) {
> + dev_info(priv->dev, "lmm(%d) powered on\n", dcfg->lmid);
> + priv->flags |= IMX_RPROC_FLAGS_SM_LMM_AVAIL;
This is set all the time imx_rproc_prepare() is called - isn't there a way to
set it once at initialisation time?
> + } else if (ret == -EACCES) {
> + dev_info(priv->dev, "lmm(%d) not under Linux Control\n", dcfg->lmid);
> + /*
> + * If remote cores boots up in detached mode, continue;
> + * else linux has no permission, return -EACCES.
> + */
> + if (priv->rproc->state != RPROC_DETACHED)
> + return -EACCES;
> + } else if (ret) {
> + dev_err(priv->dev, "Failed to power on lmm(%d): %d\n", ret, dcfg->lmid);
> + return ret;
> + }
> +
> + break;
> + default:
> + break;
> + };
> +
Please put this in a function and get rid of the switch{}.
> return 0;
> }
>
> @@ -911,13 +988,41 @@ static int imx_rproc_detect_mode(struct imx_rproc *priv)
> struct regmap_config config = { .name = "imx-rproc" };
> const struct imx_rproc_dcfg *dcfg = priv->dcfg;
> struct device *dev = priv->dev;
> + struct scmi_imx_lmm_info info;
> struct regmap *regmap;
> struct arm_smccc_res res;
> + bool started = false;
> int ret;
> u32 val;
> u8 pt;
>
> switch (dcfg->method) {
> + case IMX_RPROC_SM:
> + /* Get current Linux Logical Machine ID */
> + ret = scmi_imx_lmm_info(LMM_ID_DISCOVER, &info);
> + if (ret) {
> + dev_err(dev, "Failed to get current LMM ID err: %d\n", ret);
> + return ret;
> + }
> +
> + /*
> + * Check whether remote processor is in same Logical Machine as Linux.
> + * If no, need use Logical Machine API to manage remote processor, and
> + * set IMX_RPROC_FLAGS_SM_LMM_OP.
> + * If yes, use CPU protocol API to manage remote processor.
> + */
> + if (dcfg->lmid != info.lmid) {
> + priv->flags |= IMX_RPROC_FLAGS_SM_LMM_OP;
> + dev_info(dev, "Using LMM Protocol OPS\n");
> + } else {
> + dev_info(dev, "Using CPU Protocol OPS\n");
> + }
> +
> + scmi_imx_cpu_started(dcfg->cpuid, &started);
Function scmi_imx_cpu_started() returns a value that is not taken into account.
> + if (started)
> + priv->rproc->state = RPROC_DETACHED;
> +
> + return 0;
> case IMX_RPROC_NONE:
> priv->rproc->state = RPROC_DETACHED;
> return 0;
> @@ -1029,8 +1134,12 @@ static int imx_rproc_clk_enable(struct imx_rproc *priv)
> struct device *dev = priv->dev;
> int ret;
>
> - /* Remote core is not under control of Linux */
> - if (dcfg->method == IMX_RPROC_NONE)
> + /*
> + * IMX_RPROC_NONE indicates not under control of Linux.
> + * System Manager(SM) firmware automatically configures clock,
> + * so bypass the clk settings for IMX_RPROC_SM.
> + */
> + if (dcfg->method == IMX_RPROC_NONE || dcfg->method == IMX_RPROC_SM)
> return 0;
>
> priv->clk = devm_clk_get(dev, NULL);
> diff --git a/drivers/remoteproc/imx_rproc.h b/drivers/remoteproc/imx_rproc.h
> index cfd38d37e1467d1d9e6f89be146c0b53262b92a0..6fe8d975ed302967f27b7a4319a899e6f0822976 100644
> --- a/drivers/remoteproc/imx_rproc.h
> +++ b/drivers/remoteproc/imx_rproc.h
> @@ -26,6 +26,8 @@ enum imx_rproc_method {
> IMX_RPROC_SCU_API,
> /* Through Reset Controller API */
> IMX_RPROC_RESET_CONTROLLER,
> + /* Through System Manager */
> + IMX_RPROC_SM,
> };
>
> /* dcfg flags */
> @@ -42,6 +44,9 @@ struct imx_rproc_dcfg {
> size_t att_size;
> enum imx_rproc_method method;
> u32 flags;
> + /* For System Manager(SM) based SoCs, the IDs are from SM firmware */
> + u32 cpuid;
> + u32 lmid;
> };
>
> #endif /* _IMX_RPROC_H */
>
> --
> 2.37.1
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v3 3/5] remoteproc: imx_rproc: Add support for i.MX95
2025-06-25 2:23 ` [PATCH v3 3/5] remoteproc: imx_rproc: Add support for i.MX95 Peng Fan (OSS)
2025-06-26 18:50 ` Frank Li
@ 2025-07-08 16:39 ` Mathieu Poirier
2025-07-09 7:49 ` Peng Fan
1 sibling, 1 reply; 23+ messages in thread
From: Mathieu Poirier @ 2025-07-08 16:39 UTC (permalink / raw)
To: Peng Fan (OSS)
Cc: Bjorn Andersson, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Frank Li, Daniel Baluta, Iuliana Prodan, linux-remoteproc,
devicetree, imx, linux-arm-kernel, linux-kernel, Peng Fan
On Wed, Jun 25, 2025 at 10:23:29AM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.com>
>
> Add imx_rproc_cfg_imx95_m7 and address(TCM and DDR) mapping.
> Add i.MX95 of_device_id entry.
>
> Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
> drivers/remoteproc/imx_rproc.c | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
> index b1a117ca5e5795554b67eb7092db2a25fc7de13b..c226f78c84ad180c69804116d6cfcab19db6aaa5 100644
> --- a/drivers/remoteproc/imx_rproc.c
> +++ b/drivers/remoteproc/imx_rproc.c
> @@ -73,6 +73,10 @@
>
> #define IMX_SC_IRQ_GROUP_REBOOTED 5
>
> +/* Must align with System Manager Firmware */
> +#define IMX95_M7_CPUID 1
> +#define IMX95_M7_LMID 1
Any reason those aren't set in the device tree?
Thanks,
Mathieu
> +
> /**
> * struct imx_rproc_mem - slim internal memory structure
> * @cpu_addr: MPU virtual address of the memory region
> @@ -126,6 +130,18 @@ struct imx_rproc {
> u32 flags;
> };
>
> +static const struct imx_rproc_att imx_rproc_att_imx95_m7[] = {
> + /* dev addr , sys addr , size , flags */
> + /* TCM CODE NON-SECURE */
> + { 0x00000000, 0x203C0000, 0x00040000, ATT_OWN | ATT_IOMEM },
> +
> + /* TCM SYS NON-SECURE*/
> + { 0x20000000, 0x20400000, 0x00040000, ATT_OWN | ATT_IOMEM },
> +
> + /* DDR */
> + { 0x80000000, 0x80000000, 0x50000000, 0 },
> +};
> +
> static const struct imx_rproc_att imx_rproc_att_imx93[] = {
> /* dev addr , sys addr , size , flags */
> /* TCM CODE NON-SECURE */
> @@ -372,6 +388,14 @@ static const struct imx_rproc_dcfg imx_rproc_cfg_imx93 = {
> .method = IMX_RPROC_SMC,
> };
>
> +static const struct imx_rproc_dcfg imx_rproc_cfg_imx95_m7 = {
> + .att = imx_rproc_att_imx95_m7,
> + .att_size = ARRAY_SIZE(imx_rproc_att_imx95_m7),
> + .method = IMX_RPROC_SM,
> + .cpuid = IMX95_M7_CPUID,
> + .lmid = IMX95_M7_LMID,
> +};
> +
> static int imx_rproc_start(struct rproc *rproc)
> {
> struct imx_rproc *priv = rproc->priv;
> @@ -1301,6 +1325,7 @@ static const struct of_device_id imx_rproc_of_match[] = {
> { .compatible = "fsl,imx8qm-cm4", .data = &imx_rproc_cfg_imx8qm },
> { .compatible = "fsl,imx8ulp-cm33", .data = &imx_rproc_cfg_imx8ulp },
> { .compatible = "fsl,imx93-cm33", .data = &imx_rproc_cfg_imx93 },
> + { .compatible = "fsl,imx95-cm7", .data = &imx_rproc_cfg_imx95_m7 },
> {},
> };
> MODULE_DEVICE_TABLE(of, imx_rproc_of_match);
>
> --
> 2.37.1
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v3 3/5] remoteproc: imx_rproc: Add support for i.MX95
2025-07-08 16:39 ` Mathieu Poirier
@ 2025-07-09 7:49 ` Peng Fan
2025-07-09 14:31 ` Mathieu Poirier
0 siblings, 1 reply; 23+ messages in thread
From: Peng Fan @ 2025-07-09 7:49 UTC (permalink / raw)
To: Mathieu Poirier
Cc: Bjorn Andersson, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Frank Li, Daniel Baluta, Iuliana Prodan, linux-remoteproc,
devicetree, imx, linux-arm-kernel, linux-kernel, Peng Fan
Hi Mathieu,
On Tue, Jul 08, 2025 at 10:39:55AM -0600, Mathieu Poirier wrote:
>On Wed, Jun 25, 2025 at 10:23:29AM +0800, Peng Fan (OSS) wrote:
>> From: Peng Fan <peng.fan@nxp.com>
>>
>> Add imx_rproc_cfg_imx95_m7 and address(TCM and DDR) mapping.
>> Add i.MX95 of_device_id entry.
>>
>> Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
>> Signed-off-by: Peng Fan <peng.fan@nxp.com>
>> ---
>> drivers/remoteproc/imx_rproc.c | 25 +++++++++++++++++++++++++
>> 1 file changed, 25 insertions(+)
>>
>> diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
>> index b1a117ca5e5795554b67eb7092db2a25fc7de13b..c226f78c84ad180c69804116d6cfcab19db6aaa5 100644
>> --- a/drivers/remoteproc/imx_rproc.c
>> +++ b/drivers/remoteproc/imx_rproc.c
>> @@ -73,6 +73,10 @@
>>
>> #define IMX_SC_IRQ_GROUP_REBOOTED 5
>>
>> +/* Must align with System Manager Firmware */
>> +#define IMX95_M7_CPUID 1
>> +#define IMX95_M7_LMID 1
>
>Any reason those aren't set in the device tree?
Krzysztof rejected to introduce the IDs to devicetree.
From IRC:
"To me this makes no sense in current explanayton - you have 8 cores, but only
one can be put there, so what happens with the rest?
And I don't think we care about something like remote and local ID - it is
the same. CPUs have single number. So this looks like copy paste downstream
and thus solve it internally first"
In System Manager Firmware, CPUID is fixed and will not change.
LMID is also fixed as of now, we not expect customer to change LMID.
So with "fsl,imx95-m7", we could know the CPUID and LMID for M7, so
it does not make sense to introduce new property saying "fsl,imx95-lmid"
and "fsl,imx95-cpuid". This should be the main concern that DT maintainers
reject to add properties for the IDs.
Thanks,
Peng
>
>Thanks,
>Mathieu
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v3 2/5] remoteproc: imx_rproc: Add support for System Manager API
2025-07-08 16:32 ` Mathieu Poirier
@ 2025-07-09 9:02 ` Peng Fan
2025-07-09 14:33 ` Mathieu Poirier
0 siblings, 1 reply; 23+ messages in thread
From: Peng Fan @ 2025-07-09 9:02 UTC (permalink / raw)
To: Mathieu Poirier
Cc: Bjorn Andersson, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Frank Li, Daniel Baluta, Iuliana Prodan, linux-remoteproc,
devicetree, imx, linux-arm-kernel, linux-kernel, Peng Fan
Hi Mathieu,
On Tue, Jul 08, 2025 at 10:32:34AM -0600, Mathieu Poirier wrote:
>Good day,
Thanks, good day.
>
>On Wed, Jun 25, 2025 at 10:23:28AM +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.
>>
>> There are three cases for M7:
>> (1) M7 in a separate Logical Machine(LM) that Linux can't control it.
>> (2) M7 in a separate Logical Machine that Linux can control it using
>> LMM protocol
>> (3) M7 runs in same Logical Machine as A55, so Linux can control it
>> using CPU protocol
>>
>> So extend the driver to using LMM and CPU protocol to manage the M7 core.
>> - Add IMX_RPROC_SM to indicate the remote core runs on a SoC that
>> has System Manager.
>> - 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 seprate 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.
>>
>
>Thanks for the context, it really helps.
Glad that helps.
>
[....]
>> @@ -592,6 +637,38 @@ static int imx_rproc_prepare(struct rproc *rproc)
>> rproc_add_carveout(rproc, mem);
>> }
>>
>> + switch (dcfg->method) {
>> + case IMX_RPROC_SM:
>> + if (!(priv->flags & IMX_RPROC_FLAGS_SM_LMM_OP))
>> + break;
>> + /*
>> + * Power on the Logical Machine to make sure TCM is available.
>> + * Also serve as permission check. If in different Logical
>> + * Machine, and linux has permission to handle the Logical
>> + * Machine, set IMX_RPROC_FLAGS_SM_LMM_AVAIL.
>> + */
>> + ret = scmi_imx_lmm_operation(dcfg->lmid, SCMI_IMX_LMM_POWER_ON, 0);
>> + if (ret == 0) {
>> + dev_info(priv->dev, "lmm(%d) powered on\n", dcfg->lmid);
>> + priv->flags |= IMX_RPROC_FLAGS_SM_LMM_AVAIL;
>
>This is set all the time imx_rproc_prepare() is called - isn't there a way to
>set it once at initialisation time?
Yeah. Moving this to probe path should be ok, such as in imx_rproc_detect_mode.
The drawback is M7 logical machine will be left in powered up state if
moving to probe path before user starts M7 LM. Leaving in here means M7 logcal
machine will be only powered up when user does
"echo start > /xx/remoteproc-y/state", but needs to set
IMX_RPROC_FLAGS_SM_LMM_AVAIL flags each time do preparing.
If you prefer moving this logic to probe, I could give a try to move
to imx_rproc_detect_mode which is probe path.
How do you think?
>
>> + } else if (ret == -EACCES) {
>> + dev_info(priv->dev, "lmm(%d) not under Linux Control\n", dcfg->lmid);
>> + /*
>> + * If remote cores boots up in detached mode, continue;
>> + * else linux has no permission, return -EACCES.
>> + */
>> + if (priv->rproc->state != RPROC_DETACHED)
>> + return -EACCES;
>> + } else if (ret) {
>> + dev_err(priv->dev, "Failed to power on lmm(%d): %d\n", ret, dcfg->lmid);
>> + return ret;
>> + }
>> +
>> + break;
>> + default:
>> + break;
>> + };
>> +
>
>Please put this in a function and get rid of the switch{}.
ok. Fix in v4
>
>> return 0;
>> }
>>
>> @@ -911,13 +988,41 @@ static int imx_rproc_detect_mode(struct imx_rproc *priv)
>> struct regmap_config config = { .name = "imx-rproc" };
>> const struct imx_rproc_dcfg *dcfg = priv->dcfg;
>> struct device *dev = priv->dev;
>> + struct scmi_imx_lmm_info info;
>> struct regmap *regmap;
>> struct arm_smccc_res res;
>> + bool started = false;
>> int ret;
>> u32 val;
>> u8 pt;
>>
>> switch (dcfg->method) {
>> + case IMX_RPROC_SM:
>> + /* Get current Linux Logical Machine ID */
>> + ret = scmi_imx_lmm_info(LMM_ID_DISCOVER, &info);
>> + if (ret) {
>> + dev_err(dev, "Failed to get current LMM ID err: %d\n", ret);
>> + return ret;
>> + }
>> +
>> + /*
>> + * Check whether remote processor is in same Logical Machine as Linux.
>> + * If no, need use Logical Machine API to manage remote processor, and
>> + * set IMX_RPROC_FLAGS_SM_LMM_OP.
>> + * If yes, use CPU protocol API to manage remote processor.
>> + */
>> + if (dcfg->lmid != info.lmid) {
>> + priv->flags |= IMX_RPROC_FLAGS_SM_LMM_OP;
>> + dev_info(dev, "Using LMM Protocol OPS\n");
>> + } else {
>> + dev_info(dev, "Using CPU Protocol OPS\n");
>> + }
>> +
>> + scmi_imx_cpu_started(dcfg->cpuid, &started);
>
>Function scmi_imx_cpu_started() returns a value that is not taken into account.
>
>> + if (started)
I will update to "if (started || ret)" in v4, with ret assigned the return
value of scmi_imx_cpu_started.
Thanks,
Peng
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v3 3/5] remoteproc: imx_rproc: Add support for i.MX95
2025-07-09 7:49 ` Peng Fan
@ 2025-07-09 14:31 ` Mathieu Poirier
0 siblings, 0 replies; 23+ messages in thread
From: Mathieu Poirier @ 2025-07-09 14:31 UTC (permalink / raw)
To: Peng Fan
Cc: Bjorn Andersson, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Frank Li, Daniel Baluta, Iuliana Prodan, linux-remoteproc,
devicetree, imx, linux-arm-kernel, linux-kernel, Peng Fan
On Wed, Jul 09, 2025 at 03:49:40PM +0800, Peng Fan wrote:
> Hi Mathieu,
>
> On Tue, Jul 08, 2025 at 10:39:55AM -0600, Mathieu Poirier wrote:
> >On Wed, Jun 25, 2025 at 10:23:29AM +0800, Peng Fan (OSS) wrote:
> >> From: Peng Fan <peng.fan@nxp.com>
> >>
> >> Add imx_rproc_cfg_imx95_m7 and address(TCM and DDR) mapping.
> >> Add i.MX95 of_device_id entry.
> >>
> >> Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
> >> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> >> ---
> >> drivers/remoteproc/imx_rproc.c | 25 +++++++++++++++++++++++++
> >> 1 file changed, 25 insertions(+)
> >>
> >> diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c
> >> index b1a117ca5e5795554b67eb7092db2a25fc7de13b..c226f78c84ad180c69804116d6cfcab19db6aaa5 100644
> >> --- a/drivers/remoteproc/imx_rproc.c
> >> +++ b/drivers/remoteproc/imx_rproc.c
> >> @@ -73,6 +73,10 @@
> >>
> >> #define IMX_SC_IRQ_GROUP_REBOOTED 5
> >>
> >> +/* Must align with System Manager Firmware */
> >> +#define IMX95_M7_CPUID 1
> >> +#define IMX95_M7_LMID 1
> >
> >Any reason those aren't set in the device tree?
>
> Krzysztof rejected to introduce the IDs to devicetree.
>
> From IRC:
> "To me this makes no sense in current explanayton - you have 8 cores, but only
> one can be put there, so what happens with the rest?
> And I don't think we care about something like remote and local ID - it is
> the same. CPUs have single number. So this looks like copy paste downstream
> and thus solve it internally first"
>
>
> In System Manager Firmware, CPUID is fixed and will not change.
> LMID is also fixed as of now, we not expect customer to change LMID.
>
> So with "fsl,imx95-m7", we could know the CPUID and LMID for M7, so
> it does not make sense to introduce new property saying "fsl,imx95-lmid"
> and "fsl,imx95-cpuid". This should be the main concern that DT maintainers
> reject to add properties for the IDs.
>
Ok
> Thanks,
> Peng
>
> >
> >Thanks,
> >Mathieu
> >
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v3 2/5] remoteproc: imx_rproc: Add support for System Manager API
2025-07-09 9:02 ` Peng Fan
@ 2025-07-09 14:33 ` Mathieu Poirier
2025-07-09 15:01 ` Peng Fan
0 siblings, 1 reply; 23+ messages in thread
From: Mathieu Poirier @ 2025-07-09 14:33 UTC (permalink / raw)
To: Peng Fan
Cc: Bjorn Andersson, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Frank Li, Daniel Baluta, Iuliana Prodan, linux-remoteproc,
devicetree, imx, linux-arm-kernel, linux-kernel, Peng Fan
On Wed, Jul 09, 2025 at 05:02:31PM +0800, Peng Fan wrote:
> Hi Mathieu,
>
> On Tue, Jul 08, 2025 at 10:32:34AM -0600, Mathieu Poirier wrote:
> >Good day,
>
> Thanks, good day.
>
> >
> >On Wed, Jun 25, 2025 at 10:23:28AM +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.
> >>
> >> There are three cases for M7:
> >> (1) M7 in a separate Logical Machine(LM) that Linux can't control it.
> >> (2) M7 in a separate Logical Machine that Linux can control it using
> >> LMM protocol
> >> (3) M7 runs in same Logical Machine as A55, so Linux can control it
> >> using CPU protocol
> >>
> >> So extend the driver to using LMM and CPU protocol to manage the M7 core.
> >> - Add IMX_RPROC_SM to indicate the remote core runs on a SoC that
> >> has System Manager.
> >> - 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 seprate 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.
> >>
> >
> >Thanks for the context, it really helps.
>
> Glad that helps.
>
> >
>
> [....]
>
> >> @@ -592,6 +637,38 @@ static int imx_rproc_prepare(struct rproc *rproc)
> >> rproc_add_carveout(rproc, mem);
> >> }
> >>
> >> + switch (dcfg->method) {
> >> + case IMX_RPROC_SM:
> >> + if (!(priv->flags & IMX_RPROC_FLAGS_SM_LMM_OP))
> >> + break;
> >> + /*
> >> + * Power on the Logical Machine to make sure TCM is available.
> >> + * Also serve as permission check. If in different Logical
> >> + * Machine, and linux has permission to handle the Logical
> >> + * Machine, set IMX_RPROC_FLAGS_SM_LMM_AVAIL.
> >> + */
> >> + ret = scmi_imx_lmm_operation(dcfg->lmid, SCMI_IMX_LMM_POWER_ON, 0);
> >> + if (ret == 0) {
> >> + dev_info(priv->dev, "lmm(%d) powered on\n", dcfg->lmid);
> >> + priv->flags |= IMX_RPROC_FLAGS_SM_LMM_AVAIL;
> >
> >This is set all the time imx_rproc_prepare() is called - isn't there a way to
> >set it once at initialisation time?
>
> Yeah. Moving this to probe path should be ok, such as in imx_rproc_detect_mode.
> The drawback is M7 logical machine will be left in powered up state if
> moving to probe path before user starts M7 LM. Leaving in here means M7 logcal
> machine will be only powered up when user does
> "echo start > /xx/remoteproc-y/state", but needs to set
> IMX_RPROC_FLAGS_SM_LMM_AVAIL flags each time do preparing.
>
> If you prefer moving this logic to probe, I could give a try to move
> to imx_rproc_detect_mode which is probe path.
>
> How do you think?
Just leave it where it is.
Mathieu
>
> >
> >> + } else if (ret == -EACCES) {
> >> + dev_info(priv->dev, "lmm(%d) not under Linux Control\n", dcfg->lmid);
> >> + /*
> >> + * If remote cores boots up in detached mode, continue;
> >> + * else linux has no permission, return -EACCES.
> >> + */
> >> + if (priv->rproc->state != RPROC_DETACHED)
> >> + return -EACCES;
> >> + } else if (ret) {
> >> + dev_err(priv->dev, "Failed to power on lmm(%d): %d\n", ret, dcfg->lmid);
> >> + return ret;
> >> + }
> >> +
> >> + break;
> >> + default:
> >> + break;
> >> + };
> >> +
> >
> >Please put this in a function and get rid of the switch{}.
>
> ok. Fix in v4
>
> >
> >> return 0;
> >> }
> >>
> >> @@ -911,13 +988,41 @@ static int imx_rproc_detect_mode(struct imx_rproc *priv)
> >> struct regmap_config config = { .name = "imx-rproc" };
> >> const struct imx_rproc_dcfg *dcfg = priv->dcfg;
> >> struct device *dev = priv->dev;
> >> + struct scmi_imx_lmm_info info;
> >> struct regmap *regmap;
> >> struct arm_smccc_res res;
> >> + bool started = false;
> >> int ret;
> >> u32 val;
> >> u8 pt;
> >>
> >> switch (dcfg->method) {
> >> + case IMX_RPROC_SM:
> >> + /* Get current Linux Logical Machine ID */
> >> + ret = scmi_imx_lmm_info(LMM_ID_DISCOVER, &info);
> >> + if (ret) {
> >> + dev_err(dev, "Failed to get current LMM ID err: %d\n", ret);
> >> + return ret;
> >> + }
> >> +
> >> + /*
> >> + * Check whether remote processor is in same Logical Machine as Linux.
> >> + * If no, need use Logical Machine API to manage remote processor, and
> >> + * set IMX_RPROC_FLAGS_SM_LMM_OP.
> >> + * If yes, use CPU protocol API to manage remote processor.
> >> + */
> >> + if (dcfg->lmid != info.lmid) {
> >> + priv->flags |= IMX_RPROC_FLAGS_SM_LMM_OP;
> >> + dev_info(dev, "Using LMM Protocol OPS\n");
> >> + } else {
> >> + dev_info(dev, "Using CPU Protocol OPS\n");
> >> + }
> >> +
> >> + scmi_imx_cpu_started(dcfg->cpuid, &started);
> >
> >Function scmi_imx_cpu_started() returns a value that is not taken into account.
> >
> >> + if (started)
>
> I will update to "if (started || ret)" in v4, with ret assigned the return
> value of scmi_imx_cpu_started.
>
> Thanks,
> Peng
^ permalink raw reply [flat|nested] 23+ messages in thread
* RE: [PATCH v3 2/5] remoteproc: imx_rproc: Add support for System Manager API
2025-07-09 14:33 ` Mathieu Poirier
@ 2025-07-09 15:01 ` Peng Fan
0 siblings, 0 replies; 23+ messages in thread
From: Peng Fan @ 2025-07-09 15:01 UTC (permalink / raw)
To: Mathieu Poirier, Peng Fan (OSS)
Cc: Bjorn Andersson, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
Frank Li, Daniel Baluta, Iuliana Prodan,
linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org,
imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
> Subject: Re: [PATCH v3 2/5] remoteproc: imx_rproc: Add support for
> System Manager API
>
...
> > >
> > >This is set all the time imx_rproc_prepare() is called - isn't there
> > >a way to set it once at initialisation time?
> >
> > Yeah. Moving this to probe path should be ok, such as in
> imx_rproc_detect_mode.
> > The drawback is M7 logical machine will be left in powered up state if
> > moving to probe path before user starts M7 LM. Leaving in here
> means
> > M7 logcal machine will be only powered up when user does "echo
> start >
> > /xx/remoteproc-y/state", but needs to set
> IMX_RPROC_FLAGS_SM_LMM_AVAIL
> > flags each time do preparing.
> >
> > If you prefer moving this logic to probe, I could give a try to move
> > to imx_rproc_detect_mode which is probe path.
> >
> > How do you think?
>
> Just leave it where it is.
ok. I will just put this piece code in a separate function as you
commented in last reply and leave the function being invoked
in imx_rproc_prepare.
I will send out v4 with above change after test. It should
tomorrow.
Thanks,
Peng.
^ permalink raw reply [flat|nested] 23+ messages in thread
end of thread, other threads:[~2025-07-09 15:01 UTC | newest]
Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-25 2:23 [PATCH v3 0/5] remoteproc: imx_rproc: Support i.MX95 Peng Fan (OSS)
2025-06-25 2:23 ` [PATCH v3 1/5] dt-bindings: remoteproc: fsl,imx-rproc: Add support for i.MX95 Peng Fan (OSS)
2025-06-26 18:45 ` Frank Li
2025-06-27 7:06 ` Krzysztof Kozlowski
2025-06-25 2:23 ` [PATCH v3 2/5] remoteproc: imx_rproc: Add support for System Manager API Peng Fan (OSS)
2025-06-26 18:48 ` Frank Li
2025-07-08 16:32 ` Mathieu Poirier
2025-07-09 9:02 ` Peng Fan
2025-07-09 14:33 ` Mathieu Poirier
2025-07-09 15:01 ` Peng Fan
2025-06-25 2:23 ` [PATCH v3 3/5] remoteproc: imx_rproc: Add support for i.MX95 Peng Fan (OSS)
2025-06-26 18:50 ` Frank Li
2025-07-08 16:39 ` Mathieu Poirier
2025-07-09 7:49 ` Peng Fan
2025-07-09 14:31 ` Mathieu Poirier
2025-06-25 2:23 ` [PATCH v3 4/5] arm64: dts: imx95: Add SCMI LMM/CPU nodes Peng Fan (OSS)
2025-06-26 18:50 ` Frank Li
2025-06-25 2:23 ` [PATCH v3 5/5] arm64: dts: imx95-19x19-evk: Add CM7 nodes and vdev related memory regions Peng Fan (OSS)
2025-06-26 18:52 ` Frank Li
2025-06-27 3:21 ` Peng Fan
2025-06-25 20:25 ` [PATCH v3 0/5] remoteproc: imx_rproc: Support i.MX95 Rob Herring (Arm)
2025-06-26 3:56 ` Peng Fan
2025-07-03 5:01 ` Peng Fan
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).