All of lore.kernel.org
 help / color / mirror / Atom feed
From: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
To: Oleksii Moisieiev <Oleksii_Moisieiev@epam.com>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Anthony PERARD" <anthony.perard@vates.tech>,
	"Bertrand Marquis" <bertrand.marquis@arm.com>,
	"Jan Beulich" <jbeulich@suse.com>,
	"Juergen Gross" <jgross@suse.com>,
	"Julien Grall" <julien@xen.org>,
	"Michal Orzel" <michal.orzel@amd.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	"Grygorii Strashko" <grygorii_strashko@epam.com>
Subject: Re: [PATCH v16 4/6] xen/arm: scmi: introduce SCI SCMI SMC multi-agent driver
Date: Thu, 3 Dec 2026 23:15:21 +0000	[thread overview]
Message-ID: <87h5gugdmg.fsf@epam.com> (raw)
In-Reply-To: <1b9d9b424ca6ace85d0c80983baea8dd0812d3f9.1794839953.git.oleksii_moisieiev@epam.com>

Hi Oleksii,

Oleksii Moisieiev <Oleksii_Moisieiev@epam.com> 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@epam.com>
> Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>


Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>

[...]

--
WBR, Volodymyr

  reply	other threads:[~2026-12-03 23:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 14:41 [PATCH v16 0/6] xen/arm: scmi: introduce SCI SCMI SMC multi-agent support Oleksii Moisieiev
2026-11-16 14:41 ` [PATCH v16 2/6] xen: arm: smccc: add INVALID_PARAMETER error code Oleksii Moisieiev
2026-11-16 14:41 ` [PATCH v16 1/6] xen/domctl: chain SCI handling before IOMMU in assign_device domctl Oleksii Moisieiev
2026-12-04  1:40   ` Stefano Stabellini
2026-11-16 14:41 ` [PATCH v16 4/6] xen/arm: scmi: introduce SCI SCMI SMC multi-agent driver Oleksii Moisieiev
2026-12-03 23:15   ` Volodymyr Babchuk [this message]
2026-12-04  1:45   ` Stefano Stabellini
2026-12-04 17:06     ` Oleksii Moisieiev
2026-11-16 14:41 ` [PATCH v16 3/6] lib/arm: Add I/O memory copy helpers Oleksii Moisieiev
2026-11-16 14:41 ` [PATCH v16 5/6] tools/xl/libxl: wire up SCMI SMC multi-agent configuration Oleksii Moisieiev
2026-11-27 15:58   ` Anthony PERARD
2026-11-30  9:37     ` Oleksii Moisieiev
2026-11-16 14:41 ` [PATCH v16 6/6] docs: arm: add SCI SCMI SMC multi-agent driver docs Oleksii Moisieiev
2026-12-04  0:18   ` Volodymyr Babchuk
2026-12-04  1:45     ` Stefano Stabellini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h5gugdmg.fsf@epam.com \
    --to=volodymyr_babchuk@epam.com \
    --cc=Oleksii_Moisieiev@epam.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=anthony.perard@vates.tech \
    --cc=bertrand.marquis@arm.com \
    --cc=grygorii_strashko@epam.com \
    --cc=jbeulich@suse.com \
    --cc=jgross@suse.com \
    --cc=julien@xen.org \
    --cc=michal.orzel@amd.com \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.