[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v16 4/6] xen/arm: scmi: introduce SCI SCMI SMC multi-agent driver


  • To: Oleksii Moisieiev <Oleksii_Moisieiev@xxxxxxxx>
  • From: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Date: Thu, 3 Dec 2026 23:15:21 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=rwo3Hk0YTbtxhKFQpU6Ra22dxKBtUTDLbLvL+ecUh1Y=; b=xnvOnZNq2so34tmfR73O+GK7cUQ54pM9/2EXMINt2n7LNA6O1ntxNmcQAS6VerOeEjv2pjNwzdeqHLXqnQCD1TYNmGOrGFqsE0fUiAsJkVIcFCEt7rxTVtaVnUj2sFLh9XEyUJ6JL5ZK9pYYNxa/ZoPrfExJKgGqrYv8TjW55LHSUto7FfAfoorwd9C6+ZvhnOnSMcY9mjLh3U0dm+zbFti1HmUfucMDGcpE+MsQQoPbUNZ9x4EWdN34w1OiamPUKBcFC0dqkD6m4aeDmlUnBS1s+NDvz82e/90yuM1j85FrVOrMBGpeNrtpyLMzf6mEAKoxY/kwIVa0Bha5plhFsA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=y5ISLu8u8WNW736h2pNghdtl15QI/j/xp2yRVTeCNIudqeBAQtZURw34Pu0amQUur2XYBVoKUBvQ+MpHviC8ZMrRnduQmZOwDERYoFoVnSL+/glNFKgdGMB8HtU4OFfea9rLGmiV/pcFF7RaS7l+dS2+bEAsGozkQWOmGZz6lR8MVVAdpm0Au7Sd2bGilq58JyK1729Ap8atQb1of2mGVN8tf5rUmOgUIwFV4KcSq5TJv8xTvLfm8h2u67d+0dNPPCLWizh2kcVoL7Ar4ecpXscpnS7UmjaBWHiDFXsnzShfgdbSalg1BLQTeGgmkRXgjrlxNoAuDBxfLazpOmFQBQ==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=epam.com header.i="@epam.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:x-ms-exchange-senderadcheck"
  • Authentication-results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Grygorii Strashko <grygorii_strashko@xxxxxxxx>
  • Delivery-date: Thu, 03 Dec 2026 23:15:27 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHdddiaTKOfp8OBIEa25LA3QExKsLdMDKKA
  • Thread-topic: [PATCH v16 4/6] xen/arm: scmi: introduce SCI SCMI SMC multi-agent driver

Hi Oleksii,

Oleksii Moisieiev <Oleksii_Moisieiev@xxxxxxxx> writes:

