From: Grygorii Strashko <grygorii_strashko@epam.com>
Proposal description to add separate SCMI DT node for Xen management agent
under "chosen" or xen-config node, like Hyperlaunch "xen,config".
This proposal introduces a new approach to the Xen multi-domain
configuration, where all Xen-specific configuration has been moved
under the "/chosen" node. This requires less Dom0 device tree
manipulation and isolates Xen configuration from domain configuration.
This approach provides the following device tree (DT) parameters:
- "xen,scmi-secondary-agents": A Xen-specific parameter under the
"/chosen" node, which describes the SCMI agent configuration for
the domains.
- the SCMI configuration for Xen (privileged agent) and the shared
memory configuration for all agents are provided under the "/chosen"
node and are used strictly by Xen for its initial configuration.
- the scmi_shm and SCMI configuration for Dom0 are placed in the
"/firmware/scmi" node so that they can be moved to Dom0 without
any changes.
This configuration allows the use of Xen-specific nodes to provide
information strictly needed by Xen while using the default SCMI
configuration for Dom0 and other domains. As a result, no additional
bindings need to be introduced to the device tree.
Signed-off-by: Grygorii Strashko <grygorii_strashko@epam.com>
Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
---
 .../arm/firmware/arm-scmi-proposal.rst        | 224 ++++++++++++++++++
 1 file changed, 224 insertions(+)
 create mode 100644 docs/hypervisor-guide/arm/firmware/arm-scmi-proposal.rst
diff --git a/docs/hypervisor-guide/arm/firmware/arm-scmi-proposal.rst b/docs/hypervisor-guide/arm/firmware/arm-scmi-proposal.rst
new file mode 100644
index 0000000000..fcc2ed2b65
--- /dev/null
+++ b/docs/hypervisor-guide/arm/firmware/arm-scmi-proposal.rst
@@ -0,0 +1,224 @@
+
+Proposal for SCMI multi-agent driver bindings
+=============================================
+
+Now the Xen configuration for SCMI multi-agent support is done in a bit complicated way, especially
+from SCMI multi-agent driver initialization and Dom0 DT manipulation point of view.
+Also it does not take into account future requirements to support SCP SCMI FW.
+
+To enable SCMI multi-agent user need:
+
+* take host DT with basic SCMI enabled
+* add SCMI shared-memory nodes for all agents
+* update SCMI node to point on SCMI Xen management channel (``[smc-id, shmem]``)
+* add "xen,scmi-secondary-agents" property to the "\chosen" node
+
+.. code::
+
+   chosen {
+      xen,scmi-secondary-agents = <
+                    1 0x82000003 &scmi_shm_1
+                    2 0x82000004 &scmi_shm_2
+                    3 0x82000005 &scmi_shm_3
+                    4 0x82000006 &scmi_shm_4>;
+    }
+
+    /{
+            // SCMI shared-memory nodes for all agents
+            scmi_shm_0 : sram@47ff0000 {
+                compatible = "arm,scmi-shmem";
+                reg = <0x0 0x47ff0000 0x0 0x1000>;
+            };
+            scmi_shm_1: sram@47ff1000 {
+                    compatible = "arm,scmi-shmem";
+                    reg = <0x0 0x47ff1000 0x0 0x1000>;
+            };
+            scmi_shm_2: sram@47ff2000 {
+                    compatible = "arm,scmi-shmem";
+                    reg = <0x0 0x47ff2000 0x0 0x1000>;
+            };
+            scmi_shm_3: sram@47ff3000 {
+                    compatible = "arm,scmi-shmem";
+                    reg = <0x0 0x47ff3000 0x0 0x1000>;
+            };
+            scmi_shm_4: sram@47ff4000 {
+                    compatible = "arm,scmi-shmem";
+                    reg = <0x0 0x47ff4000 0x0 0x1000>;
+            };
+
+            firmware {
+                scmi: scmi {
+                    compatible = "arm,scmi-smc";
+                    arm, smc - id = <0x82000002>; <--- Xen management agent channel "smc-id"
+                    #address-cells = < 1>;
+                    #size-cells = < 0>;
+                    #access-controller-cells = < 1>;
+                    shmem = <&scmi_shm_0>; <--- Xen management agent channel "shmem"
+
+                    protocol@X{
+                    };
+                };
+            };
+    }
+
+Important thing to note is that all information about multi-channel support is strictly Xen specific.
+
+During initialization the SCMI multi-agent driver uses Host DT SCMI node and
+"xen,scmi-secondary-agents" property to init itself and then, during Dom0 creation, manipulates
+Dom0 DT to remove Xen specific SCMI info and update dom0 SCMI nodes with Dom0 SCMI agent specific
+information.
+
+There are two negative points:
+
+1) Double DT modification - one is user to set up SCMI Xen support in Host DT, second -
+   Dom0 DT manipulation.
+2) In case of future support of mailbox shared-memory transport there could be up to 4 mailboxes and
+   up to 2 shared-memories per SCMI agent channel.
+
+Hence SCMI multi-agent support is Xen specific knowledge there is a proposal to add it as Xen
+specific DT definitions and so minimize Host and Dom0 DT manipulations.
+Those definitions can be added in "/chosen" or, ideally, in "xen,config" node (like in Hyperlaunch design).
+
+The SCMI binding stays generic, just two SCMI nodes defined - one for Xen management channel and
+one for Host Dom0 OSPM.
+
+Example of using "chosen" for configuration:
+
+.. code::
+
+    /{
+
+        chosen {
+            ...
+
+            // Xen SCMI management channel
+            scmi_shm_0 : sram@47ff0000 {
+                compatible = "arm,scmi-shmem";
+                reg = <0x0 0x47ff0000 0x0 0x1000>;
+            };
+            scmi_xen: scmi {
+                compatible = "arm,scmi-smc";
+                arm,smc-id = <0x82000002>; <--- Xen manegement agent smc-id
+                #address-cells = < 1>;
+                #size-cells = < 0>;
+                #access-controller-cells = < 1>;
+                shmem = <&scmi_shm_0>; <--- Xen manegement agent shmem
+            };
+
+            // SCMI multi-agent configuration
+            scmi_shm_2: sram@47ff2000 {
+                    compatible = "arm,scmi-shmem";
+                    reg = <0x0 0x47ff2000 0x0 0x1000>;
+            };
+            scmi_shm_3: sram@47ff3000 {
+                    compatible = "arm,scmi-shmem";
+                    reg = <0x0 0x47ff3000 0x0 0x1000>;
+            };
+            scmi_shm_4: sram@47ff4000 {
+                    compatible = "arm,scmi-shmem";
+                    reg = <0x0 0x47ff4000 0x0 0x1000>;
+            };
+            xen,scmi-secondary-agents = <
+                        1 0x82000003 &scmi_shm
+                        2 0x82000004 &scmi_shm_2
+                        3 0x82000005 &scmi_shm_3
+                        4 0x82000006 &scmi_shm_4>;
+        };
+
+        // Host SCMI OSPM channel - provided to the Dom0 as is if SCMI enabled for it
+        scmi_shm: sram@47ff1000 {
+                compatible = "arm,scmi-shmem";
+                reg = <0x0 0x47ff1000 0x0 0x1000>;
+        };
+
+        firmware {
+            scmi: scmi {
+                compatible = "arm,scmi-smc";
+                arm,smc-id = <0x82000003>; <--- Host OSPM agent smc-id
+                #address-cells = < 1>;
+                #size-cells = < 0>;
+                shmem = <&scmi_shm>; <--- Host OSPM agent shmem
+
+                protocol@X{
+                };
+            };
+        };
+    }
+
+
+In the above case:
+
+1) Xen SCMI multi-agent can be probed with DT configuration from "chosen" (or special "xen,config")
+   node and all Xen related nodes can be easily dropped from Dom0 DT.
+2) Host SCMI OSPM channel DT nodes can be copied to Dom0 DT without changes if SCMI enabled for it.
+3) Future support for mailbox shared-memory transport (SCP SCMI FW) can be simplified as no more
+   manipulation required with Dom0 SCMI "arm,smc-id" and "shmem" DT properties.
+
+
+Example of using "xen,config" for configuration:
+
+.. code::
+
+    hypervisor {
+        compatible = “hypervisor,xen”
+
+        // Configuration container
+        config {
+            compatible = "xen,config";
+            ...
+
+            // Xen SCMI management channel
+            scmi_shm_0 : sram@47ff0000 {
+                compatible = "arm,scmi-shmem";
+                reg = <0x0 0x47ff0000 0x0 0x1000>;
+            };
+            scmi_xen: scmi {
+                compatible = "arm,scmi-smc";
+                arm,smc-id = <0x82000002>; <--- Xen manegement agent smc-id
+                #address-cells = < 1>;
+                #size-cells = < 0>;
+                #access-controller-cells = < 1>;
+                shmem = <&scmi_shm_0>; <--- Xen manegement agent shmem
+            };
+
+            // SCMI multi-agent configuration
+            scmi_shm_2: sram@47ff2000 {
+                    compatible = "arm,scmi-shmem";
+                    reg = <0x0 0x47ff2000 0x0 0x1000>;
+            };
+            scmi_shm_3: sram@47ff3000 {
+                    compatible = "arm,scmi-shmem";
+                    reg = <0x0 0x47ff3000 0x0 0x1000>;
+            };
+            scmi_shm_4: sram@47ff4000 {
+                    compatible = "arm,scmi-shmem";
+                    reg = <0x0 0x47ff4000 0x0 0x1000>;
+            };
+            xen,scmi-secondary-agents = <
+                        1 0x82000003 &scmi_shm
+                        2 0x82000004 &scmi_shm_2
+                        3 0x82000005 &scmi_shm_3
+                        4 0x82000006 &scmi_shm_4>;
+        };
+    };
+
+    /{
+        // Host SCMI OSPM channel - provided to the Dom0 as is if SCMI enabled for it
+        scmi_shm: sram@47ff1000 {
+                compatible = "arm,scmi-shmem";
+                reg = <0x0 0x47ff1000 0x0 0x1000>;
+        };
+
+        firmware {
+            scmi: scmi {
+                compatible = "arm,scmi-smc";
+                arm,smc-id = <0x82000003>; <--- Host OSPM agent smc-id
+                #address-cells = < 1>;
+                #size-cells = < 0>;
+                shmem = <&scmi_shm>; <--- Host OSPM agent shmem
+
+                protocol@X{
+                };
+            };
+        };
+    }
-- 
2.34.1
On Mon, 19 May 2025, Oleksii Moisieiev wrote:
> From: Grygorii Strashko <grygorii_strashko@epam.com>
> 
> Proposal description to add separate SCMI DT node for Xen management agent
> under "chosen" or xen-config node, like Hyperlaunch "xen,config".
I think it is OK to place a larger "xen,config" node under /chosen with
more information for Xen to setup SCMI more easily.
> This proposal introduces a new approach to the Xen multi-domain
> configuration, where all Xen-specific configuration has been moved
> under the "/chosen" node. This requires less Dom0 device tree
> manipulation and isolates Xen configuration from domain configuration.
> 
> This approach provides the following device tree (DT) parameters:
> 
> - "xen,scmi-secondary-agents": A Xen-specific parameter under the
> "/chosen" node, which describes the SCMI agent configuration for
> the domains.
> - the SCMI configuration for Xen (privileged agent) and the shared
> memory configuration for all agents are provided under the "/chosen"
> node and are used strictly by Xen for its initial configuration.
> - the scmi_shm and SCMI configuration for Dom0 are placed in the
> "/firmware/scmi" node so that they can be moved to Dom0 without
> any changes.
Isn't the SCMI configuration present in /firmware/scmi referring to the
privileged agent=0 meant to be used by Xen?
I certainly see benefits in simplifying the configuration and especially
reducing the amount of changes a user might have to make on the
underlying device tree, but if the user needs to change /firmware/scmi
with the Dom0 information, it seems more dangerous and error prone than
the previous approach.
> This configuration allows the use of Xen-specific nodes to provide
> information strictly needed by Xen while using the default SCMI
> configuration for Dom0 and other domains. As a result, no additional
> bindings need to be introduced to the device tree.
This is not actually implemented by this patch series, right?
> Signed-off-by: Grygorii Strashko <grygorii_strashko@epam.com>
> Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
> ---
> 
> 
> 
>  .../arm/firmware/arm-scmi-proposal.rst        | 224 ++++++++++++++++++
>  1 file changed, 224 insertions(+)
>  create mode 100644 docs/hypervisor-guide/arm/firmware/arm-scmi-proposal.rst
> 
> diff --git a/docs/hypervisor-guide/arm/firmware/arm-scmi-proposal.rst b/docs/hypervisor-guide/arm/firmware/arm-scmi-proposal.rst
> new file mode 100644
> index 0000000000..fcc2ed2b65
> --- /dev/null
> +++ b/docs/hypervisor-guide/arm/firmware/arm-scmi-proposal.rst
> @@ -0,0 +1,224 @@
> +
> +Proposal for SCMI multi-agent driver bindings
> +=============================================
> +
> +Now the Xen configuration for SCMI multi-agent support is done in a bit complicated way, especially
> +from SCMI multi-agent driver initialization and Dom0 DT manipulation point of view.
> +Also it does not take into account future requirements to support SCP SCMI FW.
> +
> +To enable SCMI multi-agent user need:
> +
> +* take host DT with basic SCMI enabled
> +* add SCMI shared-memory nodes for all agents
> +* update SCMI node to point on SCMI Xen management channel (``[smc-id, shmem]``)
> +* add "xen,scmi-secondary-agents" property to the "\chosen" node
> +
> +.. code::
> +
> +   chosen {
> +      xen,scmi-secondary-agents = <
> +                    1 0x82000003 &scmi_shm_1
> +                    2 0x82000004 &scmi_shm_2
> +                    3 0x82000005 &scmi_shm_3
> +                    4 0x82000006 &scmi_shm_4>;
> +    }
> +
> +    /{
> +            // SCMI shared-memory nodes for all agents
> +            scmi_shm_0 : sram@47ff0000 {
> +                compatible = "arm,scmi-shmem";
> +                reg = <0x0 0x47ff0000 0x0 0x1000>;
> +            };
> +            scmi_shm_1: sram@47ff1000 {
> +                    compatible = "arm,scmi-shmem";
> +                    reg = <0x0 0x47ff1000 0x0 0x1000>;
> +            };
> +            scmi_shm_2: sram@47ff2000 {
> +                    compatible = "arm,scmi-shmem";
> +                    reg = <0x0 0x47ff2000 0x0 0x1000>;
> +            };
> +            scmi_shm_3: sram@47ff3000 {
> +                    compatible = "arm,scmi-shmem";
> +                    reg = <0x0 0x47ff3000 0x0 0x1000>;
> +            };
> +            scmi_shm_4: sram@47ff4000 {
> +                    compatible = "arm,scmi-shmem";
> +                    reg = <0x0 0x47ff4000 0x0 0x1000>;
> +            };
> +
> +            firmware {
> +                scmi: scmi {
> +                    compatible = "arm,scmi-smc";
> +                    arm, smc - id = <0x82000002>; <--- Xen management agent channel "smc-id"
> +                    #address-cells = < 1>;
> +                    #size-cells = < 0>;
> +                    #access-controller-cells = < 1>;
> +                    shmem = <&scmi_shm_0>; <--- Xen management agent channel "shmem"
> +
> +                    protocol@X{
> +                    };
> +                };
> +            };
> +    }
> +
> +Important thing to note is that all information about multi-channel support is strictly Xen specific.
> +
> +During initialization the SCMI multi-agent driver uses Host DT SCMI node and
> +"xen,scmi-secondary-agents" property to init itself and then, during Dom0 creation, manipulates
> +Dom0 DT to remove Xen specific SCMI info and update dom0 SCMI nodes with Dom0 SCMI agent specific
> +information.
> +
> +There are two negative points:
> +
> +1) Double DT modification - one is user to set up SCMI Xen support in Host DT, second -
> +   Dom0 DT manipulation.
> +2) In case of future support of mailbox shared-memory transport there could be up to 4 mailboxes and
> +   up to 2 shared-memories per SCMI agent channel.
> +
> +Hence SCMI multi-agent support is Xen specific knowledge there is a proposal to add it as Xen
> +specific DT definitions and so minimize Host and Dom0 DT manipulations.
> +Those definitions can be added in "/chosen" or, ideally, in "xen,config" node (like in Hyperlaunch design).
> +
> +The SCMI binding stays generic, just two SCMI nodes defined - one for Xen management channel and
> +one for Host Dom0 OSPM.
> +
> +Example of using "chosen" for configuration:
> +
> +.. code::
> +
> +    /{
> +
> +        chosen {
> +            ...
> +
> +            // Xen SCMI management channel
> +            scmi_shm_0 : sram@47ff0000 {
> +                compatible = "arm,scmi-shmem";
> +                reg = <0x0 0x47ff0000 0x0 0x1000>;
> +            };
> +            scmi_xen: scmi {
> +                compatible = "arm,scmi-smc";
> +                arm,smc-id = <0x82000002>; <--- Xen manegement agent smc-id
> +                #address-cells = < 1>;
> +                #size-cells = < 0>;
> +                #access-controller-cells = < 1>;
> +                shmem = <&scmi_shm_0>; <--- Xen manegement agent shmem
> +            };
> +
> +            // SCMI multi-agent configuration
> +            scmi_shm_2: sram@47ff2000 {
> +                    compatible = "arm,scmi-shmem";
> +                    reg = <0x0 0x47ff2000 0x0 0x1000>;
> +            };
> +            scmi_shm_3: sram@47ff3000 {
> +                    compatible = "arm,scmi-shmem";
> +                    reg = <0x0 0x47ff3000 0x0 0x1000>;
> +            };
> +            scmi_shm_4: sram@47ff4000 {
> +                    compatible = "arm,scmi-shmem";
> +                    reg = <0x0 0x47ff4000 0x0 0x1000>;
> +            };
> +            xen,scmi-secondary-agents = <
> +                        1 0x82000003 &scmi_shm
> +                        2 0x82000004 &scmi_shm_2
> +                        3 0x82000005 &scmi_shm_3
> +                        4 0x82000006 &scmi_shm_4>;
> +        };
> +
> +        // Host SCMI OSPM channel - provided to the Dom0 as is if SCMI enabled for it
> +        scmi_shm: sram@47ff1000 {
> +                compatible = "arm,scmi-shmem";
> +                reg = <0x0 0x47ff1000 0x0 0x1000>;
> +        };
> +
> +        firmware {
> +            scmi: scmi {
> +                compatible = "arm,scmi-smc";
> +                arm,smc-id = <0x82000003>; <--- Host OSPM agent smc-id
> +                #address-cells = < 1>;
> +                #size-cells = < 0>;
> +                shmem = <&scmi_shm>; <--- Host OSPM agent shmem
By OSPM you mean Dom0 and not Xen? So this is a change compared to a
device tree for baremetal Linux without Xen?
Let me ask the same question differently. In the case of barematal Linux
without Xen (no KVM), what would Linux see under /firmware/scmi as
smc-id and shmem? The same as the one that Xen would use for itself? Or
the same as the ones that Dom0 would use when Xen is present?
> +                protocol@X{
> +                };
> +            };
> +        };
> +    }
> +
> +
> +In the above case:
> +
> +1) Xen SCMI multi-agent can be probed with DT configuration from "chosen" (or special "xen,config")
> +   node and all Xen related nodes can be easily dropped from Dom0 DT.
> +2) Host SCMI OSPM channel DT nodes can be copied to Dom0 DT without changes if SCMI enabled for it.
> +3) Future support for mailbox shared-memory transport (SCP SCMI FW) can be simplified as no more
> +   manipulation required with Dom0 SCMI "arm,smc-id" and "shmem" DT properties.
Yes, I can see the benefit if we can arrange it so that the underlying
host device tree is the same that Linux would use baremetal. And all the
extra configuration is placed under /chosen in "xen,config" node or
similar. I would probably call it "xen,scmi".
> +Example of using "xen,config" for configuration:
> +
> +.. code::
> +
> +    hypervisor {
> +        compatible = “hypervisor,xen”
> +
> +        // Configuration container
> +        config {
> +            compatible = "xen,config";
> +            ...
> +
> +            // Xen SCMI management channel
> +            scmi_shm_0 : sram@47ff0000 {
> +                compatible = "arm,scmi-shmem";
> +                reg = <0x0 0x47ff0000 0x0 0x1000>;
> +            };
> +            scmi_xen: scmi {
> +                compatible = "arm,scmi-smc";
> +                arm,smc-id = <0x82000002>; <--- Xen manegement agent smc-id
> +                #address-cells = < 1>;
> +                #size-cells = < 0>;
> +                #access-controller-cells = < 1>;
> +                shmem = <&scmi_shm_0>; <--- Xen manegement agent shmem
> +            };
> +
> +            // SCMI multi-agent configuration
> +            scmi_shm_2: sram@47ff2000 {
> +                    compatible = "arm,scmi-shmem";
> +                    reg = <0x0 0x47ff2000 0x0 0x1000>;
> +            };
> +            scmi_shm_3: sram@47ff3000 {
> +                    compatible = "arm,scmi-shmem";
> +                    reg = <0x0 0x47ff3000 0x0 0x1000>;
> +            };
> +            scmi_shm_4: sram@47ff4000 {
> +                    compatible = "arm,scmi-shmem";
> +                    reg = <0x0 0x47ff4000 0x0 0x1000>;
> +            };
> +            xen,scmi-secondary-agents = <
> +                        1 0x82000003 &scmi_shm
> +                        2 0x82000004 &scmi_shm_2
> +                        3 0x82000005 &scmi_shm_3
> +                        4 0x82000006 &scmi_shm_4>;
> +        };
> +    };
> +
> +    /{
> +        // Host SCMI OSPM channel - provided to the Dom0 as is if SCMI enabled for it
> +        scmi_shm: sram@47ff1000 {
> +                compatible = "arm,scmi-shmem";
> +                reg = <0x0 0x47ff1000 0x0 0x1000>;
> +        };
> +
> +        firmware {
> +            scmi: scmi {
> +                compatible = "arm,scmi-smc";
> +                arm,smc-id = <0x82000003>; <--- Host OSPM agent smc-id
> +                #address-cells = < 1>;
> +                #size-cells = < 0>;
> +                shmem = <&scmi_shm>; <--- Host OSPM agent shmem
> +
> +                protocol@X{
> +                };
> +            };
> +        };
> +    }
> -- 
> 2.34.1
> 
                
            
On 23/05/2025 23:19, Stefano Stabellini wrote:
> On Mon, 19 May 2025, Oleksii Moisieiev wrote:
>> From: Grygorii Strashko<grygorii_strashko@epam.com>
>>
>> Proposal description to add separate SCMI DT node for Xen management agent
>> under "chosen" or xen-config node, like Hyperlaunch "xen,config".
> I think it is OK to place a larger "xen,config" node under /chosen with
> more information for Xen to setup SCMI more easily.
>
>
>> This proposal introduces a new approach to the Xen multi-domain
>> configuration, where all Xen-specific configuration has been moved
>> under the "/chosen" node. This requires less Dom0 device tree
>> manipulation and isolates Xen configuration from domain configuration.
>>
>> This approach provides the following device tree (DT) parameters:
>>
>> - "xen,scmi-secondary-agents": A Xen-specific parameter under the
>> "/chosen" node, which describes the SCMI agent configuration for
>> the domains.
>> - the SCMI configuration for Xen (privileged agent) and the shared
>> memory configuration for all agents are provided under the "/chosen"
>> node and are used strictly by Xen for its initial configuration.
>> - the scmi_shm and SCMI configuration for Dom0 are placed in the
>> "/firmware/scmi" node so that they can be moved to Dom0 without
>> any changes.
> Isn't the SCMI configuration present in /firmware/scmi referring to the
> privileged agent=0 meant to be used by Xen?
>
> I certainly see benefits in simplifying the configuration and especially
> reducing the amount of changes a user might have to make on the
> underlying device tree, but if the user needs to change /firmware/scmi
> with the Dom0 information, it seems more dangerous and error prone than
> the previous approach.
>
The idea is to move the privileged agent=0 configuration to the /chosen 
node and
assign agent=1 to the Dom0 node under /firmware/scmi.
Benefits of This Approach:
- No Modification of the Xen DT Node Required
     This eliminates the need to modify the Xen Device Tree (DT) node 
