arm: introduce basic scmi support and scmi reset driver#124
Conversation
5e49228 to
76bf3d5
Compare
lorc
left a comment
There was a problem hiding this comment.
Great job!
I have a number of minor questions, though.
There was a problem hiding this comment.
Do we really need KConfig entries for features that are not available yet?
There was a problem hiding this comment.
+1. And keep on mind that for mailbox transport - new compatible string should be introduced - "arm,scmi"
That's why I think that transport can be deternime based on copmatibility string. Also you have mentioned "arm,scmi-smc-param" compatible in the commit description, but haven't introduce it in the code. Maybe it will be better to remove this/
There was a problem hiding this comment.
Do you really need this callback? As I can see, depending on build configuration scmi_smccc_smc/hvc can call either arm_smccc_smc or arm_smccc_hvc. Why do you need extra layer of indirection?
You can have one function scmi_smccc_call that calls either arm_smccc_smc or arm_smccc_hvc, depending on CONFIG_ARM_SCMI_SMC_METHOD_SMC
There was a problem hiding this comment.
I believe you can do this in KConfig. Something like
depends on DT_HAS_ARM_SCMI_SMC_ENABLED
There was a problem hiding this comment.
Here no as diferent compatible need to be selected
There was a problem hiding this comment.
Why this is part of the driver itself and not part of the shell.c?
There was a problem hiding this comment.
It can't be moved there as it uses private reset scmi functions.
This scmi reset and shell.c placed in different driver's folders.
There was a problem hiding this comment.
+1. And keep on mind that for mailbox transport - new compatible string should be introduced - "arm,scmi"
That's why I think that transport can be deternime based on copmatibility string. Also you have mentioned "arm,scmi-smc-param" compatible in the commit description, but haven't introduce it in the code. Maybe it will be better to remove this/
|
Great job. thank you. Also, a few comments from me |
9a16630 to
67fe7d8
Compare
|
Updated and ready for review |
67fe7d8 to
75fb2f9
Compare
oleksiimoisieiev
left a comment
There was a problem hiding this comment.
LGTM Reviewed-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
75fb2f9 to
8dfde74
Compare
|
Updated:
|
firscity
left a comment
There was a problem hiding this comment.
Also, I am not sure if it should go to rpi5_dev branch, all patches that you've asked for were added to zephyr-v3.6.0-xt and I think you can start moving whole RPI5 setup to it.
With 2 comments:
Acked-by: Dmytro Firsov <dmytro_firsov@epam.com>
8dfde74 to
c5b128b
Compare
It's in a dev stage and rpi5 not switched fully yet. I'll updated it on top zephyr-v3.6.0-xt when rpi is switched. |
Add DT bindings for ARM System Control and Management Interface (SCMI) DT
bindings with SMC/shmem based transport and for Reset domain management
protocol.
The SCMI bindings are overall based on Linux Kernel ARM SCMI bindings [1].
Hence Zephyr is not supported multi-compatible bindings definitions in one
yaml file the separate bindings has to be created for each defined ARM SCMI
compatible. This path introduces bindings (arm,scmi-smc.yaml) only for:
"arm,scmi-smc" - description: SCMI compliant firmware with ARM SMC/HVC
transport.
"arm,scmi-smc-param" - SCMI compliant firmware with ARM SMC/HVC transport
with shmem address(4KB-page, offset) as parameters
In addition, the Zephyr's DT processing design and devices instantiating is
tightly based on compatibility property presence in DT node, therefore, as
per this bindings, the SCMI protocol nodes are required to have
compatibility property.
Example:
firmware {
scmi {
compatible = "arm,scmi-smc";
arm,smc-id = <0x82000002>;
#address-cells = <1>;
#size-cells = <0>;
shmem = <&scmi_buf>;
scmi_reset: protocol@16 {
compatible = "arm,scmi-reset";
reg = <0x16>;
#reset-cells = <1>;
};
};
};
reserved-memory {
#address-cells = <2>;
#size-cells = <1>;
ranges;
scmi_buf: scmi@2201f000 {
compatible = "zephyr,memory-region";
reg = <0x0 0x3ff00000 4096>;
zephyr,memory-region = "scmi";
};
};
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/firmware/arm,scmi.yaml
Signed-off-by: Grygorii Strashko <grygorii_strashko@epam.com>
Reviewed-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
Acked-by: Dmytro Firsov <dmytro_firsov@epam.com>
The SCMI [1] is a set of operating system-independent software interfaces
that are used in system management. The SCMI is intended to resolve
critical HW platform resources management problem in the modern
multiprocessor systems where different software (Operating systems,
firmware) are running on different processors (or in virtualized
environment), but still have to access some shared system resources like
power, clocks, etc.
SCMI Design Document v3.2 is currently defines interfaces for:
- Discovery and self-description of the interfaces it supports.
- Power domain management.
- Performance management
- Clock management.
- Sensor management.
- Reset domain management.
- Voltage domain management.
- Power capping and monitoring.
- Pin control protocol
In terms of the SCMI design, the *platform* code is designated to handle
resource management requests in centralized manner and can run - or on
separate System Control Processor (SCP), or as part of Trusted Firmware
(ARM TF, OPTEE). In terms of the SCMI design, the *agent* is used to
describe the caller of the SCMI. The SCMI Transport describes how messages
are exchanged between agents and the platform.
This patch introduces basic support for ARM System Control and Management
Interface (SCMI) which implements interface to SCMI compliant firmware with
ARM SMC/HVC transport through the shared memory and can be extended.
The SCMI DT bindings are overall based on Linux Kernel ARM SCMI bindings
[2] with major difference that the SCMI protocol nodes are required to have
compatibility property.
+-------------+
| SCMI |
| Transport |
| device |
+------+------+
|
+-----v-------+
|SCMI XFER API|
+------+ |
| +-------------+
|
|
| +---------------+ Zephyr reset API
+----->SCMI reset +--------->
| | device |
| +---------------+
|
| +---------------+ Zephyr clock API
+-----> SCMI clock +--------->
| | device |
| +---------------+
| ...
| +---------------+
+-----> SCMI X |
| device |
+---------------+
The SCMI Transport device is intended to implement required SCMI transport
according to the SCMI DT compatibility property.
For example:
- "arm,scmi-smc" SCMI compliant firmware with ARM SMC/HVC transport;
- "arm,scmi-smc-param" SCMI compliant firmware with ARM SMC/HVC transport
with shmem address(4KB-page, offset) as parameters.
And expose SCMI transfer (XFER) API which can be used by other SCMI
functional devices.
The SCMI functional devices appear as child devices of the SCMI Transport
device, implement SCMI protocols for resource management and provide
corresponding standard Zephyr APIs.
For example, SCMI Reset domain management protocol (0x16, compatible
"arm,scmi-reset") is implemented as standard Zephyr Reset Controller
device/driver.
This implementation provides:
- only SCMI Transport device which implements ARM SMC/HVC transport with
shared memory;
- only sync transfers are implemented hence SMC/HVC transport only supports
"completed on return" functionality.
[1] https://developer.arm.com/Architectures/System%20Control%20and%20Management%20Interface
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/firmware/arm,scmi.yaml
Signed-off-by: Grygorii Strashko <grygorii_strashko@epam.com>
Reviewed-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
Acked-by: Dmytro Firsov <dmytro_firsov@epam.com>
Add basic shell interface for testing purposes.
This patch introduces base *arm_scmi* shell command with following format:
arm_scmi <proto> [protocol params]
The following commands introduced for Base protocol:
arm_scmi base help
base - SCMI Base proto commands.
Subcommands:
revision : SCMI Base get revision info
Usage: arm_scmi base revision
discover_agent : SCMI Base discover an agent
Usage: arm_scmi base discover_agent [agent_id]
device_permission : SCMI Base set an agent permissions to access device
Usage: arm_scmi base discover_agent <agent_id>
<device_id> <allow := 0|1>
reset_agent_cfg : SCMI Base reset an agent configuration
Usage: arm_scmi base reset_agent_cfg <agent_id>
<reset_perm := 0|1>
In the future more commands will be implemented as for Base protocol as for
other protocols. For example, for Reset domain management protocol
following shell commands are going to be added:
arm_scmi reset <revision|list|info|assert|deassert|autoreset> [params]
Signed-off-by: Grygorii Strashko <grygorii_strashko@epam.com>
Reviewed-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
Acked-by: Dmytro Firsov <dmytro_firsov@epam.com>
This patch adds reset driver which implements ARM SCMI Reset domain management protocol and exposes Zephyr Reset API. The current implementation supports only sync operations. Signed-off-by: Grygorii Strashko <grygorii_strashko@epam.com> Reviewed-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com> Acked-by: Dmytro Firsov <dmytro_firsov@epam.com>
Add ARM SCMI Reset shell interface for demo and testing purposes, which is
defined as sub-command of *arm_scmi* command.
It's optional and can be enabled by CONFIG_ARM_SCMI_RESET_SHELL option.
The ARM SCMI Reset shell interface defined as following:
$arm_scmi reset
reset - SCMI Reset proto commands.
Subcommands:
revision : SCMI Reset proto show revision information
Usage: arm_scmi reset revision
list : SCMI Reset domains list
Usage: arm_scmi reset list
info : SCMI Reset domain show info
Usage: arm_scmi reset info <domain_id>
assert : SCMI Reset domain assert
Usage: arm_scmi reset assert <domain_id>
deassert : SCMI Reset domain de-assert
Usage: arm_scmi reset deassert <domain_id>
autoreset : SCMI Reset domain Autonomous reset
Usage: arm_scmi reset autoreset <domain_id>
Signed-off-by: Grygorii Strashko <grygorii_strashko@epam.com>
Reviewed-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
Acked-by: Dmytro Firsov <dmytro_firsov@epam.com>
Add ARM SCMI shell sample application. Signed-off-by: Grygorii Strashko <grygorii_strashko@epam.com> Reviewed-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com> Acked-by: Dmytro Firsov <dmytro_firsov@epam.com>
c5b128b to
c14efb5
Compare
|
As requested updated on top of zephyr-v3.6.0-xt |
|
@firscity please take a look and merge if everything is ok |
|
No objections from my side, but I would like to have @lorc AB/RB when he will be available |
|
This PR should be reworked, taking into account zephyrproject-rtos#75102 |
ok. @klogg @oleksiimoisieiev FYI. |
|
Are we going to merge this PR? |
The SCMI [1] is a set of operating system-independent software interfaces
that are used in system management. The SCMI is intended to resolve
critical HW platform resources management problem in the modern
multiprocessor systems where different software (Operating systems,
firmware) are running on different processors (or in virtualized
environment), but still have to access some shared system resources like
power, clocks, etc.
SCMI Design Document v3.2 is currently defines interfaces for:
In terms of the SCMI design, the platform code is designated to handle
resource management requests in centralized manner and can run - or on
separate System Control Processor (SCP), or as part of Trusted Firmware
(ARM TF, OPTEE). In terms of the SCMI design, the agent is used to
describe the caller of the SCMI. The SCMI Transport describes how messages
are exchanged between agents and the platform.
This patch introduces basic support for ARM System Control and Management
Interface (SCMI) which implements interface to SCMI compliant firmware with
ARM SMC/HVC transport through the shared memory and can be extended.
The SCMI DT bindings are overall based on Linux Kernel ARM SCMI bindings
[2] with major difference that the SCMI protocol nodes are required to have
compatibility property.
The SCMI Transport device is intended to implement required SCMI transport
according to the SCMI DT compatibility property.
For example:
with shmem address(4KB-page, offset) as parameters.
And expose SCMI transfer (XFER) API which can be used by other SCMI
functional devices.
The SCMI functional devices appear as child devices of the SCMI Transport
device, implement SCMI protocols for resource management and provide
corresponding standard Zephyr APIs.
For example, SCMI Reset domain management protocol (0x16, compatible
"arm,scmi-reset") is implemented as standard Zephyr Reset Controller
device/driver.
This implementation provides:
shared memory;
"completed on return" functionality.
[1] https://developer.arm.com/Architectures/System%20Control%20and%20Management%20Interface
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/firmware/arm,scmi.yaml