> Add an SCI mediator for Arm EL3 firmware, such as Trusted Firmware-A
> (TF-A), that provides a separate SCMI SMC shared-memory channel for each
> agent. Xen keeps a trusted management agent and assigns secondary agents
> exclusively to domains, as shown below.
>
>   +-----------------------------------------+
>   |                                         |
>   | EL3 TF-A SCMI                           |
>   +-------+--+-------+--+-------+--+-------++
>   |shmem1 |  |shmem0 |  |shmem2 |  |shmemX |
>   +-----+-+  +---+---+  +--+----+  +---+---+
> smc-id1 |        |         |           |
> agent1  |        |         |           |
>   +-----v--------+---------+-----------+----+
>   |              |         |           |    |
>   |              |   Xen   |           |    |
>   +--------------+---------+-----------+----+
>          smc-id0 |  smc-id2|    smc-idX|
>          agent0  |  agent2 |    agentX |
>                  |         |           |
>             +----v---+  +--v-----+  +--v-----+
>             |        |  |        |  |        |
>             | Dom0   |  | Dom1   |  | DomX   |
>             |        |  |        |  |        |
>             |        |  |        |  |        |
>             +--------+  +--------+  +--------+
>
> Each channel consists of an arm,smc-id doorbell and a shared-memory buffer
> whose address and nonzero size are Xen page aligned. Xen maps shared
> memory as Device memory. Guests exchange messages directly through their
> assigned buffer; Xen checks the SMC function ID before forwarding the
> call synchronously to EL3.
>
> Require BASE_SET_DEVICE_PERMISSIONS support. Query its availability using
> Base PROTOCOL_MESSAGE_ATTRIBUTES before registering the mediator and fail
> initialization if the command is unavailable. Firmware must enforce the
> permissions configured by Xen and prevent untrusted agents from changing
> other agents' permissions.
>
> Keep BASE_RESET_AGENT_CONFIGURATION optional. Request an agent reset
> through the management channel when relinquishing a domain's resources.
> Warn if reset fails, explaining that device state and permissions may
> persist and agent reuse may be unsafe. Unsupported reset permits teardown;
> other reset errors propagate to the caller.
>
> Bind only to the arm,scmi-smc management node inside a xen,sci-compatible
> node beneath /chosen. Other SCMI nodes, including the host /firmware/scmi,
> are ignored by the mediator. Describe secondary agents as xen,scmi-agent
> children of its agents node, with #address-cells = <1> and
> phandle. At least one enabled secondary agent is required.
>
> The optional single-cell reg property specifies an agent ID in 0..254.
> Use a matching hexadecimal unit address for an explicit ID and retain a
> node label for domain phandle references. For example:
>
> / {
>     #address-cells = <2>;
>     #size-cells = <2>;
>
>     scmi_shm_0: sram@47ff0000 {
>         compatible = "arm,scmi-shmem";
>         reg = <0x0 0x47ff0000 0x0 0x1000>;
>     };
>
>     firmware {
>         scmi: scmi {
>             compatible = "arm,scmi-smc";
>             arm,smc-id = <0x82000002>; /* Host OSPM agent smc-id */
>             #address-cells = <1>;
>             #size-cells = <0>;
>             shmem = <&scmi_shm_0>; /* Host OSPM agent shmem */
>         };
>     };
>
>     chosen {
>         #address-cells = <2>;
>         #size-cells = <2>;
>         ranges;
>
>         xen {
>             #address-cells = <2>;
>             #size-cells = <2>;
>             ranges;
>
>             xen_scmi_config {
>                 compatible = "xen,sci";
>                 #address-cells = <2>;
>                 #size-cells = <2>;
>                 ranges;
>                 xen,dom0-sci-agent = <&scmi_agent_dom0>;
>
>                 /* Xen management channel */
>                 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_xen: scmi {
>                     compatible = "arm,scmi-smc";
>                     arm,smc-id = <0x82000003>; /* Xen management smc-id */
>                     #address-cells = <1>;
>                     #size-cells = <0>;
>                     #access-controller-cells = <1>;
>                     shmem = <&scmi_shm_1>; /* Xen management agent shmem */
>                 };
>
>                 agents {
>                     #address-cells = <1>;
>                     #size-cells = <0>;
>
>                     scmi_agent_dom0: agent@0 {
>                         compatible = "xen,scmi-agent";
>                         reg = <0>;
>                         arm,smc-id = <0x82000002>;
>                         shmem = <&scmi_shm_0>;
>                     };
>
>                     scmi_agent_domu: agent@2 {
>                         compatible = "xen,scmi-agent";
>                         reg = <2>;
>                         arm,smc-id = <0x82000004>;
>                         shmem = <&scmi_shm_2>;
>                     };
>
>                     scmi_agent_domu3: agent@3 {
>                         compatible = "xen,scmi-agent";
>                         reg = <3>;
>                         arm,smc-id = <0x82000005>;
>                         shmem = <&scmi_shm_3>;
>                     };
>                 };
>             };
>         };
>     };
> };
>
> To discover the secondary ID from firmware, replace only
> scmi_agent_domu: agent@2 with the following node. Omit reg and the unit
> address, but keep the label so the domain phandle still resolves:
>
> scmi_agent_domu: agent-domu {
>     compatible = "xen,scmi-agent";
>     arm,smc-id = <0x82000004>;
>     shmem = <&scmi_shm_2>;
> };
>
> Xen always discovers its own management agent ID. For secondary agents
> without reg, send BASE_DISCOVER_AGENT on the channel described by that
> node's arm,smc-id and shmem. Validate the response before inserting the
> channel, rejecting invalid IDs, duplicates and clashes with the management
> agent. Supplying reg skips mapping and probing that secondary channel.
> Discovery failure aborts initialization rather than guessing an ID from
> the node name, phandle or SMC function ID.
>
> Dom0 selects an enabled secondary agent using xen,dom0-sci-agent in the
> xen,sci node, as shown above. An absent property disables SCMI for Dom0;
> an invalid reference warns and disables it. When enabled, Xen copies the
> host /firmware/scmi description to Dom0 unmodified. Its doorbell and
> shared memory must match the selected agent's channel.
>
> A dom0less guest selects an agent with xen,sci-agent in its xen,domain
> node. Add this domain configuration to /chosen, alongside the Xen SCMI
> configuration above:
>
> / {
>     chosen {
>         domU1 {
>             compatible = "xen,domain";
>             xen,sci_type = "scmi_smc_multiagent";
>             xen,sci-agent = <&scmi_agent_domu>;
>             /* Other domain and boot-module properties go here. */
>         };
>     };
> };
>
> Both selectors contain phandles to agent nodes, not numeric agent IDs.
> SCI initialization completes discovery before boot-domain construction.
> The optional SCI get_agent_id callback, dispatched by sci_get_agent_id(),
> resolves either phandle to the configured or discovered ID saved with the
> channel. It does not issue another discovery request. Existing channel
> acquisition enforces exclusive ownership; invalid dom0less references
> fail domain construction.
>
> Toolstack-created guests continue to select a numeric agent_id through
> arm_sci, for example:
>
>     arm_sci = "type=scmi_smc_multiagent,agent_id=2"
>     iomem = [ "47ff2,1@22001" ]
>
> The guest's partial DT must describe the corresponding doorbell and guest
> shared-memory address. Dom0less guests map the same channel through
> xen,reg in their partial DT.
>
> Use Xen's management SCMI node as an access-controller provider. Devices
> reference scmi_xen, which declares #access-controller-cells = <1>:
>
>     &i2c1 {
>         access-controllers = <&scmi_xen 0>;
>     };
>
> Dom0 and dom0less device assignment paths invoke sci_assign_dt_device(). For
> toolstack-created domains, include all passed-through SCMI-managed devices
> in xl.cfg's dtdev list, including devices without IOMMU protection.
>
> Keep Xen's shared-memory descriptions under xen_scmi_config and leave the
> host OSPM node and /firmware/scmi unchanged. These descriptions do not
> reserve RAM. If buffers occupy system RAM, the platform must reserve the
> whole firmware-owned range separately in /reserved-memory before Xen
> boots. SRAM outside system RAM does not need a RAM reservation.
>
> Factor out the SCMI protocol definitions and shared-memory transport,
> record the feature in MAINTAINERS and SUPPORT.md, and document the
> pre-existing scmi-smc-passthrough command-line option. Full host and guest
> configuration examples are in the binding and hypervisor guide.
>
> [0] https://developer.arm.com/documentation/den0056
> [1] 
> https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/firmware/arm,scmi.yaml
> [2] 
> https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/access-controllers/access-controllers.yaml
>
> Signed-off-by: Grygorii Strashko <grygorii_strashko@xxxxxxxx>
> Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@xxxxxxxx>


Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>

[...]

--
WBR, Volodymyr

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.