before creating Dom0 in
     order to set the correct shared memory (shmem).
-Consistent SCMI Configuration Format
   The Dom0 DT will have the same SCMI configuration format as other 
domains, simplifying the
   overall configuration process.
- Unified SCMI Configuration Method
    There will no longer be a need to use a different approach for SCMI 
configuration in Dom0
   compared to other domains.
- Separation Between Dom0 and Privileged Node
       This provides a clear separation between the Dom0 node and the 
privileged node.
       For example:
             If Dom0 only requires the clock protocol, but the Xen SCMI 
configuration requires additional protocols,
             this approach allows Dom0 to receive only the necessary 
protocol configuration.
>> This configuration allows the use of Xen-specific nodes to provide
>> information strictly needed by Xen while using the default SCMI
>> configuration for Dom0 and other domains. As a result, no additional
>> bindings need to be introduced to the device tree.
> This is not actually implemented by this patch series, right?
It is not. Just posted this document as a proposal.
>> Signed-off-by: Grygorii Strashko<grygorii_strashko@epam.com>
>> Signed-off-by: Oleksii Moisieiev<oleksii_moisieiev@epam.com>
>> ---
>>
>>
>>
>>   .../arm/firmware/arm-scmi-proposal.rst        | 224 ++++++++++++++++++
>>   1 file changed, 224 insertions(+)
>>   create mode 100644 docs/hypervisor-guide/arm/firmware/arm-scmi-proposal.rst
>>
>> diff --git a/docs/hypervisor-guide/arm/firmware/arm-scmi-proposal.rst b/docs/hypervisor-guide/arm/firmware/arm-scmi-proposal.rst
>> new file mode 100644
>> index 0000000000..fcc2ed2b65
>> --- /dev/null
>> +++ b/docs/hypervisor-guide/arm/firmware/arm-scmi-proposal.rst
>> @@ -0,0 +1,224 @@
>> +
>> +Proposal for SCMI multi-agent driver bindings
>> +=============================================
>> +
>> +Now the Xen configuration for SCMI multi-agent support is done in a bit complicated way, especially
>> +from SCMI multi-agent driver initialization and Dom0 DT manipulation point of view.
>> +Also it does not take into account future requirements to support SCP SCMI FW.
>> +
>> +To enable SCMI multi-agent user need:
>> +
>> +* take host DT with basic SCMI enabled
>> +* add SCMI shared-memory nodes for all agents
>> +* update SCMI node to point on SCMI Xen management channel (``[smc-id, shmem]``)
>> +* add "xen,scmi-secondary-agents" property to the "\chosen" node
>> +
>> +.. code::
>> +
>> +   chosen {
>> +      xen,scmi-secondary-agents = <
>> +                    1 0x82000003 &scmi_shm_1
>> +                    2 0x82000004 &scmi_shm_2
>> +                    3 0x82000005 &scmi_shm_3
>> +                    4 0x82000006 &scmi_shm_4>;
>> +    }
>> +
>> +    /{
>> +            // SCMI shared-memory nodes for all agents
>> +            scmi_shm_0 : sram@47ff0000 {
>> +                compatible = "arm,scmi-shmem";
>> +                reg = <0x0 0x47ff0000 0x0 0x1000>;
>> +            };
>> +            scmi_shm_1: sram@47ff1000 {
>> +                    compatible = "arm,scmi-shmem";
>> +                    reg = <0x0 0x47ff1000 0x0 0x1000>;
>> +            };
>> +            scmi_shm_2: sram@47ff2000 {
>> +                    compatible = "arm,scmi-shmem";
>> +                    reg = <0x0 0x47ff2000 0x0 0x1000>;
>> +            };
>> +            scmi_shm_3: sram@47ff3000 {
>> +                    compatible = "arm,scmi-shmem";
>> +                    reg = <0x0 0x47ff3000 0x0 0x1000>;
>> +            };
>> +            scmi_shm_4: sram@47ff4000 {
>> +                    compatible = "arm,scmi-shmem";
>> +                    reg = <0x0 0x47ff4000 0x0 0x1000>;
>> +            };
>> +
>> +            firmware {
>> +                scmi: scmi {
>> +                    compatible = "arm,scmi-smc";
>> +                    arm, smc - id = <0x82000002>; <--- Xen management agent channel "smc-id"
>> +                    #address-cells = < 1>;
>> +                    #size-cells = < 0>;
>> +                    #access-controller-cells = < 1>;
>> +                    shmem = <&scmi_shm_0>; <--- Xen management agent channel "shmem"
>> +
>> +                    protocol@X{
>> +                    };
>> +                };
>> +            };
>> +    }
>> +
>> +Important thing to note is that all information about multi-channel support is strictly Xen specific.
>> +
>> +During initialization the SCMI multi-agent driver uses Host DT SCMI node and
>> +"xen,scmi-secondary-agents" property to init itself and then, during Dom0 creation, manipulates
>> +Dom0 DT to remove Xen specific SCMI info and update dom0 SCMI nodes with Dom0 SCMI agent specific
>> +information.
>> +
>> +There are two negative points:
>> +
>> +1) Double DT modification - one is user to set up SCMI Xen support in Host DT, second -
>> +   Dom0 DT manipulation.
>> +2) In case of future support of mailbox shared-memory transport there could be up to 4 mailboxes and
>> +   up to 2 shared-memories per SCMI agent channel.
>> +
>> +Hence SCMI multi-agent support is Xen specific knowledge there is a proposal to add it as Xen
>> +specific DT definitions and so minimize Host and Dom0 DT manipulations.
>> +Those definitions can be added in "/chosen" or, ideally, in "xen,config" node (like in Hyperlaunch design).
>> +
>> +The SCMI binding stays generic, just two SCMI nodes defined - one for Xen management channel and
>> +one for Host Dom0 OSPM.
>> +
>> +Example of using "chosen" for configuration:
>> +
>> +.. code::
>> +
>> +    /{
>> +
>> +        chosen {
>> +            ...
>> +
>> +            // Xen SCMI management channel
>> +            scmi_shm_0 : sram@47ff0000 {
>> +                compatible = "arm,scmi-shmem";
>> +                reg = <0x0 0x47ff0000 0x0 0x1000>;
>> +            };
>> +            scmi_xen: scmi {
>> +                compatible = "arm,scmi-smc";
>> +                arm,smc-id = <0x82000002>; <--- Xen manegement agent smc-id
>> +                #address-cells = < 1>;
>> +                #size-cells = < 0>;
>> +                #access-controller-cells = < 1>;
>> +                shmem = <&scmi_shm_0>; <--- Xen manegement agent shmem
>> +            };
>> +
>> +            // SCMI multi-agent configuration
>> +            scmi_shm_2: sram@47ff2000 {
>> +                    compatible = "arm,scmi-shmem";
>> +                    reg = <0x0 0x47ff2000 0x0 0x1000>;
>> +            };
>> +            scmi_shm_3: sram@47ff3000 {
>> +                    compatible = "arm,scmi-shmem";
>> +                    reg = <0x0 0x47ff3000 0x0 0x1000>;
>> +            };
>> +            scmi_shm_4: sram@47ff4000 {
>> +                    compatible = "arm,scmi-shmem";
>> +                    reg = <0x0 0x47ff4000 0x0 0x1000>;
>> +            };
>> +            xen,scmi-secondary-agents = <
>> +                        1 0x82000003 &scmi_shm
>> +                        2 0x82000004 &scmi_shm_2
>> +                        3 0x82000005 &scmi_shm_3
>> +                        4 0x82000006 &scmi_shm_4>;
>> +        };
>> +
>> +        // Host SCMI OSPM channel - provided to the Dom0 as is if SCMI enabled for it
>> +        scmi_shm: sram@47ff1000 {
>> +                compatible = "arm,scmi-shmem";
>> +                reg = <0x0 0x47ff1000 0x0 0x1000>;
>> +        };
>> +
>> +        firmware {
>> +            scmi: scmi {
>> +                compatible = "arm,scmi-smc";
>> +                arm,smc-id = <0x82000003>; <--- Host OSPM agent smc-id
>> +                #address-cells = < 1>;
>> +                #size-cells = < 0>;
>> +                shmem = <&scmi_shm>; <--- Host OSPM agent shmem
> By OSPM you mean Dom0 and not Xen? So this is a change compared to a
> device tree for baremetal Linux without Xen?
>
> Let me ask the same question differently. In the case of barematal Linux
> without Xen (no KVM), what would Linux see under /firmware/scmi as
> smc-id and shmem? The same as the one that Xen would use for itself? Or
> the same as the ones that Dom0 would use when Xen is present?
If this DT is used with the baremetal Linux - then the Linux Kernel will
see Dom0 "smc-id" and "shmen" under /firmware/scmi.
>> +                protocol@X{
>> +                };
>> +            };
>> +        };
>> +    }
>> +
>> +
>> +In the above case:
>> +
>> +1) Xen SCMI multi-agent can be probed with DT configuration from "chosen" (or special "xen,config")
>> +   node and all Xen related nodes can be easily dropped from Dom0 DT.
>> +2) Host SCMI OSPM channel DT nodes can be copied to Dom0 DT without changes if SCMI enabled for it.
>> +3) Future support for mailbox shared-memory transport (SCP SCMI FW) can be simplified as no more
>> +   manipulation required with Dom0 SCMI "arm,smc-id" and "shmem" DT properties.
> Yes, I can see the benefit if we can arrange it so that the underlying
> host device tree is the same that Linux would use baremetal. And all the
> extra configuration is placed under /chosen in "xen,config" node or
> similar. I would probably call it "xen,scmi".
Personally, I would keep "xen,config" as it leaves room to add additional
configuration nodes in the future.
>> +Example of using "xen,config" for configuration:
>> +
>> +.. code::
>> +
>> +    hypervisor {
>> +        compatible = “hypervisor,xen”
>> +
>> +        // Configuration container
>> +        config {
>> +            compatible = "xen,config";
>> +            ...
>> +
>> +            // Xen SCMI management channel
>> +            scmi_shm_0 : sram@47ff0000 {
>> +                compatible = "arm,scmi-shmem";
>> +                reg = <0x0 0x47ff0000 0x0 0x1000>;
>> +            };
>> +            scmi_xen: scmi {
>> +                compatible = "arm,scmi-smc";
>> +                arm,smc-id = <0x82000002>; <--- Xen manegement agent smc-id
>> +                #address-cells = < 1>;
>> +                #size-cells = < 0>;
>> +                #access-controller-cells = < 1>;
>> +                shmem = <&scmi_shm_0>; <--- Xen manegement agent shmem
>> +            };
>> +
>> +            // SCMI multi-agent configuration
>> +            scmi_shm_2: sram@47ff2000 {
>> +                    compatible = "arm,scmi-shmem";
>> +                    reg = <0x0 0x47ff2000 0x0 0x1000>;
>> +            };
>> +            scmi_shm_3: sram@47ff3000 {
>> +                    compatible = "arm,scmi-shmem";
>> +                    reg = <0x0 0x47ff3000 0x0 0x1000>;
>> +            };
>> +            scmi_shm_4: sram@47ff4000 {
>> +                    compatible = "arm,scmi-shmem";
>> +                    reg = <0x0 0x47ff4000 0x0 0x1000>;
>> +            };
>> +            xen,scmi-secondary-agents = <
>> +                        1 0x82000003 &scmi_shm
>> +                        2 0x82000004 &scmi_shm_2
>> +                        3 0x82000005 &scmi_shm_3
>> +                        4 0x82000006 &scmi_shm_4>;
>> +        };
>> +    };
>> +
>> +    /{
>> +        // Host SCMI OSPM channel - provided to the Dom0 as is if SCMI enabled for it
>> +        scmi_shm: sram@47ff1000 {
>> +                compatible = "arm,scmi-shmem";
>> +                reg = <0x0 0x47ff1000 0x0 0x1000>;
>> +        };
>> +
>> +        firmware {
>> +            scmi: scmi {
>> +                compatible = "arm,scmi-smc";
>> +                arm,smc-id = <0x82000003>; <--- Host OSPM agent smc-id
>> +                #address-cells = < 1>;
>> +                #size-cells = < 0>;
>> +                shmem = <&scmi_shm>; <--- Host OSPM agent shmem
>> +
>> +                protocol@X{
>> +                };
>> +            };
>> +        };
>> +    }
>> -- 
>> 2.34.1
                
            On Thu, 12 Jun 2025, Oleksii Moisieiev wrote:
