* [PATCH v4 0/7] firmware: scmi/imx: Add i.MX95 LMM/CPU Protocol
@ 2025-04-08 8:44 Peng Fan (OSS)
2025-04-08 8:44 ` [PATCH v4 1/7] firmware: arm_scmi: imx: Add LMM and CPU documentation Peng Fan (OSS)
` (7 more replies)
0 siblings, 8 replies; 21+ messages in thread
From: Peng Fan (OSS) @ 2025-04-08 8:44 UTC (permalink / raw)
To: Sudeep Holla, Cristian Marussi, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: Dan Carpenter, linux-kernel, arm-scmi, linux-arm-kernel, imx,
devicetree, Peng Fan
i.MX95 System Manager(SM) implements Logical Machine Management(LMM) and
CPU protocol to manage Logical Machine(LM) and CPUs(eg, M7).
To manage M7 in a separate LM or in same LM as Linux itself. LMM APIs
and CPU APIs are needed.
When M7 is in LM 'lm-m7', and this LM is managable by 'linux-lm',
linux could use LMM_BOOT, LMM_SHUTDOWN and etc to manage 'lm-m7'.
If in same LM, use CPU_START, CPU_STOP, CPU_RESET_VECTOR_SET and etc to
manage M7.
Both LMM/CPU APIs will be used by remoteproc driver. The remoteproc
patchset will be posted out after this patchset gets reviewed or in
good shape per Maitainer's view.
Build pass with COMPILE_TEST
Tested with remoteproc on i.MX95
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
Changes in v4:
- In patch 1 to address Sudeep's comments
1. Several typo/format fixes in documentation
2. Describe what LM is in LMM part, update number LMs to use bits[4:0]
3. Limit max number of LM to 16
4. Add info for reason in LMM_RESET_REASON
5. Add info in CPU protocol part about the need for having a CPU protocol
in the presence of the LMM protocol
- In patch 3: use info->name instead of out->name, update
SCMI_IMX_LMM_NR_LM_MASK to cover bits[4:0]
- Add R-b from Cristian for patch 1 and patch 3, from Rob for patch 2
- Link to v3: https://lore.kernel.org/r/20250303-imx-lmm-cpu-v3-0-7695f6f61cfc@nxp.com
Changes in v3:
Patch 1: Correct LMM_ATTRIBUTE return values
Update the return status of LM_BOOT/RESET/SHUTDOWN/WAKE
clarify sync/async in the Introduction chapter of LMM
Update the Origin entry in LMM_RESET_REASON
Clarify CPU run/sleep mode
Add note for CPU protocol to indicate AP using PSCI, non-AP use OS.
Specify mandatory for each command in LMM/CPU per firmware owner.
For BBM/MISC which have optional command, I will update doc in separate patch later
Patch 2: Add description in binding doc
Patch 3: Unify scmi_imx_lmm_[boot,power_on], Use le32_get_bits
Patch 4: Unify scmi_imx_cpu_[start,stop], Use le32_encode_bits
Add pointer check in scmi_imx_cpu_started
correct nr_cpus calculation
Patch 5: Unify lmm shutdown,boot/power_on, update kconfig to avoid build bot issue
Add R-b
Patch 6: Unity cpu start/stop, update Kconfig to avoid build bot issue.
Add R-b
Ran smatch as below, no issue found.
~/smatch/smatch_scripts/kchecker drivers/firmware/arm_scmi/vendors/imx/
~/smatch/smatch_scripts/kchecker drivers/firmware/imx/
- Link to v2: https://lore.kernel.org/r/20250212-imx-lmm-cpu-v2-0-3aee005968c1@nxp.com
Changes in v2:
- Add dt-bindings patch 2
- Add a maintainer entry with patch 7
- Update doc to address various questions and make it clear
- Use strscpy to use scmi server returned string
- Drop extra blank line
- Shrink scmi_imx_cpu_attributes_get function args.
- Typo fixes
- Add LMM_RESET_VECTOR_SET
- Link to v1: https://lore.kernel.org/r/20250121-imx-lmm-cpu-v1-0-0eab7e073e4e@nxp.com
---
Peng Fan (7):
firmware: arm_scmi: imx: Add LMM and CPU documentation
dt-bindings: firmware: Add i.MX95 SCMI LMM and CPU protocol
firmware: arm_scmi: imx: Add i.MX95 LMM protocol
firmware: arm_scmi: imx: Add i.MX95 CPU Protocol
firmware: imx: Add i.MX95 SCMI LMM driver
firmware: imx: Add i.MX95 SCMI CPU driver
MAINTAINERS: add entry for i.MX SCMI extensions
.../bindings/firmware/nxp,imx95-scmi.yaml | 23 +
MAINTAINERS | 9 +
drivers/firmware/arm_scmi/vendors/imx/Kconfig | 24 +
drivers/firmware/arm_scmi/vendors/imx/Makefile | 2 +
drivers/firmware/arm_scmi/vendors/imx/imx-sm-cpu.c | 276 +++++++
drivers/firmware/arm_scmi/vendors/imx/imx-sm-lmm.c | 262 +++++++
drivers/firmware/arm_scmi/vendors/imx/imx95.rst | 828 +++++++++++++++++++++
drivers/firmware/imx/Kconfig | 22 +
drivers/firmware/imx/Makefile | 2 +
drivers/firmware/imx/sm-cpu.c | 85 +++
drivers/firmware/imx/sm-lmm.c | 91 +++
include/linux/firmware/imx/sm.h | 19 +
include/linux/scmi_imx_protocol.h | 42 ++
13 files changed, 1685 insertions(+)
---
base-commit: a1bbf852df875d12e8916095a961d890b7b939e0
change-id: 20250120-imx-lmm-cpu-418daaa257e2
Best regards,
--
Peng Fan <peng.fan@nxp.com>
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH v4 1/7] firmware: arm_scmi: imx: Add LMM and CPU documentation
2025-04-08 8:44 [PATCH v4 0/7] firmware: scmi/imx: Add i.MX95 LMM/CPU Protocol Peng Fan (OSS)
@ 2025-04-08 8:44 ` Peng Fan (OSS)
2025-04-08 8:44 ` [PATCH v4 2/7] dt-bindings: firmware: Add i.MX95 SCMI LMM and CPU protocol Peng Fan (OSS)
` (6 subsequent siblings)
7 siblings, 0 replies; 21+ messages in thread
From: Peng Fan (OSS) @ 2025-04-08 8:44 UTC (permalink / raw)
To: Sudeep Holla, Cristian Marussi, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: Dan Carpenter, linux-kernel, arm-scmi, linux-arm-kernel, imx,
devicetree, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Add i.MX95 Logical Machine Management and CPU Protocol documentation.
Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/firmware/arm_scmi/vendors/imx/imx95.rst | 828 ++++++++++++++++++++++++
1 file changed, 828 insertions(+)
diff --git a/drivers/firmware/arm_scmi/vendors/imx/imx95.rst b/drivers/firmware/arm_scmi/vendors/imx/imx95.rst
index b2dfd6c46ca2f5f12f0475c24cb54c060e9fa421..4e246a78a042a79eb81be35632079c7626bbbe57 100644
--- a/drivers/firmware/arm_scmi/vendors/imx/imx95.rst
+++ b/drivers/firmware/arm_scmi/vendors/imx/imx95.rst
@@ -32,6 +32,518 @@ port, and deploy the SM on supported processors.
The SM implements an interface compliant with the Arm SCMI Specification
with additional vendor specific extensions.
+System Control and Management Logical Machine Management Vendor Protocol
+========================================================================
+
+The SM adds the concept of logical machines (LMs). These are analogous to
+VMs and each has its own instance of SCMI. All normal SCMI calls only apply
+the LM running the calling agent. That includes boot, shutdown, reset,
+suspend, wake, etc. If a caller makes the SCMI base call to get a list
+of agents, it will only get those on that LM. Each LM is completely isolated
+from the others. This is mandatory for these to operate independently.
+
+This protocol is intended to support boot, shutdown, and reset of other logical
+machines (LM). It is usually used to allow one LM(e.g. OSPM) to manage
+another LM which is usually an offload or accelerator engine. Notifications
+from this protocol can also be used to manage a communication link to another
+LM. The LMM protocol provides commands to:
+
+- Describe the protocol version.
+- Discover implementation attributes.
+- Discover all the LMs defined in the system.
+- Boot a target LM.
+- Shutdown a target LM (gracefully or forcibly).
+- Reset a target LM (gracefully or forcibly).
+- Wake a target LM from suspend.
+- Suspend a target LM (gracefully).
+- Read boot/shutdown/reset information for a target LM.
+- Get notifications when a target LM boots or shuts down (e.g. LM 'X' requested
+ notification of LM 'Y' boots or shuts down, when LM 'Y' boots or shuts down,
+ SCMI firmware will send notification to LM 'X').
+
+'Graceful' means asking LM itself to shutdown/reset/etc (e.g. sending
+notification to Linux, Then Linux reboots or powers down itself). It is async
+command that the SUCCESS of the command just means the command successfully
+return, not means reboot/reset successfully finished.
+
+'Forceful' means the SM will force shutdown/reset/etc the LM. It is sync
+command that the SUCCESS of the command means the LM has been successfully
+shutdown/reset/etc.
+If the commands not have Graceful/Forceful flag settings, such as WAKE, SUSEND,
+it is a Graceful command.
+
+Commands:
+_________
+
+PROTOCOL_VERSION
+~~~~~~~~~~~~~~~~
+
+message_id: 0x0
+protocol_id: 0x80
+This command is mandatory.
+
++---------------+--------------------------------------------------------------+
+|Return values |
++---------------+--------------------------------------------------------------+
+|Name |Description |
++---------------+--------------------------------------------------------------+
+|int32 status | See ARM SCMI Specification for status code definitions. |
++---------------+--------------------------------------------------------------+
+|uint32 version | For this revision of the specification, this value must be |
+| | 0x10000. |
++---------------+--------------------------------------------------------------+
+
+PROTOCOL_ATTRIBUTES
+~~~~~~~~~~~~~~~~~~~
+
+message_id: 0x1
+protocol_id: 0x80
+This command is mandatory.
+
++------------------+-----------------------------------------------------------+
+|Return values |
++------------------+-----------------------------------------------------------+
+|Name |Description |
++------------------+-----------------------------------------------------------+
+|int32 status | See ARM SCMI Specification for status code definitions. |
++------------------+-----------------------------------------------------------+
+|uint32 attributes |Protocol attributes: |
+| |Bits[31:5] Reserved, must be zero. |
+| |Bits[4:0] Number of Logical Machines |
+| |Note that due to both hardware limitations and reset reason|
+| |field limitations, the max number of LM is 16. The minimum |
+| |is 1. |
++------------------+-----------------------------------------------------------+
+
+PROTOCOL_MESSAGE_ATTRIBUTES
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+message_id: 0x2
+protocol_id: 0x80
+This command is mandatory.
+
++------------------+-----------------------------------------------------------+
+|Return values |
++------------------+-----------------------------------------------------------+
+|Name |Description |
++------------------+-----------------------------------------------------------+
+|int32 status |SUCCESS: in case the message is implemented and available |
+| |to use. |
+| |NOT_FOUND: if the message identified by message_id is |
+| |invalid or not implemented |
++------------------+-----------------------------------------------------------+
+|uint32 attributes |Flags that are associated with a specific command in the |
+| |protocol. For all commands in this protocol, this |
+| |parameter has a value of 0 |
++------------------+-----------------------------------------------------------+
+
+LMM_ATTRIBUTES
+~~~~~~~~~~~~~~
+
+message_id: 0x3
+protocol_id: 0x80
+This command is mandatory.
+
++------------------+-----------------------------------------------------------+
+|Parameters |
++------------------+-----------------------------------------------------------+
+|Name |Description |
++------------------+-----------------------------------------------------------+
+|uint32 lmid |ID of the Logical Machine |
++------------------+-----------------------------------------------------------+
+|Return values |
++------------------+-----------------------------------------------------------+
+|Name |Description |
++------------------+-----------------------------------------------------------+
+|int32 status |SUCCESS: if valid attributes are returned. |
+| |NOT_FOUND: if lmid not points to a valid logical machine. |
+| |DENIED: if the agent does not have permission to get info |
+| |for the LM specified by lmid. |
++------------------+-----------------------------------------------------------+
+|uint32 lmid |Identifier of the LM whose identification is requested. |
+| |This field is: Populated with the lmid of the calling |
+| |agent, when the lmid parameter passed via the command is |
+| |0xFFFFFFFF. Identical to the lmid field passed via the |
+| |calling parameters, in all other cases |
++------------------+-----------------------------------------------------------+
+|uint32 attributes | Bits[31:0] reserved. must be zero |
++------------------+-----------------------------------------------------------+
+|uint32 state | Current state of the LM |
++------------------+-----------------------------------------------------------+
+|uint32 errStatus | Last error status recorded |
++------------------+-----------------------------------------------------------+
+|char name[16] | A NULL terminated ASCII string with the LM name, of up |
+| | to 16 bytes |
++------------------+-----------------------------------------------------------+
+
+LMM_BOOT
+~~~~~~~~
+
+message_id: 0x4
+protocol_id: 0x80
+This command is mandatory.
+
++------------------+-----------------------------------------------------------+
+|Parameters |
++------------------+-----------------------------------------------------------+
+|Name |Description |
++------------------+-----------------------------------------------------------+
+|uint32 lmid |ID of the Logical Machine |
++------------------+-----------------------------------------------------------+
+|Return values |
++------------------+-----------------------------------------------------------+
+|Name |Description |
++------------------+-----------------------------------------------------------+
+|int32 status |SUCCESS: if LM boots successfully started. |
+| |NOT_FOUND: if lmid not points to a valid logical machine. |
+| |INVALID_PARAMETERS: if lmid is same as the caller. |
+| |DENIED: if the agent does not have permission to manage the|
+| |the LM specified by lmid. |
++------------------+-----------------------------------------------------------+
+
+LMM_RESET
+~~~~~~~~~
+
+message_id: 0x5
+protocol_id: 0x80
+This command is mandatory.
+
++------------------+-----------------------------------------------------------+
+|Parameters |
++------------------+-----------------------------------------------------------+
+|Name |Description |
++------------------+-----------------------------------------------------------+
+|uint32 lmid |ID of the Logical Machine |
++------------------+-----------------------------------------------------------+
+|uint32 flags |Reset flags: |
+| |Bits[31:1] Reserved, must be zero. |
+| |Bit[0] Graceful request: |
+| |Set to 1 if the request is a graceful request. |
+| |Set to 0 if the request is a forceful request. |
++------------------+-----------------------------------------------------------+
+|Return values |
++------------------+-----------------------------------------------------------+
+|Name |Description |
++------------------+-----------------------------------------------------------+
+|int32 status |SUCCESS: The LMM RESET command finished successfully in |
+| |graceful reset or LM successfully resets in forceful reset.|
+| |NOT_FOUND: if lmid not points to a valid logical machine. |
+| |INVALID_PARAMETERS: if lmid is same as the caller. |
+| |DENIED: if the agent does not have permission to manage the|
+| |the LM specified by lmid. |
++------------------+-----------------------------------------------------------+
+
+LMM_SHUTDOWN
+~~~~~~~~~~~~
+
+message_id: 0x6
+protocol_id: 0x80
+This command is mandatory.
+
++------------------+-----------------------------------------------------------+
+|Parameters |
++------------------+-----------------------------------------------------------+
+|Name |Description |
++------------------+-----------------------------------------------------------+
+|uint32 lmid |ID of the Logical Machine |
++------------------+-----------------------------------------------------------+
+|uint32 flags |Reset flags: |
+| |Bits[31:1] Reserved, must be zero. |
+| |Bit[0] Graceful request: |
+| |Set to 1 if the request is a graceful request. |
+| |Set to 0 if the request is a forceful request. |
++------------------+-----------------------------------------------------------+
+|Return values |
++------------------+-----------------------------------------------------------+
+|Name |Description |
++------------------+-----------------------------------------------------------+
+|int32 status |SUCCESS: The LMM shutdown command finished successfully in |
+| |graceful request or LM successfully shutdown in forceful |
+| |request. |
+| |NOT_FOUND: if lmid not points to a valid logical machine. |
+| |INVALID_PARAMETERS: if lmid is same as the caller. |
+| |DENIED: if the agent does not have permission to manage the|
+| |the LM specified by lmid. |
++------------------+-----------------------------------------------------------+
+
+LMM_WAKE
+~~~~~~~~
+
+message_id: 0x7
+protocol_id: 0x80
+This command is mandatory.
+
++------------------+-----------------------------------------------------------+
+|Parameters |
++------------------+-----------------------------------------------------------+
+|Name |Description |
++------------------+-----------------------------------------------------------+
+|uint32 lmid |ID of the Logical Machine |
++------------------+-----------------------------------------------------------+
+|Return values |
++------------------+-----------------------------------------------------------+
+|Name |Description |
++------------------+-----------------------------------------------------------+
+|int32 status |SUCCESS: if LM wake command successfully returns. |
+| |NOT_FOUND: if lmid not points to a valid logical machine. |
+| |INVALID_PARAMETERS: if lmid is same as the caller. |
+| |DENIED: if the agent does not have permission to manage the|
+| |the LM specified by lmid. |
++------------------+-----------------------------------------------------------+
+
+LMM_SUSPEND
+~~~~~~~~~~~
+
+message_id: 0x8
+protocol_id: 0x80
+This command is mandatory.
+
++------------------+-----------------------------------------------------------+
+|Parameters |
++------------------+-----------------------------------------------------------+
+|Name |Description |
++------------------+-----------------------------------------------------------+
+|uint32 lmid |ID of the Logical Machine |
++------------------+-----------------------------------------------------------+
+|Return values |
++------------------+-----------------------------------------------------------+
+|Name |Description |
++------------------+-----------------------------------------------------------+
+|int32 status |SUCCESS: if LM suspend command successfully returns. |
+| |NOT_FOUND: if lmid not points to a valid logical machine. |
+| |INVALID_PARAMETERS: if lmid is same as the caller. |
+| |DENIED: if the agent does not have permission to manage the|
+| |the LM specified by lmid. |
++------------------+-----------------------------------------------------------+
+
+LMM_NOTIFY
+~~~~~~~~~~
+
+message_id: 0x9
+protocol_id: 0x80
+This command is mandatory.
+
++------------------+-----------------------------------------------------------+
+|Parameters |
++------------------+-----------------------------------------------------------+
+|Name |Description |
++------------------+-----------------------------------------------------------+
+|uint32 lmid |ID of the Logical Machine |
++------------------+-----------------------------------------------------------+
+|uint32 flags |Notification flags: |
+| |Bits[31:3] Reserved, must be zero. |
+| |Bit[3] Wake (resume) notification: |
+| |Set to 1 to send notification. |
+| |Set to 0 if no notification. |
+| |Bit[2] Suspend (sleep) notification: |
+| |Set to 1 to send notification. |
+| |Set to 0 if no notification. |
+| |Bit[1] Shutdown (off) notification: |
+| |Set to 1 to send notification. |
+| |Set to 0 if no notification. |
+| |Bit[0] Boot (on) notification: |
+| |Set to 1 to send notification. |
+| |Set to 0 if no notification |
++------------------+-----------------------------------------------------------+
+|Return values |
++------------------+-----------------------------------------------------------+
+|Name |Description |
++------------------+-----------------------------------------------------------+
+|int32 status |SUCCESS: if the notification state successfully updated. |
+| |NOT_FOUND: if lmid not points to a valid logical machine. |
+| |INVALID_PARAMETERS: if input attributes flag specifies |
+| |unsupported or invalid configurations. |
+| |DENIED: if the agent does not have permission to request |
+| |the notification. |
++------------------+-----------------------------------------------------------+
+
+LMM_RESET_REASON
+~~~~~~~~~~~~~~~~
+
+message_id: 0xA
+protocol_id: 0x80
+This command is mandatory.
+
+This command is to return the reset reason that caused the last reset, such as
+POR, WDOG, JTAG and etc.
+
++---------------------+--------------------------------------------------------+
+|Parameters |
++---------------------+--------------------------------------------------------+
+|Name |Description |
++---------------------+--------------------------------------------------------+
+|uint32 lmid |ID of the Logical Machine |
++---------------------+--------------------------------------------------------+
+|Return values |
++---------------------+--------------------------------------------------------+
+|Name |Description |
++---------------------+--------------------------------------------------------+
+|int32 status |SUCCESS: if the reset reason of the LM successfully |
+| |updated. |
+| |NOT_FOUND: if lmid not points to a valid logical machine|
+| |DENIED: if the agent does not have permission to request|
+| |the reset reason. |
++---------------------+--------------------------------------------------------+
+|uint32 bootflags |Boot reason flags. This parameter has the format: |
+| |Bits[31] Valid. |
+| |Set to 1 if the entire reason is valid. |
+| |Set to 0 if the entire reason is not valid. |
+| |Bits[30:29] Reserved, must be zero. |
+| |Bit[28] Valid origin: |
+| |Set to 1 if the origin field is valid. |
+| |Set to 0 if the origin field is not valid. |
+| |Bits[27:24] Origin. |
+| |Logical Machine(LM) ID that causes the BOOT of this LM |
+| |Bit[23] Valid err ID: |
+| |Set to 1 if the error ID field is valid. |
+| |Set to 0 if the error ID field is not valid. |
+| |Bits[22:8] Error ID(Agent ID of the system). |
+| |Bit[7:0] Reason(WDOG, POR, FCCU and etc): |
+| |See the SRESR register description in the System |
+| |Reset Controller (SRC) section in SoC reference mannual |
+| |One reason maps to BIT(reason) in SRESR |
++---------------------+--------------------------------------------------------+
+|uint32 shutdownflags |Shutdown reason flags. This parameter has the format: |
+| |Bits[31] Valid. |
+| |Set to 1 if the entire reason is valid. |
+| |Set to 0 if the entire reason is not valid. |
+| |Bits[30:29] Number of valid extended info words. |
+| |Bit[28] Valid origin: |
+| |Set to 1 if the origin field is valid. |
+| |Set to 0 if the origin field is not valid. |
+| |Bits[27:24] Origin. |
+| |Logical Machine(LM) ID that causes the BOOT of this LM |
+| |Bit[23] Valid err ID: |
+| |Set to 1 if the error ID field is valid. |
+| |Set to 0 if the error ID field is not valid. |
+| |Bits[22:8] Error ID(Agent ID of the System). |
+| |Bit[7:0] Reason |
+| |See the SRESR register description in the System |
+| |Reset Controller (SRC) section in SoC reference mannual |
+| |One reason maps to BIT(reason) in SRESR |
++---------------------+--------------------------------------------------------+
+|uint32 extinfo[3] |Array of extended info words(e.g. fault pc) |
++---------------------+--------------------------------------------------------+
+
+LMM_POWER_ON
+~~~~~~~~~~~~
+
+message_id: 0xB
+protocol_id: 0x80
+This command is mandatory.
+
++------------------+-----------------------------------------------------------+
+|Parameters |
++------------------+-----------------------------------------------------------+
+|Name |Description |
++------------------+-----------------------------------------------------------+
+|uint32 lmid |ID of the Logical Machine |
++------------------+-----------------------------------------------------------+
+|Return values |
++------------------+-----------------------------------------------------------+
+|Name |Description |
++------------------+-----------------------------------------------------------+
+|int32 status |SUCCESS: if LM successfully powers on. |
+| |NOT_FOUND: if lmid not points to a valid logical machine. |
+| |INVALID_PARAMETERS: if lmid is same as the caller. |
+| |DENIED: if the agent does not have permission to manage the|
+| |the LM specified by lmid. |
++------------------+-----------------------------------------------------------+
+
+LMM_RESET_VECTOR_SET
+~~~~~~~~~~~~~~~~~~~~
+
+message_id: 0xC
+protocol_id: 0x80
+This command is mandatory.
+
++-----------------------+------------------------------------------------------+
+|Parameters |
++-----------------------+------------------------------------------------------+
+|Name |Description |
++-----------------------+------------------------------------------------------+
+|uint32 lmid |ID of the Logical Machine |
++-----------------------+------------------------------------------------------+
+|uint32 cpuid |ID of the CPU inside the LM |
++-----------------------+------------------------------------------------------+
+|uint32 flags |Reset vector flags |
+| |Bits[31:0] Reserved, must be zero. |
++-----------------------+------------------------------------------------------+
+|uint32 resetVectorLow |Lower vector |
++-----------------------+------------------------------------------------------+
+|uint32 resetVectorHigh |Higher vector |
++-----------------------+------------------------------------------------------+
+|Return values |
++-----------------------+------------------------------------------------------+
+|Name |Description |
++-----------------------+------------------------------------------------------+
+|int32 status |SUCCESS: If reset vector is set successfully. |
+| |NOT_FOUND: if lmid not points to a valid logical |
+| |machine, or cpuId is not valid. |
+| |INVALID_PARAMETERS: if reset vector is invalid. |
+| |DENIED: if the agent does not have permission to set |
+| |the reset vector for the CPU in the LM. |
++-----------------------+------------------------------------------------------+
+
+NEGOTIATE_PROTOCOL_VERSION
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+message_id: 0x10
+protocol_id: 0x80
+This command is mandatory.
+
++--------------------+---------------------------------------------------------+
+|Parameters |
++--------------------+---------------------------------------------------------+
+|Name |Description |
++--------------------+---------------------------------------------------------+
+|uint32 version |The negotiated protocol version the agent intends to use |
++--------------------+---------------------------------------------------------+
+|Return values |
++--------------------+---------------------------------------------------------+
+|Name |Description |
++--------------------+---------------------------------------------------------+
+|int32 status |SUCCESS: if the negotiated protocol version is supported |
+| |by the platform. All commands, responses, and |
+| |notifications post successful return of this command must|
+| |comply with the negotiated version. |
+| |NOT_SUPPORTED: if the protocol version is not supported. |
++--------------------+---------------------------------------------------------+
+
+Notifications
+_____________
+
+LMM_EVENT
+~~~~~~~~~
+
+message_id: 0x0
+protocol_id: 0x80
+
++------------------+-----------------------------------------------------------+
+|Parameters |
++------------------+-----------------------------------------------------------+
+|Name |Description |
++------------------+-----------------------------------------------------------+
+|uint32 lmid |Identifier for the LM that caused the transition. |
++------------------+-----------------------------------------------------------+
+|uint32 eventlm |Identifier of the LM this event refers to. |
++------------------+-----------------------------------------------------------+
+|uint32 flags |LM events: |
+| |Bits[31:3] Reserved, must be zero. |
+| |Bit[3] Wake (resume) event: |
+| |1 LM has awakened. |
+| |0 not a wake event. |
+| |Bit[2] Suspend (sleep) event: |
+| |1 LM has suspended. |
+| |0 not a suspend event. |
+| |Bit[1] Shutdown (off) event: |
+| |1 LM has shutdown. |
+| |0 not a shutdown event. |
+| |Bit[0] Boot (on) event: |
+| |1 LM has booted. |
+| |0 not a boot event. |
++------------------+-----------------------------------------------------------+
+
SCMI_BBM: System Control and Management BBM Vendor Protocol
==============================================================
@@ -436,6 +948,322 @@ protocol_id: 0x81
| |0 no button change detected. |
+------------------+-----------------------------------------------------------+
+System Control and Management CPU Vendor Protocol
+=================================================
+
+This protocol allows an agent to start or stop a CPU. It is used to manage
+auxiliary CPUs in a target LM (e.g. additional cores in an AP cluster or
+Cortex-M cores).
+Note:
+ - For cores in AP cluster, PSCI should be used and PSCI firmware will use CPU
+ protocol to handle them. For cores in non-AP cluster, Operating System(e.g.
+ Linux OS) could use CPU protocols to control Cortex-M7 cores.
+ - CPU indicates the core and its auxiliary peripherals(e.g. TCM) inside
+ i.MX SoC
+
+There are cases where giving an agent full control of a CPU via the CPU
+protocol is not desired. The LMM protocol is more restricted to just boot,
+shutdown, etc. So an agent might boot another logical machine but not be
+able to directly mess the state of its CPUs. Its also the reason there is an
+LMM power on command even though that could have been done through the
+power protocol.
+
+The CPU protocol provides commands to:
+
+- Describe the protocol version.
+- Discover implementation attributes.
+- Discover the CPUs defined in the system.
+- Start a CPU.
+- Stop a CPU.
+- Set the boot and resume addresses for a CPU.
+- Set the sleep mode of a CPU.
+- Configure wake-up sources for a CPU.
+- Configure power domain reactions (LPM mode and retention mask) for a CPU.
+- The CPU IDs can be found in the CPU section of the SoC DEVICE: SM Device
+ Interface. They can also be found in the SoC RM. See the CPU Mode Control
+ (CMC) list in General Power Controller (GPC) section.
+
+CPU settings are not aggregated and setting their state is normally exclusive
+to one client.
+
+Commands:
+_________
+
+PROTOCOL_VERSION
+~~~~~~~~~~~~~~~~
+
+message_id: 0x0
+protocol_id: 0x82
+This command is mandatory.
+
++---------------+--------------------------------------------------------------+
+|Return values |
++---------------+--------------------------------------------------------------+
+|Name |Description |
++---------------+--------------------------------------------------------------+
+|int32 status | See ARM SCMI Specification for status code definitions. |
++---------------+--------------------------------------------------------------+
+|uint32 version | For this revision of the specification, this value must be |
+| | 0x10000. |
++---------------+--------------------------------------------------------------+
+
+PROTOCOL_ATTRIBUTES
+~~~~~~~~~~~~~~~~~~~
+
+message_id: 0x1
+protocol_id: 0x82
+This command is mandatory.
+
++---------------+--------------------------------------------------------------+
+|Return values |
++------------------+-----------------------------------------------------------+
+|Name |Description |
++------------------+-----------------------------------------------------------+
+|int32 status | See ARM SCMI Specification for status code definitions. |
++------------------+-----------------------------------------------------------+
+|uint32 attributes |Protocol attributes: |
+| |Bits[31:16] Reserved, must be zero. |
+| |Bits[15:0] Number of CPUs |
++------------------+-----------------------------------------------------------+
+
+PROTOCOL_MESSAGE_ATTRIBUTES
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+message_id: 0x2
+protocol_id: 0x82
+This command is mandatory.
+
++---------------+--------------------------------------------------------------+
+|Return values |
++------------------+-----------------------------------------------------------+
+|Name |Description |
++------------------+-----------------------------------------------------------+
+|int32 status |SUCCESS: in case the message is implemented and available |
+| |to use. |
+| |NOT_FOUND: if the message identified by message_id is |
+| |invalid or not implemented |
++------------------+-----------------------------------------------------------+
+|uint32 attributes |Flags that are associated with a specific command in the |
+| |protocol. For all commands in this protocol, this |
+| |parameter has a value of 0 |
++------------------+-----------------------------------------------------------+
+
+CPU_ATTRIBUTES
+~~~~~~~~~~~~~~
+
+message_id: 0x4
+protocol_id: 0x82
+This command is mandatory.
+
++------------------+-----------------------------------------------------------+
+|Parameters |
++------------------+-----------------------------------------------------------+
+|Name |Description |
++------------------+-----------------------------------------------------------+
+|uint32 cpuid |Identifier for the CPU |
++------------------+-----------------------------------------------------------+
+|Return values |
++------------------+-----------------------------------------------------------+
+|Name |Description |
++------------------+-----------------------------------------------------------+
+|int32 status |SUCCESS: if valid attributes are returned successfully. |
+| |NOT_FOUND: if the cpuid is not valid. |
++------------------+-----------------------------------------------------------+
+|uint32 attributes |Bits[31:0] Reserved, must be zero |
++------------------+-----------------------------------------------------------+
+|char name[16] |NULL terminated ASCII string with CPU name up to 16 bytes |
++------------------+-----------------------------------------------------------+
+
+CPU_START
+~~~~~~~~~
+
+message_id: 0x4
+protocol_id: 0x82
+This command is mandatory.
+
++------------------+-----------------------------------------------------------+
+|Parameters |
++------------------+-----------------------------------------------------------+
+|Name |Description |
++------------------+-----------------------------------------------------------+
+|uint32 cpuid |Identifier for the CPU |
++------------------+-----------------------------------------------------------+
+|Return values |
++------------------+-----------------------------------------------------------+
+|Name |Description |
++------------------+-----------------------------------------------------------+
+|int32 status |SUCCESS: if the cpu is started successfully. |
+| |NOT_FOUND: if cpuid is not valid. |
+| |DENIED: the calling agent is not allowed to start this CPU.|
++------------------+-----------------------------------------------------------+
+
+CPU_STOP
+~~~~~~~~
+
+message_id: 0x5
+protocol_id: 0x82
+This command is mandatory.
+
++------------------+-----------------------------------------------------------+
+|Parameters |
++------------------+-----------------------------------------------------------+
+|Name |Description |
++------------------+-----------------------------------------------------------+
+|uint32 cpuid |Identifier for the CPU |
++------------------+-----------------------------------------------------------+
+|Return values |
++------------------+-----------------------------------------------------------+
+|Name |Description |
++------------------+-----------------------------------------------------------+
+|int32 status |SUCCESS: if the cpu is started successfully. |
+| |NOT_FOUND: if cpuid is not valid. |
+| |DENIED: the calling agent is not allowed to stop this CPU. |
++------------------+-----------------------------------------------------------+
+
+CPU_RESET_VECTOR_SET
+~~~~~~~~~~~~~~~~~~~~
+
+message_id: 0x6
+protocol_id: 0x82
+This command is mandatory.
+
++----------------------+-------------------------------------------------------+
+|Parameters |
++----------------------+-------------------------------------------------------+
+|Name |Description |
++----------------------+-------------------------------------------------------+
+|uint32 cpuid |Identifier for the CPU |
++----------------------+-------------------------------------------------------+
+|uint32 flags |Reset vector flags: |
+| |Bit[31] Resume flag. |
+| |Set to 1 to update the reset vector used on resume. |
+| |Bit[30] Boot flag. |
+| |Set to 1 to update the reset vector used for boot. |
+| |Bits[29:1] Reserved, must be zero. |
+| |Bit[0] Table flag. |
+| |Set to 1 if vector is the vector table base address. |
++----------------------+-------------------------------------------------------+
+|uint32 resetVectorLow |Lower vector: |
+| |If bit[0] of flags is 0, the lower 32 bits of the |
+| |physical address where the CPU should execute from on |
+| |reset. If bit[0] of flags is 1, the lower 32 bits of |
+| |the vector table base address |
++----------------------+-------------------------------------------------------+
+|uint32 resetVectorhigh|Upper vector: |
+| |If bit[0] of flags is 0, the upper 32 bits of the |
+| |physical address where the CPU should execute from on |
+| |reset. If bit[0] of flags is 1, the upper 32 bits of |
+| |the vector table base address |
++----------------------+-------------------------------------------------------+
+|Return values |
++----------------------+-------------------------------------------------------+
+|Name |Description |
++----------------------+-------------------------------------------------------+
+|int32 status |SUCCESS: if the CPU reset vector is set successfully. |
+| |NOT_FOUND: if cpuId does not point to a valid CPU. |
+| |INVALID_PARAMETERS: the requested vector type is not |
+| |supported by this CPU. |
+| |DENIED: the calling agent is not allowed to set the |
+| |reset vector of this CPU |
++----------------------+-------------------------------------------------------+
+
+CPU_SLEEP_MODE_SET
+~~~~~~~~~~~~~~~~~~
+
+message_id: 0x7
+protocol_id: 0x82
+This command is mandatory.
+
++----------------------+-------------------------------------------------------+
+|Parameters |
++----------------------+-------------------------------------------------------+
+|Name |Description |
++----------------------+-------------------------------------------------------+
+|uint32 cpuid |Identifier for the CPU |
++----------------------+-------------------------------------------------------+
+|uint32 flags |Sleep mode flags: |
+| |Bits[31:1] Reserved, must be zero. |
+| |Bit[0] IRQ mux: |
+| |If set to 1 the wakeup mux source is the GIC, else if 0|
+| |then the GPC |
++----------------------+-------------------------------------------------------+
+|uint32 sleepmode |target sleep mode. When CPU runs into WFI, the GPC mode|
+| |will be triggered to be in below modes: |
+| |RUN: (0) |
+| |WAIT: (1) |
+| |STOP: (2) |
+| |SUSPEND: (3) |
++----------------------+-------------------------------------------------------+
+|Return values |
++----------------------+-------------------------------------------------------+
+|Name |Description |
++----------------------+-------------------------------------------------------+
+|int32 status |SUCCESS: if the CPU sleep mode is set successfully. |
+| |NOT_FOUND: if cpuId does not point to a valid CPU. |
+| |INVALID_PARAMETERS: the sleepmode or flags is invalid. |
+| |DENIED: the calling agent is not allowed to configure |
+| |the CPU |
++----------------------+-------------------------------------------------------+
+
+CPU_INFO_GET
+~~~~~~~~~~~~
+
+message_id: 0xC
+protocol_id: 0x82
+This command is mandatory.
+
++----------------------+-------------------------------------------------------+
+|Parameters |
++----------------------+-------------------------------------------------------+
+|Name |Description |
++----------------------+-------------------------------------------------------+
+|uint32 cpuid |Identifier for the CPU |
++----------------------+-------------------------------------------------------+
+|Return values |
++----------------------+-------------------------------------------------------+
+|Name |Description |
++----------------------+-------------------------------------------------------+
+|int32 status |SUCCESS: if valid attributes are returned successfully.|
+| |NOT_FOUND: if the cpuid is not valid. |
++----------------------+-------------------------------------------------------+
+|uint32 runmode |Run mode for the CPU |
+| |RUN(0):cpu started |
+| |HOLD(1):cpu powered up and reset asserted |
+| |STOP(2):cpu reseted and hold cpu |
+| |SUSPEND(3):in cpuidle state |
++----------------------+-------------------------------------------------------+
+|uint32 sleepmode |Sleep mode for the CPU, see CPU_SLEEP_MODE_SET |
++----------------------+-------------------------------------------------------+
+|uint32 resetvectorlow |Reset vector low 32 bits for the CPU |
++----------------------+-------------------------------------------------------+
+|uint32 resetvecothigh |Reset vector high 32 bits for the CPU |
++----------------------+-------------------------------------------------------+
+
+NEGOTIATE_PROTOCOL_VERSION
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+message_id: 0x10
+protocol_id: 0x82
+This command is mandatory.
+
++--------------------+---------------------------------------------------------+
+|Parameters |
++--------------------+---------------------------------------------------------+
+|Name |Description |
++--------------------+---------------------------------------------------------+
+|uint32 version |The negotiated protocol version the agent intends to use |
++--------------------+---------------------------------------------------------+
+|Return values |
++--------------------+---------------------------------------------------------+
+|Name |Description |
++--------------------+---------------------------------------------------------+
+|int32 status |SUCCESS: if the negotiated protocol version is supported |
+| |by the platform. All commands, responses, and |
+| |notifications post successful return of this command must|
+| |comply with the negotiated version. |
+| |NOT_SUPPORTED: if the protocol version is not supported. |
++--------------------+---------------------------------------------------------+
+
SCMI_MISC: System Control and Management MISC Vendor Protocol
================================================================
--
2.37.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v4 2/7] dt-bindings: firmware: Add i.MX95 SCMI LMM and CPU protocol
2025-04-08 8:44 [PATCH v4 0/7] firmware: scmi/imx: Add i.MX95 LMM/CPU Protocol Peng Fan (OSS)
2025-04-08 8:44 ` [PATCH v4 1/7] firmware: arm_scmi: imx: Add LMM and CPU documentation Peng Fan (OSS)
@ 2025-04-08 8:44 ` Peng Fan (OSS)
2025-04-08 8:44 ` [PATCH v4 3/7] firmware: arm_scmi: imx: Add i.MX95 LMM protocol Peng Fan (OSS)
` (5 subsequent siblings)
7 siblings, 0 replies; 21+ messages in thread
From: Peng Fan (OSS) @ 2025-04-08 8:44 UTC (permalink / raw)
To: Sudeep Holla, Cristian Marussi, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: Dan Carpenter, linux-kernel, arm-scmi, linux-arm-kernel, imx,
devicetree, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Add i.MX SCMI Extension protocols bindings for:
- Logic Machine Management(LMM) Protocol
intended for boot, shutdown, and reset of other logical machines (LM).
It is usually used to allow one LM to manager another used as an offload
or accelerator engine..
- CPU Protocol.
allows an agent to start or stop a CPU. It is used to manage auxiliary
CPUs in an LM (e.g. additional cores in an AP cluster).
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
.../bindings/firmware/nxp,imx95-scmi.yaml | 23 ++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/Documentation/devicetree/bindings/firmware/nxp,imx95-scmi.yaml b/Documentation/devicetree/bindings/firmware/nxp,imx95-scmi.yaml
index 1a95010a546b14b1d3d97aa990c0305a551f2620..2bda2e0e13693f12816762137e07dc308d2c49e4 100644
--- a/Documentation/devicetree/bindings/firmware/nxp,imx95-scmi.yaml
+++ b/Documentation/devicetree/bindings/firmware/nxp,imx95-scmi.yaml
@@ -11,6 +11,18 @@ maintainers:
- Peng Fan <peng.fan@nxp.com>
properties:
+ protocol@80:
+ description:
+ SCMI LMM protocol which is for boot, shutdown, and reset of other logical
+ machines (LM). It is usually used to allow one LM to manage another used
+ as an offload or accelerator engine.
+ $ref: '/schemas/firmware/arm,scmi.yaml#/$defs/protocol-node'
+ unevaluatedProperties: false
+
+ properties:
+ reg:
+ const: 0x80
+
protocol@81:
$ref: '/schemas/firmware/arm,scmi.yaml#/$defs/protocol-node'
unevaluatedProperties: false
@@ -19,6 +31,17 @@ properties:
reg:
const: 0x81
+ protocol@82:
+ description:
+ SCMI CPU Protocol which allows an agent to start or stop a CPU. It is
+ used to manage auxiliary CPUs in a LM.
+ $ref: '/schemas/firmware/arm,scmi.yaml#/$defs/protocol-node'
+ unevaluatedProperties: false
+
+ properties:
+ reg:
+ const: 0x82
+
protocol@84:
$ref: '/schemas/firmware/arm,scmi.yaml#/$defs/protocol-node'
unevaluatedProperties: false
--
2.37.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v4 3/7] firmware: arm_scmi: imx: Add i.MX95 LMM protocol
2025-04-08 8:44 [PATCH v4 0/7] firmware: scmi/imx: Add i.MX95 LMM/CPU Protocol Peng Fan (OSS)
2025-04-08 8:44 ` [PATCH v4 1/7] firmware: arm_scmi: imx: Add LMM and CPU documentation Peng Fan (OSS)
2025-04-08 8:44 ` [PATCH v4 2/7] dt-bindings: firmware: Add i.MX95 SCMI LMM and CPU protocol Peng Fan (OSS)
@ 2025-04-08 8:44 ` Peng Fan (OSS)
2025-04-08 9:17 ` Dan Carpenter
2025-04-08 9:21 ` Dan Carpenter
2025-04-08 8:44 ` [PATCH v4 4/7] firmware: arm_scmi: imx: Add i.MX95 CPU Protocol Peng Fan (OSS)
` (4 subsequent siblings)
7 siblings, 2 replies; 21+ messages in thread
From: Peng Fan (OSS) @ 2025-04-08 8:44 UTC (permalink / raw)
To: Sudeep Holla, Cristian Marussi, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: Dan Carpenter, linux-kernel, arm-scmi, linux-arm-kernel, imx,
devicetree, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Add Logical Machine Management(LMM) protocol which is intended for boot,
shutdown, and reset of other logical machines (LM). It is usually used to
allow one LM to manager another used as an offload or accelerator engine.
Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/firmware/arm_scmi/vendors/imx/Kconfig | 11 +
drivers/firmware/arm_scmi/vendors/imx/Makefile | 1 +
drivers/firmware/arm_scmi/vendors/imx/imx-sm-lmm.c | 262 +++++++++++++++++++++
include/linux/scmi_imx_protocol.h | 32 +++
4 files changed, 306 insertions(+)
diff --git a/drivers/firmware/arm_scmi/vendors/imx/Kconfig b/drivers/firmware/arm_scmi/vendors/imx/Kconfig
index a01bf5e47301d2f93c9bfc7eebc77e083ea4ed75..1a936fc87d2350e2a21bccd45dfbeebfa3b90286 100644
--- a/drivers/firmware/arm_scmi/vendors/imx/Kconfig
+++ b/drivers/firmware/arm_scmi/vendors/imx/Kconfig
@@ -12,6 +12,17 @@ config IMX_SCMI_BBM_EXT
To compile this driver as a module, choose M here: the
module will be called imx-sm-bbm.
+config IMX_SCMI_LMM_EXT
+ tristate "i.MX SCMI LMM EXTENSION"
+ depends on ARM_SCMI_PROTOCOL || (COMPILE_TEST && OF)
+ default y if ARCH_MXC
+ help
+ This enables i.MX System Logical Machine Protocol to
+ manage Logical Machines boot, shutdown and etc.
+
+ To compile this driver as a module, choose M here: the
+ module will be called imx-sm-lmm.
+
config IMX_SCMI_MISC_EXT
tristate "i.MX SCMI MISC EXTENSION"
depends on ARM_SCMI_PROTOCOL || (COMPILE_TEST && OF)
diff --git a/drivers/firmware/arm_scmi/vendors/imx/Makefile b/drivers/firmware/arm_scmi/vendors/imx/Makefile
index d3ee6d5449244a4f5cdf6abcf1845f312c512325..f39a99ccaf9af757475e8b112d224669444d7ddc 100644
--- a/drivers/firmware/arm_scmi/vendors/imx/Makefile
+++ b/drivers/firmware/arm_scmi/vendors/imx/Makefile
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: GPL-2.0-only
obj-$(CONFIG_IMX_SCMI_BBM_EXT) += imx-sm-bbm.o
+obj-$(CONFIG_IMX_SCMI_LMM_EXT) += imx-sm-lmm.o
obj-$(CONFIG_IMX_SCMI_MISC_EXT) += imx-sm-misc.o
diff --git a/drivers/firmware/arm_scmi/vendors/imx/imx-sm-lmm.c b/drivers/firmware/arm_scmi/vendors/imx/imx-sm-lmm.c
new file mode 100644
index 0000000000000000000000000000000000000000..7f4febe2e17770d745f936dff25b556d8e4f20c8
--- /dev/null
+++ b/drivers/firmware/arm_scmi/vendors/imx/imx-sm-lmm.c
@@ -0,0 +1,262 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * System control and Management Interface (SCMI) NXP LMM Protocol
+ *
+ * Copyright 2025 NXP
+ */
+
+#include <linux/bits.h>
+#include <linux/io.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/scmi_protocol.h>
+#include <linux/scmi_imx_protocol.h>
+
+#include "../../protocols.h"
+#include "../../notify.h"
+
+#define SCMI_PROTOCOL_SUPPORTED_VERSION 0x10000
+
+enum scmi_imx_lmm_protocol_cmd {
+ SCMI_IMX_LMM_ATTRIBUTES = 0x3,
+ SCMI_IMX_LMM_BOOT = 0x4,
+ SCMI_IMX_LMM_RESET = 0x5,
+ SCMI_IMX_LMM_SHUTDOWN = 0x6,
+ SCMI_IMX_LMM_WAKE = 0x7,
+ SCMI_IMX_LMM_SUSPEND = 0x8,
+ SCMI_IMX_LMM_NOTIFY = 0x9,
+ SCMI_IMX_LMM_RESET_REASON = 0xA,
+ SCMI_IMX_LMM_POWER_ON = 0xB,
+ SCMI_IMX_LMM_RESET_VECTOR_SET = 0xC,
+};
+
+struct scmi_imx_lmm_priv {
+ u32 nr_lmm;
+};
+
+#define SCMI_IMX_LMM_NR_LM_MASK GENMASK(5, 0)
+#define SCMI_IMX_LMM_NR_MAX 16
+struct scmi_msg_imx_lmm_protocol_attributes {
+ __le32 attributes;
+};
+
+struct scmi_msg_imx_lmm_attributes_out {
+ __le32 lmid;
+ __le32 attributes;
+ __le32 state;
+ __le32 errstatus;
+ u8 name[LMM_MAX_NAME];
+};
+
+struct scmi_imx_lmm_reset_vector_set_in {
+ __le32 lmid;
+ __le32 cpuid;
+ __le32 flags; /* reserved for future extension */
+ __le32 resetvectorlow;
+ __le32 resetvectorhigh;
+};
+
+struct scmi_imx_lmm_shutdown_in {
+ __le32 lmid;
+#define SCMI_IMX_LMM_SHUTDOWN_GRACEFUL BIT(0)
+ __le32 flags;
+};
+
+static int scmi_imx_lmm_validate_lmid(const struct scmi_protocol_handle *ph, u32 lmid)
+{
+ struct scmi_imx_lmm_priv *priv = ph->get_priv(ph);
+
+ if (lmid >= priv->nr_lmm)
+ return -EINVAL;
+
+ return 0;
+}
+
+static int scmi_imx_lmm_attributes(const struct scmi_protocol_handle *ph,
+ u32 lmid, struct scmi_imx_lmm_info *info)
+{
+ struct scmi_msg_imx_lmm_attributes_out *out;
+ struct scmi_xfer *t;
+ int ret;
+
+ ret = ph->xops->xfer_get_init(ph, SCMI_IMX_LMM_ATTRIBUTES, sizeof(u32), 0, &t);
+ if (ret)
+ return ret;
+
+ put_unaligned_le32(lmid, t->tx.buf);
+ ret = ph->xops->do_xfer(ph, t);
+ if (!ret) {
+ out = t->rx.buf;
+ info->lmid = le32_to_cpu(out->lmid);
+ info->state = le32_to_cpu(out->state);
+ info->errstatus = le32_to_cpu(out->errstatus);
+ strscpy(info->name, out->name);
+ dev_dbg(ph->dev, "i.MX LMM: Logical Machine(%d), name: %s\n",
+ info->lmid, info->name);
+ } else {
+ dev_err(ph->dev, "i.MX LMM: Failed to get info of Logical Machine(%u)\n", lmid);
+ }
+
+ ph->xops->xfer_put(ph, t);
+
+ return ret;
+}
+
+static int
+scmi_imx_lmm_power_boot(const struct scmi_protocol_handle *ph, u32 lmid, bool boot)
+{
+ struct scmi_xfer *t;
+ u8 msg_id;
+ int ret;
+
+ ret = scmi_imx_lmm_validate_lmid(ph, lmid);
+ if (ret)
+ return ret;
+
+ if (boot)
+ msg_id = SCMI_IMX_LMM_BOOT;
+ else
+ msg_id = SCMI_IMX_LMM_POWER_ON;
+
+ ret = ph->xops->xfer_get_init(ph, msg_id, sizeof(u32), 0, &t);
+ if (ret)
+ return ret;
+
+ put_unaligned_le32(lmid, t->tx.buf);
+ ret = ph->xops->do_xfer(ph, t);
+
+ ph->xops->xfer_put(ph, t);
+
+ return ret;
+}
+
+static int scmi_imx_lmm_reset_vector_set(const struct scmi_protocol_handle *ph,
+ u32 lmid, u32 cpuid, u32 flags, u64 vector)
+{
+ struct scmi_imx_lmm_reset_vector_set_in *in;
+ struct scmi_xfer *t;
+ int ret;
+
+ ret = ph->xops->xfer_get_init(ph, SCMI_IMX_LMM_RESET_VECTOR_SET, sizeof(*in),
+ 0, &t);
+ if (ret)
+ return ret;
+
+ in = t->tx.buf;
+ in->lmid = cpu_to_le32(lmid);
+ in->cpuid = cpu_to_le32(cpuid);
+ in->flags = cpu_to_le32(0);
+ in->resetvectorlow = cpu_to_le32(lower_32_bits(vector));
+ in->resetvectorhigh = cpu_to_le32(upper_32_bits(vector));
+ ret = ph->xops->do_xfer(ph, t);
+
+ ph->xops->xfer_put(ph, t);
+
+ return ret;
+}
+
+static int scmi_imx_lmm_shutdown(const struct scmi_protocol_handle *ph, u32 lmid,
+ u32 flags)
+{
+ struct scmi_imx_lmm_shutdown_in *in;
+ struct scmi_xfer *t;
+ int ret;
+
+ ret = scmi_imx_lmm_validate_lmid(ph, lmid);
+ if (ret)
+ return ret;
+
+ ret = ph->xops->xfer_get_init(ph, SCMI_IMX_LMM_SHUTDOWN, sizeof(*in),
+ 0, &t);
+ if (ret)
+ return ret;
+
+ in = t->tx.buf;
+ in->lmid = cpu_to_le32(lmid);
+ if (flags & SCMI_IMX_LMM_SHUTDOWN_GRACEFUL)
+ in->flags = cpu_to_le32(SCMI_IMX_LMM_SHUTDOWN_GRACEFUL);
+ else
+ in->flags = cpu_to_le32(0);
+ ret = ph->xops->do_xfer(ph, t);
+
+ ph->xops->xfer_put(ph, t);
+
+ return ret;
+}
+
+static const struct scmi_imx_lmm_proto_ops scmi_imx_lmm_proto_ops = {
+ .lmm_power_boot = scmi_imx_lmm_power_boot,
+ .lmm_info = scmi_imx_lmm_attributes,
+ .lmm_reset_vector_set = scmi_imx_lmm_reset_vector_set,
+ .lmm_shutdown = scmi_imx_lmm_shutdown,
+};
+
+static int scmi_imx_lmm_protocol_attributes_get(const struct scmi_protocol_handle *ph,
+ struct scmi_imx_lmm_priv *priv)
+{
+ struct scmi_msg_imx_lmm_protocol_attributes *attr;
+ struct scmi_xfer *t;
+ int ret;
+
+ ret = ph->xops->xfer_get_init(ph, PROTOCOL_ATTRIBUTES, 0,
+ sizeof(*attr), &t);
+ if (ret)
+ return ret;
+
+ attr = t->rx.buf;
+
+ ret = ph->xops->do_xfer(ph, t);
+ if (!ret) {
+ priv->nr_lmm = le32_get_bits(attr->attributes, SCMI_IMX_LMM_NR_LM_MASK);
+ if (priv->nr_lmm > SCMI_IMX_LMM_NR_MAX) {
+ dev_err(ph->dev, "i.MX LMM: %d:Exceed max supported Logical Machines\n",
+ priv->nr_lmm);
+ return -EINVAL;
+ }
+ dev_info(ph->dev, "i.MX LMM: %d Logical Machines\n", priv->nr_lmm);
+ }
+
+ ph->xops->xfer_put(ph, t);
+
+ return ret;
+}
+
+static int scmi_imx_lmm_protocol_init(const struct scmi_protocol_handle *ph)
+{
+ struct scmi_imx_lmm_priv *info;
+ u32 version;
+ int ret;
+
+ ret = ph->xops->version_get(ph, &version);
+ if (ret)
+ return ret;
+
+ dev_info(ph->dev, "NXP SM LMM Version %d.%d\n",
+ PROTOCOL_REV_MAJOR(version), PROTOCOL_REV_MINOR(version));
+
+ info = devm_kzalloc(ph->dev, sizeof(*info), GFP_KERNEL);
+ if (!info)
+ return -ENOMEM;
+
+ ret = scmi_imx_lmm_protocol_attributes_get(ph, info);
+ if (ret)
+ return ret;
+
+ return ph->set_priv(ph, info, version);
+}
+
+static const struct scmi_protocol scmi_imx_lmm = {
+ .id = SCMI_PROTOCOL_IMX_LMM,
+ .owner = THIS_MODULE,
+ .instance_init = &scmi_imx_lmm_protocol_init,
+ .ops = &scmi_imx_lmm_proto_ops,
+ .supported_version = SCMI_PROTOCOL_SUPPORTED_VERSION,
+ .vendor_id = SCMI_IMX_VENDOR,
+ .sub_vendor_id = SCMI_IMX_SUBVENDOR,
+};
+module_scmi_protocol(scmi_imx_lmm);
+
+MODULE_ALIAS("scmi-protocol-" __stringify(SCMI_PROTOCOL_IMX_LMM) "-" SCMI_IMX_VENDOR);
+MODULE_DESCRIPTION("i.MX SCMI LMM driver");
+MODULE_LICENSE("GPL");
diff --git a/include/linux/scmi_imx_protocol.h b/include/linux/scmi_imx_protocol.h
index 53b356a26414279f4aaaa8287c32209ed1ad57b4..2a96fc29cb6f4dd1e4c29e0aaaa614ae9783da4a 100644
--- a/include/linux/scmi_imx_protocol.h
+++ b/include/linux/scmi_imx_protocol.h
@@ -11,8 +11,10 @@
#include <linux/bitfield.h>
#include <linux/device.h>
#include <linux/notifier.h>
+#include <linux/scmi_protocol.h>
#include <linux/types.h>
+#define SCMI_PROTOCOL_IMX_LMM 0x80
#define SCMI_PROTOCOL_IMX_BBM 0x81
#define SCMI_PROTOCOL_IMX_MISC 0x84
@@ -57,4 +59,34 @@ struct scmi_imx_misc_proto_ops {
int (*misc_ctrl_req_notify)(const struct scmi_protocol_handle *ph,
u32 ctrl_id, u32 evt_id, u32 flags);
};
+
+/* See LMM_ATTRIBUTES in imx95.rst */
+#define LMM_ID_DISCOVER 0xFFFFFFFFU
+#define LMM_MAX_NAME 16
+
+enum scmi_imx_lmm_state {
+ LMM_STATE_LM_OFF,
+ LMM_STATE_LM_ON,
+ LMM_STATE_LM_SUSPEND,
+ LMM_STATE_LM_POWERED,
+};
+
+struct scmi_imx_lmm_info {
+ u32 lmid;
+ enum scmi_imx_lmm_state state;
+ u32 errstatus;
+ u8 name[LMM_MAX_NAME];
+};
+
+struct scmi_imx_lmm_proto_ops {
+ int (*lmm_power_boot)(const struct scmi_protocol_handle *ph, u32 lmid,
+ bool boot);
+ int (*lmm_info)(const struct scmi_protocol_handle *ph, u32 lmid,
+ struct scmi_imx_lmm_info *info);
+ int (*lmm_reset_vector_set)(const struct scmi_protocol_handle *ph,
+ u32 lmid, u32 cpuid, u32 flags, u64 vector);
+ int (*lmm_shutdown)(const struct scmi_protocol_handle *ph, u32 lmid,
+ u32 flags);
+};
+
#endif
--
2.37.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v4 4/7] firmware: arm_scmi: imx: Add i.MX95 CPU Protocol
2025-04-08 8:44 [PATCH v4 0/7] firmware: scmi/imx: Add i.MX95 LMM/CPU Protocol Peng Fan (OSS)
` (2 preceding siblings ...)
2025-04-08 8:44 ` [PATCH v4 3/7] firmware: arm_scmi: imx: Add i.MX95 LMM protocol Peng Fan (OSS)
@ 2025-04-08 8:44 ` Peng Fan (OSS)
2025-04-08 8:44 ` [PATCH v4 5/7] firmware: imx: Add i.MX95 SCMI LMM driver Peng Fan (OSS)
` (3 subsequent siblings)
7 siblings, 0 replies; 21+ messages in thread
From: Peng Fan (OSS) @ 2025-04-08 8:44 UTC (permalink / raw)
To: Sudeep Holla, Cristian Marussi, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: Dan Carpenter, linux-kernel, arm-scmi, linux-arm-kernel, imx,
devicetree, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
This protocol allows an agent to start, stop a CPU or set reset vector. It
is used to manage auxiliary CPUs in an LM (e.g. additional cores in an AP
cluster).
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/firmware/arm_scmi/vendors/imx/Kconfig | 11 +
drivers/firmware/arm_scmi/vendors/imx/Makefile | 1 +
drivers/firmware/arm_scmi/vendors/imx/imx-sm-cpu.c | 276 +++++++++++++++++++++
include/linux/scmi_imx_protocol.h | 10 +
4 files changed, 298 insertions(+)
diff --git a/drivers/firmware/arm_scmi/vendors/imx/Kconfig b/drivers/firmware/arm_scmi/vendors/imx/Kconfig
index 1a936fc87d2350e2a21bccd45dfbeebfa3b90286..b5f13d0e40155e485f4d1696e9550645d888ef44 100644
--- a/drivers/firmware/arm_scmi/vendors/imx/Kconfig
+++ b/drivers/firmware/arm_scmi/vendors/imx/Kconfig
@@ -12,6 +12,17 @@ config IMX_SCMI_BBM_EXT
To compile this driver as a module, choose M here: the
module will be called imx-sm-bbm.
+config IMX_SCMI_CPU_EXT
+ tristate "i.MX SCMI CPU EXTENSION"
+ depends on ARM_SCMI_PROTOCOL || (COMPILE_TEST && OF)
+ default y if ARCH_MXC
+ help
+ This enables i.MX System CPU Protocol to manage cpu
+ start, stop and etc.
+
+ To compile this driver as a module, choose M here: the
+ module will be called imx-sm-cpu.
+
config IMX_SCMI_LMM_EXT
tristate "i.MX SCMI LMM EXTENSION"
depends on ARM_SCMI_PROTOCOL || (COMPILE_TEST && OF)
diff --git a/drivers/firmware/arm_scmi/vendors/imx/Makefile b/drivers/firmware/arm_scmi/vendors/imx/Makefile
index f39a99ccaf9af757475e8b112d224669444d7ddc..e3a5ea46345c89da1afae25e55698044672b7c28 100644
--- a/drivers/firmware/arm_scmi/vendors/imx/Makefile
+++ b/drivers/firmware/arm_scmi/vendors/imx/Makefile
@@ -1,4 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-only
obj-$(CONFIG_IMX_SCMI_BBM_EXT) += imx-sm-bbm.o
+obj-$(CONFIG_IMX_SCMI_CPU_EXT) += imx-sm-cpu.o
obj-$(CONFIG_IMX_SCMI_LMM_EXT) += imx-sm-lmm.o
obj-$(CONFIG_IMX_SCMI_MISC_EXT) += imx-sm-misc.o
diff --git a/drivers/firmware/arm_scmi/vendors/imx/imx-sm-cpu.c b/drivers/firmware/arm_scmi/vendors/imx/imx-sm-cpu.c
new file mode 100644
index 0000000000000000000000000000000000000000..7fa9a89d825396de00ae666f525e8d6a2d2aed18
--- /dev/null
+++ b/drivers/firmware/arm_scmi/vendors/imx/imx-sm-cpu.c
@@ -0,0 +1,276 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * System control and Management Interface (SCMI) NXP CPU Protocol
+ *
+ * Copyright 2025 NXP
+ */
+
+#include <linux/bits.h>
+#include <linux/io.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/scmi_protocol.h>
+#include <linux/scmi_imx_protocol.h>
+
+#include "../../protocols.h"
+#include "../../notify.h"
+
+#define SCMI_PROTOCOL_SUPPORTED_VERSION 0x10000
+
+enum scmi_imx_cpu_protocol_cmd {
+ SCMI_IMX_CPU_ATTRIBUTES = 0x3,
+ SCMI_IMX_CPU_START = 0x4,
+ SCMI_IMX_CPU_STOP = 0x5,
+ SCMI_IMX_CPU_RESET_VECTOR_SET = 0x6,
+ SCMI_IMX_CPU_INFO_GET = 0xC,
+};
+
+struct scmi_imx_cpu_info {
+ u32 nr_cpu;
+};
+
+#define SCMI_IMX_CPU_NR_CPU_MASK GENMASK(15, 0)
+struct scmi_msg_imx_cpu_protocol_attributes {
+ __le32 attributes;
+};
+
+struct scmi_msg_imx_cpu_attributes_out {
+ __le32 attributes;
+#define CPU_MAX_NAME 16
+ u8 name[CPU_MAX_NAME];
+};
+
+struct scmi_imx_cpu_reset_vector_set_in {
+ __le32 cpuid;
+#define CPU_VEC_FLAGS_RESUME BIT(31)
+#define CPU_VEC_FLAGS_START BIT(30)
+#define CPU_VEC_FLAGS_BOOT BIT(29)
+ __le32 flags;
+ __le32 resetvectorlow;
+ __le32 resetvectorhigh;
+};
+
+struct scmi_imx_cpu_info_get_out {
+#define CPU_RUN_MODE_START 0
+#define CPU_RUN_MODE_HOLD 1
+#define CPU_RUN_MODE_STOP 2
+#define CPU_RUN_MODE_SLEEP 3
+ __le32 runmode;
+ __le32 sleepmode;
+ __le32 resetvectorlow;
+ __le32 resetvectorhigh;
+};
+
+static int scmi_imx_cpu_validate_cpuid(const struct scmi_protocol_handle *ph,
+ u32 cpuid)
+{
+ struct scmi_imx_cpu_info *info = ph->get_priv(ph);
+
+ if (cpuid >= info->nr_cpu)
+ return -EINVAL;
+
+ return 0;
+}
+
+static int scmi_imx_cpu_start(const struct scmi_protocol_handle *ph,
+ u32 cpuid, bool start)
+{
+ struct scmi_xfer *t;
+ u8 msg_id;
+ int ret;
+
+ ret = scmi_imx_cpu_validate_cpuid(ph, cpuid);
+ if (ret)
+ return ret;
+
+ if (start)
+ msg_id = SCMI_IMX_CPU_START;
+ else
+ msg_id = SCMI_IMX_CPU_STOP;
+
+ ret = ph->xops->xfer_get_init(ph, msg_id, sizeof(u32), 0, &t);
+ if (ret)
+ return ret;
+
+ put_unaligned_le32(cpuid, t->tx.buf);
+ ret = ph->xops->do_xfer(ph, t);
+
+ ph->xops->xfer_put(ph, t);
+
+ return ret;
+}
+
+static int scmi_imx_cpu_reset_vector_set(const struct scmi_protocol_handle *ph,
+ u32 cpuid, u64 vector, bool start,
+ bool boot, bool resume)
+{
+ struct scmi_imx_cpu_reset_vector_set_in *in;
+ struct scmi_xfer *t;
+ int ret;
+
+ ret = scmi_imx_cpu_validate_cpuid(ph, cpuid);
+ if (ret)
+ return ret;
+
+ ret = ph->xops->xfer_get_init(ph, SCMI_IMX_CPU_RESET_VECTOR_SET, sizeof(*in),
+ 0, &t);
+ if (ret)
+ return ret;
+
+ in = t->tx.buf;
+ in->cpuid = cpu_to_le32(cpuid);
+ in->flags = cpu_to_le32(0);
+ if (start)
+ in->flags |= le32_encode_bits(1, CPU_VEC_FLAGS_START);
+ if (boot)
+ in->flags |= le32_encode_bits(1, CPU_VEC_FLAGS_BOOT);
+ if (resume)
+ in->flags |= le32_encode_bits(1, CPU_VEC_FLAGS_RESUME);
+ in->resetvectorlow = cpu_to_le32(lower_32_bits(vector));
+ in->resetvectorhigh = cpu_to_le32(upper_32_bits(vector));
+ ret = ph->xops->do_xfer(ph, t);
+
+ ph->xops->xfer_put(ph, t);
+
+ return ret;
+}
+
+static int scmi_imx_cpu_started(const struct scmi_protocol_handle *ph, u32 cpuid,
+ bool *started)
+{
+ struct scmi_imx_cpu_info_get_out *out;
+ struct scmi_xfer *t;
+ u32 mode;
+ int ret;
+
+ if (!started)
+ return -EINVAL;
+
+ *started = false;
+ ret = scmi_imx_cpu_validate_cpuid(ph, cpuid);
+ if (ret)
+ return ret;
+
+ ret = ph->xops->xfer_get_init(ph, SCMI_IMX_CPU_INFO_GET, sizeof(u32),
+ 0, &t);
+ if (ret)
+ return ret;
+
+ put_unaligned_le32(cpuid, t->tx.buf);
+ ret = ph->xops->do_xfer(ph, t);
+ if (!ret) {
+ out = t->rx.buf;
+ mode = le32_to_cpu(out->runmode);
+ if ((mode == CPU_RUN_MODE_START) || (mode == CPU_RUN_MODE_SLEEP))
+ *started = true;
+ }
+
+ ph->xops->xfer_put(ph, t);
+
+ return ret;
+}
+
+static const struct scmi_imx_cpu_proto_ops scmi_imx_cpu_proto_ops = {
+ .cpu_reset_vector_set = scmi_imx_cpu_reset_vector_set,
+ .cpu_start = scmi_imx_cpu_start,
+ .cpu_started = scmi_imx_cpu_started,
+};
+
+static int scmi_imx_cpu_protocol_attributes_get(const struct scmi_protocol_handle *ph,
+ struct scmi_imx_cpu_info *info)
+{
+ struct scmi_msg_imx_cpu_protocol_attributes *attr;
+ struct scmi_xfer *t;
+ int ret;
+
+ ret = ph->xops->xfer_get_init(ph, PROTOCOL_ATTRIBUTES, 0,
+ sizeof(*attr), &t);
+ if (ret)
+ return ret;
+
+ attr = t->rx.buf;
+
+ ret = ph->xops->do_xfer(ph, t);
+ if (!ret) {
+ info->nr_cpu = le32_get_bits(attr->attributes, SCMI_IMX_CPU_NR_CPU_MASK);
+ dev_info(ph->dev, "i.MX SM CPU: %d cpus\n",
+ info->nr_cpu);
+ }
+
+ ph->xops->xfer_put(ph, t);
+
+ return ret;
+}
+
+static int scmi_imx_cpu_attributes_get(const struct scmi_protocol_handle *ph,
+ u32 cpuid)
+{
+ struct scmi_msg_imx_cpu_attributes_out *out;
+ char name[SCMI_SHORT_NAME_MAX_SIZE] = {'\0'};
+ struct scmi_xfer *t;
+ int ret;
+
+ ret = ph->xops->xfer_get_init(ph, SCMI_IMX_CPU_ATTRIBUTES, sizeof(u32), 0, &t);
+ if (ret)
+ return ret;
+
+ put_unaligned_le32(cpuid, t->tx.buf);
+ ret = ph->xops->do_xfer(ph, t);
+ if (!ret) {
+ out = t->rx.buf;
+ strscpy(name, out->name, SCMI_SHORT_NAME_MAX_SIZE);
+ dev_info(ph->dev, "i.MX CPU: name: %s\n", name);
+ } else {
+ dev_err(ph->dev, "i.MX cpu: Failed to get info of cpu(%u)\n", cpuid);
+ }
+
+ ph->xops->xfer_put(ph, t);
+
+ return ret;
+}
+
+static int scmi_imx_cpu_protocol_init(const struct scmi_protocol_handle *ph)
+{
+ struct scmi_imx_cpu_info *info;
+ u32 version;
+ int ret, i;
+
+ ret = ph->xops->version_get(ph, &version);
+ if (ret)
+ return ret;
+
+ dev_info(ph->dev, "NXP SM CPU Protocol Version %d.%d\n",
+ PROTOCOL_REV_MAJOR(version), PROTOCOL_REV_MINOR(version));
+
+ info = devm_kzalloc(ph->dev, sizeof(*info), GFP_KERNEL);
+ if (!info)
+ return -ENOMEM;
+
+ ret = scmi_imx_cpu_protocol_attributes_get(ph, info);
+ if (ret)
+ return ret;
+
+ for (i = 0; i < info->nr_cpu; i++) {
+ ret = scmi_imx_cpu_attributes_get(ph, i);
+ if (ret)
+ return ret;
+ }
+
+ return ph->set_priv(ph, info, version);
+}
+
+static const struct scmi_protocol scmi_imx_cpu = {
+ .id = SCMI_PROTOCOL_IMX_CPU,
+ .owner = THIS_MODULE,
+ .instance_init = &scmi_imx_cpu_protocol_init,
+ .ops = &scmi_imx_cpu_proto_ops,
+ .supported_version = SCMI_PROTOCOL_SUPPORTED_VERSION,
+ .vendor_id = SCMI_IMX_VENDOR,
+ .sub_vendor_id = SCMI_IMX_SUBVENDOR,
+};
+module_scmi_protocol(scmi_imx_cpu);
+
+MODULE_ALIAS("scmi-protocol-" __stringify(SCMI_PROTOCOL_IMX_CPU) "-" SCMI_IMX_VENDOR);
+MODULE_DESCRIPTION("i.MX SCMI CPU driver");
+MODULE_LICENSE("GPL");
diff --git a/include/linux/scmi_imx_protocol.h b/include/linux/scmi_imx_protocol.h
index 2a96fc29cb6f4dd1e4c29e0aaaa614ae9783da4a..27bd372cbfb142b6acb0b1cf4b82f061529d0d45 100644
--- a/include/linux/scmi_imx_protocol.h
+++ b/include/linux/scmi_imx_protocol.h
@@ -16,6 +16,7 @@
#define SCMI_PROTOCOL_IMX_LMM 0x80
#define SCMI_PROTOCOL_IMX_BBM 0x81
+#define SCMI_PROTOCOL_IMX_CPU 0x82
#define SCMI_PROTOCOL_IMX_MISC 0x84
#define SCMI_IMX_VENDOR "NXP"
@@ -89,4 +90,13 @@ struct scmi_imx_lmm_proto_ops {
u32 flags);
};
+struct scmi_imx_cpu_proto_ops {
+ int (*cpu_reset_vector_set)(const struct scmi_protocol_handle *ph,
+ u32 cpuid, u64 vector, bool start,
+ bool boot, bool resume);
+ int (*cpu_start)(const struct scmi_protocol_handle *ph, u32 cpuid,
+ bool start);
+ int (*cpu_started)(const struct scmi_protocol_handle *ph, u32 cpuid,
+ bool *started);
+};
#endif
--
2.37.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v4 5/7] firmware: imx: Add i.MX95 SCMI LMM driver
2025-04-08 8:44 [PATCH v4 0/7] firmware: scmi/imx: Add i.MX95 LMM/CPU Protocol Peng Fan (OSS)
` (3 preceding siblings ...)
2025-04-08 8:44 ` [PATCH v4 4/7] firmware: arm_scmi: imx: Add i.MX95 CPU Protocol Peng Fan (OSS)
@ 2025-04-08 8:44 ` Peng Fan (OSS)
2025-04-14 9:34 ` Sudeep Holla
2025-04-08 8:44 ` [PATCH v4 6/7] firmware: imx: Add i.MX95 SCMI CPU driver Peng Fan (OSS)
` (2 subsequent siblings)
7 siblings, 1 reply; 21+ messages in thread
From: Peng Fan (OSS) @ 2025-04-08 8:44 UTC (permalink / raw)
To: Sudeep Holla, Cristian Marussi, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: Dan Carpenter, linux-kernel, arm-scmi, linux-arm-kernel, imx,
devicetree, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
The i.MX95 System manager exports SCMI LMM protocol for linux to manage
Logical Machines. The driver is to use the LMM Protocol interface to
boot, shutdown a LM.
Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/firmware/arm_scmi/vendors/imx/Kconfig | 3 +-
drivers/firmware/imx/Kconfig | 11 ++++
drivers/firmware/imx/Makefile | 1 +
drivers/firmware/imx/sm-lmm.c | 91 +++++++++++++++++++++++++++
include/linux/firmware/imx/sm.h | 14 +++++
5 files changed, 119 insertions(+), 1 deletion(-)
diff --git a/drivers/firmware/arm_scmi/vendors/imx/Kconfig b/drivers/firmware/arm_scmi/vendors/imx/Kconfig
index b5f13d0e40155e485f4d1696e9550645d888ef44..4c24e17425f830810f8ba376ece9db93c8cded6d 100644
--- a/drivers/firmware/arm_scmi/vendors/imx/Kconfig
+++ b/drivers/firmware/arm_scmi/vendors/imx/Kconfig
@@ -26,7 +26,8 @@ config IMX_SCMI_CPU_EXT
config IMX_SCMI_LMM_EXT
tristate "i.MX SCMI LMM EXTENSION"
depends on ARM_SCMI_PROTOCOL || (COMPILE_TEST && OF)
- default y if ARCH_MXC
+ depends on IMX_SCMI_LMM_DRV
+ default y if ARCH_MXC && ARM64
help
This enables i.MX System Logical Machine Protocol to
manage Logical Machines boot, shutdown and etc.
diff --git a/drivers/firmware/imx/Kconfig b/drivers/firmware/imx/Kconfig
index c964f4924359fcd375560ee8263021b0fe65db1b..70c092424328067ea6b946cee59f072661e27e47 100644
--- a/drivers/firmware/imx/Kconfig
+++ b/drivers/firmware/imx/Kconfig
@@ -23,6 +23,17 @@ config IMX_SCU
This driver manages the IPC interface between host CPU and the
SCU firmware running on M4.
+config IMX_SCMI_LMM_DRV
+ tristate "IMX SCMI LMM Protocol driver"
+ depends on ARCH_MXC && ARM64 || COMPILE_TEST
+ default y if ARCH_MXC && ARM64
+ help
+ The System Controller Management Interface firmware (SCMI FW) is
+ a low-level system function which runs on a dedicated Cortex-M
+ core that could provide Logical Machine management features.
+
+ This driver can also be built as a module.
+
config IMX_SCMI_MISC_DRV
tristate "IMX SCMI MISC Protocol driver"
depends on ARCH_MXC || COMPILE_TEST
diff --git a/drivers/firmware/imx/Makefile b/drivers/firmware/imx/Makefile
index 8d046c341be878bb6dd1e6277992ff66ae90e292..7762855d2a771169d4f1867d27e0d51be7c9ad03 100644
--- a/drivers/firmware/imx/Makefile
+++ b/drivers/firmware/imx/Makefile
@@ -2,3 +2,4 @@
obj-$(CONFIG_IMX_DSP) += imx-dsp.o
obj-$(CONFIG_IMX_SCU) += imx-scu.o misc.o imx-scu-irq.o rm.o imx-scu-soc.o
obj-${CONFIG_IMX_SCMI_MISC_DRV} += sm-misc.o
+obj-${CONFIG_IMX_SCMI_LMM_DRV} += sm-lmm.o
diff --git a/drivers/firmware/imx/sm-lmm.c b/drivers/firmware/imx/sm-lmm.c
new file mode 100644
index 0000000000000000000000000000000000000000..6807bf563c03d21a68022ecf3469c38bee4fc2f5
--- /dev/null
+++ b/drivers/firmware/imx/sm-lmm.c
@@ -0,0 +1,91 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright 2025 NXP
+ */
+
+#include <linux/firmware/imx/sm.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/scmi_protocol.h>
+#include <linux/scmi_imx_protocol.h>
+
+static const struct scmi_imx_lmm_proto_ops *imx_lmm_ops;
+static struct scmi_protocol_handle *ph;
+
+int scmi_imx_lmm_info(u32 lmid, struct scmi_imx_lmm_info *info)
+{
+ if (!ph)
+ return -EPROBE_DEFER;
+
+ if (!info)
+ return -EINVAL;
+
+ return imx_lmm_ops->lmm_info(ph, lmid, info);
+};
+EXPORT_SYMBOL(scmi_imx_lmm_info);
+
+int scmi_imx_lmm_reset_vector_set(u32 lmid, u32 cpuid, u32 flags, u64 vector)
+{
+ if (!ph)
+ return -EPROBE_DEFER;
+
+ return imx_lmm_ops->lmm_reset_vector_set(ph, lmid, cpuid, flags, vector);
+}
+EXPORT_SYMBOL(scmi_imx_lmm_reset_vector_set);
+
+int scmi_imx_lmm_operation(u32 lmid, enum scmi_imx_lmm_op op, u32 flags)
+{
+ if (!ph)
+ return -EPROBE_DEFER;
+
+ switch (op) {
+ case SCMI_IMX_LMM_BOOT:
+ return imx_lmm_ops->lmm_power_boot(ph, lmid, true);
+ case SCMI_IMX_LMM_POWER_ON:
+ return imx_lmm_ops->lmm_power_boot(ph, lmid, false);
+ case SCMI_IMX_LMM_SHUTDOWN:
+ return imx_lmm_ops->lmm_shutdown(ph, lmid, flags);
+ default:
+ break;
+ }
+
+ return -EINVAL;
+}
+EXPORT_SYMBOL(scmi_imx_lmm_operation);
+
+static int scmi_imx_lmm_probe(struct scmi_device *sdev)
+{
+ const struct scmi_handle *handle = sdev->handle;
+
+ if (!handle)
+ return -ENODEV;
+
+ if (imx_lmm_ops) {
+ dev_err(&sdev->dev, "lmm already initialized\n");
+ return -EEXIST;
+ }
+
+ imx_lmm_ops = handle->devm_protocol_get(sdev, SCMI_PROTOCOL_IMX_LMM, &ph);
+ if (IS_ERR(imx_lmm_ops))
+ return PTR_ERR(imx_lmm_ops);
+
+ return 0;
+}
+
+static const struct scmi_device_id scmi_id_table[] = {
+ { SCMI_PROTOCOL_IMX_LMM, "imx-lmm" },
+ { },
+};
+MODULE_DEVICE_TABLE(scmi, scmi_id_table);
+
+static struct scmi_driver scmi_imx_lmm_driver = {
+ .name = "scmi-imx-lmm",
+ .probe = scmi_imx_lmm_probe,
+ .id_table = scmi_id_table,
+};
+module_scmi_driver(scmi_imx_lmm_driver);
+
+MODULE_AUTHOR("Peng Fan <peng.fan@nxp.com>");
+MODULE_DESCRIPTION("IMX SM LMM driver");
+MODULE_LICENSE("GPL");
diff --git a/include/linux/firmware/imx/sm.h b/include/linux/firmware/imx/sm.h
index 9b85a3f028d1b0a5287b453eb3ad8412a363fe6c..bc27b04afb2f68b048955f51c07a106f4c7e5852 100644
--- a/include/linux/firmware/imx/sm.h
+++ b/include/linux/firmware/imx/sm.h
@@ -8,6 +8,7 @@
#include <linux/bitfield.h>
#include <linux/errno.h>
+#include <linux/scmi_imx_protocol.h>
#include <linux/types.h>
#define SCMI_IMX_CTRL_PDM_CLK_SEL 0 /* AON PDM clock sel */
@@ -20,4 +21,17 @@
int scmi_imx_misc_ctrl_get(u32 id, u32 *num, u32 *val);
int scmi_imx_misc_ctrl_set(u32 id, u32 val);
+enum scmi_imx_lmm_op {
+ SCMI_IMX_LMM_BOOT,
+ SCMI_IMX_LMM_POWER_ON,
+ SCMI_IMX_LMM_SHUTDOWN,
+};
+
+/* For shutdown pperation */
+#define SCMI_IMX_LMM_OP_FORCEFUL 0
+#define SCMI_IMX_LMM_OP_GRACEFUL BIT(0)
+
+int scmi_imx_lmm_operation(u32 lmid, enum scmi_imx_lmm_op op, u32 flags);
+int scmi_imx_lmm_info(u32 lmid, struct scmi_imx_lmm_info *info);
+int scmi_imx_lmm_reset_vector_set(u32 lmid, u32 cpuid, u32 flags, u64 vector);
#endif
--
2.37.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v4 6/7] firmware: imx: Add i.MX95 SCMI CPU driver
2025-04-08 8:44 [PATCH v4 0/7] firmware: scmi/imx: Add i.MX95 LMM/CPU Protocol Peng Fan (OSS)
` (4 preceding siblings ...)
2025-04-08 8:44 ` [PATCH v4 5/7] firmware: imx: Add i.MX95 SCMI LMM driver Peng Fan (OSS)
@ 2025-04-08 8:44 ` Peng Fan (OSS)
2025-04-08 8:44 ` [PATCH v4 7/7] MAINTAINERS: add entry for i.MX SCMI extensions Peng Fan (OSS)
2025-04-24 9:43 ` [PATCH v4 0/7] firmware: scmi/imx: Add i.MX95 LMM/CPU Protocol Sudeep Holla
7 siblings, 0 replies; 21+ messages in thread
From: Peng Fan (OSS) @ 2025-04-08 8:44 UTC (permalink / raw)
To: Sudeep Holla, Cristian Marussi, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: Dan Carpenter, linux-kernel, arm-scmi, linux-arm-kernel, imx,
devicetree, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
The i.MX95 System manager exports SCMI CPU protocol for linux to manage
cpu cores. The driver is to use the cpu Protocol interface to
start, stop a cpu cores (eg, M7).
Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/firmware/arm_scmi/vendors/imx/Kconfig | 3 +-
drivers/firmware/imx/Kconfig | 11 ++++
drivers/firmware/imx/Makefile | 1 +
drivers/firmware/imx/sm-cpu.c | 85 +++++++++++++++++++++++++++
include/linux/firmware/imx/sm.h | 5 ++
5 files changed, 104 insertions(+), 1 deletion(-)
diff --git a/drivers/firmware/arm_scmi/vendors/imx/Kconfig b/drivers/firmware/arm_scmi/vendors/imx/Kconfig
index 4c24e17425f830810f8ba376ece9db93c8cded6d..9b4339b93826804599371f2e3a2e79f27449582b 100644
--- a/drivers/firmware/arm_scmi/vendors/imx/Kconfig
+++ b/drivers/firmware/arm_scmi/vendors/imx/Kconfig
@@ -15,7 +15,8 @@ config IMX_SCMI_BBM_EXT
config IMX_SCMI_CPU_EXT
tristate "i.MX SCMI CPU EXTENSION"
depends on ARM_SCMI_PROTOCOL || (COMPILE_TEST && OF)
- default y if ARCH_MXC
+ depends on IMX_SCMI_CPU_DRV
+ default y if ARCH_MXC && ARM64
help
This enables i.MX System CPU Protocol to manage cpu
start, stop and etc.
diff --git a/drivers/firmware/imx/Kconfig b/drivers/firmware/imx/Kconfig
index 70c092424328067ea6b946cee59f072661e27e47..8236f81e054ff43c5fbc660a67c53ea9324ab402 100644
--- a/drivers/firmware/imx/Kconfig
+++ b/drivers/firmware/imx/Kconfig
@@ -23,6 +23,17 @@ config IMX_SCU
This driver manages the IPC interface between host CPU and the
SCU firmware running on M4.
+config IMX_SCMI_CPU_DRV
+ tristate "IMX SCMI CPU Protocol driver"
+ depends on ARCH_MXC && ARM64 || COMPILE_TEST
+ default y if ARCH_MXC && ARM64
+ help
+ The System Controller Management Interface firmware (SCMI FW) is
+ a low-level system function which runs on a dedicated Cortex-M
+ core that could provide cpu management features.
+
+ This driver can also be built as a module.
+
config IMX_SCMI_LMM_DRV
tristate "IMX SCMI LMM Protocol driver"
depends on ARCH_MXC && ARM64 || COMPILE_TEST
diff --git a/drivers/firmware/imx/Makefile b/drivers/firmware/imx/Makefile
index 7762855d2a771169d4f1867d27e0d51be7c9ad03..3bbaffa6e3478112638ed031375602389f18ef09 100644
--- a/drivers/firmware/imx/Makefile
+++ b/drivers/firmware/imx/Makefile
@@ -1,5 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
obj-$(CONFIG_IMX_DSP) += imx-dsp.o
obj-$(CONFIG_IMX_SCU) += imx-scu.o misc.o imx-scu-irq.o rm.o imx-scu-soc.o
+obj-${CONFIG_IMX_SCMI_CPU_DRV} += sm-cpu.o
obj-${CONFIG_IMX_SCMI_MISC_DRV} += sm-misc.o
obj-${CONFIG_IMX_SCMI_LMM_DRV} += sm-lmm.o
diff --git a/drivers/firmware/imx/sm-cpu.c b/drivers/firmware/imx/sm-cpu.c
new file mode 100644
index 0000000000000000000000000000000000000000..091b014f739f68d815d71f9b53a2a7eaf0bd607b
--- /dev/null
+++ b/drivers/firmware/imx/sm-cpu.c
@@ -0,0 +1,85 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright 2025 NXP
+ */
+
+#include <linux/firmware/imx/sm.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/scmi_protocol.h>
+#include <linux/scmi_imx_protocol.h>
+
+static const struct scmi_imx_cpu_proto_ops *imx_cpu_ops;
+static struct scmi_protocol_handle *ph;
+
+int scmi_imx_cpu_reset_vector_set(u32 cpuid, u64 vector, bool start, bool boot,
+ bool resume)
+{
+ if (!ph)
+ return -EPROBE_DEFER;
+
+ return imx_cpu_ops->cpu_reset_vector_set(ph, cpuid, vector, start,
+ boot, resume);
+}
+EXPORT_SYMBOL(scmi_imx_cpu_reset_vector_set);
+
+int scmi_imx_cpu_start(u32 cpuid, bool start)
+{
+ if (!ph)
+ return -EPROBE_DEFER;
+
+ if (start)
+ return imx_cpu_ops->cpu_start(ph, cpuid, true);
+
+ return imx_cpu_ops->cpu_start(ph, cpuid, false);
+};
+EXPORT_SYMBOL(scmi_imx_cpu_start);
+
+int scmi_imx_cpu_started(u32 cpuid, bool *started)
+{
+ if (!ph)
+ return -EPROBE_DEFER;
+
+ if (!started)
+ return -EINVAL;
+
+ return imx_cpu_ops->cpu_started(ph, cpuid, started);
+};
+EXPORT_SYMBOL(scmi_imx_cpu_started);
+
+static int scmi_imx_cpu_probe(struct scmi_device *sdev)
+{
+ const struct scmi_handle *handle = sdev->handle;
+
+ if (!handle)
+ return -ENODEV;
+
+ if (imx_cpu_ops) {
+ dev_err(&sdev->dev, "sm cpu already initialized\n");
+ return -EEXIST;
+ }
+
+ imx_cpu_ops = handle->devm_protocol_get(sdev, SCMI_PROTOCOL_IMX_CPU, &ph);
+ if (IS_ERR(imx_cpu_ops))
+ return PTR_ERR(imx_cpu_ops);
+
+ return 0;
+}
+
+static const struct scmi_device_id scmi_id_table[] = {
+ { SCMI_PROTOCOL_IMX_CPU, "imx-cpu" },
+ { },
+};
+MODULE_DEVICE_TABLE(scmi, scmi_id_table);
+
+static struct scmi_driver scmi_imx_cpu_driver = {
+ .name = "scmi-imx-cpu",
+ .probe = scmi_imx_cpu_probe,
+ .id_table = scmi_id_table,
+};
+module_scmi_driver(scmi_imx_cpu_driver);
+
+MODULE_AUTHOR("Peng Fan <peng.fan@nxp.com>");
+MODULE_DESCRIPTION("IMX SM CPU driver");
+MODULE_LICENSE("GPL");
diff --git a/include/linux/firmware/imx/sm.h b/include/linux/firmware/imx/sm.h
index bc27b04afb2f68b048955f51c07a106f4c7e5852..a8a17eeb7d907ef8ac074c4ed1d3ac83f1104627 100644
--- a/include/linux/firmware/imx/sm.h
+++ b/include/linux/firmware/imx/sm.h
@@ -21,6 +21,11 @@
int scmi_imx_misc_ctrl_get(u32 id, u32 *num, u32 *val);
int scmi_imx_misc_ctrl_set(u32 id, u32 val);
+int scmi_imx_cpu_start(u32 cpuid, bool start);
+int scmi_imx_cpu_started(u32 cpuid, bool *started);
+int scmi_imx_cpu_reset_vector_set(u32 cpuid, u64 vector, bool start, bool boot,
+ bool resume);
+
enum scmi_imx_lmm_op {
SCMI_IMX_LMM_BOOT,
SCMI_IMX_LMM_POWER_ON,
--
2.37.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH v4 7/7] MAINTAINERS: add entry for i.MX SCMI extensions
2025-04-08 8:44 [PATCH v4 0/7] firmware: scmi/imx: Add i.MX95 LMM/CPU Protocol Peng Fan (OSS)
` (5 preceding siblings ...)
2025-04-08 8:44 ` [PATCH v4 6/7] firmware: imx: Add i.MX95 SCMI CPU driver Peng Fan (OSS)
@ 2025-04-08 8:44 ` Peng Fan (OSS)
2025-04-24 9:43 ` [PATCH v4 0/7] firmware: scmi/imx: Add i.MX95 LMM/CPU Protocol Sudeep Holla
7 siblings, 0 replies; 21+ messages in thread
From: Peng Fan (OSS) @ 2025-04-08 8:44 UTC (permalink / raw)
To: Sudeep Holla, Cristian Marussi, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: Dan Carpenter, linux-kernel, arm-scmi, linux-arm-kernel, imx,
devicetree, Peng Fan
From: Peng Fan <peng.fan@nxp.com>
Add entry for i.MX SCMI extensions and myself as maintainer
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
MAINTAINERS | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/MAINTAINERS b/MAINTAINERS
index ce2b64f4568d5d3dc48792843b6bb8928f5e0728..e406de86df9bed0f34871fe1ddca408984463493 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -23505,6 +23505,15 @@ F: include/linux/sc[mp]i_protocol.h
F: include/trace/events/scmi.h
F: include/uapi/linux/virtio_scmi.h
+SYSTEM CONTROL MANAGEMENT INTERFACE (SCMI) i.MX Extension Message Protocol drivers
+M: Peng Fan <peng.fan@nxp.com>
+L: arm-scmi@vger.kernel.org
+L: imx@lists.linux.dev
+L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
+S: Maintained
+F: Documentation/devicetree/bindings/firmware/nxp,*scmi.yaml
+F: drivers/firmware/arm_scmi/vendors/imx/
+
SYSTEM RESET/SHUTDOWN DRIVERS
M: Sebastian Reichel <sre@kernel.org>
L: linux-pm@vger.kernel.org
--
2.37.1
^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH v4 3/7] firmware: arm_scmi: imx: Add i.MX95 LMM protocol
2025-04-08 8:44 ` [PATCH v4 3/7] firmware: arm_scmi: imx: Add i.MX95 LMM protocol Peng Fan (OSS)
@ 2025-04-08 9:17 ` Dan Carpenter
2025-04-09 3:37 ` Peng Fan
2025-04-08 9:21 ` Dan Carpenter
1 sibling, 1 reply; 21+ messages in thread
From: Dan Carpenter @ 2025-04-08 9:17 UTC (permalink / raw)
To: Peng Fan (OSS)
Cc: Sudeep Holla, Cristian Marussi, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, linux-kernel, arm-scmi,
linux-arm-kernel, imx, devicetree, Peng Fan
On Tue, Apr 08, 2025 at 04:44:27PM +0800, Peng Fan (OSS) wrote:
> +static int scmi_imx_lmm_protocol_attributes_get(const struct scmi_protocol_handle *ph,
> + struct scmi_imx_lmm_priv *priv)
> +{
> + struct scmi_msg_imx_lmm_protocol_attributes *attr;
> + struct scmi_xfer *t;
> + int ret;
> +
> + ret = ph->xops->xfer_get_init(ph, PROTOCOL_ATTRIBUTES, 0,
> + sizeof(*attr), &t);
> + if (ret)
> + return ret;
> +
> + attr = t->rx.buf;
> +
> + ret = ph->xops->do_xfer(ph, t);
> + if (!ret) {
> + priv->nr_lmm = le32_get_bits(attr->attributes, SCMI_IMX_LMM_NR_LM_MASK);
> + if (priv->nr_lmm > SCMI_IMX_LMM_NR_MAX) {
> + dev_err(ph->dev, "i.MX LMM: %d:Exceed max supported Logical Machines\n",
> + priv->nr_lmm);
> + return -EINVAL;
This needs to call ph->xops->xfer_put(ph, t) before returning.
> + }
> + dev_info(ph->dev, "i.MX LMM: %d Logical Machines\n", priv->nr_lmm);
> + }
> +
> + ph->xops->xfer_put(ph, t);
> +
> + return ret;
> +}
regards,
dan carpenter
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v4 3/7] firmware: arm_scmi: imx: Add i.MX95 LMM protocol
2025-04-08 8:44 ` [PATCH v4 3/7] firmware: arm_scmi: imx: Add i.MX95 LMM protocol Peng Fan (OSS)
2025-04-08 9:17 ` Dan Carpenter
@ 2025-04-08 9:21 ` Dan Carpenter
2025-04-09 3:33 ` Peng Fan
1 sibling, 1 reply; 21+ messages in thread
From: Dan Carpenter @ 2025-04-08 9:21 UTC (permalink / raw)
To: Peng Fan (OSS)
Cc: Sudeep Holla, Cristian Marussi, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, linux-kernel, arm-scmi,
linux-arm-kernel, imx, devicetree, Peng Fan
On Tue, Apr 08, 2025 at 04:44:27PM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.com>
>
> Add Logical Machine Management(LMM) protocol which is intended for boot,
> shutdown, and reset of other logical machines (LM). It is usually used to
> allow one LM to manager another used as an offload or accelerator engine.
>
> Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
> drivers/firmware/arm_scmi/vendors/imx/Kconfig | 11 +
> drivers/firmware/arm_scmi/vendors/imx/Makefile | 1 +
> drivers/firmware/arm_scmi/vendors/imx/imx-sm-lmm.c | 262 +++++++++++++++++++++
> include/linux/scmi_imx_protocol.h | 32 +++
> 4 files changed, 306 insertions(+)
>
> diff --git a/drivers/firmware/arm_scmi/vendors/imx/Kconfig b/drivers/firmware/arm_scmi/vendors/imx/Kconfig
> index a01bf5e47301d2f93c9bfc7eebc77e083ea4ed75..1a936fc87d2350e2a21bccd45dfbeebfa3b90286 100644
> --- a/drivers/firmware/arm_scmi/vendors/imx/Kconfig
> +++ b/drivers/firmware/arm_scmi/vendors/imx/Kconfig
> @@ -12,6 +12,17 @@ config IMX_SCMI_BBM_EXT
> To compile this driver as a module, choose M here: the
> module will be called imx-sm-bbm.
>
> +config IMX_SCMI_LMM_EXT
> + tristate "i.MX SCMI LMM EXTENSION"
> + depends on ARM_SCMI_PROTOCOL || (COMPILE_TEST && OF)
> + default y if ARCH_MXC
> + help
> + This enables i.MX System Logical Machine Protocol to
> + manage Logical Machines boot, shutdown and etc.
> +
> + To compile this driver as a module, choose M here: the
> + module will be called imx-sm-lmm.
> +
Remind me again what happens if you have both the default and the
extension modules enabled?
regards,
dan carpenter
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v4 3/7] firmware: arm_scmi: imx: Add i.MX95 LMM protocol
2025-04-08 9:21 ` Dan Carpenter
@ 2025-04-09 3:33 ` Peng Fan
0 siblings, 0 replies; 21+ messages in thread
From: Peng Fan @ 2025-04-09 3:33 UTC (permalink / raw)
To: Dan Carpenter
Cc: Sudeep Holla, Cristian Marussi, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, linux-kernel, arm-scmi,
linux-arm-kernel, imx, devicetree, Peng Fan
On Tue, Apr 08, 2025 at 12:21:56PM +0300, Dan Carpenter wrote:
>On Tue, Apr 08, 2025 at 04:44:27PM +0800, Peng Fan (OSS) wrote:
>> From: Peng Fan <peng.fan@nxp.com>
>>
>> Add Logical Machine Management(LMM) protocol which is intended for boot,
>> shutdown, and reset of other logical machines (LM). It is usually used to
>> allow one LM to manager another used as an offload or accelerator engine.
>>
>> Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>
>> Signed-off-by: Peng Fan <peng.fan@nxp.com>
>> ---
>> drivers/firmware/arm_scmi/vendors/imx/Kconfig | 11 +
>> drivers/firmware/arm_scmi/vendors/imx/Makefile | 1 +
>> drivers/firmware/arm_scmi/vendors/imx/imx-sm-lmm.c | 262 +++++++++++++++++++++
>> include/linux/scmi_imx_protocol.h | 32 +++
>> 4 files changed, 306 insertions(+)
>>
>> diff --git a/drivers/firmware/arm_scmi/vendors/imx/Kconfig b/drivers/firmware/arm_scmi/vendors/imx/Kconfig
>> index a01bf5e47301d2f93c9bfc7eebc77e083ea4ed75..1a936fc87d2350e2a21bccd45dfbeebfa3b90286 100644
>> --- a/drivers/firmware/arm_scmi/vendors/imx/Kconfig
>> +++ b/drivers/firmware/arm_scmi/vendors/imx/Kconfig
>> @@ -12,6 +12,17 @@ config IMX_SCMI_BBM_EXT
>> To compile this driver as a module, choose M here: the
>> module will be called imx-sm-bbm.
>>
>> +config IMX_SCMI_LMM_EXT
>> + tristate "i.MX SCMI LMM EXTENSION"
>> + depends on ARM_SCMI_PROTOCOL || (COMPILE_TEST && OF)
>> + default y if ARCH_MXC
>> + help
>> + This enables i.MX System Logical Machine Protocol to
>> + manage Logical Machines boot, shutdown and etc.
>> +
>> + To compile this driver as a module, choose M here: the
>> + module will be called imx-sm-lmm.
>> +
>
>Remind me again what happens if you have both the default and the
>extension modules enabled?
With update defconfig to m, it will be built as module as below output:
MODPOST Module.symvers
CC [M] drivers/firmware/arm_scmi/vendors/imx/imx-sm-lmm.mod.o
CC [M] drivers/firmware/arm_scmi/vendors/imx/imx-sm-misc.mod.o
LD [M] drivers/firmware/arm_scmi/vendors/imx/imx-sm-lmm.ko
LD [M] drivers/firmware/arm_scmi/vendors/imx/imx-sm-misc.ko
Regards,
Peng
>
>regards,
>dan carpenter
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v4 3/7] firmware: arm_scmi: imx: Add i.MX95 LMM protocol
2025-04-08 9:17 ` Dan Carpenter
@ 2025-04-09 3:37 ` Peng Fan
0 siblings, 0 replies; 21+ messages in thread
From: Peng Fan @ 2025-04-09 3:37 UTC (permalink / raw)
To: Dan Carpenter
Cc: Sudeep Holla, Cristian Marussi, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, linux-kernel, arm-scmi,
linux-arm-kernel, imx, devicetree, Peng Fan
On Tue, Apr 08, 2025 at 12:17:54PM +0300, Dan Carpenter wrote:
>On Tue, Apr 08, 2025 at 04:44:27PM +0800, Peng Fan (OSS) wrote:
>> +static int scmi_imx_lmm_protocol_attributes_get(const struct scmi_protocol_handle *ph,
>> + struct scmi_imx_lmm_priv *priv)
>> +{
>> + struct scmi_msg_imx_lmm_protocol_attributes *attr;
>> + struct scmi_xfer *t;
>> + int ret;
>> +
>> + ret = ph->xops->xfer_get_init(ph, PROTOCOL_ATTRIBUTES, 0,
>> + sizeof(*attr), &t);
>> + if (ret)
>> + return ret;
>> +
>> + attr = t->rx.buf;
>> +
>> + ret = ph->xops->do_xfer(ph, t);
>> + if (!ret) {
>> + priv->nr_lmm = le32_get_bits(attr->attributes, SCMI_IMX_LMM_NR_LM_MASK);
>> + if (priv->nr_lmm > SCMI_IMX_LMM_NR_MAX) {
>> + dev_err(ph->dev, "i.MX LMM: %d:Exceed max supported Logical Machines\n",
>> + priv->nr_lmm);
>> + return -EINVAL;
>
>This needs to call ph->xops->xfer_put(ph, t) before returning.
Oops. Thanks for spotting this.
I will wait to see if any more comments.
Not sure Sudeep could help address this if no more comments, or need me to
send a new version.
Thanks,
Peng.
>
>> + }
>> + dev_info(ph->dev, "i.MX LMM: %d Logical Machines\n", priv->nr_lmm);
>> + }
>> +
>> + ph->xops->xfer_put(ph, t);
>> +
>> + return ret;
>> +}
>
>regards,
>dan carpenter
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v4 5/7] firmware: imx: Add i.MX95 SCMI LMM driver
2025-04-08 8:44 ` [PATCH v4 5/7] firmware: imx: Add i.MX95 SCMI LMM driver Peng Fan (OSS)
@ 2025-04-14 9:34 ` Sudeep Holla
2025-04-14 9:57 ` Peng Fan
0 siblings, 1 reply; 21+ messages in thread
From: Sudeep Holla @ 2025-04-14 9:34 UTC (permalink / raw)
To: Peng Fan (OSS)
Cc: Cristian Marussi, Shawn Guo, Sascha Hauer, Sudeep Holla,
Pengutronix Kernel Team, Fabio Estevam, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Dan Carpenter, linux-kernel,
arm-scmi, linux-arm-kernel, imx, devicetree, Peng Fan
On Tue, Apr 08, 2025 at 04:44:29PM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@nxp.com>
>
> The i.MX95 System manager exports SCMI LMM protocol for linux to manage
> Logical Machines. The driver is to use the LMM Protocol interface to
> boot, shutdown a LM.
>
> Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
> drivers/firmware/arm_scmi/vendors/imx/Kconfig | 3 +-
> drivers/firmware/imx/Kconfig | 11 ++++
> drivers/firmware/imx/Makefile | 1 +
> drivers/firmware/imx/sm-lmm.c | 91 +++++++++++++++++++++++++++
> include/linux/firmware/imx/sm.h | 14 +++++
> 5 files changed, 119 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/firmware/arm_scmi/vendors/imx/Kconfig b/drivers/firmware/arm_scmi/vendors/imx/Kconfig
> index b5f13d0e40155e485f4d1696e9550645d888ef44..4c24e17425f830810f8ba376ece9db93c8cded6d 100644
> --- a/drivers/firmware/arm_scmi/vendors/imx/Kconfig
> +++ b/drivers/firmware/arm_scmi/vendors/imx/Kconfig
> @@ -26,7 +26,8 @@ config IMX_SCMI_CPU_EXT
> config IMX_SCMI_LMM_EXT
> tristate "i.MX SCMI LMM EXTENSION"
> depends on ARM_SCMI_PROTOCOL || (COMPILE_TEST && OF)
> - default y if ARCH_MXC
> + depends on IMX_SCMI_LMM_DRV
> + default y if ARCH_MXC && ARM64
I can't understand the ARM64 dependency on this and next patch.
--
Regards,
Sudeep
^ permalink raw reply [flat|nested] 21+ messages in thread
* RE: [PATCH v4 5/7] firmware: imx: Add i.MX95 SCMI LMM driver
2025-04-14 9:34 ` Sudeep Holla
@ 2025-04-14 9:57 ` Peng Fan
2025-04-14 10:15 ` Sudeep Holla
0 siblings, 1 reply; 21+ messages in thread
From: Peng Fan @ 2025-04-14 9:57 UTC (permalink / raw)
To: Sudeep Holla, Peng Fan (OSS)
Cc: Cristian Marussi, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Dan Carpenter,
linux-kernel@vger.kernel.org, arm-scmi@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev,
devicetree@vger.kernel.org
Hi Sudeep,
> Subject: Re: [PATCH v4 5/7] firmware: imx: Add i.MX95 SCMI LMM
> driver
>
> On Tue, Apr 08, 2025 at 04:44:29PM +0800, Peng Fan (OSS) wrote:
> > From: Peng Fan <peng.fan@nxp.com>
> >
> > The i.MX95 System manager exports SCMI LMM protocol for linux to
> > manage Logical Machines. The driver is to use the LMM Protocol
> > interface to boot, shutdown a LM.
> >
> > Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>
> > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > ---
> > drivers/firmware/arm_scmi/vendors/imx/Kconfig | 3 +-
> > drivers/firmware/imx/Kconfig | 11 ++++
> > drivers/firmware/imx/Makefile | 1 +
> > drivers/firmware/imx/sm-lmm.c | 91
> +++++++++++++++++++++++++++
> > include/linux/firmware/imx/sm.h | 14 +++++
> > 5 files changed, 119 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/firmware/arm_scmi/vendors/imx/Kconfig
> > b/drivers/firmware/arm_scmi/vendors/imx/Kconfig
> > index
> >
> b5f13d0e40155e485f4d1696e9550645d888ef44..4c24e17425f83081
> 0f8ba376ece9
> > db93c8cded6d 100644
> > --- a/drivers/firmware/arm_scmi/vendors/imx/Kconfig
> > +++ b/drivers/firmware/arm_scmi/vendors/imx/Kconfig
> > @@ -26,7 +26,8 @@ config IMX_SCMI_CPU_EXT config
> IMX_SCMI_LMM_EXT
> > tristate "i.MX SCMI LMM EXTENSION"
> > depends on ARM_SCMI_PROTOCOL || (COMPILE_TEST && OF)
> > - default y if ARCH_MXC
> > + depends on IMX_SCMI_LMM_DRV
> > + default y if ARCH_MXC && ARM64
>
> I can't understand the ARM64 dependency on this and next patch.
ARCH_MXC both supports ARM32 and ARM64.
To i.MX ARM32 platform, there is no plan to enable SCMI, so only
set y for ARCH_MXC ARM64 platforms.
Thanks,
Peng.
>
> --
> Regards,
> Sudeep
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v4 5/7] firmware: imx: Add i.MX95 SCMI LMM driver
2025-04-14 9:57 ` Peng Fan
@ 2025-04-14 10:15 ` Sudeep Holla
2025-04-14 10:44 ` Peng Fan
0 siblings, 1 reply; 21+ messages in thread
From: Sudeep Holla @ 2025-04-14 10:15 UTC (permalink / raw)
To: Peng Fan
Cc: Peng Fan (OSS), Cristian Marussi, Sudeep Holla, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Dan Carpenter,
linux-kernel@vger.kernel.org, arm-scmi@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev,
devicetree@vger.kernel.org
On Mon, Apr 14, 2025 at 09:57:43AM +0000, Peng Fan wrote:
> Hi Sudeep,
>
> > Subject: Re: [PATCH v4 5/7] firmware: imx: Add i.MX95 SCMI LMM
> > driver
> >
> > On Tue, Apr 08, 2025 at 04:44:29PM +0800, Peng Fan (OSS) wrote:
> > > From: Peng Fan <peng.fan@nxp.com>
> > >
> > > The i.MX95 System manager exports SCMI LMM protocol for linux to
> > > manage Logical Machines. The driver is to use the LMM Protocol
> > > interface to boot, shutdown a LM.
> > >
> > > Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>
> > > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > > ---
> > > drivers/firmware/arm_scmi/vendors/imx/Kconfig | 3 +-
> > > drivers/firmware/imx/Kconfig | 11 ++++
> > > drivers/firmware/imx/Makefile | 1 +
> > > drivers/firmware/imx/sm-lmm.c | 91
> > +++++++++++++++++++++++++++
> > > include/linux/firmware/imx/sm.h | 14 +++++
> > > 5 files changed, 119 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/firmware/arm_scmi/vendors/imx/Kconfig
> > > b/drivers/firmware/arm_scmi/vendors/imx/Kconfig
> > > index
> > >
> > b5f13d0e40155e485f4d1696e9550645d888ef44..4c24e17425f83081
> > 0f8ba376ece9
> > > db93c8cded6d 100644
> > > --- a/drivers/firmware/arm_scmi/vendors/imx/Kconfig
> > > +++ b/drivers/firmware/arm_scmi/vendors/imx/Kconfig
> > > @@ -26,7 +26,8 @@ config IMX_SCMI_CPU_EXT config
> > IMX_SCMI_LMM_EXT
> > > tristate "i.MX SCMI LMM EXTENSION"
> > > depends on ARM_SCMI_PROTOCOL || (COMPILE_TEST && OF)
> > > - default y if ARCH_MXC
> > > + depends on IMX_SCMI_LMM_DRV
> > > + default y if ARCH_MXC && ARM64
> >
> > I can't understand the ARM64 dependency on this and next patch.
>
> ARCH_MXC both supports ARM32 and ARM64.
>
> To i.MX ARM32 platform, there is no plan to enable SCMI, so only
> set y for ARCH_MXC ARM64 platforms.
>
OK but why is it different for IMX_SCMI_MISC_DRV. I really don't see
any dependency. If it is not supported today fine, but do you need any
issue to use it or compile it for arm32 ?
--
Regards,
Sudeep
^ permalink raw reply [flat|nested] 21+ messages in thread
* RE: [PATCH v4 5/7] firmware: imx: Add i.MX95 SCMI LMM driver
2025-04-14 10:15 ` Sudeep Holla
@ 2025-04-14 10:44 ` Peng Fan
2025-04-14 11:00 ` Peng Fan
0 siblings, 1 reply; 21+ messages in thread
From: Peng Fan @ 2025-04-14 10:44 UTC (permalink / raw)
To: Sudeep Holla
Cc: Peng Fan (OSS), Cristian Marussi, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Dan Carpenter,
linux-kernel@vger.kernel.org, arm-scmi@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev,
devicetree@vger.kernel.org
Hi Sudeep,
> Subject: Re: [PATCH v4 5/7] firmware: imx: Add i.MX95 SCMI LMM
> driver
>
> On Mon, Apr 14, 2025 at 09:57:43AM +0000, Peng Fan wrote:
> > Hi Sudeep,
> >
> > > Subject: Re: [PATCH v4 5/7] firmware: imx: Add i.MX95 SCMI LMM
> > > driver
> > >
> > > On Tue, Apr 08, 2025 at 04:44:29PM +0800, Peng Fan (OSS) wrote:
> > > > From: Peng Fan <peng.fan@nxp.com>
> > > >
> > > > The i.MX95 System manager exports SCMI LMM protocol for linux
> to
> > > > manage Logical Machines. The driver is to use the LMM Protocol
> > > > interface to boot, shutdown a LM.
> > > >
> > > > Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>
> > > > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > > > ---
> > > > drivers/firmware/arm_scmi/vendors/imx/Kconfig | 3 +-
> > > > drivers/firmware/imx/Kconfig | 11 ++++
> > > > drivers/firmware/imx/Makefile | 1 +
> > > > drivers/firmware/imx/sm-lmm.c | 91
> > > +++++++++++++++++++++++++++
> > > > include/linux/firmware/imx/sm.h | 14 +++++
> > > > 5 files changed, 119 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/firmware/arm_scmi/vendors/imx/Kconfig
> > > > b/drivers/firmware/arm_scmi/vendors/imx/Kconfig
> > > > index
> > > >
> > >
> b5f13d0e40155e485f4d1696e9550645d888ef44..4c24e17425f83081
> > > 0f8ba376ece9
> > > > db93c8cded6d 100644
> > > > --- a/drivers/firmware/arm_scmi/vendors/imx/Kconfig
> > > > +++ b/drivers/firmware/arm_scmi/vendors/imx/Kconfig
> > > > @@ -26,7 +26,8 @@ config IMX_SCMI_CPU_EXT config
> > > IMX_SCMI_LMM_EXT
> > > > tristate "i.MX SCMI LMM EXTENSION"
> > > > depends on ARM_SCMI_PROTOCOL || (COMPILE_TEST && OF)
> > > > - default y if ARCH_MXC
> > > > + depends on IMX_SCMI_LMM_DRV
> > > > + default y if ARCH_MXC && ARM64
> > >
> > > I can't understand the ARM64 dependency on this and next patch.
> >
> > ARCH_MXC both supports ARM32 and ARM64.
> >
> > To i.MX ARM32 platform, there is no plan to enable SCMI, so only set
> y
> > for ARCH_MXC ARM64 platforms.
> >
>
> OK but why is it different for IMX_SCMI_MISC_DRV. I really don't see
> any dependency. If it is not supported today fine, but do you need any
> issue to use it or compile it for arm32 ?
Seems my over-thinking.
There is no ARM64 dependency. No issue.
I just think there is no need to default build in this driver for i.MX
ARM32 platform, because no i.MX ARM32 platform supports SCMI.
But after a rethink, ARM64 dependency could be dropped, because
there was already a dependency ARM_SCMI_PROTOCOL(i.MX ARM32
not select this option), so we could follow same as
IMX_SCMI_MISC_DRV.
Please let me know if I need post new version for this and
Dan's comments. Anyway, no rush.
Thanks,
Peng.
>
> --
> Regards,
> Sudeep
^ permalink raw reply [flat|nested] 21+ messages in thread
* RE: [PATCH v4 5/7] firmware: imx: Add i.MX95 SCMI LMM driver
2025-04-14 10:44 ` Peng Fan
@ 2025-04-14 11:00 ` Peng Fan
2025-04-14 11:17 ` Sudeep Holla
0 siblings, 1 reply; 21+ messages in thread
From: Peng Fan @ 2025-04-14 11:00 UTC (permalink / raw)
To: Peng Fan, Sudeep Holla
Cc: Peng Fan (OSS), Cristian Marussi, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Dan Carpenter,
linux-kernel@vger.kernel.org, arm-scmi@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev,
devicetree@vger.kernel.org
> Subject: RE: [PATCH v4 5/7] firmware: imx: Add i.MX95 SCMI LMM
> driver
>
> Hi Sudeep,
>
> > Subject: Re: [PATCH v4 5/7] firmware: imx: Add i.MX95 SCMI LMM
> driver
> >
> > On Mon, Apr 14, 2025 at 09:57:43AM +0000, Peng Fan wrote:
> > > Hi Sudeep,
> > >
> > > > Subject: Re: [PATCH v4 5/7] firmware: imx: Add i.MX95 SCMI
> LMM
> > > > driver
> > > >
> > > > On Tue, Apr 08, 2025 at 04:44:29PM +0800, Peng Fan (OSS)
> wrote:
> > > > > From: Peng Fan <peng.fan@nxp.com>
> > > > >
> > > > > The i.MX95 System manager exports SCMI LMM protocol for
> linux
> > to
> > > > > manage Logical Machines. The driver is to use the LMM
> Protocol
> > > > > interface to boot, shutdown a LM.
> > > > >
> > > > > Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>
> > > > > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > > > > ---
> > > > > drivers/firmware/arm_scmi/vendors/imx/Kconfig | 3 +-
> > > > > drivers/firmware/imx/Kconfig | 11 ++++
> > > > > drivers/firmware/imx/Makefile | 1 +
> > > > > drivers/firmware/imx/sm-lmm.c | 91
> > > > +++++++++++++++++++++++++++
> > > > > include/linux/firmware/imx/sm.h | 14 +++++
> > > > > 5 files changed, 119 insertions(+), 1 deletion(-)
> > > > >
> > > > > diff --git a/drivers/firmware/arm_scmi/vendors/imx/Kconfig
> > > > > b/drivers/firmware/arm_scmi/vendors/imx/Kconfig
> > > > > index
> > > > >
> > > >
> >
> b5f13d0e40155e485f4d1696e9550645d888ef44..4c24e17425f83081
> > > > 0f8ba376ece9
> > > > > db93c8cded6d 100644
> > > > > --- a/drivers/firmware/arm_scmi/vendors/imx/Kconfig
> > > > > +++ b/drivers/firmware/arm_scmi/vendors/imx/Kconfig
> > > > > @@ -26,7 +26,8 @@ config IMX_SCMI_CPU_EXT config
> > > > IMX_SCMI_LMM_EXT
> > > > > tristate "i.MX SCMI LMM EXTENSION"
> > > > > depends on ARM_SCMI_PROTOCOL || (COMPILE_TEST && OF)
> > > > > - default y if ARCH_MXC
> > > > > + depends on IMX_SCMI_LMM_DRV
> > > > > + default y if ARCH_MXC && ARM64
> > > >
> > > > I can't understand the ARM64 dependency on this and next patch.
> > >
> > > ARCH_MXC both supports ARM32 and ARM64.
> > >
> > > To i.MX ARM32 platform, there is no plan to enable SCMI, so only
> set
> > y
> > > for ARCH_MXC ARM64 platforms.
> > >
> >
> > OK but why is it different for IMX_SCMI_MISC_DRV. I really don't see
> > any dependency. If it is not supported today fine, but do you need
> any
> > issue to use it or compile it for arm32 ?
>
> Seems my over-thinking.
> There is no ARM64 dependency. No issue.
> I just think there is no need to default build in this driver for i.MX
> ARM32 platform, because no i.MX ARM32 platform supports SCMI.
>
> But after a rethink, ARM64 dependency could be dropped, because
> there was already a dependency ARM_SCMI_PROTOCOL(i.MX ARM32
> not select this option), so we could follow same as
> IMX_SCMI_MISC_DRV.
Oops, I just checked wrong Kconfig under drivers/firmware/arm_scmi/
vendors/imx
Build this for ARM32 i.MX is ok, I just think no need. So add
a ARM64 dependency.
For IMX_SCMI_MISC_DRV, I could not recall clearly, seems I forgot
to add. But anyway, w/o ARM64 should be both fine.
I tested ARM32 build with imx_v6_v7_defconfig, no issue.
Thanks,
Peng.
>
> Please let me know if I need post new version for this and Dan's
> comments. Anyway, no rush.
>
> Thanks,
> Peng.
>
> >
> > --
> > Regards,
> > Sudeep
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v4 5/7] firmware: imx: Add i.MX95 SCMI LMM driver
2025-04-14 11:00 ` Peng Fan
@ 2025-04-14 11:17 ` Sudeep Holla
2025-04-15 9:10 ` Peng Fan
0 siblings, 1 reply; 21+ messages in thread
From: Sudeep Holla @ 2025-04-14 11:17 UTC (permalink / raw)
To: Peng Fan
Cc: Peng Fan (OSS), Cristian Marussi, Shawn Guo, Sudeep Holla,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Dan Carpenter,
linux-kernel@vger.kernel.org, arm-scmi@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev,
devicetree@vger.kernel.org
On Mon, Apr 14, 2025 at 11:00:20AM +0000, Peng Fan wrote:
>
> Oops, I just checked wrong Kconfig under drivers/firmware/arm_scmi/
> vendors/imx
>
> Build this for ARM32 i.MX is ok, I just think no need. So add
> a ARM64 dependency.
>
OK, I will drop the ARM64 dependency when applying. I also don't understand
the dependency on i.MX firmware LMM and CPU drivers in the scmi vendor
protocol as the dependency should be other way around. But I see Arnd had
fixed it so I will keep it as you have posted to keep them all aligned.
--
Regards,
Sudeep
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v4 5/7] firmware: imx: Add i.MX95 SCMI LMM driver
2025-04-14 11:17 ` Sudeep Holla
@ 2025-04-15 9:10 ` Peng Fan
2025-04-15 14:48 ` Sudeep Holla
0 siblings, 1 reply; 21+ messages in thread
From: Peng Fan @ 2025-04-15 9:10 UTC (permalink / raw)
To: Sudeep Holla
Cc: Peng Fan, Cristian Marussi, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Dan Carpenter,
linux-kernel@vger.kernel.org, arm-scmi@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev,
devicetree@vger.kernel.org
On Mon, Apr 14, 2025 at 12:17:34PM +0100, Sudeep Holla wrote:
>On Mon, Apr 14, 2025 at 11:00:20AM +0000, Peng Fan wrote:
>>
>> Oops, I just checked wrong Kconfig under drivers/firmware/arm_scmi/
>> vendors/imx
>>
>> Build this for ARM32 i.MX is ok, I just think no need. So add
>> a ARM64 dependency.
>>
>
>OK, I will drop the ARM64 dependency when applying. I also don't understand
Thanks for helping on this.
>the dependency on i.MX firmware LMM and CPU drivers in the scmi vendor
>protocol as the dependency should be other way around. But I see Arnd had
>fixed it so I will keep it as you have posted to keep them all aligned.
Not dig into much on this.
I just followed what Arnd did when I prepared the patchset to avoid
potential build issue as reported before.
Thanks,
Peng
>
>--
>Regards,
>Sudeep
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v4 5/7] firmware: imx: Add i.MX95 SCMI LMM driver
2025-04-15 9:10 ` Peng Fan
@ 2025-04-15 14:48 ` Sudeep Holla
0 siblings, 0 replies; 21+ messages in thread
From: Sudeep Holla @ 2025-04-15 14:48 UTC (permalink / raw)
To: Peng Fan
Cc: Peng Fan, Cristian Marussi, Sudeep Holla, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Dan Carpenter,
linux-kernel@vger.kernel.org, arm-scmi@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev,
devicetree@vger.kernel.org
On Tue, Apr 15, 2025 at 05:10:16PM +0800, Peng Fan wrote:
> On Mon, Apr 14, 2025 at 12:17:34PM +0100, Sudeep Holla wrote:
> >On Mon, Apr 14, 2025 at 11:00:20AM +0000, Peng Fan wrote:
> >>
> >> Oops, I just checked wrong Kconfig under drivers/firmware/arm_scmi/
> >> vendors/imx
> >>
> >> Build this for ARM32 i.MX is ok, I just think no need. So add
> >> a ARM64 dependency.
> >>
> >
> >OK, I will drop the ARM64 dependency when applying. I also don't understand
>
> Thanks for helping on this.
>
> >the dependency on i.MX firmware LMM and CPU drivers in the scmi vendor
> >protocol as the dependency should be other way around. But I see Arnd had
> >fixed it so I will keep it as you have posted to keep them all aligned.
> Not dig into much on this.
> I just followed what Arnd did when I prepared the patchset to avoid
> potential build issue as reported before.
>
Yes, I am keeping it based on those changes. I need to spend sometime to
understand why it was done so and see if anything can be improved. It is
not straightforward to understand that dependency, for me looks like it
is in reverse direction.
Anyway I have pushed it tentatively, will let you know once it is finalised.
--
Regards,
Sudeep
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v4 0/7] firmware: scmi/imx: Add i.MX95 LMM/CPU Protocol
2025-04-08 8:44 [PATCH v4 0/7] firmware: scmi/imx: Add i.MX95 LMM/CPU Protocol Peng Fan (OSS)
` (6 preceding siblings ...)
2025-04-08 8:44 ` [PATCH v4 7/7] MAINTAINERS: add entry for i.MX SCMI extensions Peng Fan (OSS)
@ 2025-04-24 9:43 ` Sudeep Holla
7 siblings, 0 replies; 21+ messages in thread
From: Sudeep Holla @ 2025-04-24 9:43 UTC (permalink / raw)
To: Cristian Marussi, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Peng Fan (OSS)
Cc: Sudeep Holla, Dan Carpenter, linux-kernel, arm-scmi,
linux-arm-kernel, imx, devicetree, Peng Fan
On Tue, 08 Apr 2025 16:44:24 +0800, Peng Fan (OSS) wrote:
> i.MX95 System Manager(SM) implements Logical Machine Management(LMM) and
> CPU protocol to manage Logical Machine(LM) and CPUs(eg, M7).
>
> To manage M7 in a separate LM or in same LM as Linux itself. LMM APIs
> and CPU APIs are needed.
>
> When M7 is in LM 'lm-m7', and this LM is managable by 'linux-lm',
> linux could use LMM_BOOT, LMM_SHUTDOWN and etc to manage 'lm-m7'.
>
> [...]
Applied to sudeep.holla/linux (for-next/scmi/updates), thanks!
[1/7] firmware: arm_scmi: imx: Add LMM and CPU documentation
https://git.kernel.org/sudeep.holla/c/15ec0e776935
[2/7] dt-bindings: firmware: Add i.MX95 SCMI LMM and CPU protocol
https://git.kernel.org/sudeep.holla/c/73b7a51b7445
[3/7] firmware: arm_scmi: imx: Add i.MX95 LMM protocol
https://git.kernel.org/sudeep.holla/c/34180863e000
[4/7] firmware: arm_scmi: imx: Add i.MX95 CPU Protocol
https://git.kernel.org/sudeep.holla/c/e68c305bc2f3
[5/7] firmware: imx: Add i.MX95 SCMI LMM driver
https://git.kernel.org/sudeep.holla/c/7242bbf418f0
[6/7] firmware: imx: Add i.MX95 SCMI CPU driver
https://git.kernel.org/sudeep.holla/c/1055faa5d660
[7/7] MAINTAINERS: add entry for i.MX SCMI extensions
https://git.kernel.org/sudeep.holla/c/b0a1c9d4893a
--
Regards,
Sudeep
^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2025-04-24 10:43 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-08 8:44 [PATCH v4 0/7] firmware: scmi/imx: Add i.MX95 LMM/CPU Protocol Peng Fan (OSS)
2025-04-08 8:44 ` [PATCH v4 1/7] firmware: arm_scmi: imx: Add LMM and CPU documentation Peng Fan (OSS)
2025-04-08 8:44 ` [PATCH v4 2/7] dt-bindings: firmware: Add i.MX95 SCMI LMM and CPU protocol Peng Fan (OSS)
2025-04-08 8:44 ` [PATCH v4 3/7] firmware: arm_scmi: imx: Add i.MX95 LMM protocol Peng Fan (OSS)
2025-04-08 9:17 ` Dan Carpenter
2025-04-09 3:37 ` Peng Fan
2025-04-08 9:21 ` Dan Carpenter
2025-04-09 3:33 ` Peng Fan
2025-04-08 8:44 ` [PATCH v4 4/7] firmware: arm_scmi: imx: Add i.MX95 CPU Protocol Peng Fan (OSS)
2025-04-08 8:44 ` [PATCH v4 5/7] firmware: imx: Add i.MX95 SCMI LMM driver Peng Fan (OSS)
2025-04-14 9:34 ` Sudeep Holla
2025-04-14 9:57 ` Peng Fan
2025-04-14 10:15 ` Sudeep Holla
2025-04-14 10:44 ` Peng Fan
2025-04-14 11:00 ` Peng Fan
2025-04-14 11:17 ` Sudeep Holla
2025-04-15 9:10 ` Peng Fan
2025-04-15 14:48 ` Sudeep Holla
2025-04-08 8:44 ` [PATCH v4 6/7] firmware: imx: Add i.MX95 SCMI CPU driver Peng Fan (OSS)
2025-04-08 8:44 ` [PATCH v4 7/7] MAINTAINERS: add entry for i.MX SCMI extensions Peng Fan (OSS)
2025-04-24 9:43 ` [PATCH v4 0/7] firmware: scmi/imx: Add i.MX95 LMM/CPU Protocol Sudeep Holla
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).