> On 23/05/2025 23:19, Stefano Stabellini wrote:
> > On Mon, 19 May 2025, Oleksii Moisieiev wrote:
> >> From: Grygorii Strashko<grygorii_strashko@epam.com>
> >>
> >> Proposal description to add separate SCMI DT node for Xen management agent
> >> under "chosen" or xen-config node, like Hyperlaunch "xen,config".
> > I think it is OK to place a larger "xen,config" node under /chosen with
> > more information for Xen to setup SCMI more easily.
> >
> >
> >> This proposal introduces a new approach to the Xen multi-domain
> >> configuration, where all Xen-specific configuration has been moved
> >> under the "/chosen" node. This requires less Dom0 device tree
> >> manipulation and isolates Xen configuration from domain configuration.
> >>
> >> This approach provides the following device tree (DT) parameters:
> >>
> >> - "xen,scmi-secondary-agents": A Xen-specific parameter under the
> >> "/chosen" node, which describes the SCMI agent configuration for
> >> the domains.
> >> - the SCMI configuration for Xen (privileged agent) and the shared
> >> memory configuration for all agents are provided under the "/chosen"
> >> node and are used strictly by Xen for its initial configuration.
> >> - the scmi_shm and SCMI configuration for Dom0 are placed in the
> >> "/firmware/scmi" node so that they can be moved to Dom0 without
> >> any changes.
> > Isn't the SCMI configuration present in /firmware/scmi referring to the
> > privileged agent=0 meant to be used by Xen?
> >
> > I certainly see benefits in simplifying the configuration and especially
> > reducing the amount of changes a user might have to make on the
> > underlying device tree, but if the user needs to change /firmware/scmi
> > with the Dom0 information, it seems more dangerous and error prone than
> > the previous approach.
> >
> The idea is to move the privileged agent=0 configuration to the /chosen 
> node and
> 
> assign agent=1 to the Dom0 node under /firmware/scmi.
> 
> Benefits of This Approach:
> - No Modification of the Xen DT Node Required
> 
>      This eliminates the need to modify the Xen Device Tree (DT) node 
> before creating Dom0 in
> 
>      order to set the correct shared memory (shmem).
> 
> -Consistent SCMI Configuration Format
> 
>    The Dom0 DT will have the same SCMI configuration format as other 
> domains, simplifying the
> 
>    overall configuration process.
> 
> - Unified SCMI Configuration Method
> 
>     There will no longer be a need to use a different approach for SCMI 
> configuration in Dom0
> 
>    compared to other domains.
> 
> - Separation Between Dom0 and Privileged Node
> 
>        This provides a clear separation between the Dom0 node and the 
> privileged node.
> 
>        For example:
>              If Dom0 only requires the clock protocol, but the Xen SCMI 
> configuration requires additional protocols,
> 
>              this approach allows Dom0 to receive only the necessary 
> protocol configuration.
I don't think this is a good idea because we end up confusing the data
for Xen and the data for the DomUs/Dom0 in the host device tree.
I think we should follow these very simple guidelines:
- The host DTB (the DTB given to Xen at boot) should be the same for Xen
  and for Linux baremetal (no KVM), with the exception of the data under
  the /chosen node
- We can place Xen specific configurations under the /chosen node in the
  host DTB, both Xen hypervisor configuration and also Dom0/DomU
  configurations
This way, the host information remains generic and the configuration for
Xen the domUs/Dom0 is kept clearly separate from the rest. I don't
think we can break these two assumptions but we have more freedom with
the rest.
If we start with these two simple assumptions, here are the
consequences:
- data under /firmware/scmi should be the same for Xen and baremetal
  Linux, ideally it would describe Xen's agent0 channel in both cases
- We can add as many nodes as we like under /chosen, including a
  xen,config node and also additional nodes for the domains config
- We can define the new nodes under /chosen to be as simple as possible
  for the user to configure them, while also trying to minimize
  complexity in Xen in terms of DT manipulations
If the Xen SCMI configuration data cannot be the same as the Linux
baremetal SCMI configuration (i.e. /firmware/scmi has to be different in
the two cases) I would still suggest to avoid modifying /firmware/scmi
for Xen and instead provide the Xen configuration under /chosen. It is
important to keep everything in the host DTB (except /chosen) the same
between Linux baremetal and Xen.
However, we can add a new node similar to /firmware/scmi under /chosen
specifically for Xen, such as /chosen/xen-config/scmi
The Dom0 configuration cannot be expected to be under /firmware/scmi.
However, it could also be defined under /chosen.
Keep in mind that the more we add to /chosen the more difficult it will
be for the user to configure the system. I think we should plan ahead to
have ImageBuilder be able to generate the DT nodes under /chosen for Xen
starting from the simplest possible configuration format provided by the
user. The more complex and rich are the device tree nodes under /chosen,
the more important is the documentation and ImageBuilder support for it.
> >> This configuration allows the use of Xen-specific nodes to provide
> >> information strictly needed by Xen while using the default SCMI
> >> configuration for Dom0 and other domains. As a result, no additional
> >> bindings need to be introduced to the device tree.
> > This is not actually implemented by this patch series, right?
> It is not. Just posted this document as a proposal.
> >> Signed-off-by: Grygorii Strashko<grygorii_strashko@epam.com>
> >> Signed-off-by: Oleksii Moisieiev<oleksii_moisieiev@epam.com>
> >> ---
> >>
> >>
> >>
> >>   .../arm/firmware/arm-scmi-proposal.rst        | 224 ++++++++++++++++++
> >>   1 file changed, 224 insertions(+)
> >>   create mode 100644 docs/hypervisor-guide/arm/firmware/arm-scmi-proposal.rst
> >>
> >> diff --git a/docs/hypervisor-guide/arm/firmware/arm-scmi-proposal.rst b/docs/hypervisor-guide/arm/firmware/arm-scmi-proposal.rst
> >> new file mode 100644
> >> index 0000000000..fcc2ed2b65
> >> --- /dev/null
> >> +++ b/docs/hypervisor-guide/arm/firmware/arm-scmi-proposal.rst
> >> @@ -0,0 +1,224 @@
> >> +
> >> +Proposal for SCMI multi-agent driver bindings
> >> +=============================================
> >> +
> >> +Now the Xen configuration for SCMI multi-agent support is done in a bit complicated way, especially
> >> +from SCMI multi-agent driver initialization and Dom0 DT manipulation point of view.
> >> +Also it does not take into account future requirements to support SCP SCMI FW.
> >> +
> >> +To enable SCMI multi-agent user need:
> >> +
> >> +* take host DT with basic SCMI enabled
> >> +* add SCMI shared-memory nodes for all agents
> >> +* update SCMI node to point on SCMI Xen management channel (``[smc-id, shmem]``)
> >> +* add "xen,scmi-secondary-agents" property to the "\chosen" node
> >> +
> >> +.. code::
> >> +
> >> +   chosen {
> >> +      xen,scmi-secondary-agents = <
> >> +                    1 0x82000003 &scmi_shm_1
> >> +                    2 0x82000004 &scmi_shm_2
> >> +                    3 0x82000005 &scmi_shm_3
> >> +                    4 0x82000006 &scmi_shm_4>;
> >> +    }
> >> +
> >> +    /{
> >> +            // SCMI shared-memory nodes for all agents
> >> +            scmi_shm_0 : sram@47ff0000 {
> >> +                compatible = "arm,scmi-shmem";
> >> +                reg = <0x0 0x47ff0000 0x0 0x1000>;
> >> +            };
> >> +            scmi_shm_1: sram@47ff1000 {
> >> +                    compatible = "arm,scmi-shmem";
> >> +                    reg = <0x0 0x47ff1000 0x0 0x1000>;
> >> +            };
> >> +            scmi_shm_2: sram@47ff2000 {
> >> +                    compatible = "arm,scmi-shmem";
> >> +                    reg = <0x0 0x47ff2000 0x0 0x1000>;
> >> +            };
> >> +            scmi_shm_3: sram@47ff3000 {
> >> +                    compatible = "arm,scmi-shmem";
> >> +                    reg = <0x0 0x47ff3000 0x0 0x1000>;
> >> +            };
> >> +            scmi_shm_4: sram@47ff4000 {
> >> +                    compatible = "arm,scmi-shmem";
> >> +                    reg = <0x0 0x47ff4000 0x0 0x1000>;
> >> +            };
> >> +
> >> +            firmware {
> >> +                scmi: scmi {
> >> +                    compatible = "arm,scmi-smc";
> >> +                    arm, smc - id = <0x82000002>; <--- Xen management agent channel "smc-id"
> >> +                    #address-cells = < 1>;
> >> +                    #size-cells = < 0>;
> >> +                    #access-controller-cells = < 1>;
> >> +                    shmem = <&scmi_shm_0>; <--- Xen management agent channel "shmem"
> >> +
> >> +                    protocol@X{
> >> +                    };
> >> +                };
> >> +            };
> >> +    }
> >> +
> >> +Important thing to note is that all information about multi-channel support is strictly Xen specific.
> >> +
> >> +During initialization the SCMI multi-agent driver uses Host DT SCMI node and
> >> +"xen,scmi-secondary-agents" property to init itself and then, during Dom0 creation, manipulates
> >> +Dom0 DT to remove Xen specific SCMI info and update dom0 SCMI nodes with Dom0 SCMI agent specific
> >> +information.
> >> +
> >> +There are two negative points:
> >> +
> >> +1) Double DT modification - one is user to set up SCMI Xen support in Host DT, second -
> >> +   Dom0 DT manipulation.
> >> +2) In case of future support of mailbox shared-memory transport there could be up to 4 mailboxes and
> >> +   up to 2 shared-memories per SCMI agent channel.
> >> +
> >> +Hence SCMI multi-agent support is Xen specific knowledge there is a proposal to add it as Xen
> >> +specific DT definitions and so minimize Host and Dom0 DT manipulations.
> >> +Those definitions can be added in "/chosen" or, ideally, in "xen,config" node (like in Hyperlaunch design).
> >> +
> >> +The SCMI binding stays generic, just two SCMI nodes defined - one for Xen management channel and
> >> +one for Host Dom0 OSPM.
> >> +
> >> +Example of using "chosen" for configuration:
> >> +
> >> +.. code::
> >> +
> >> +    /{
> >> +
> >> +        chosen {
> >> +            ...
> >> +
> >> +            // Xen SCMI management channel
> >> +            scmi_shm_0 : sram@47ff0000 {
> >> +                compatible = "arm,scmi-shmem";
> >> +                reg = <0x0 0x47ff0000 0x0 0x1000>;
> >> +            };
> >> +            scmi_xen: scmi {
> >> +                compatible = "arm,scmi-smc";
> >> +                arm,smc-id = <0x82000002>; <--- Xen manegement agent smc-id
> >> +                #address-cells = < 1>;
> >> +                #size-cells = < 0>;
> >> +                #access-controller-cells = < 1>;
> >> +                shmem = <&scmi_shm_0>; <--- Xen manegement agent shmem
> >> +            };
> >> +
> >> +            // SCMI multi-agent configuration
> >> +            scmi_shm_2: sram@47ff2000 {
> >> +                    compatible = "arm,scmi-shmem";
> >> +                    reg = <0x0 0x47ff2000 0x0 0x1000>;
> >> +            };
> >> +            scmi_shm_3: sram@47ff3000 {
> >> +                    compatible = "arm,scmi-shmem";
> >> +                    reg = <0x0 0x47ff3000 0x0 0x1000>;
> >> +            };
> >> +            scmi_shm_4: sram@47ff4000 {
> >> +                    compatible = "arm,scmi-shmem";
> >> +                    reg = <0x0 0x47ff4000 0x0 0x1000>;
> >> +            };
> >> +            xen,scmi-secondary-agents = <
> >> +                        1 0x82000003 &scmi_shm
> >> +                        2 0x82000004 &scmi_shm_2
> >> +                        3 0x82000005 &scmi_shm_3
> >> +                        4 0x82000006 &scmi_shm_4>;
> >> +        };
> >> +
> >> +        // Host SCMI OSPM channel - provided to the Dom0 as is if SCMI enabled for it
> >> +        scmi_shm: sram@47ff1000 {
> >> +                compatible = "arm,scmi-shmem";
> >> +                reg = <0x0 0x47ff1000 0x0 0x1000>;
> >> +        };
> >> +
> >> +        firmware {
> >> +            scmi: scmi {
> >> +                compatible = "arm,scmi-smc";
> >> +                arm,smc-id = <0x82000003>; <--- Host OSPM agent smc-id
> >> +                #address-cells = < 1>;
> >> +                #size-cells = < 0>;
> >> +                shmem = <&scmi_shm>; <--- Host OSPM agent shmem
> > By OSPM you mean Dom0 and not Xen? So this is a change compared to a
> > device tree for baremetal Linux without Xen?
> >
> > Let me ask the same question differently. In the case of barematal Linux
> > without Xen (no KVM), what would Linux see under /firmware/scmi as
> > smc-id and shmem? The same as the one that Xen would use for itself? Or
> > the same as the ones that Dom0 would use when Xen is present?
> 
> If this DT is used with the baremetal Linux - then the Linux Kernel will
> 
> see Dom0 "smc-id" and "shmen" under /firmware/scmi.
> 
> >> +                protocol@X{
> >> +                };
> >> +            };
> >> +        };
> >> +    }
> >> +
> >> +
> >> +In the above case:
> >> +
> >> +1) Xen SCMI multi-agent can be probed with DT configuration from "chosen" (or special "xen,config")
> >> +   node and all Xen related nodes can be easily dropped from Dom0 DT.
> >> +2) Host SCMI OSPM channel DT nodes can be copied to Dom0 DT without changes if SCMI enabled for it.
> >> +3) Future support for mailbox shared-memory transport (SCP SCMI FW) can be simplified as no more
> >> +   manipulation required with Dom0 SCMI "arm,smc-id" and "shmem" DT properties.
> > Yes, I can see the benefit if we can arrange it so that the underlying
> > host device tree is the same that Linux would use baremetal. And all the
> > extra configuration is placed under /chosen in "xen,config" node or
> > similar. I would probably call it "xen,scmi".
> 
> Personally, I would keep "xen,config" as it leaves room to add additional
> 
> configuration nodes in the future.
> 
> >> +Example of using "xen,config" for configuration:
> >> +
> >> +.. code::
> >> +
> >> +    hypervisor {
> >> +        compatible = “hypervisor,xen”
> >> +
> >> +        // Configuration container
> >> +        config {
> >> +            compatible = "xen,config";
> >> +            ...
> >> +
> >> +            // Xen SCMI management channel
> >> +            scmi_shm_0 : sram@47ff0000 {
> >> +                compatible = "arm,scmi-shmem";
> >> +                reg = <0x0 0x47ff0000 0x0 0x1000>;
> >> +            };
> >> +            scmi_xen: scmi {
> >> +                compatible = "arm,scmi-smc";
> >> +                arm,smc-id = <0x82000002>; <--- Xen manegement agent smc-id
> >> +                #address-cells = < 1>;
> >> +                #size-cells = < 0>;
> >> +                #access-controller-cells = < 1>;
> >> +                shmem = <&scmi_shm_0>; <--- Xen manegement agent shmem
> >> +            };
> >> +
> >> +            // SCMI multi-agent configuration
> >> +            scmi_shm_2: sram@47ff2000 {
> >> +                    compatible = "arm,scmi-shmem";
> >> +                    reg = <0x0 0x47ff2000 0x0 0x1000>;
> >> +            };
> >> +            scmi_shm_3: sram@47ff3000 {
> >> +                    compatible = "arm,scmi-shmem";
> >> +                    reg = <0x0 0x47ff3000 0x0 0x1000>;
> >> +            };
> >> +            scmi_shm_4: sram@47ff4000 {
> >> +                    compatible = "arm,scmi-shmem";
> >> +                    reg = <0x0 0x47ff4000 0x0 0x1000>;
> >> +            };
> >> +            xen,scmi-secondary-agents = <
> >> +                        1 0x82000003 &scmi_shm
> >> +                        2 0x82000004 &scmi_shm_2
> >> +                        3 0x82000005 &scmi_shm_3
> >> +                        4 0x82000006 &scmi_shm_4>;
> >> +        };
> >> +    };
> >> +
> >> +    /{
> >> +        // Host SCMI OSPM channel - provided to the Dom0 as is if SCMI enabled for it
> >> +        scmi_shm: sram@47ff1000 {
> >> +                compatible = "arm,scmi-shmem";
> >> +                reg = <0x0 0x47ff1000 0x0 0x1000>;
> >> +        };
> >> +
> >> +        firmware {
> >> +            scmi: scmi {
> >> +                compatible = "arm,scmi-smc";
> >> +                arm,smc-id = <0x82000003>; <--- Host OSPM agent smc-id
> >> +                #address-cells = < 1>;
> >> +                #size-cells = < 0>;
> >> +                shmem = <&scmi_shm>; <--- Host OSPM agent shmem
> >> +
> >> +                protocol@X{
> >> +                };
> >> +            };
> >> +        };
> >> +    }
> >> -- 
> >> 2.34.1
                
            
On 18/06/2025 03:35, Stefano Stabellini wrote:
> On Thu, 12 Jun 2025, Oleksii Moisieiev wrote:
>> On 23/05/2025 23:19, Stefano Stabellini wrote:
>>> On Mon, 19 May 2025, Oleksii Moisieiev wrote:
>>>> From: Grygorii Strashko<grygorii_strashko@epam.com>
>>>>
>>>> Proposal description to add separate SCMI DT node for Xen management agent
>>>> under "chosen" or xen-config node, like Hyperlaunch "xen,config".
>>> I think it is OK to place a larger "xen,config" node under /chosen with
>>> more information for Xen to setup SCMI more easily.
>>>
>>>
>>>> This proposal introduces a new approach to the Xen multi-domain
>>>> configuration, where all Xen-specific configuration has been moved
>>>> under the "/chosen" node. This requires less Dom0 device tree
>>>> manipulation and isolates Xen configuration from domain configuration.
>>>>
>>>> This approach provides the following device tree (DT) parameters:
>>>>
>>>> - "xen,scmi-secondary-agents": A Xen-specific parameter under the
>>>> "/chosen" node, which describes the SCMI agent configuration for
>>>> the domains.
>>>> - the SCMI configuration for Xen (privileged agent) and the shared
>>>> memory configuration for all agents are provided under the "/chosen"
>>>> node and are used strictly by Xen for its initial configuration.
>>>> - the scmi_shm and SCMI configuration for Dom0 are placed in the
>>>> "/firmware/scmi" node so that they can be moved to Dom0 without
>>>> any changes.
>>> Isn't the SCMI configuration present in /firmware/scmi referring to the
>>> privileged agent=0 meant to be used by Xen?
>>>
>>> I certainly see benefits in simplifying the configuration and especially
>>> reducing the amount of changes a user might have to make on the
>>> underlying device tree, but if the user needs to change /firmware/scmi
>>> with the Dom0 information, it seems more dangerous and error prone than
>>> the previous approach.
>>>
>> The idea is to move the privileged agent=0 configuration to the /chosen
>> node and
>>
>> assign agent=1 to the Dom0 node under /firmware/scmi.
>>
>> Benefits of This Approach:
>> - No Modification of the Xen DT Node Required
>>
>>       This eliminates the need to modify the Xen Device Tree (DT) node
>> before creating Dom0 in
>>
>>       order to set the correct shared memory (shmem).
>>
>> -Consistent SCMI Configuration Format
>>
>>     The Dom0 DT will have the same SCMI configuration format as other
>> domains, simplifying the
>>
>>     overall configuration process.
>>
>> - Unified SCMI Configuration Method
>>
>>      There will no longer be a need to use a different approach for SCMI
>> configuration in Dom0
>>
>>     compared to other domains.
>>
>> - Separation Between Dom0 and Privileged Node
>>
>>         This provides a clear separation between the Dom0 node and the
>> privileged node.
>>
>>         For example:
>>               If Dom0 only requires the clock protocol, but the Xen SCMI
>> configuration requires additional protocols,
>>
>>               this approach allows Dom0 to receive only the necessary
>> protocol configuration.
> I don't think this is a good idea because we end up confusing the data
> for Xen and the data for the DomUs/Dom0 in the host device tree.
>
> I think we should follow these very simple guidelines:
>
> - The host DTB (the DTB given to Xen at boot) should be the same for Xen
>    and for Linux baremetal (no KVM), with the exception of the data under
>    the /chosen node
>
> - We can place Xen specific configurations under the /chosen node in the
>    host DTB, both Xen hypervisor configuration and also Dom0/DomU
>    configurations
>
> This way, the host information remains generic and the configuration for
> Xen the domUs/Dom0 is kept clearly separate from the rest. I don't
> think we can break these two assumptions but we have more freedom with
> the rest.
>
> If we start with these two simple assumptions, here are the
> consequences:
>
> - data under /firmware/scmi should be the same for Xen and baremetal
>    Linux, ideally it would describe Xen's agent0 channel in both cases
According to the proposal:
The data under the Host DT /firmware/scmi node will always point to the 
default OSPM agent, which will remain
the same (smc-id and shmem) for both the BSP case (no Xen) and the Xen 
case (Dom0 domain).
Meanwhile, the Xen management agent's SCMI node and configuration are 
expected to be placed under /chosen.
This approach ensures that the Host DT remains as unchanged as possible.
Currently:
The Host DT /firmware/scmi node requires modification to point to the 
Xen management agent by changing
the smc-id and shmem values.
At boot time, during Dom0 creation, the SCMI multi-agent driver reverts 
these changes.
> - We can add as many nodes as we like under /chosen, including a
>    xen,config node and also additional nodes for the domains config
>
> - We can define the new nodes under /chosen to be as simple as possible
>    for the user to configure them, while also trying to minimize
>    complexity in Xen in terms of DT manipulations
>
>
>
> If the Xen SCMI configuration data cannot be the same as the Linux
> baremetal SCMI configuration (i.e. /firmware/scmi has to be different in
> the two cases) I would still suggest to avoid modifying /firmware/scmi
> for Xen and instead provide the Xen configuration under /chosen. It is
> important to keep everything in the host DTB (except /chosen) the same
> between Linux baremetal and Xen.
>
> However, we can add a new node similar to /firmware/scmi under /chosen
> specifically for Xen, such as /chosen/xen-config/scmi
>
> The Dom0 configuration cannot be expected to be under /firmware/scmi.
> However, it could also be defined under /chosen.
No. The idea is to keep it and provide unchanged, but with possibility 
to "disable SCMI for Dom0"
- now with Xen bootarg parameter.
> Keep in mind that the more we add to /chosen the more difficult it will
> be for the user to configure the system. I think we should plan ahead to
> have ImageBuilder be able to generate the DT nodes under /chosen for Xen
> starting from the simplest possible configuration format provided by the
> user. The more complex and rich are the device tree nodes under /chosen,
> the more important is the documentation and ImageBuilder support for it.
>
>
Regarding all the other points you’ve mentioned – this is exactly what 
we are trying to achieve
with this proposal.
We are proposing the following changes to the approach so that all 
requirements are met, and the
Xen device tree (DT) will remain the same as the Host Platform DT (BSP 
Linux), except for the /chosen node:
```
     /{
         chosen {
             ...
             // Xen SCMI management channel
             scmi_shm_xen : sram@47ff1000 {
                 compatible = "arm,scmi-shmem";
                 reg = <0x0 0x47ff1000 0x0 0x1000>;
             };
             scmi_xen: scmi {
                 compatible = "arm,scmi-smc";
                 arm,smc-id = <0x82000003>; <--- Xen manegement agent smc-id
                 #address-cells = < 1>;
                 #size-cells = < 0>;
                 #access-controller-cells = < 1>;
                 shmem = <&scmi_shm_xen>; <--- Xen manegement agent shmem
             };
             // SCMI multi-agent configuration
             scmi_shm_2: sram@47ff2000 {
                     compatible = "arm,scmi-shmem";
                     reg = <0x0 0x47ff2000 0x0 0x1000>;
             };
             scmi_shm_3: sram@47ff3000 {
                     compatible = "arm,scmi-shmem";
                     reg = <0x0 0x47ff3000 0x0 0x1000>;
             };
             scmi_shm_4: sram@47ff4000 {
                     compatible = "arm,scmi-shmem";
                     reg = <0x0 0x47ff4000 0x0 0x1000>;
             };
             xen,scmi-secondary-agents = <
                         0x82000002 &scmi_shm   1
                         0x82000004 &scmi_shm_2 2
                         0x82000005 &scmi_shm_3 3
                         0x82000006 &scmi_shm_4 4>;
         };
         // Host SCMI OSPM channel - provided to the Dom0 as is if SCMI 
enabled for it (same address as Host Platform DT)
         scmi_shm: sram@47ff0000 {
                 compatible = "arm,scmi-shmem";
                 reg = <0x0 0x47ff0000 0x0 0x1000>;
         };
         firmware { <-- the below configuration is the same as Host 
Platform DT and will be passed to Dom0
             scmi: scmi {
                 compatible = "arm,scmi-smc";
                 arm,smc-id = <0x82000002>; <--- Host OSPM agent smc-id 
which is the same as in Host Platform DT
                 #address-cells = < 1>;
                 #size-cells = < 0>;
                 shmem = <&scmi_shm>; <--- Host OSPM agent shmem (same 
address as Host Platform DT)
                 protocol@X{
                 };
             };
         };
     }
```
>>>> This configuration allows the use of Xen-specific nodes to provide
>>>> information strictly needed by Xen while using the default SCMI
>>>> configuration for Dom0 and other domains. As a result, no additional
>>>> bindings need to be introduced to the device tree.
>>> This is not actually implemented by this patch series, right?
>> It is not. Just posted this document as a proposal.
>>>> Signed-off-by: Grygorii Strashko<grygorii_strashko@epam.com>
>>>> Signed-off-by: Oleksii Moisieiev<oleksii_moisieiev@epam.com>
>>>> ---
>>>>
>>>>
>>>>
>>>>    .../arm/firmware/arm-scmi-proposal.rst        | 224 ++++++++++++++++++
>>>>    1 file changed, 224 insertions(+)
>>>>    create mode 100644 docs/hypervisor-guide/arm/firmware/arm-scmi-proposal.rst
>>>>
>>>> diff --git a/docs/hypervisor-guide/arm/firmware/arm-scmi-proposal.rst b/docs/hypervisor-guide/arm/firmware/arm-scmi-proposal.rst
>>>> new file mode 100644
>>>> index 0000000000..fcc2ed2b65
>>>> --- /dev/null
>>>> +++ b/docs/hypervisor-guide/arm/firmware/arm-scmi-proposal.rst
>>>> @@ -0,0 +1,224 @@
>>>> +
>>>> +Proposal for SCMI multi-agent driver bindings
>>>> +=============================================
>>>> +
>>>> +Now the Xen configuration for SCMI multi-agent support is done in a bit complicated way, especially
>>>> +from SCMI multi-agent driver initialization and Dom0 DT manipulation point of view.
>>>> +Also it does not take into account future requirements to support SCP SCMI FW.
>>>> +
>>>> +To enable SCMI multi-agent user need:
>>>> +
>>>> +* take host DT with basic SCMI enabled
>>>> +* add SCMI shared-memory nodes for all agents
>>>> +* update SCMI node to point on SCMI Xen management channel (``[smc-id, shmem]``)
>>>> +* add "xen,scmi-secondary-agents" property to the "\chosen" node
>>>> +
>>>> +.. code::
>>>> +
>>>> +   chosen {
>>>> +      xen,scmi-secondary-agents = <
>>>> +                    1 0x82000003 &scmi_shm_1
>>>> +                    2 0x82000004 &scmi_shm_2
>>>> +                    3 0x82000005 &scmi_shm_3
>>>> +                    4 0x82000006 &scmi_shm_4>;
>>>> +    }
>>>> +
>>>> +    /{
>>>> +            // SCMI shared-memory nodes for all agents
>>>> +            scmi_shm_0 : sram@47ff0000 {
>>>> +                compatible = "arm,scmi-shmem";
>>>> +                reg = <0x0 0x47ff0000 0x0 0x1000>;
>>>> +            };
>>>> +            scmi_shm_1: sram@47ff1000 {
>>>> +                    compatible = "arm,scmi-shmem";
>>>> +                    reg = <0x0 0x47ff1000 0x0 0x1000>;
>>>> +            };
>>>> +            scmi_shm_2: sram@47ff2000 {
>>>> +                    compatible = "arm,scmi-shmem";
>>>> +                    reg = <0x0 0x47ff2000 0x0 0x1000>;
>>>> +            };
>>>> +            scmi_shm_3: sram@47ff3000 {
>>>> +                    compatible = "arm,scmi-shmem";
>>>> +                    reg = <0x0 0x47ff3000 0x0 0x1000>;
>>>> +            };
>>>> +            scmi_shm_4: sram@47ff4000 {
>>>> +                    compatible = "arm,scmi-shmem";
>>>> +                    reg = <0x0 0x47ff4000 0x0 0x1000>;
>>>> +            };
>>>> +
>>>> +            firmware {
>>>> +                scmi: scmi {
>>>> +                    compatible = "arm,scmi-smc";
>>>> +                    arm, smc - id = <0x82000002>; <--- Xen management agent channel "smc-id"
>>>> +                    #address-cells = < 1>;
>>>> +                    #size-cells = < 0>;
>>>> +                    #access-controller-cells = < 1>;
>>>> +                    shmem = <&scmi_shm_0>; <--- Xen management agent channel "shmem"
>>>> +
>>>> +                    protocol@X{
>>>> +                    };
>>>> +                };
>>>> +            };
>>>> +    }
>>>> +
>>>> +Important thing to note is that all information about multi-channel support is strictly Xen specific.
>>>> +
>>>> +During initialization the SCMI multi-agent driver uses Host DT SCMI node and
>>>> +"xen,scmi-secondary-agents" property to init itself and then, during Dom0 creation, manipulates
>>>> +Dom0 DT to remove Xen specific SCMI info and update dom0 SCMI nodes with Dom0 SCMI agent specific
>>>> +information.
>>>> +
>>>> +There are two negative points:
>>>> +
>>>> +1) Double DT modification - one is user to set up SCMI Xen support in Host DT, second -
>>>> +   Dom0 DT manipulation.
>>>> +2) In case of future support of mailbox shared-memory transport there could be up to 4 mailboxes and
>>>> +   up to 2 shared-memories per SCMI agent channel.
>>>> +
>>>> +Hence SCMI multi-agent support is Xen specific knowledge there is a proposal to add it as Xen
>>>> +specific DT definitions and so minimize Host and Dom0 DT manipulations.
>>>> +Those definitions can be added in "/chosen" or, ideally, in "xen,config" node (like in Hyperlaunch design).
>>>> +
>>>> +The SCMI binding stays generic, just two SCMI nodes defined - one for Xen management channel and
>>>> +one for Host Dom0 OSPM.
>>>> +
>>>> +Example of using "chosen" for configuration:
>>>> +
>>>> +.. code::
>>>> +
>>>> +    /{
>>>> +
>>>> +        chosen {
>>>> +            ...
>>>> +
>>>> +            // Xen SCMI management channel
>>>> +            scmi_shm_0 : sram@47ff0000 {
>>>> +                compatible = "arm,scmi-shmem";
>>>> +                reg = <0x0 0x47ff0000 0x0 0x1000>;
>>>> +            };
>>>> +            scmi_xen: scmi {
>>>> +                compatible = "arm,scmi-smc";
>>>> +                arm,smc-id = <0x82000002>; <--- Xen manegement agent smc-id
>>>> +                #address-cells = < 1>;
>>>> +                #size-cells = < 0>;
>>>> +                #access-controller-cells = < 1>;
>>>> +                shmem = <&scmi_shm_0>; <--- Xen manegement agent shmem
>>>> +            };
>>>> +
>>>> +            // SCMI multi-agent configuration
>>>> +            scmi_shm_2: sram@47ff2000 {
>>>> +                    compatible = "arm,scmi-shmem";
>>>> +                    reg = <0x0 0x47ff2000 0x0 0x1000>;
>>>> +            };
>>>> +            scmi_shm_3: sram@47ff3000 {
>>>> +                    compatible = "arm,scmi-shmem";
>>>> +                    reg = <0x0 0x47ff3000 0x0 0x1000>;
>>>> +            };
>>>> +            scmi_shm_4: sram@47ff4000 {
>>>> +                    compatible = "arm,scmi-shmem";
>>>> +                    reg = <0x0 0x47ff4000 0x0 0x1000>;
>>>> +            };
>>>> +            xen,scmi-secondary-agents = <
>>>> +                        1 0x82000003 &scmi_shm
>>>> +                        2 0x82000004 &scmi_shm_2
>>>> +                        3 0x82000005 &scmi_shm_3
>>>> +                        4 0x82000006 &scmi_shm_4>;
>>>> +        };
>>>> +
>>>> +        // Host SCMI OSPM channel - provided to the Dom0 as is if SCMI enabled for it
>>>> +        scmi_shm: sram@47ff1000 {
>>>> +                compatible = "arm,scmi-shmem";
>>>> +                reg = <0x0 0x47ff1000 0x0 0x1000>;
>>>> +        };
>>>> +
>>>> +        firmware {
>>>> +            scmi: scmi {
>>>> +                compatible = "arm,scmi-smc";
>>>> +                arm,smc-id = <0x82000003>; <--- Host OSPM agent smc-id
>>>> +                #address-cells = < 1>;
>>>> +                #size-cells = < 0>;
>>>> +                shmem = <&scmi_shm>; <--- Host OSPM agent shmem
>>> By OSPM you mean Dom0 and not Xen? So this is a change compared to a
>>> device tree for baremetal Linux without Xen?
OSPM is OS in general, for example Linux.
>>> Let me ask the same question differently. In the case of barematal Linux
>>> without Xen (no KVM), what would Linux see under /firmware/scmi as
>>> smc-id and shmem? The same as the one that Xen would use for itself? Or
>>> the same as the ones that Dom0 would use when Xen is present?
>> If this DT is used with the baremetal Linux - then the Linux Kernel will
>>
>> see Dom0 "smc-id" and "shmen" under /firmware/scmi.
>>
>>>> +                protocol@X{
>>>> +                };
>>>> +            };
>>>> +        };
>>>> +    }
>>>> +
>>>> +
>>>> +In the above case:
>>>> +
>>>> +1) Xen SCMI multi-agent can be probed with DT configuration from "chosen" (or special "xen,config")
>>>> +   node and all Xen related nodes can be easily dropped from Dom0 DT.
>>>> +2) Host SCMI OSPM channel DT nodes can be copied to Dom0 DT without changes if SCMI enabled for it.
>>>> +3) Future support for mailbox shared-memory transport (SCP SCMI FW) can be simplified as no more
>>>> +   manipulation required with Dom0 SCMI "arm,smc-id" and "shmem" DT properties.
>>> Yes, I can see the benefit if we can arrange it so that the underlying
>>> host device tree is the same that Linux would use baremetal. And all the
>>> extra configuration is placed under /chosen in "xen,config" node or
>>> similar. I would probably call it "xen,scmi".
>> Personally, I would keep "xen,config" as it leaves room to add additional
>>
>> configuration nodes in the future.
>>
>>>> +Example of using "xen,config" for configuration:
>>>> +
>>>> +.. code::
>>>> +
>>>> +    hypervisor {
>>>> +        compatible = “hypervisor,xen”
>>>> +
>>>> +        // Configuration container
>>>> +        config {
>>>> +            compatible = "xen,config";
>>>> +            ...
>>>> +
>>>> +            // Xen SCMI management channel
>>>> +            scmi_shm_0 : sram@47ff0000 {
>>>> +                compatible = "arm,scmi-shmem";
>>>> +                reg = <0x0 0x47ff0000 0x0 0x1000>;
>>>> +            };
>>>> +            scmi_xen: scmi {
>>>> +                compatible = "arm,scmi-smc";
>>>> +                arm,smc-id = <0x82000002>; <--- Xen manegement agent smc-id
>>>> +                #address-cells = < 1>;
>>>> +                #size-cells = < 0>;
>>>> +                #access-controller-cells = < 1>;
>>>> +                shmem = <&scmi_shm_0>; <--- Xen manegement agent shmem
>>>> +            };
>>>> +
>>>> +            // SCMI multi-agent configuration
>>>> +            scmi_shm_2: sram@47ff2000 {
>>>> +                    compatible = "arm,scmi-shmem";
>>>> +                    reg = <0x0 0x47ff2000 0x0 0x1000>;
>>>> +            };
>>>> +            scmi_shm_3: sram@47ff3000 {
>>>> +                    compatible = "arm,scmi-shmem";
>>>> +                    reg = <0x0 0x47ff3000 0x0 0x1000>;
>>>> +            };
>>>> +            scmi_shm_4: sram@47ff4000 {
>>>> +                    compatible = "arm,scmi-shmem";
>>>> +                    reg = <0x0 0x47ff4000 0x0 0x1000>;
>>>> +            };
>>>> +            xen,scmi-secondary-agents = <
>>>> +                        1 0x82000003 &scmi_shm
>>>> +                        2 0x82000004 &scmi_shm_2
>>>> +                        3 0x82000005 &scmi_shm_3
>>>> +                        4 0x82000006 &scmi_shm_4>;
>>>> +        };
>>>> +    };
>>>> +
>>>> +    /{
>>>> +        // Host SCMI OSPM channel - provided to the Dom0 as is if SCMI enabled for it
>>>> +        scmi_shm: sram@47ff1000 {
>>>> +                compatible = "arm,scmi-shmem";
>>>> +                reg = <0x0 0x47ff1000 0x0 0x1000>;
>>>> +        };
>>>> +
>>>> +        firmware {
>>>> +            scmi: scmi {
>>>> +                compatible = "arm,scmi-smc";
>>>> +                arm,smc-id = <0x82000003>; <--- Host OSPM agent smc-id
>>>> +                #address-cells = < 1>;
>>>> +                #size-cells = < 0>;
>>>> +                shmem = <&scmi_shm>; <--- Host OSPM agent shmem
>>>> +
>>>> +                protocol@X{
>>>> +                };
>>>> +            };
>>>> +        };
>>>> +    }
>>>> -- 
>>>> 2.34.1
                
            On Thu, 19 Jun 2025, Oleksii Moisieiev wrote:
> On 18/06/2025 03:35, Stefano Stabellini wrote:
> > On Thu, 12 Jun 2025, Oleksii Moisieiev wrote:
> >> On 23/05/2025 23:19, Stefano Stabellini wrote:
> >>> On Mon, 19 May 2025, Oleksii Moisieiev wrote:
> >>>> From: Grygorii Strashko<grygorii_strashko@epam.com>
> >>>>
> >>>> Proposal description to add separate SCMI DT node for Xen management agent
> >>>> under "chosen" or xen-config node, like Hyperlaunch "xen,config".
> >>> I think it is OK to place a larger "xen,config" node under /chosen with
> >>> more information for Xen to setup SCMI more easily.
> >>>
> >>>
> >>>> This proposal introduces a new approach to the Xen multi-domain
> >>>> configuration, where all Xen-specific configuration has been moved
> >>>> under the "/chosen" node. This requires less Dom0 device tree
> >>>> manipulation and isolates Xen configuration from domain configuration.
> >>>>
> >>>> This approach provides the following device tree (DT) parameters:
> >>>>
> >>>> - "xen,scmi-secondary-agents": A Xen-specific parameter under the
> >>>> "/chosen" node, which describes the SCMI agent configuration for
> >>>> the domains.
> >>>> - the SCMI configuration for Xen (privileged agent) and the shared
> >>>> memory configuration for all agents are provided under the "/chosen"
> >>>> node and are used strictly by Xen for its initial configuration.
> >>>> - the scmi_shm and SCMI configuration for Dom0 are placed in the
> >>>> "/firmware/scmi" node so that they can be moved to Dom0 without
> >>>> any changes.
> >>> Isn't the SCMI configuration present in /firmware/scmi referring to the
> >>> privileged agent=0 meant to be used by Xen?
> >>>
> >>> I certainly see benefits in simplifying the configuration and especially
> >>> reducing the amount of changes a user might have to make on the
> >>> underlying device tree, but if the user needs to change /firmware/scmi
> >>> with the Dom0 information, it seems more dangerous and error prone than
> >>> the previous approach.
> >>>
> >> The idea is to move the privileged agent=0 configuration to the /chosen
> >> node and
> >>
> >> assign agent=1 to the Dom0 node under /firmware/scmi.
> >>
> >> Benefits of This Approach:
> >> - No Modification of the Xen DT Node Required
> >>
> >>       This eliminates the need to modify the Xen Device Tree (DT) node
> >> before creating Dom0 in
> >>
> >>       order to set the correct shared memory (shmem).
> >>
> >> -Consistent SCMI Configuration Format
> >>
> >>     The Dom0 DT will have the same SCMI configuration format as other
> >> domains, simplifying the
> >>
> >>     overall configuration process.
> >>
> >> - Unified SCMI Configuration Method
> >>
> >>      There will no longer be a need to use a different approach for SCMI
> >> configuration in Dom0
> >>
> >>     compared to other domains.
> >>
> >> - Separation Between Dom0 and Privileged Node
> >>
> >>         This provides a clear separation between the Dom0 node and the
> >> privileged node.
> >>
> >>         For example:
> >>               If Dom0 only requires the clock protocol, but the Xen SCMI
> >> configuration requires additional protocols,
> >>
> >>               this approach allows Dom0 to receive only the necessary
> >> protocol configuration.
> > I don't think this is a good idea because we end up confusing the data
> > for Xen and the data for the DomUs/Dom0 in the host device tree.
> >
> > I think we should follow these very simple guidelines:
> >
> > - The host DTB (the DTB given to Xen at boot) should be the same for Xen
> >    and for Linux baremetal (no KVM), with the exception of the data under
> >    the /chosen node
> >
> > - We can place Xen specific configurations under the /chosen node in the
> >    host DTB, both Xen hypervisor configuration and also Dom0/DomU
> >    configurations
> >
> > This way, the host information remains generic and the configuration for
> > Xen the domUs/Dom0 is kept clearly separate from the rest. I don't
> > think we can break these two assumptions but we have more freedom with
> > the rest.
> >
> > If we start with these two simple assumptions, here are the
> > consequences:
> >
> > - data under /firmware/scmi should be the same for Xen and baremetal
> >    Linux, ideally it would describe Xen's agent0 channel in both cases
> 
> According to the proposal:
> The data under the Host DT /firmware/scmi node will always point to the 
> default OSPM agent, which will remain
> 
> the same (smc-id and shmem) for both the BSP case (no Xen) and the Xen 
> case (Dom0 domain).
> 
> Meanwhile, the Xen management agent's SCMI node and configuration are 
> expected to be placed under /chosen.
> 
> This approach ensures that the Host DT remains as unchanged as possible.
Yes, my main point is that all the device tree information, except for
what is under /chosen, should be left unchanged between the BSP case (no
Xen) and the Xen case.
We have freedom to decide:
- the information we put under /chosen and how to interpret it
- how to use the information under /firmware/scmi when Xen is present
> Currently:
> 
> The Host DT /firmware/scmi node requires modification to point to the 
> Xen management agent by changing
> 
> the smc-id and shmem values.
I don't think we should require changes to /firmware/scmi in the host DT
when Xen is present.
Often, people don't know when or if Xen is present at the time the
Device Tree is generated. So it is best to avoid modification (outside
of /chosen).
> At boot time, during Dom0 creation, the SCMI multi-agent driver reverts 
> these changes.
>
>
> > - We can add as many nodes as we like under /chosen, including a
> >    xen,config node and also additional nodes for the domains config
> >
> > - We can define the new nodes under /chosen to be as simple as possible
> >    for the user to configure them, while also trying to minimize
> >    complexity in Xen in terms of DT manipulations
> >
> >
> >
> > If the Xen SCMI configuration data cannot be the same as the Linux
> > baremetal SCMI configuration (i.e. /firmware/scmi has to be different in
> > the two cases) I would still suggest to avoid modifying /firmware/scmi
> > for Xen and instead provide the Xen configuration under /chosen. It is
> > important to keep everything in the host DTB (except /chosen) the same
> > between Linux baremetal and Xen.
> >
> > However, we can add a new node similar to /firmware/scmi under /chosen
> > specifically for Xen, such as /chosen/xen-config/scmi
> >
> > The Dom0 configuration cannot be expected to be under /firmware/scmi.
> > However, it could also be defined under /chosen.
> 
> No. The idea is to keep it and provide unchanged, but with possibility 
> to "disable SCMI for Dom0"
> - now with Xen bootarg parameter.
> > Keep in mind that the more we add to /chosen the more difficult it will
> > be for the user to configure the system. I think we should plan ahead to
> > have ImageBuilder be able to generate the DT nodes under /chosen for Xen
> > starting from the simplest possible configuration format provided by the
> > user. The more complex and rich are the device tree nodes under /chosen,
> > the more important is the documentation and ImageBuilder support for it.
> >
> >
> Regarding all the other points you’ve mentioned – this is exactly what 
> we are trying to achieve
> 
> with this proposal.
OK good
> We are proposing the following changes to the approach so that all 
> requirements are met, and the
> 
> Xen device tree (DT) will remain the same as the Host Platform DT (BSP 
> Linux), except for the /chosen node:
> 
> ```
> 
>      /{
> 
>          chosen {
>              ...
> 
>              // Xen SCMI management channel
>              scmi_shm_xen : sram@47ff1000 {
>                  compatible = "arm,scmi-shmem";
>                  reg = <0x0 0x47ff1000 0x0 0x1000>;
>              };
> 
>              scmi_xen: scmi {
>                  compatible = "arm,scmi-smc";
>                  arm,smc-id = <0x82000003>; <--- Xen manegement agent smc-id
>                  #address-cells = < 1>;
>                  #size-cells = < 0>;
>                  #access-controller-cells = < 1>;
>                  shmem = <&scmi_shm_xen>; <--- Xen manegement agent shmem
>              };
> 
>              // SCMI multi-agent configuration
>              scmi_shm_2: sram@47ff2000 {
>                      compatible = "arm,scmi-shmem";
>                      reg = <0x0 0x47ff2000 0x0 0x1000>;
>              };
>              scmi_shm_3: sram@47ff3000 {
>                      compatible = "arm,scmi-shmem";
>                      reg = <0x0 0x47ff3000 0x0 0x1000>;
>              };
>              scmi_shm_4: sram@47ff4000 {
>                      compatible = "arm,scmi-shmem";
>                      reg = <0x0 0x47ff4000 0x0 0x1000>;
>              };
> 
>              xen,scmi-secondary-agents = <
>                          0x82000002 &scmi_shm   1
>                          0x82000004 &scmi_shm_2 2
>                          0x82000005 &scmi_shm_3 3
>                          0x82000006 &scmi_shm_4 4>;
>          };
> 
>          // Host SCMI OSPM channel - provided to the Dom0 as is if SCMI 
> enabled for it (same address as Host Platform DT)
>          scmi_shm: sram@47ff0000 {
>                  compatible = "arm,scmi-shmem";
>                  reg = <0x0 0x47ff0000 0x0 0x1000>;
>          };
> 
>          firmware { <-- the below configuration is the same as Host 
> Platform DT and will be passed to Dom0
>              scmi: scmi {
>                  compatible = "arm,scmi-smc";
>                  arm,smc-id = <0x82000002>; <--- Host OSPM agent smc-id 
> which is the same as in Host Platform DT
>                  #address-cells = < 1>;
>                  #size-cells = < 0>;
>                  shmem = <&scmi_shm>; <--- Host OSPM agent shmem (same 
> address as Host Platform DT)
> 
>                  protocol@X{
>                  };
>              };
>          };
>      }
> 
> ```
I think this is OK, thank you!
> >>>> This configuration allows the use of Xen-specific nodes to provide
> >>>> information strictly needed by Xen while using the default SCMI
> >>>> configuration for Dom0 and other domains. As a result, no additional
> >>>> bindings need to be introduced to the device tree.
> >>> This is not actually implemented by this patch series, right?
> >> It is not. Just posted this document as a proposal.
> >>>> Signed-off-by: Grygorii Strashko<grygorii_strashko@epam.com>
> >>>> Signed-off-by: Oleksii Moisieiev<oleksii_moisieiev@epam.com>
> >>>> ---
> >>>>
> >>>>
> >>>>
> >>>>    .../arm/firmware/arm-scmi-proposal.rst        | 224 ++++++++++++++++++
> >>>>    1 file changed, 224 insertions(+)
> >>>>    create mode 100644 docs/hypervisor-guide/arm/firmware/arm-scmi-proposal.rst
> >>>>
> >>>> diff --git a/docs/hypervisor-guide/arm/firmware/arm-scmi-proposal.rst b/docs/hypervisor-guide/arm/firmware/arm-scmi-proposal.rst
> >>>> new file mode 100644
> >>>> index 0000000000..fcc2ed2b65
> >>>> --- /dev/null
> >>>> +++ b/docs/hypervisor-guide/arm/firmware/arm-scmi-proposal.rst
> >>>> @@ -0,0 +1,224 @@
> >>>> +
> >>>> +Proposal for SCMI multi-agent driver bindings
> >>>> +=============================================
> >>>> +
> >>>> +Now the Xen configuration for SCMI multi-agent support is done in a bit complicated way, especially
> >>>> +from SCMI multi-agent driver initialization and Dom0 DT manipulation point of view.
> >>>> +Also it does not take into account future requirements to support SCP SCMI FW.
> >>>> +
> >>>> +To enable SCMI multi-agent user need:
> >>>> +
> >>>> +* take host DT with basic SCMI enabled
> >>>> +* add SCMI shared-memory nodes for all agents
> >>>> +* update SCMI node to point on SCMI Xen management channel (``[smc-id, shmem]``)
> >>>> +* add "xen,scmi-secondary-agents" property to the "\chosen" node
> >>>> +
> >>>> +.. code::
> >>>> +
> >>>> +   chosen {
> >>>> +      xen,scmi-secondary-agents = <
> >>>> +                    1 0x82000003 &scmi_shm_1
> >>>> +                    2 0x82000004 &scmi_shm_2
> >>>> +                    3 0x82000005 &scmi_shm_3
> >>>> +                    4 0x82000006 &scmi_shm_4>;
> >>>> +    }
> >>>> +
> >>>> +    /{
> >>>> +            // SCMI shared-memory nodes for all agents
> >>>> +            scmi_shm_0 : sram@47ff0000 {
> >>>> +                compatible = "arm,scmi-shmem";
> >>>> +                reg = <0x0 0x47ff0000 0x0 0x1000>;
> >>>> +            };
> >>>> +            scmi_shm_1: sram@47ff1000 {
> >>>> +                    compatible = "arm,scmi-shmem";
> >>>> +                    reg = <0x0 0x47ff1000 0x0 0x1000>;
> >>>> +            };
> >>>> +            scmi_shm_2: sram@47ff2000 {
> >>>> +                    compatible = "arm,scmi-shmem";
> >>>> +                    reg = <0x0 0x47ff2000 0x0 0x1000>;
> >>>> +            };
> >>>> +            scmi_shm_3: sram@47ff3000 {
> >>>> +                    compatible = "arm,scmi-shmem";
> >>>> +                    reg = <0x0 0x47ff3000 0x0 0x1000>;
> >>>> +            };
> >>>> +            scmi_shm_4: sram@47ff4000 {
> >>>> +                    compatible = "arm,scmi-shmem";
> >>>> +                    reg = <0x0 0x47ff4000 0x0 0x1000>;
> >>>> +            };
> >>>> +
> >>>> +            firmware {
> >>>> +                scmi: scmi {
> >>>> +                    compatible = "arm,scmi-smc";
> >>>> +                    arm, smc - id = <0x82000002>; <--- Xen management agent channel "smc-id"
> >>>> +                    #address-cells = < 1>;
> >>>> +                    #size-cells = < 0>;
> >>>> +                    #access-controller-cells = < 1>;
> >>>> +                    shmem = <&scmi_shm_0>; <--- Xen management agent channel "shmem"
> >>>> +
> >>>> +                    protocol@X{
> >>>> +                    };
> >>>> +                };
> >>>> +            };
> >>>> +    }
> >>>> +
> >>>> +Important thing to note is that all information about multi-channel support is strictly Xen specific.
> >>>> +
> >>>> +During initialization the SCMI multi-agent driver uses Host DT SCMI node and
> >>>> +"xen,scmi-secondary-agents" property to init itself and then, during Dom0 creation, manipulates
> >>>> +Dom0 DT to remove Xen specific SCMI info and update dom0 SCMI nodes with Dom0 SCMI agent specific
> >>>> +information.
> >>>> +
> >>>> +There are two negative points:
> >>>> +
> >>>> +1) Double DT modification - one is user to set up SCMI Xen support in Host DT, second -
> >>>> +   Dom0 DT manipulation.
> >>>> +2) In case of future support of mailbox shared-memory transport there could be up to 4 mailboxes and
> >>>> +   up to 2 shared-memories per SCMI agent channel.
> >>>> +
> >>>> +Hence SCMI multi-agent support is Xen specific knowledge there is a proposal to add it as Xen
> >>>> +specific DT definitions and so minimize Host and Dom0 DT manipulations.
> >>>> +Those definitions can be added in "/chosen" or, ideally, in "xen,config" node (like in Hyperlaunch design).
> >>>> +
> >>>> +The SCMI binding stays generic, just two SCMI nodes defined - one for Xen management channel and
> >>>> +one for Host Dom0 OSPM.
> >>>> +
> >>>> +Example of using "chosen" for configuration:
> >>>> +
> >>>> +.. code::
> >>>> +
> >>>> +    /{
> >>>> +
> >>>> +        chosen {
> >>>> +            ...
> >>>> +
> >>>> +            // Xen SCMI management channel
> >>>> +            scmi_shm_0 : sram@47ff0000 {
> >>>> +                compatible = "arm,scmi-shmem";
> >>>> +                reg = <0x0 0x47ff0000 0x0 0x1000>;
> >>>> +            };
> >>>> +            scmi_xen: scmi {
> >>>> +                compatible = "arm,scmi-smc";
> >>>> +                arm,smc-id = <0x82000002>; <--- Xen manegement agent smc-id
> >>>> +                #address-cells = < 1>;
> >>>> +                #size-cells = < 0>;
> >>>> +                #access-controller-cells = < 1>;
> >>>> +                shmem = <&scmi_shm_0>; <--- Xen manegement agent shmem
> >>>> +            };
> >>>> +
> >>>> +            // SCMI multi-agent configuration
> >>>> +            scmi_shm_2: sram@47ff2000 {
> >>>> +                    compatible = "arm,scmi-shmem";
> >>>> +                    reg = <0x0 0x47ff2000 0x0 0x1000>;
> >>>> +            };
> >>>> +            scmi_shm_3: sram@47ff3000 {
> >>>> +                    compatible = "arm,scmi-shmem";
> >>>> +                    reg = <0x0 0x47ff3000 0x0 0x1000>;
> >>>> +            };
> >>>> +            scmi_shm_4: sram@47ff4000 {
> >>>> +                    compatible = "arm,scmi-shmem";
> >>>> +                    reg = <0x0 0x47ff4000 0x0 0x1000>;
> >>>> +            };
> >>>> +            xen,scmi-secondary-agents = <
> >>>> +                        1 0x82000003 &scmi_shm
> >>>> +                        2 0x82000004 &scmi_shm_2
> >>>> +                        3 0x82000005 &scmi_shm_3
> >>>> +                        4 0x82000006 &scmi_shm_4>;
> >>>> +        };
> >>>> +
> >>>> +        // Host SCMI OSPM channel - provided to the Dom0 as is if SCMI enabled for it
> >>>> +        scmi_shm: sram@47ff1000 {
> >>>> +                compatible = "arm,scmi-shmem";
> >>>> +                reg = <0x0 0x47ff1000 0x0 0x1000>;
> >>>> +        };
> >>>> +
> >>>> +        firmware {
> >>>> +            scmi: scmi {
> >>>> +                compatible = "arm,scmi-smc";
> >>>> +                arm,smc-id = <0x82000003>; <--- Host OSPM agent smc-id
> >>>> +                #address-cells = < 1>;
> >>>> +                #size-cells = < 0>;
> >>>> +                shmem = <&scmi_shm>; <--- Host OSPM agent shmem
> >>> By OSPM you mean Dom0 and not Xen? So this is a change compared to a
> >>> device tree for baremetal Linux without Xen?
> OSPM is OS in general, for example Linux.
> >>> Let me ask the same question differently. In the case of barematal Linux
> >>> without Xen (no KVM), what would Linux see under /firmware/scmi as
> >>> smc-id and shmem? The same as the one that Xen would use for itself? Or
> >>> the same as the ones that Dom0 would use when Xen is present?
> >> If this DT is used with the baremetal Linux - then the Linux Kernel will
> >>
> >> see Dom0 "smc-id" and "shmen" under /firmware/scmi.
> >>
> >>>> +                protocol@X{
> >>>> +                };
> >>>> +            };
> >>>> +        };
> >>>> +    }
> >>>> +
> >>>> +
> >>>> +In the above case:
> >>>> +
> >>>> +1) Xen SCMI multi-agent can be probed with DT configuration from "chosen" (or special "xen,config")
> >>>> +   node and all Xen related nodes can be easily dropped from Dom0 DT.
> >>>> +2) Host SCMI OSPM channel DT nodes can be copied to Dom0 DT without changes if SCMI enabled for it.
> >>>> +3) Future support for mailbox shared-memory transport (SCP SCMI FW) can be simplified as no more
> >>>> +   manipulation required with Dom0 SCMI "arm,smc-id" and "shmem" DT properties.
> >>> Yes, I can see the benefit if we can arrange it so that the underlying
> >>> host device tree is the same that Linux would use baremetal. And all the
> >>> extra configuration is placed under /chosen in "xen,config" node or
> >>> similar. I would probably call it "xen,scmi".
> >> Personally, I would keep "xen,config" as it leaves room to add additional
> >>
> >> configuration nodes in the future.
> >>
> >>>> +Example of using "xen,config" for configuration:
> >>>> +
> >>>> +.. code::
> >>>> +
> >>>> +    hypervisor {
> >>>> +        compatible = “hypervisor,xen”
> >>>> +
> >>>> +        // Configuration container
> >>>> +        config {
> >>>> +            compatible = "xen,config";
> >>>> +            ...
> >>>> +
> >>>> +            // Xen SCMI management channel
> >>>> +            scmi_shm_0 : sram@47ff0000 {
> >>>> +                compatible = "arm,scmi-shmem";
> >>>> +                reg = <0x0 0x47ff0000 0x0 0x1000>;
> >>>> +            };
> >>>> +            scmi_xen: scmi {
> >>>> +                compatible = "arm,scmi-smc";
> >>>> +                arm,smc-id = <0x82000002>; <--- Xen manegement agent smc-id
> >>>> +                #address-cells = < 1>;
> >>>> +                #size-cells = < 0>;
> >>>> +                #access-controller-cells = < 1>;
> >>>> +                shmem = <&scmi_shm_0>; <--- Xen manegement agent shmem
> >>>> +            };
> >>>> +
> >>>> +            // SCMI multi-agent configuration
> >>>> +            scmi_shm_2: sram@47ff2000 {
> >>>> +                    compatible = "arm,scmi-shmem";
> >>>> +                    reg = <0x0 0x47ff2000 0x0 0x1000>;
> >>>> +            };
> >>>> +            scmi_shm_3: sram@47ff3000 {
> >>>> +                    compatible = "arm,scmi-shmem";
> >>>> +                    reg = <0x0 0x47ff3000 0x0 0x1000>;
> >>>> +            };
> >>>> +            scmi_shm_4: sram@47ff4000 {
> >>>> +                    compatible = "arm,scmi-shmem";
> >>>> +                    reg = <0x0 0x47ff4000 0x0 0x1000>;
> >>>> +            };
> >>>> +            xen,scmi-secondary-agents = <
> >>>> +                        1 0x82000003 &scmi_shm
> >>>> +                        2 0x82000004 &scmi_shm_2
> >>>> +                        3 0x82000005 &scmi_shm_3
> >>>> +                        4 0x82000006 &scmi_shm_4>;
> >>>> +        };
> >>>> +    };
> >>>> +
> >>>> +    /{
> >>>> +        // Host SCMI OSPM channel - provided to the Dom0 as is if SCMI enabled for it
> >>>> +        scmi_shm: sram@47ff1000 {
> >>>> +                compatible = "arm,scmi-shmem";
> >>>> +                reg = <0x0 0x47ff1000 0x0 0x1000>;
> >>>> +        };
> >>>> +
> >>>> +        firmware {
> >>>> +            scmi: scmi {
> >>>> +                compatible = "arm,scmi-smc";
> >>>> +                arm,smc-id = <0x82000003>; <--- Host OSPM agent smc-id
> >>>> +                #address-cells = < 1>;
> >>>> +                #size-cells = < 0>;
> >>>> +                shmem = <&scmi_shm>; <--- Host OSPM agent shmem
> >>>> +
> >>>> +                protocol@X{
> >>>> +                };
> >>>> +            };
> >>>> +        };
> >>>> +    }
> >>>> -- 
> >>>> 2.34.1
                
            Hi Stefano and Oleksii, Let me start with a bit of process. This is discussion is getting fairly difficult to follow.... Can you please trim unrelevant bits when replying? On 22/06/2025 22:57, Stefano Stabellini wrote: > On Thu, 19 Jun 2025, Oleksii Moisieiev wrote: >> On 18/06/2025 03:35, Stefano Stabellini wrote: >>> On Thu, 12 Jun 2025, Oleksii Moisieiev wrote: >>>> On 23/05/2025 23:19, Stefano Stabellini wrote: >>>>> On Mon, 19 May 2025, Oleksii Moisieiev wrote: >>>>>> From: Grygorii Strashko<grygorii_strashko@epam.com> >> the same (smc-id and shmem) for both the BSP case (no Xen) and the Xen >> case (Dom0 domain). >> >> Meanwhile, the Xen management agent's SCMI node and configuration are >> expected to be placed under /chosen. >> >> This approach ensures that the Host DT remains as unchanged as possible. > > Yes, my main point is that all the device tree information, except for > what is under /chosen, should be left unchanged between the BSP case (no > Xen) and the Xen case. > > We have freedom to decide: > - the information we put under /chosen and how to interpret it > - how to use the information under /firmware/scmi when Xen is present > > >> Currently: >> >> The Host DT /firmware/scmi node requires modification to point to the >> Xen management agent by changing >> >> the smc-id and shmem values. > > I don't think we should require changes to /firmware/scmi in the host DT > when Xen is present. > > Often, people don't know when or if Xen is present at the time the > Device Tree is generated. So it is best to avoid modification (outside > of /chosen). I am probably missing something. But it looks like TF-A requires to suport multi-agent so Xen can use it. Am I correct? Furthermore, I can't tell why the multi-agent support is Xen specific. Surely, you may want something similar with other hypervisors? If not, then my next question is why does Xen needs to do things differently? Cheers, -- Julien Grall
On 23/06/2025 11:02, Julien Grall wrote: > Hi Stefano and Oleksii, > > Let me start with a bit of process. This is discussion is getting > fairly difficult to follow.... Can you please trim unrelevant bits > when replying? > > On 22/06/2025 22:57, Stefano Stabellini wrote: >> On Thu, 19 Jun 2025, Oleksii Moisieiev wrote: >>> On 18/06/2025 03:35, Stefano Stabellini wrote: >>>> On Thu, 12 Jun 2025, Oleksii Moisieiev wrote: >>>>> On 23/05/2025 23:19, Stefano Stabellini wrote: >>>>>> On Mon, 19 May 2025, Oleksii Moisieiev wrote: >>>>>>> From: Grygorii Strashko<grygorii_strashko@epam.com> >>> the same (smc-id and shmem) for both the BSP case (no Xen) and the Xen >>> case (Dom0 domain). >>> >>> Meanwhile, the Xen management agent's SCMI node and configuration are >>> expected to be placed under /chosen. >>> >>> This approach ensures that the Host DT remains as unchanged as >>> possible. >> >> Yes, my main point is that all the device tree information, except for >> what is under /chosen, should be left unchanged between the BSP case (no >> Xen) and the Xen case. >> >> We have freedom to decide: >> - the information we put under /chosen and how to interpret it >> - how to use the information under /firmware/scmi when Xen is present >> >> >>> Currently: >>> >>> The Host DT /firmware/scmi node requires modification to point to the >>> Xen management agent by changing >>> >>> the smc-id and shmem values. >> >> I don't think we should require changes to /firmware/scmi in the host DT >> when Xen is present. >> >> Often, people don't know when or if Xen is present at the time the >> Device Tree is generated. So it is best to avoid modification (outside >> of /chosen). > > I am probably missing something. But it looks like TF-A requires to > suport multi-agent so Xen can use it. Am I correct? > > Furthermore, I can't tell why the multi-agent support is Xen specific. > Surely, you may want something similar with other hypervisors? If not, > then my next question is why does Xen needs to do things differently? > > Cheers, > Yes, multi-agent support is required in TF-A for Xen, but this is not specific to Xen. The implementation is based on the scenario described in the last paragraph of section 4.2.1 of DEN0056 [0]. The key points are as follows: - a Virtual Machine (VM) serves as a non-trusted agent in the Non-secure Security state. - a hypervisor acts as a trusted agent in the Non-secure Security state. - the hypervisor can configure fine-grained Non-secure resource access permissions for Virtual Machines. - the hypervisor sets resource access permissions for the agent identifier associated with the channel and assigns the channel to the VM. Therefore, we can expect other hypervisors to follow this specification. [0]: https://developer.arm.com/documentation/den0056/latest/
Hi Oleksii, On 25/06/2025 20:47, Oleksii Moisieiev wrote: > > On 23/06/2025 11:02, Julien Grall wrote: >> I am probably missing something. But it looks like TF-A requires to >> suport multi-agent so Xen can use it. Am I correct? >> >> Furthermore, I can't tell why the multi-agent support is Xen specific. >> Surely, you may want something similar with other hypervisors? If not, >> then my next question is why does Xen needs to do things differently? >> >> Cheers, >> > > Yes, multi-agent support is required in TF-A for Xen, but this is not > specific to Xen. I am really confused. If the support is not Xen specific then why do we end up to have xen specific node/properties in your proposal (see [1]) such as xen,scmi-secondary-agents. I also question the placement of the SMCI multi-agent in /chosen. For me /chosen is for configuration related to the hypervisor/OS. But here, it seems the multi-agent SMCI is related to the platform. So wouldn't it be better to create a new compatible arm,smci-multi that will include the information for multi? An alternative would be to extend the existing SCMI node in a backward compatible way. Lastly, I see if you put a node under "/chosen" with "arm,scmi-smc". Have you checked this will not confused Linux? I was under the impression Linux would look for any node with the compatible when initializing a driver. Cheers, [1] https://lists.xenproject.org/archives/html/xen-devel/2025-06/msg01421.html -- Julien Grall
On 25/06/2025 23:32, Julien Grall wrote:
> Hi Oleksii,
>
> On 25/06/2025 20:47, Oleksii Moisieiev wrote:
>>
>> On 23/06/2025 11:02, Julien Grall wrote:
>>> I am probably missing something. But it looks like TF-A requires to
>>> suport multi-agent so Xen can use it. Am I correct?
>>>
>>> Furthermore, I can't tell why the multi-agent support is Xen specific.
>>> Surely, you may want something similar with other hypervisors? If not,
>>> then my next question is why does Xen needs to do things differently?
>>>
>>> Cheers,
>>>
>>
>> Yes, multi-agent support is required in TF-A for Xen, but this is not
>> specific to Xen.
>
> I am really confused. If the support is not Xen specific then why do
> we end up to have xen specific node/properties in your proposal (see
> [1]) such as xen,scmi-secondary-agents.
>
Sorry, for confusion. Some additional explanation is below.
All this is about the case when Host platform doesn't have SCP and SCMI
implemented in EL2 Firmware (TF-A).
The SCMI standard defines multi-agent support (as many other features),
but it is Optional.
Also SCMI standard doesn't define how its features has to be implemented
internally, just defines standard interface (API/HAL) to access them.
More over, even "shared-ram" Transport implementation is not strictly
standardized, for example in terms of
"shared-ram" base address alignment.
In most of the cases, SoC Vendors (if we are lucky) provide BSP with EL2
SCMI FW which implements
one SCMI transport and, so supports only one Agent which, in general,
has access to all resources.
Such EL2 SCMI FW is NOT virtualization (Xen) aware, so only "Simple SCMI
over SMC/HVC calls forwarding driver (EL3)" (CONFIG_SCMI_SMC)
can be used out of the box to enable SCMI in Hardware domain (or, with
patches 1-3 of this series, in Driver domain).
So, to have SCMI multi-channel features enabled with EL2 SCMI FW - it
has some SCMI features to be implemented
(which otherwise optional), including defining additional Transport
channels (Agents), shmem alignment on Xen page boundary,..
The requirements for EL2 SCMI FW is described in SCMI documentation [2].
And generic answer on your question above "I am probably missing
something. But it looks like TF-A requires to
suport multi-agent so Xen can use it. Am I correct?" would be Yes.
[1]
https://github.com/oleksiimoisieiev/xen/blob/scmi_upstrv5/docs/hypervisor-guide/arm/firmware/arm-scmi.rst#simple-scmi-over-smchvc-calls-forwarding-driver-el3
[2]
https://github.com/oleksiimoisieiev/xen/blob/scmi_upstrv5/docs/hypervisor-guide/arm/firmware/arm-scmi.rst#scmi-smchvc-multi-agent-driver-el3
-----
SCMI SCP Note. When Host platform support SCP the multi-agent support
will be in place, as
in such cases separate SCMI transport is allocated for at least each
Application processor (AP) which is defined as SCMI Agent.
For example, Core-R(s) (like Cortex-R/M), DSPs, Core-A (Cortex-A - here
the Xen is usually running).
No Agents in the system knows about each other. Only SCP FW does.
And even in this case, the BSP SCP FW might NOT be virtualization (Xen)
aware as only one Transport (Agent)
is provided for Core-A (actually two - one Secure for PSCI, and one
non-secure - for OSPM).
---
In the Virtualized system:
- The Xen is real OSPM which manages other Virtual OSPM and it needs
dedicated SCMI management channel through which
  it can perform HW resources assignment for Virtual OSPM by
communicating with EL2 SCMI FW
  during Virtual OSPM creation or release HW resources during Virtual
OSPM destruction.
  In the future it also possible to enable such PM feature as SCMI based
CpuFreq in Xen.
  The SCMI DT binding for Xen SCMI Agent expected to be exactly the same
as for any OSPM (like Linux) as from
  SCMI FW point of few it is just OS running on Application Core (which
substitutes regular OS - Linux, RTOS).
  So no new SCMI specific bindings (including compatibilities)
introduced neither in this series nor in this proposal.
  In other words, Xen needs two DT to boot, kinda:
  - Xen DT (with bootinfo, Application Core info, uart)
  - Host Platform DT (source information to create domains)
   and if there would be two separate DTs - each will have own standard
(bindings) DT SCMI node.
According to the current design Xen accepts DT which is Host Platform DT
with added Xen configuration so Xen SCMI info is added in Xen
configuration node under /chosen, and no Domains is expected to see it
ever. After Xen initialization DT nodes from Xen DT are copied to the
Dom0 device tree. Our proposal is to keep SCMI configuration from
Platform Host DT the  same so it will be copied to the Dom0 device tree.
- the number of Virtual Machines or Virtual OSPMs (in terms of SCMI)
depends on hypervisor (Xen) configuration.
  And Virtual OSPM is defined as VM which has direct access to HW
(passthrough), so need access
  SCMI services to get fine-grained and safe access to required Platform
HW resources, and avoid interference.
  Every Virtual OSPM is SCMI agent, which sees it's own SCMI transport,
and doesn't know about other agents.
  In the case of DT - the standard SCMI bindings are used.
- So the Xen is the only entity in the platform which need to know about
other Agents.
   Therefore, this Xen specific configuration "xen,scmi-secondary-agents",
   for the case of the EL2 SCMI FW, is introduced and added under the
/chosen node (or xen-config).
   Unfortunately, there is no way to discover Agent's configurations
using SCMI protocol (base), like "func-id"
   and shmem parameter (only can get Number of Agents, and discover own
Agent id), so only option is to
   define this info in DT for Xen. However, Xen can use shared memory
regions and func_ids of the other Agents to   determine agent_id using
base protocol. That's why it was decided to make agent_id in
"xem,scmi-secondary-agents" optional.
> I also question the placement of the SMCI multi-agent in /chosen. For
> me /chosen is for configuration related to the hypervisor/OS. But
> here, it seems the multi-agent SMCI is related to the platform.
>
 From SCMI point of view the Xen is separate OSPM (SCMI Agent), which
have own boot configuration data, in case of ARM - Device-tree.
The SCMI doesn't see the difference between Linux or Xen running on
Application processor.
They are both OSPM (Agents), but with different privileges and permissions.
As was stated before from Xen standpoint the device tree should be same
as Host DT with Xen
configuration placed under /chosen node. So agent_id dedicated to Xen
should be in xen configuration node.
The Host platform (BSP) will run using Host DT with Xen DT data removed and
doesn't need to know about Xen SCMI management channel (agent) or agents
available for Virtual OSPMs (VMs).
For Xen to run with SCMI multi-channel support - Xen specific DT data has
to be added under /chosen which includes Xen specific SCMI data.
> So wouldn't it be better to create a new compatible arm,smci-multi
> that will include the information for multi? An alternative would be
> to extend the existing SCMI node in a backward compatible way.
>
> Lastly, I see if you put a node under "/chosen" with "arm,scmi-smc".
> Have you checked this will not confused Linux? I was under the
> impression Linux would look for any node with the compatible when
> initializing a driver.
>
Xen configuration under /chosen will be removed when passing DT to the
Domains.
So Linux domains will not see any Xen configuration data.
When booting Baremetal Xen DT Linux kernel will not parse "arm,scmi-smc"
node under "chosen"  as Linux uses 2 depth level for probing.
And there is no compatible in chosen:
{
    chosen {
     // no compatible - skip
     xen-config {
         compat = "xen,config"; <- no go below as not Bus compat
         scmi {
             <-never get here
         }
     }
    }
}
> Cheers,
>
> [1]
> https://lists.xenproject.org/archives/html/xen-devel/2025-06/msg01421.html
>
>
                
            Hi Oleksii, On 29/06/2025 16:41, Oleksii Moisieiev wrote: > ---> > In the Virtualized system: Thanks for the long explanation. In this section, you mention Xen all over the place. But as you previously agreed the multi-agent SCMI is not Xen specific. To put it differently, aside the fact... > > - The Xen is real OSPM which manages other Virtual OSPM and it needs> dedicated SCMI management channel through which > it can perform HW resources assignment for Virtual OSPM by > communicating with EL2 SCMI FW > during Virtual OSPM creation or release HW resources during Virtual > OSPM destruction. > In the future it also possible to enable such PM feature as SCMI based > CpuFreq in Xen. > > The SCMI DT binding for Xen SCMI Agent expected to be exactly the same > as for any OSPM (like Linux) as from > SCMI FW point of few it is just OS running on Application Core (which > substitutes regular OS - Linux, RTOS). > So no new SCMI specific bindings (including compatibilities) > introduced neither in this series nor in this proposal. > > In other words, Xen needs two DT to boot, kinda: > - Xen DT (with bootinfo, Application Core info, uart) > - Host Platform DT (source information to create domains) > and if there would be two separate DTs - each will have own standard > (bindings) DT SCMI node. > According to the current design Xen accepts DT which is Host Platform DT > with added Xen configuration so Xen SCMI info is added in Xen > configuration node under /chosen, and no Domains is expected to see it > ever. After Xen initialization DT nodes from Xen DT are copied to the > Dom0 device tree. Our proposal is to keep SCMI configuration from > Platform Host DT the same so it will be copied to the Dom0 device tree. > > > - the number of Virtual Machines or Virtual OSPMs (in terms of SCMI) > depends on hypervisor (Xen) configuration. > And Virtual OSPM is defined as VM which has direct access to HW > (passthrough), so need access > SCMI services to get fine-grained and safe access to required Platform > HW resources, and avoid interference. > > Every Virtual OSPM is SCMI agent, which sees it's own SCMI transport, > and doesn't know about other agents. > In the case of DT - the standard SCMI bindings are used. > > - So the Xen is the only entity in the platform which need to know about > other Agents. > Therefore, this Xen specific configuration "xen,scmi-secondary-agents", > for the case of the EL2 SCMI FW, is introduced and added under the > /chosen node (or xen-config). > Unfortunately, there is no way to discover Agent's configurations > using SCMI protocol (base), like "func-id" > and shmem parameter (only can get Number of Agents, and discover own > Agent id), so only option is to > define this info in DT for Xen. However, Xen can use shared memory > regions and func_ids of the other Agents to determine agent_id using > base protocol. That's why it was decided to make agent_id in > "xem,scmi-secondary-agents" optional. ... the name of this property contains "xen", I still don't understand why the binding could not be used by other hypervisors. IOW, what if above you s/xen/KVM/ (or any other hypervisor you come up with)? Are they all going to create their own bindings? I would guess not given the single agent is already generic (if I am not mistaken, both Linux and Xen are using it) I will not insist on moving the binding outside of /chosen if the other maintainers think this is the best. But I think this is shortsighted to add "xen" in all the name or put it in a Xen specific position. Ultimately what I want to avoid is we have to support multiple bindings in Xen because someone else decided to create a new binding as we didn't even attempt to make ours generic... Cheers, -- Julien Grall
On 29/06/2025 21:34, Julien Grall wrote: > Hi Oleksii, > > On 29/06/2025 16:41, Oleksii Moisieiev wrote: > > ---> >> In the Virtualized system: > > Thanks for the long explanation. In this section, you mention Xen all > over the place. But as you previously agreed the multi-agent SCMI is > not Xen specific. To put it differently, aside the fact... > >> > > - The Xen is real OSPM which manages other Virtual OSPM and it > needs> dedicated SCMI management channel through which >> it can perform HW resources assignment for Virtual OSPM by >> communicating with EL2 SCMI FW >> during Virtual OSPM creation or release HW resources during Virtual >> OSPM destruction. >> In the future it also possible to enable such PM feature as SCMI >> based >> CpuFreq in Xen. >> >> The SCMI DT binding for Xen SCMI Agent expected to be exactly the >> same >> as for any OSPM (like Linux) as from >> SCMI FW point of few it is just OS running on Application Core (which >> substitutes regular OS - Linux, RTOS). >> So no new SCMI specific bindings (including compatibilities) >> introduced neither in this series nor in this proposal. >> >> In other words, Xen needs two DT to boot, kinda: >> - Xen DT (with bootinfo, Application Core info, uart) >> - Host Platform DT (source information to create domains) >> and if there would be two separate DTs - each will have own standard >> (bindings) DT SCMI node. >> According to the current design Xen accepts DT which is Host Platform DT >> with added Xen configuration so Xen SCMI info is added in Xen >> configuration node under /chosen, and no Domains is expected to see it >> ever. After Xen initialization DT nodes from Xen DT are copied to the >> Dom0 device tree. Our proposal is to keep SCMI configuration from >> Platform Host DT the same so it will be copied to the Dom0 device tree. >> >> >> - the number of Virtual Machines or Virtual OSPMs (in terms of SCMI) >> depends on hypervisor (Xen) configuration. >> And Virtual OSPM is defined as VM which has direct access to HW >> (passthrough), so need access >> SCMI services to get fine-grained and safe access to required >> Platform >> HW resources, and avoid interference. >> >> Every Virtual OSPM is SCMI agent, which sees it's own SCMI transport, >> and doesn't know about other agents. >> In the case of DT - the standard SCMI bindings are used. >> >> - So the Xen is the only entity in the platform which need to know about >> other Agents. >> Therefore, this Xen specific configuration >> "xen,scmi-secondary-agents", >> for the case of the EL2 SCMI FW, is introduced and added under the >> /chosen node (or xen-config). >> Unfortunately, there is no way to discover Agent's configurations >> using SCMI protocol (base), like "func-id" >> and shmem parameter (only can get Number of Agents, and discover own >> Agent id), so only option is to >> define this info in DT for Xen. However, Xen can use shared memory >> regions and func_ids of the other Agents to determine agent_id using >> base protocol. That's why it was decided to make agent_id in >> "xem,scmi-secondary-agents" optional. > > > ... the name of this property contains "xen", I still don't understand > why the binding could not be used by other hypervisors. IOW, what if > above you s/xen/KVM/ (or any other hypervisor you come up with)? Are > they all going to create their own bindings? I would guess not given > the single agent is already generic (if I am not mistaken, both Linux > and Xen are using it) > KVM [1] is not applicable here as it starts under/inside Linux, so it doesn't have direct access to SCMI, the Linux does. And Linux will see only one SCMI transport (Agent). Seems, the only option possible is virtio-scmi (qemu) - the virtio-scmi potentially can simulate multi-channel, but this is out if scope of this work. QNX [0] relies on configuration files rather than the Device Tree. [0] https://www.qnx.com/developers/docs/8.0/com.qnx.doc.hypervisor.user/topic/config/hyp.html [1] https://trueconf.com/blog/knowledge-base/configure-kvm-hypervisor-ubuntu-server#KVM_configuration > I will not insist on moving the binding outside of /chosen if the > other maintainers think this is the best. But I think this is > shortsighted to add "xen" in all the name or put it in a Xen specific > position. > > Ultimately what I want to avoid is we have to support multiple > bindings in Xen because someone else decided to create a new binding > as we didn't even attempt to make ours generic... > Not aware of any similar task done or in progress. > Cheers, >
Hi, On 30/06/2025 12:57, Oleksii Moisieiev wrote: > KVM [1] is not applicable here as it starts under/inside Linux, so it > doesn't have direct access to SCMI, the Linux does. > And Linux will see only one SCMI transport (Agent). > Seems, the only option possible is virtio-scmi (qemu) - the virtio-scmi > potentially can simulate multi-channel, > but this is out if scope of this work. > QNX [0] relies on configuration files rather than the Device Tree. To clarify, I didn't ask to implement anything in KVM or QNX. I asked to write the bindings in a way that they are not Xen specific to give a chance to for other to re-use them. Yes today KVM and QNX would not use them... But I also still don't see why we should actively prevent them to use the bindings you come up with... Cheers, -- Julien Grall
On Mon, 30 Jun 2025, Julien Grall wrote: > Hi, > > On 30/06/2025 12:57, Oleksii Moisieiev wrote: > > KVM [1] is not applicable here as it starts under/inside Linux, so it > > doesn't have direct access to SCMI, the Linux does. > > And Linux will see only one SCMI transport (Agent). > > Seems, the only option possible is virtio-scmi (qemu) - the virtio-scmi > > potentially can simulate multi-channel, > > but this is out if scope of this work. > > QNX [0] relies on configuration files rather than the Device Tree. > To clarify, I didn't ask to implement anything in KVM or QNX. I asked to write > the bindings in a way that they are not Xen specific to give a chance to for > other to re-use them. Yes today KVM and QNX would not use them... But I also > still don't see why we should actively prevent them to use the bindings you > come up with... I agree with Julien. We can still have the property or node under /chosen to avoid conflicts and confusion while still making the node more generic so at least in theory it could be reused by other hypervisors -- remove the "xen," prefix from "xen,scmi-secondary-agents".
© 2016 - 2025 Red Hat, Inc.