xen/arm: scmi: introduce SCI SCMI SMC multi-agent support
v15 cover xen/arm: scmi: introduce SCI SCMI SMC multi-agent support
Inroducing patch series which includes implementation of the SCI SCMI SMC multi-agent support.
This patch series follows RFC v5 [3] series which was introducing both SCMI single-agent and multi-agent support. After the discussion it was decided to split features and upstream singe-agent support first. This feature is merged for now to v4.21-rc2.
I'm starting this patch series from v6 to save the discussion history and don't break changes log.
Patch - xen/domctl: extend XEN_DOMCTL_assign_device to handle not only iommu
- add chainged handling of assigned DT devices to support access-controller functionality through SCI framework. Change was done in two parts:
- call to sci_do_domctl() to do_domctl()
- update iommu_do_dt_domctl() to check for dt_device_is_protected() and not fail if DT device is not protected by IOMMU
Patch - xen/arm: scmi: introduce SCI SCMI SMC multi-agent driver
- add Xen-specific SCMI container compatible xen,sci
under /chosen/xen; Xen binds only to the arm,scmi-smc inside it and ignores other SCMI nodes (e.g. under /firmware).
- describe secondary agents as xen,scmi-agent children of an agents node, with arm,smc-id, shmem and optional reg for the agent ID. Discover the ID through BASE_DISCOVER_AGENT when reg is absent.
- keep shared-memory nodes under xen_scmi_config; platform RAM reservations are described separately in /reserved-memory.
- each guest using SCMI supplies its agent_id (dom0 via xen,dom0-sci-agent-id property in xen,sci compatible node, toolstack via arm_sci = "type=scmi_smc_multiagent,agent_id=...", dom0less via xen,sci_type + xen,sci-agent-id in xen,domain).
- factor out SCMI generic definitions and shmem code.
- passthrough configuration for SCMI guests mirrors other HW passthrough.
Patch - docs: arm: add SCI SCMI SMC multi-agent driver docs
- document the Xen SCMI container under /chosen/xen/xen_scmi_config and the mediator’s binding rules; update examples accordingly.
All Xen-specific SCMI configuration now lives under /chosen/ to keep host DT changes isolated while leaving the host /firmware/scmi untouched for Dom0 consumption.
Code can be found at:
https://github.com/oleksiimoisieiev/xen/tree/scmi_ma_upstrv6
[1] RFC v2:
http://patchwork.kernel.org/project/xen-devel/cover/[email protected]/
[2] RFC v3:
https://patchwork.kernel.org/project/xen-devel/patch/[email protected]
[3] RFC v5:
https://lore.kernel.org/xen-devel/[email protected]/
[4] SCMI single-agent:
https://lore.kernel.org/xen-devel/[email protected]/
SCMI spec:
https://developer.arm.com/documentation/den0056/e/?lang=en
SCMI bindings:
https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/firmware/arm,scmi.yaml
https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/access-controllers/access-controllers.yaml
Reference EL3 FW:
RPI5: https://github.com/xen-troops/arm-trusted-firmware/commits/rpi5_dev/
Renesas v4h:
https://github.com/GrygiriiS/arm-trusted-firmware/commits/rcar_gen4_v2.7_v4x-scmi_upd/
base-commit: dbe60f244c (Update Xen to 4.21, 2025-02-21)
Changes in v15:
- rename the shared-memory helpers to scmi_put_message() and scmi_get_message(), and remove redundant volatile parameter qualifiers
- use writel_relaxed() consistently for the request control fields and explain their Device-memory ordering
- retain the naturally aligned shared-memory structure and verify its transport field offsets at compile time instead of adding __packed
- correct the SMC diagnostic wording and wrap long lines, retaining the size-error diagnostics as agreed during review
- document the limit derived from the Base protocol's eight-bit agent
count: platform ID 0 is separate, so 255 agents plus the platform occupy IDs 0..255 and fit in the eight-bit domain configuration field
- use paddr_t for channel physical addresses, PRIpaddr for their diagnostics, and uint64_t for DT address and size decoding
- initialize channel status through an MMIO accessor
- mark free_channel_list() and the Dom0 DT callback as __init
- move the response trace before the cleanup label, skip it on send failure, and rename the label to cleanup
- use %pd for domain diagnostics
Changes in v14:
- replace the flat secondary-agent list and its cell-count property with xen,scmi-agent child nodes under agents, using reg for an optional ID
- scope secondary-agent parsing to the management channel's xen,sci container
- resolve discovered IDs before insertion and reject duplicate or invalid IDs
- validate shared-memory phandles, addresses and nonzero page-aligned sizes
- retain shared-memory nodes under xen_scmi_config and document platform reservations separately, following the review discussion
- update binding examples and commit description for the child-node format
- match the const-qualified SCI domain_sanitise_config callback interface
- describe secondary agents as xen,scmi-agent nodes under agents
- update host, discovery and dom0less examples for the child-node format
- clarify shared-memory placement and platform RAM reservations
Changes in v13:
- memcpy_{from,to}io(): align only the I/O pointer and access the regular memory side through get_unaligned_le32()/put_unaligned_le32().
- document the contract of the helpers in xen/io.h
- reword the Arm implementation notes to state the concrete access pattern
- drop the incorrect claim about avoiding endianness conversion from the commit message; note instead that the _le32 helpers pair with readl()/writel() so the byte sequence is preserved on either endianness
- fix typo in commit description
Changes in v12:
- rebase to the latest staging
- add R-Bs from Stefano and Ack from Jan
- add missed Ack.
- Add missed R-B
- correct the Emacs footer of both files, which asked for 8 column tab indentation while the code is in 4 column Xen style
- rebase to the latest staging
- return EINVAL if xen,sci_type=scmi_smc_multiagent was set but CONFIG_SCMI_SMC_MA not set
- put arm_sci_agent_id after v8r_el1_msa and before pad to preserve order. Reduced pad from uint16_t to uint8_t to fill the gap (was 2 bytes before adding arm_sci_agent_id and left only 1, so used uint8_t to preserve structure size)
- fix scmi_handle_call to use arm_smccc_guest_smc helper function
- update send_smc_message function to use new format of arm_smccc_1_1_smc
- guard the Dom0 SCMI agent id setup in create_dom0() and MA related funcitons with CONFIG_SCMI_SMC_MA
- fix the xen_scmi_config example in booting.txt, which placed properties after subnodes and was rejected by dtc with "Properties must precede subnodes"
Changes in v11:
- Fix agent_id documentation: clarify it applies to SCMI SMC multi-agent support only, not plain SCMI SMC (reviewer feedback)
- Remove "non-zero" from agent_id description to match accepted range [0..254]
- Remove "UINT8_MAX (255) is treated as invalid" from user documentation as unnecessary implementation detail
- Add LIBXL_HAVE_SCMI_SMC_MULTIAGENT feature macro in libxl.h to advertise the new scmi_smc_multiagent type and agent_id field
- Add agent_id validation in libxl__arch_domain_build_info_setdefault() to reject invalid values at the libxl level, not only in xl
Changes in v10:
- remove unused sci_do_domctl stub from sci.h
- removed extra include in memcpy-{to/from}io.c files
- Fix tabs in MAINTAINERS file
- remove duplicate SPDX tag from scmi-shmem.c
- add cast to ARM_SMCCC_INVALID_PARAMETER to settle the sign since ARM_SMCCC_INVALID_PARAMETER is -3 which is part of the spec and resp is the default smccc call structure.
- update free_channel_list. Add spinlock to avoid race condition and a comment with a description of the function work
- preserve error of smc_create_channel in scmi_probe
- check scmi shmem address alignment as wel as it is done for size
- check for d->arch.sci_data != NULL in scmi_handle_call
- use SCMI_SHMEM_MAPPED size for iomem_permit_access
- change len type to unsigned in shmem_{get|put}_message
- rename shmem_channel_is_free to shmem_channel_status
- add comment about skipping message status when getting message response
- Set correct agent_id ranges for dom0less and a toolstack. Agent_id 0 is not binded for dom0 so can be reused. Also mentioned that UINT8_MAX (255) is treated as invalid agent_id.
- Split hypervisor and toolstack changes into separate commits
- move init list and spin init after initial checks in probe call
- fix typo in comments
- clean resources when sci_register returns an error.
- Split hypervisor and toolstack changes into separate commits
- rephrase section about /firmware/scmi. Mentioned that this node is taken from Host DT and copied unmodified.
- fix xen,reg address for secondary domains for Dom0less configuration
Changes in v9:
- treat SCI as a gate for XEN_DOMCTL_*assign_device: abort before IOMMU if sci_do_domctl() returns an error other than -ENXIO, instead of trying to propagate SCI errors after a successful IOMMU operation. This avoids partial success and the need for IOMMU rollback.
- remove early return from do_domctl() in the assign_device path to keep RCU handling intact.
- change IS_ENABLED(*) to #ifdef in sci_do_domctl quard
- reword commit description to refer to memcpy_fromio and memcpy_toio
- ordering obj-y in Makefile
- rename ALL_LIBS to ARCH_LIBS
- drop io.h and move definitions to the common header, fix comments to be arch neutral
- update comments for memcpy_{from/to}io implementation
- sort and refactor MAINTAINERS enties
- remove Spurious changes
- add extra check to avoid ASSERT when calling unmap_channel_memory from assign device method
- set correct tx flag to SCMI_BASE_AGENT_PERMISSIONS_RESET when freeing resources. Flag should be set to 1 according to the section 4.2.2.12 [0].
- fix dt node copmaring
- moved channel->shmem check from ASSERT in unmap_memory_channel to "if" statement. This will prevent firing ASSERT if unmap_channel_memory was called twice on the same channel.
Changes in v8:
- check for CONFIG_ARM_SCI to be ebabled instead of COMFIG_ARM before calling sci_do_domctl
- rework sci_do_domctl call to avoid extra checks, improved error handling.
- do not propagate ret1 if sci_do_domctl returned positive ret
- updated comment in domctl.c code
- switched to ordered accessors to address the ordering and barrier concerns.
- updated the documentation to match the implementation and explicitly state the supported access sizes and granularity.
- rename memcpy_* implementation files to memcpu-* to follow naming convension
- fix indentation to match Xen style
- fix intendation to match Xen style
- move memcpy-{from/to}io to more convenient library place
- update xen_scmi func_id in commit description
- updated documentation with the new DT format
- updated opt_dom0_scmi_agent_id setting to avoid it to be equal SCMI_AGENT_ID_INVALID.
- changed SCMI_AGENT_ID_INVALID from 0xff to UINT8_MAX which makes
code more clear showing that UINT8_MAX is theated like invalidagent_id and couldn't be used. Also excluded SCMI_AGENT_ID_INVALID
from acceptable value range
- remove outdated xen,config property ignore, added xen,sci compatible
to skip_matches in handle_node
- add documentation for pre-existing scmi-smc-passthrough command line option in alphabetically correct location (in 's' section)
- add note to commit description about documentation for previously undocumented scmi-smc-passthrough
- Fix SMC IDs in DT examples (Xen management uses 0x82000003, Dom0 uses 0x82000002)
- Add explicit note explaining why Dom0 and Xen channels do not conflict
- Document dom0less multi-agent configuration example (xen,sci_type / xen,sci-agent-id)
- Add scmi_xen node to agent-discovery example with #scmi-secondary-agents-cells = 2
- Drop dom0=sci-agent-id command line handling; Dom0 SCMI is now enabled via xen,dom0-sci-agent-id in the xen,sci DT container
- Refresh docs and examples to mention the DT property instead of the cmdline option
- update documentation to match the last DT format
- fixed RST: "... code-block:: dts" -> ".. code-block:: dts"
- update documentation with dom0less configuration example
- update documentation with new param xen,dom0-sci-agent-id
instead of the command line parameter
Changes in v7:
- update domctl to build on both Arm and x86 platforms
- move ret1 declaration to the top of the function as required by code style
- x86 guidance: removed the speculative note; header now just says each arch supplies its own implementation or macro.
- name spacing: dropped the double-underscore; the helpers are now memcpy_fromio / memcpy_toio. The header also explicitly allows an arch to define these as macros before including it.
- updated io.c to keep 32-bit transfers safe on arm32
- moved to __raw_read*/__raw_write* accessors to avoid endianness conversion.
- split the helpers into separate compilation units
- rework scmi nodes for xen to match on compatible string instead of the direct path
- update documentation in section of the xen_scmi configuration which is matched by "xen,sci" compatible instead of the direct path.
Changes in v6:
- change iommu_do_domctl and sci_do_domctl command order and call sci_do_domctl first which will produce cleaner code path. Also dropped changing return code when iommu was disabled in iommu_do_domctl.
- sorted objs in Makefile alhabetically
- added newline at the end of Makefile
- used uint{N}_t intead of u{N}
- add comment about why 32 bit IO operations were used
- updated cast opertaions to avoid dropping constness which is wrong
- move function definitions to generic place so the could be reused by other arch
- add SPDX tag to io.c
- updated scmi-shmem to use io.h from generic location
- update scmi_agent_id parameter to be provided inside dom0= parameter list and have the following format "dom0=sci-agent-id=0" This change was done as a response for Stefano comment and requires a lot of code changes, but produces much cleaner solution that's why I've added it to the code.
- fix file comments and return codes
- fix lenght checks in shmem_{get,put}_message to use offsetof
- remove len member from scmi_channel structure as it is not used
- set scmi-secondary-agents property to be mandatory since if no secondary agents were provided then there is no sence to enable scmi when no secondary agents are populated to the Domains
- update documentation in booting.txt, added xen_scmi node to the example
- adjust d->arch.sci_enabled value in scmi_domain_destroy
- fix lock management in smc_create_channel call
- avoid extra map_channel_memory command for Xen management channel because collect_agent_id call unmaps memory if DOMID_XEN is not set. So for Xen management channel we can init domain_id ad DOMID_XEN before calling collect_agent_id so memory shouldn't be unmapped.
- remove all HVC mentions from the multi-agent doc
- update sci-agent-id parameter description in the documentation
- add missing Sign-of
- minor fixes across the document
Changes in v5:
- return -EINVAL if mediator without assign_dt_device was provided
- invert return code check for iommu_do_domctl in XEN_DOMCTL_assign_device domctl processing to make cleaner code
- change -ENOTSUPP error code to -ENXIO in sci_do_domctl
- handle -ENXIO return comde of iommu_do_domctl
- leave !dt_device_is_protected check in iommu_do_dt_domctl to make code work the same way it's done in "handle_device" call while creating hwdom(dom0) and "handle_passthrough_prop" call for dom0less creation
- drop return check from sci_assign_dt_device call as not needed
- do not return EINVAL when addign_dt_device is not set. That is because this callback is optional and not implemented in single-agent driver
- move memcpy_toio/fromio to the generic place
- fix device-tree example format in booting.txt, added ";" after "}".
- update define in scmi-proto.h
- update define in scmi-shmem.h file
- scmi_assign_device - do not ignore -EOPNOTSUPP return
code of the do_smc_xfer
- remove overwriting agent_channel->agent_id after SCMI_BASE_DISCOVER_AGENT call
- add multi-agent files to the MAINTAINERS
- add SCMI multi-agent description to the SUPPORT.md
- handle ARM_SMCCC_INVALID_PARAMETER return code and return -EINVAL for smc call
- updated collect_agents function. Set agent_id parameter as optional in scmi-secondary-agents device-tree property
- introduce "#scmi-secondary-agents-cells" parameter to set if agent_id was provided
- reanme xen,scmi-secondary-agents property to scmi-secondary-agents
- move memcpu_toio/fromio for the generic place
- update Xen to get management channel from /chosen/xen,config node
- get hypervisor channnel from node instead of using hardcoded
- update handling scmi and shmem nodes for the domain
- Set multi-agent driver to support only Arm64
- rework multi-agent driver to leave Host Device-tree unmodified
Changes in v4:
- toolstack comments from Anthony PERARD
- added dom0less support
- added doc for "xen,scmi-secondary-agents"
Grygorii Strashko (2):
xen/domctl: chain SCI handling before IOMMU in assign_device domctl
docs: arm: add SCI SCMI SMC multi-agent driver docs
Oleksii Moisieiev (4):
xen: arm: smccc: add INVALID_PARAMETER error code lib/arm: Add I/O memory copy helpers
xen/arm: scmi: introduce SCI SCMI SMC multi-agent driver tools/xl/libxl: wire up SCMI SMC multi-agent configuration
MAINTAINERS | 1 + SUPPORT.md | 11 + .../arm/firmware/arm-scmi.rst | 405 +++++++++ docs/man/xl.cfg.5.pod.in | 13 + docs/misc/arm/device-tree/booting.txt | 195 +++++ tools/include/libxl.h | 8 + tools/libs/light/libxl_arm.c | 13 + tools/libs/light/libxl_types.idl | 4 +- tools/xl/xl_parse.c | 27 + xen/arch/arm/Makefile | 1 + xen/arch/arm/arch.mk | 1 + xen/arch/arm/dom0less-build.c | 17 + xen/arch/arm/domain_build.c | 43 + xen/arch/arm/firmware/Kconfig | 12 + xen/arch/arm/firmware/Makefile | 1 + xen/arch/arm/firmware/sci.c | 36 + xen/arch/arm/firmware/scmi-proto.h | 174 ++++ xen/arch/arm/firmware/scmi-shmem.c | 129 +++ xen/arch/arm/firmware/scmi-shmem.h | 45 + xen/arch/arm/firmware/scmi-smc-multiagent.c | 800 ++++++++++++++++++ xen/arch/arm/include/asm/firmware/sci.h | 8 + xen/arch/arm/include/asm/smccc.h | 1 + xen/arch/arm/lib/Makefile | 2 + xen/arch/arm/lib/memcpy-fromio.c | 56 ++ xen/arch/arm/lib/memcpy-toio.c | 56 ++ xen/common/domctl.c | 15 + xen/drivers/passthrough/device_tree.c | 6 + xen/include/public/arch-arm.h | 5 +- xen/include/xen/io.h | 25 + 29 files changed, 2108 insertions(+), 2 deletions(-) create mode 100644 xen/arch/arm/firmware/scmi-proto.h create mode 100644 xen/arch/arm/firmware/scmi-shmem.c create mode 100644 xen/arch/arm/firmware/scmi-shmem.h create mode 100644 xen/arch/arm/firmware/scmi-smc-multiagent.c create mode 100644 xen/arch/arm/lib/Makefile create mode 100644 xen/arch/arm/lib/memcpy-fromio.c create mode 100644 xen/arch/arm/lib/memcpy-toio.c
Signature · 4 lines
2.43.0 base-commit: aa73a1b99309f22d9bbc2603d1b206e7298d9473 branch: scmi_ma_upstrv15
PATCH v15 1/6 xen/domctl: chain SCI handling before IOMMU in assign_device domctl
From: Grygorii Strashko <[email protected]>
Add chained handling of assigned DT devices to support access-controller functionality through SCI framework, so a DT device assign request can be passed to firmware for processing and enabling VM access to the requested device (for example, device power management through SCMI).
The SCI access-controller DT device processing is called before the IOMMU path. It runs for any DT-described device (protected or not, and even when the IOMMU is disabled). The IOMMU path remains unchanged for PCI devices; only the DT path is relaxed to permit non-IOMMU devices.
This lets xl.cfg:"dtdev" list both IOMMU-protected and non-protected DT devices:
dtdev = [
"/soc/video@e6ef0000", <- IOMMU protected device
"/soc/i2c@e6508000", <- not IOMMU protected device]
The change is done in two parts:
1) call sci_do_domctl() in do_domctl() before IOMMU processing. If sci_do_domctl() reports an error other than -ENXIO, treat it as authoritative and skip the IOMMU path. A return of -ENXIO indicates that SCI did not handle the request and is ignored, allowing the existing IOMMU handling to run unchanged;
2) update iommu_do_dt_domctl() to check for dt_device_is_protected() and not fail if DT device is not protected by IOMMU. iommu_do_pci_domctl doesn't need to be updated because iommu_do_domctl first tries iommu_do_pci_domctl (when CONFIG_HAS_PCI) and falls back to iommu_do_dt_domctl only if PCI returns -ENODEV.
The new dt_device_is_protected() bypass in iommu_do_dt_domctl only applies to DT-described devices; SCI parameters are carried via DT nodes. PCI devices handled by iommu_do_pci_domctl do not carry DT/SCI metadata in this path, so there is no notion of “SCI parameters on a non-IOMMU-protected PCI device” for it to interpret or to skip. The PCI path should continue to report errors if assignment cannot be performed by the IOMMU layer. So we should leave iommu_do_pci_domctl unchanged; the SCI/DT-specific relaxations belong only in the DT path. Also SCI handling only exists when DT is present.
---
(no changes since v12)
Changes in v12:
- rebase to the latest staging
- add R-Bs from Stefano and Ack from Jan
Changes in v10:
- remove unused sci_do_domctl stub from sci.h
Changes in v9:
- treat SCI as a gate for XEN_DOMCTL_*assign_device: abort before IOMMU if sci_do_domctl() returns an error other than -ENXIO, instead of trying to propagate SCI errors after a successful IOMMU operation. This avoids partial success and the need for IOMMU rollback.
- remove early return from do_domctl() in the assign_device path to keep RCU handling intact.
- change IS_ENABLED(*) to #ifdef in sci_do_domctl quard
Changes in v8:
- check for CONFIG_ARM_SCI to be ebabled instead of COMFIG_ARM before calling sci_do_domctl
- rework sci_do_domctl call to avoid extra checks, improved error handling.
- do not propagate ret1 if sci_do_domctl returned positive ret
- updated comment in domctl.c code
Changes in v7:
- update domctl to build on both Arm and x86 platforms
- move ret1 declaration to the top of the function as required by code style
Changes in v6:
- change iommu_do_domctl and sci_do_domctl command order and call sci_do_domctl first which will produce cleaner code path. Also dropped changing return code when iommu was disabled in iommu_do_domctl.
Changes in v5:
- return -EINVAL if mediator without assign_dt_device was provided
- invert return code check for iommu_do_domctl in XEN_DOMCTL_assign_device domctl processing to make cleaner code
- change -ENOTSUPP error code to -ENXIO in sci_do_domctl
- handle -ENXIO return comde of iommu_do_domctl
- leave !dt_device_is_protected check in iommu_do_dt_domctl to make code work the same way it's done in "handle_device" call while creating hwdom(dom0) and "handle_passthrough_prop" call for dom0less creation
- drop return check from sci_assign_dt_device call as not needed
- do not return EINVAL when addign_dt_device is not set. That is because this callback is optional and not implemented in single-agent driver
xen/arch/arm/firmware/sci.c | 36 +++++++++++++++++++++++++ xen/arch/arm/include/asm/firmware/sci.h | 8 ++++++ xen/common/domctl.c | 15 +++++++++++ xen/drivers/passthrough/device_tree.c | 6 +++++ 4 files changed, 65 insertions(+)
xen/arch/arm/firmware/sci.c +36 -0
@@ -126,6 +126,42 @@ int sci_assign_dt_device(struct domain *d, struct dt_device_node *dev)return 0 ; } +int sci_do_domctl (struct xen_domctl *domctl,struct domain *d, +XEN_GUEST_HANDLE_PARAM (xen_domctl_t) u_domctl) +{ +struct dt_device_node *dev; +int ret =0 ; + +switch ( domctl->cmd ) + { +case XEN_DOMCTL_assign_device: + ret = -ENXIO ; +if ( domctl->u.assign_device.dev !=XEN_DOMCTL_DEV_DT ) +break ; + +if ( !cur_mediator ) +break ; + +if ( !cur_mediator->assign_dt_device ) +break ; + + ret =dt_find_node_by_gpath (domctl->u.assign_device.u.dt.path, + domctl->u.assign_device.u.dt.size, &dev); +if ( ret ) +return ret; + + ret =sci_assign_dt_device (d, dev); + +break ; + +default : +/* do not fail here as call is chained with iommu handling */ +break ; + } + +return ret; +} +static int __init sci_init (void ) {struct dt_device_node *np;
xen/arch/arm/include/asm/firmware/sci.h +8 -0
@@ -146,6 +146,14 @@ int sci_dt_finalize(struct domain *d, void *fdt);* control" functionality. */ int sci_assign_dt_device (struct domain *d,struct dt_device_node *dev); + +/* +* SCI domctl handler +* +* Only XEN_DOMCTL_assign_device is handled for now. +*/ +int sci_do_domctl (struct xen_domctl *domctl,struct domain *d, +XEN_GUEST_HANDLE_PARAM (xen_domctl_t) u_domctl);#else #include <public/arch-arm.h>
xen/common/domctl.c +15 -0
@@ -29,6 +29,9 @@#include <xen/xvmalloc.h> #include <asm/current.h> +#ifdef CONFIG_ARM +#include <asm/firmware/sci.h> +#endif #include <asm/irq.h> #include <asm/page.h> #include <asm/p2m.h>
@@ -925,6 +928,18 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)case XEN_DOMCTL_assign_device:case XEN_DOMCTL_test_assign_device:case XEN_DOMCTL_deassign_device: +/* +* Chain SCI DT handling ahead of the IOMMU path so an SCI mediator +* can authorise access-controlled DT devices. Unhandled cases report +* -ENXIO, which is ignored. Any other SCI error aborts before the +* IOMMU path runs. +*/ +#ifdef CONFIG_ARM_SCI + ret =sci_do_domctl (op, d, u_domctl); +if ( ret <0 && ret != -ENXIO ) +break ; +#endif + ret =iommu_do_domctl (op, d, u_domctl);break ;
xen/drivers/passthrough/device_tree.c +6 -0
@@ -379,6 +379,12 @@ int iommu_do_dt_domctl(struct xen_domctl *domctl, struct domain *d,break ; } +if ( !dt_device_is_protected (dev) ) + { + ret =0 ; +break ; + } + ret =iommu_assign_dt_device (d, dev);if ( ret )
Signature · 1 line
2.43.0
PATCH v15 2/6 xen: arm: smccc: add INVALID_PARAMETER error code
In reply to Oleksii MoisieievAccording to the "7.1 Return Codes" section of DEN0028 [1] INVALID_PARAMETER code (-3) is returned when one of the call parameters has a non-supported value.
Adding this error code to the common smccc header file.
[1]: https://documentation-service.arm.com/static/5f8edaeff86e16515cdbe4c6
---
(no changes since v12)
Changes in v12:
- add missed Ack.
xen/arch/arm/include/asm/smccc.h | 1 + 1 file changed, 1 insertion(+)
xen/arch/arm/include/asm/smccc.h +1 -0
@@ -381,6 +381,7 @@ void arm_smccc_1_2_smc(const struct arm_smccc_1_2_regs *args, 0x3FFF)/* SMCCC error codes */ +#define ARM_SMCCC_INVALID_PARAMETER (-3)#define ARM_SMCCC_NOT_REQUIRED (-2)#define ARM_SMCCC_ERR_UNKNOWN_FUNCTION (-1)#define ARM_SMCCC_NOT_SUPPORTED (-1)
Signature · 1 line
2.43.0
PATCH v15 3/6 lib/arm: Add I/O memory copy helpers
In reply to Oleksii MoisieievIntroduce memcpy_fromio() and memcpy_toio() helpers to copy between regular memory and a memory-like I/O region on Arm. The generic prototypes live in io.h so other architectures can provide their own implementations.
The helpers copy a byte sequence: byte accesses are used until the I/O pointer is 32-bit aligned and for the trailing count % 4 bytes, the aligned bulk uses 32-bit accesses. Only the I/O pointer is aligned, the regular memory side is accessed through get_unaligned_le32() / put_unaligned_le32(), so the access widths issued on the I/O side do not depend on the alignment of the memory buffer. These _le32 helpers pair with readl()/writel(), which are little endian accessors, hence the byte sequence is preserved on either CPU endianness.
The constraints on the I/O region are documented next to the declarations in xen/io.h, the arch-specific access pattern next to the implementation.
---
(no changes since v13)
Changes in v13:
- memcpy_{from,to}io(): align only the I/O pointer and access the regular memory side through get_unaligned_le32()/put_unaligned_le32().
- document the contract of the helpers in xen/io.h
- reword the Arm implementation notes to state the concrete access pattern
- drop the incorrect claim about avoiding endianness conversion from the commit message; note instead that the _le32 helpers pair with readl()/writel() so the byte sequence is preserved on either endianness
Changes in v12:
- Add missed R-B
- correct the Emacs footer of both files, which asked for 8 column tab indentation while the code is in 4 column Xen style
Changes in v10:
- removed extra include in memcpy-{to/from}io.c files
Changes in v9:
- reword commit description to refer to memcpy_fromio and memcpy_toio
- ordering obj-y in Makefile
- rename ALL_LIBS to ARCH_LIBS
- drop io.h and move definitions to the common header, fix comments to be arch neutral
- update comments for memcpy_{from/to}io implementation
Changes in v8:
- switched to ordered accessors to address the ordering and barrier concerns.
- updated the documentation to match the implementation and explicitly state the supported access sizes and granularity.
- rename memcpy_* implementation files to memcpu-* to follow naming convension
- fix indentation to match Xen style
- fix intendation to match Xen style
- move memcpy-{from/to}io to more convenient library place
Changes in v7:
- x86 guidance: removed the speculative note; header now just says each arch supplies its own implementation or macro.
- name spacing: dropped the double-underscore; the helpers are now memcpy_fromio / memcpy_toio. The header also explicitly allows an arch to define these as macros before including it.
- updated io.c to keep 32-bit transfers safe on arm32
- moved to __raw_read*/__raw_write* accessors to avoid endianness conversion.
- split the helpers into separate compilation units
Changes in v6:
- sorted objs in Makefile alhabetically
- added newline at the end of Makefile
- used uint{N}_t intead of u{N}
- add comment about why 32 bit IO operations were used
- updated cast opertaions to avoid dropping constness which is wrong
- move function definitions to generic place so the could be reused by other arch
- add SPDX tag to io.c
Changes in v5:
- move memcpy_toio/fromio to the generic place
xen/arch/arm/Makefile | 1 + xen/arch/arm/arch.mk | 1 + xen/arch/arm/lib/Makefile | 2 ++ xen/arch/arm/lib/memcpy-fromio.c | 56 ++++++++++++++++++++++++++++++++ xen/arch/arm/lib/memcpy-toio.c | 56 ++++++++++++++++++++++++++++++++ xen/include/xen/io.h | 25 ++++++++++++++ 6 files changed, 141 insertions(+) create mode 100644 xen/arch/arm/lib/Makefile create mode 100644 xen/arch/arm/lib/memcpy-fromio.c create mode 100644 xen/arch/arm/lib/memcpy-toio.c
xen/arch/arm/Makefile +1 -0
@@ -8,6 +8,7 @@ ifneq ($(CONFIG_NO_PLAT),y) obj-y += platforms/ endif obj-y += firmware/ +obj-y += lib/ obj-$(CONFIG_TEE) += tee/ obj-$(CONFIG_HAS_VPCI) += vpci.o
xen/arch/arm/arch.mk +1 -0
@@ -2,6 +2,7 @@ # arm-specific definitions ARCH_LIBS-y += arch/arm/$(ARCH)/lib/lib.a +ARCH_LIBS-y += arch/arm/lib/lib.a $(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS)) $(call cc-option-add,CFLAGS,CC,-Wnested-externs)
xen/arch/arm/lib/Makefile new file +2 -0
@@ -0,0 +1,2 @@ +lib-y += memcpy-fromio.o +lib-y += memcpy-toio.o
xen/arch/arm/lib/memcpy-fromio.c new file +56 -0
56 lines not on this page · raw message
xen/arch/arm/lib/memcpy-toio.c new file +56 -0
56 lines not on this page · raw message
xen/include/xen/io.h +25 -0
@@ -67,4 +67,29 @@ static inline bool write_mmio(volatile void __iomem *mem, unsigned long data, return true; } +/* +* Copy a sequence of bytes between regular memory and a memory-like I/O +* region, e.g. shared memory placed in RAM or SRAM mapped with device +* attributes. +* +* The I/O region must behave like byte-addressable storage: it has to +* accept 8-bit accesses at any byte address and naturally aligned 32-bit +* accesses, with plain byte-storage semantics in both cases (no side +* effects, no dependency on the access width). An implementation may use +* any of these widths, but never wider ones. The helpers are therefore +* not suitable for device registers with access-width requirements. +* +* Neither pointer needs to be aligned. The access widths issued on the +* I/O side depend only on the alignment of the I/O pointer and on count, +* never on the alignment of the regular memory pointer. +* +* Implementations are architecture-specific and may impose further +* constraints; see the respective arch/<arch>/lib/memcpy-{from,to}io.c +* for the exact access pattern. +*/ +void memcpy_fromio (void *to,const volatile void __iomem *from, +size_t count); +void memcpy_toio (volatile void __iomem *to,const void *from, +size_t count); +#endif /* XEN_IO_H */
Signature · 1 line
2.43.0
PATCH v15 4/6 xen/arm: scmi: introduce SCI SCMI SMC multi-agent driver
In reply to Oleksii MoisieievThis patch introduces SCI driver to support for ARM EL3 Trusted Firmware-A (TF-A) which provides SCMI interface with multi-agent support, as shown below.
+-----------------------------------------+
| |
| EL3 TF-A SCMI |
+-------+--+-------+--+-------+--+-------++
|shmem1 | |shmem0 | |shmem2 | |shmemX |
+-----+-+ +---+---+ +--+----+ +---+---+
smc-id1 | | | |
agent1 | | | |
+-----v--------+---------+-----------+----+
| | | | |
| | | | |
+--------------+---------+-----------+----+
smc-id0 | smc-id2| smc-idX|
agent0 | agent2 | agentX |
| | |
+----v---+ +--v-----+ +--v-----+
| | | | | |
| Dom0 | | Dom1 | | DomX |
| | | | | |
| | | | | |
+--------+ +--------+ +--------+The EL3 SCMI multi-agent firmware is expected to provide SCMI SMC shared memory transport for every Agent in the system.
The SCMI Agent transport channel defined by pair:
- smc-id: SMC id used for Doorbell
- shmem: shared memory for messages transfer, Xen page aligned. Shared memory is mapped with the following flags:
MT_DEVICE_nGnRE.
The following SCMI Agents are expected to be defined by SCMI FW to enable SCMI multi-agent functionality under Xen:
- Xen management agent: trusted agents that accesses to the Base Protocol commands to configure agent specific permissions
- OSPM VM agents: non-trusted agent, one for each Guest domain which is allowed direct HW access. At least one OSPM VM agent has to be provided by FW if HW is handled only by Dom0 or Driver Domain.
The EL3 SCMI FW is expected to implement following Base protocol messages:
- BASE_DISCOVER_AGENT (required for Xen and secondary agents without reg)
- BASE_RESET_AGENT_CONFIGURATION (optional)
- BASE_SET_DEVICE_PERMISSIONS (optional)
The driver binds to the arm,scmi-smc management node inside a Xen-specific container compatible with xen,sci under /chosen/xen. Other SCMI nodes, including the host /firmware/scmi, are ignored by the mediator.
Describe secondary agents as xen,scmi-agent children of an agents node inside the same container. The agents node uses #address-cells = <1> and #size-cells = <0>. Each child provides arm,smc-id and a single shmem phandle. The optional single-cell reg property supplies the SCMI agent ID (0..254). When reg is absent, Xen discovers the ID using BASE_DISCOVER_AGENT on that channel. Use agent@<id> for an explicit ID, and a node name without a unit address for discovery. Disabled agent nodes are ignored; at least one enabled secondary agent is required.
Resolve discovered IDs before adding channels to the list, so duplicate IDs are rejected consistently, including clashes with Xen's management agent. Explicit IDs avoid mapping and probing secondary channels during initialization. Xen always discovers its own management agent ID.
Keep shared-memory nodes under xen_scmi_config and leave the platform's existing /firmware/scmi and host OSPM shared-memory node unchanged. Channel nodes describe locations, rather than reserve memory: if firmware buffers occupy system RAM, the platform DT must reserve the whole firmware-owned range in /reserved-memory before Xen boots. A single reservation may cover multiple channels, including unused ones. SRAM outside system RAM does not require a RAM reservation. Channel nodes need not be moved into /reserved-memory.
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>;
#address-cells = <1>;
#size-cells = <0>;
shmem = <&scmi_shm_0>;
};
};
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-id = <0>;
/* 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>;
#address-cells = <1>;
#size-cells = <0>;
#access-controller-cells = <1>;
shmem = <&scmi_shm_1>;
};
agents {
#address-cells = <1>;
#size-cells = <0>;
agent@0 {
compatible = "xen,scmi-agent";
reg = <0>;
arm,smc-id = <0x82000002>;
shmem = <&scmi_shm_0>;
};
agent@2 {
compatible = "xen,scmi-agent";
reg = <2>;
arm,smc-id = <0x82000004>;
shmem = <&scmi_shm_2>;
};
agent@3 {
compatible = "xen,scmi-agent";
reg = <3>;
arm,smc-id = <0x82000005>;
shmem = <&scmi_shm_3>;
};
};
};
};
};
};To discover a secondary agent ID instead, omit reg from its node:
agent-domu {
compatible = "xen,scmi-agent";
arm,smc-id = <0x82000004>;
shmem = <&scmi_shm_2>;
};The agents child nodes replace the former scmi-secondary-agents list and #scmi-secondary-agents-cells property. The xen,sci subtree is omitted from Dom0's DT; the host OSPM channel is passed through when SCMI is enabled for Dom0. Full configuration and domain examples are included in the binding documentation and the hypervisor guide in patch 6.
SMC ID Configuration and SCMI Connection Compatibility:
The configuration allows the same device tree to work for both baremetal Linux and Linux Dom0. This is achieved because:
- Baremetal Linux uses: func_id 0x82000002, scmi-shmem 0x47ff0000
- Dom0 Linux uses: func_id 0x82000002, scmi-shmem 0x47ff0000
- Xen management uses: func_id 0x82000003, scmi-shmem 0x47ff1000
This works because the privileged SCMI connection in EL3 firmware is not tied exclusively to func_id 0x82000002. The EL3 firmware supports multiple SCMI agents with different SMC IDs and shared memory regions. Each agent (Dom0 via 0x82000002, Xen via 0x82000003, other domains via additional func_ids) has an independent communication channel to the firmware.
The key distinction is that Xen's management channel (0x82000003) is used for privileged operations like agent configuration and device permissions (BASE_SET_DEVICE_PERMISSIONS, BASE_RESET_AGENT_CONFIGURATION), while Dom0's channel (0x82000002) is used for standard SCMI protocol operations (power, clock, sensor management, etc.). The firmware enforces different permission levels for each agent based on their agent_id, not the SMC ID.
Therefore, there is no conflict: Linux Dom0 retains its standard SCMI connection for hardware management, while Xen uses its separate privileged channel for mediating access between multiple domains.
- It implements the SCI subsystem interface required for configuring and enabling SCMI functionality for Dom0/hwdom and Guest domains. To enable SCMI functionality for domain it has to be configured with unique supported SCMI Agent_id and use corresponding SCMI SMC shared memory transport [smc-id, shmem] defined for this SCMI Agent_id.
- Once Xen domain is configured it can communicate with EL3 SCMI FW:
-- zero-copy, the guest domain puts SCMI message in shmem;
-- the guest triggers SMC exception with smc-id (doorbell); -- the Xen driver catches exception, do checks and synchronously forwards it to EL3 FW.
- the Xen driver sends BASE_RESET_AGENT_CONFIGURATION message to Xen management agent channel on domain destroy event. This allows to reset resources used by domain and so implement use-case like domain reboot.
Dom0 Enable SCMI SMC:
- set xen,dom0-sci-agent-id=<agent_id> under the xen,sci container in the Host DT. If the property is absent, SCMI is disabled for Dom0 and all SCMI nodes are removed from the Dom0 DT. The driver updates the Dom0 DT SCMI node "arm,smc-id" value and fixes up the shmem node according to the assigned agent_id.
- pass dom0=sci-agent-id=<agent_id> in Xen command line. if not provided SCMI will be disabled for Dom0 and all SCMI nodes removed from Dom0 DT. The driver updates Dom0 DT SCMI node "arm,smc-id" value and fix up shmem node according to assigned agent_id.
Guest domains enable SCMI SMC:
- xl.cfg: add configuration option as below
arm_sci = "type=scmi_smc_multiagent,agent_id=2"
- xl.cfg: enable access to the "arm,scmi-shmem" which should correspond assigned agent_id for the domain, for example:
iomem = [
"47ff2,1@22001",
]
- DT: add SCMI nodes to the Driver domain partial device tree as in the below example. The "arm,smc-id" should correspond assigned agent_id for the domain:
passthrough {
scmi_shm_0: sram@22001000 {
compatible = "arm,scmi-shmem";
reg = <0x0 0x22001000 0x0 0x1000>;};
firmware {
compatible = "simple-bus";
scmi: scmi {
compatible = "arm,scmi-smc";
arm,smc-id = <0x82000004>;
shmem = <&scmi_shm_0>;
...
}
}
}SCMI "4.2.1.1 Device specific access control"
The XEN SCI SCMI SMC multi-agent driver performs "access-controller" provider function in case EL3 SCMI FW implements SCMI "4.2.1.1 Device specific access control" and provides the BASE_SET_DEVICE_PERMISSIONS command to configure the devices that an agents have access to. The DT SCMI node should "#access-controller-cells=<1>" property and DT devices should be bound to the Xen SCMI.
&i2c1 {
access-controllers = <&scmi 0>;
};The Dom0 and dom0less domains DT devices will be processed automatically through sci_assign_dt_device() call, but to assign SCMI devices from toolstack the xl.cfg:"dtdev" property
shall be used:
dtdev = [
"/soc/i2c@e6508000",
]
xl.cfg:dtdev will contain all nodes which are under SCMI management (not only those which are behind IOMMU).
Additionally, this patch adds documentation for the pre-existing scmi-smc-passthrough command line option, which was previously undocumented.
[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
---
Changes in v15:
- rename the shared-memory helpers to scmi_put_message() and scmi_get_message(), and remove redundant volatile parameter qualifiers
- use writel_relaxed() consistently for the request control fields and explain their Device-memory ordering
- retain the naturally aligned shared-memory structure and verify its transport field offsets at compile time instead of adding __packed
- correct the SMC diagnostic wording and wrap long lines, retaining the size-error diagnostics as agreed during review
- document the limit derived from the Base protocol's eight-bit agent
count: platform ID 0 is separate, so 255 agents plus the platform occupy IDs 0..255 and fit in the eight-bit domain configuration field
- use paddr_t for channel physical addresses, PRIpaddr for their diagnostics, and uint64_t for DT address and size decoding
- initialize channel status through an MMIO accessor
- mark free_channel_list() and the Dom0 DT callback as __init
- move the response trace before the cleanup label, skip it on send failure, and rename the label to cleanup
- use %pd for domain diagnostics
Changes in v14:
- replace the flat secondary-agent list and its cell-count property with xen,scmi-agent child nodes under agents, using reg for an optional ID
- scope secondary-agent parsing to the management channel's xen,sci container
- resolve discovered IDs before insertion and reject duplicate or invalid IDs
- validate shared-memory phandles, addresses and nonzero page-aligned sizes
- retain shared-memory nodes under xen_scmi_config and document platform reservations separately, following the review discussion
- update binding examples and commit description for the child-node format
- match the const-qualified SCI domain_sanitise_config callback interface
Changes in v13:
- fix typo in commit description
Changes in v12:
- rebase to the latest staging
- return EINVAL if xen,sci_type=scmi_smc_multiagent was set but CONFIG_SCMI_SMC_MA not set
- put arm_sci_agent_id after v8r_el1_msa and before pad to preserve order. Reduced pad from uint16_t to uint8_t to fill the gap (was 2 bytes before adding arm_sci_agent_id and left only 1, so used uint8_t to preserve structure size)
- fix scmi_handle_call to use arm_smccc_guest_smc helper function
- update send_smc_message function to use new format of arm_smccc_1_1_smc
- guard the Dom0 SCMI agent id setup in create_dom0() and MA related funcitons with CONFIG_SCMI_SMC_MA
- fix the xen_scmi_config example in booting.txt, which placed properties after subnodes and was rejected by dtc with "Properties must precede subnodes"
Changes in v10:
- Fix tabs in MAINTAINERS file
- remove duplicate SPDX tag from scmi-shmem.c
- add cast to ARM_SMCCC_INVALID_PARAMETER to settle the sign since ARM_SMCCC_INVALID_PARAMETER is -3 which is part of the spec and resp is the default smccc call structure.
- update free_channel_list. Add spinlock to avoid race condition and a comment with a description of the function work
- preserve error of smc_create_channel in scmi_probe
- check scmi shmem address alignment as wel as it is done for size
- check for d->arch.sci_data != NULL in scmi_handle_call
- use SCMI_SHMEM_MAPPED size for iomem_permit_access
- change len type to unsigned in shmem_{get|put}_message
- rename shmem_channel_is_free to shmem_channel_status
- add comment about skipping message status when getting message response
- Set correct agent_id ranges for dom0less and a toolstack. Agent_id 0 is not binded for dom0 so can be reused. Also mentioned that UINT8_MAX (255) is treated as invalid agent_id.
- Split hypervisor and toolstack changes into separate commits
- move init list and spin init after initial checks in probe call
- fix typo in comments
- clean resources when sci_register returns an error.
Changes in v9:
- sort and refactor MAINTAINERS enties
- remove Spurious changes
- add extra check to avoid ASSERT when calling unmap_channel_memory from assign device method
- set correct tx flag to SCMI_BASE_AGENT_PERMISSIONS_RESET when freeing resources. Flag should be set to 1 according to the section 4.2.2.12 [0].
- fix dt node copmaring
- moved channel->shmem check from ASSERT in unmap_memory_channel to "if" statement. This will prevent firing ASSERT if unmap_channel_memory was called twice on the same channel.
Changes in v8:
- update xen_scmi func_id in commit description
- updated documentation with the new DT format
- updated opt_dom0_scmi_agent_id setting to avoid it to be equal SCMI_AGENT_ID_INVALID.
- changed SCMI_AGENT_ID_INVALID from 0xff to UINT8_MAX which makes
code more clear showing that UINT8_MAX is theated like invalidagent_id and couldn't be used. Also excluded SCMI_AGENT_ID_INVALID
from acceptable value range
- remove outdated xen,config property ignore, added xen,sci compatible
to skip_matches in handle_node
- add documentation for pre-existing scmi-smc-passthrough command line option in alphabetically correct location (in 's' section)
- add note to commit description about documentation for previously undocumented scmi-smc-passthrough
- Fix SMC IDs in DT examples (Xen management uses 0x82000003, Dom0 uses 0x82000002)
- Add explicit note explaining why Dom0 and Xen channels do not conflict
- Document dom0less multi-agent configuration example (xen,sci_type / xen,sci-agent-id)
- Add scmi_xen node to agent-discovery example with #scmi-secondary-agents-cells = 2
- Drop dom0=sci-agent-id command line handling; Dom0 SCMI is now enabled via xen,dom0-sci-agent-id in the xen,sci DT container
- Refresh docs and examples to mention the DT property instead of the cmdline option
Changes in v7:
- rework scmi nodes for xen to match on compatible string instead of the direct path
Changes in v6:
- updated scmi-shmem to use io.h from generic location
- update scmi_agent_id parameter to be provided inside dom0= parameter list and have the following format "dom0=sci-agent-id=0" This change was done as a response for Stefano comment and requires a lot of code changes, but produces much cleaner solution that's why I've added it to the code.
- fix file comments and return codes
- fix lenght checks in shmem_{get,put}_message to use offsetof
- remove len member from scmi_channel structure as it is not used
- set scmi-secondary-agents property to be mandatory since if no secondary agents were provided then there is no sence to enable scmi when no secondary agents are populated to the Domains
- update documentation in booting.txt, added xen_scmi node to the example
- adjust d->arch.sci_enabled value in scmi_domain_destroy
- fix lock management in smc_create_channel call
- avoid extra map_channel_memory command for Xen management channel because collect_agent_id call unmaps memory if DOMID_XEN is not set. So for Xen management channel we can init domain_id ad DOMID_XEN before calling collect_agent_id so memory shouldn't be unmapped.
Changes in v5:
- fix device-tree example format in booting.txt, added ";" after "}".
- update define in scmi-proto.h
- update define in scmi-shmem.h file
- scmi_assign_device - do not ignore -EOPNOTSUPP return code of the do_smc_xfer
- remove overwriting agent_channel->agent_id after SCMI_BASE_DISCOVER_AGENT call
- add multi-agent files to the MAINTAINERS
- add SCMI multi-agent description to the SUPPORT.md
- handle ARM_SMCCC_INVALID_PARAMETER return code and return -EINVAL for smc call
- updated collect_agents function. Set agent_id parameter as optional in scmi-secondary-agents device-tree property
- introduce "#scmi-secondary-agents-cells" parameter to set if agent_id was provided
- reanme xen,scmi-secondary-agents property to scmi-secondary-agents
- move memcpu_toio/fromio for the generic place
- update Xen to get management channel from /chosen/xen,config node
- get hypervisor channnel from node instead of using hardcoded
- update handling scmi and shmem nodes for the domain
- Set multi-agent driver to support only Arm64
Changes in v4:
- toolstack comments from Anthony PERARD
- added dom0less support
- added doc for "xen,scmi-secondary-agents"
MAINTAINERS | 1 + SUPPORT.md | 11 + docs/misc/arm/device-tree/booting.txt | 195 +++++ xen/arch/arm/dom0less-build.c | 17 + xen/arch/arm/domain_build.c | 43 ++ xen/arch/arm/firmware/Kconfig | 12 + xen/arch/arm/firmware/Makefile | 1 + xen/arch/arm/firmware/scmi-proto.h | 174 +++++ xen/arch/arm/firmware/scmi-shmem.c | 129 ++++ xen/arch/arm/firmware/scmi-shmem.h | 45 ++ xen/arch/arm/firmware/scmi-smc-multiagent.c | 800 ++++++++++++++++++++ xen/include/public/arch-arm.h | 5 +- 12 files changed, 1432 insertions(+), 1 deletion(-) create mode 100644 xen/arch/arm/firmware/scmi-proto.h create mode 100644 xen/arch/arm/firmware/scmi-shmem.c create mode 100644 xen/arch/arm/firmware/scmi-shmem.h create mode 100644 xen/arch/arm/firmware/scmi-smc-multiagent.c
MAINTAINERS +1 -0
@@ -534,6 +534,7 @@ SCI MEDIATORS R: Oleksii Moisieiev <[email protected]> S: Supported F: xen/arch/arm/firmware/sci.c +F: xen/arch/arm/firmware/scmi-*.[ch] F: xen/arch/arm/include/asm/firmware/sci.h SEABIOS UPSTREAM
SUPPORT.md +11 -0
@@ -972,6 +972,17 @@ by hwdom. Some platforms use SCMI for access to system-level resources. Status: Supported +### Arm: SCMI SMC multi-agent support + +Enable support for the multi-agent configuration of the EL3 Firmware, which +allows Xen to provide an SCMI interface to the Domains. +Xen manages access permissions to the HW resources and provides an SCMI interface +to the Domains. Each Domain is represented as a separate Agent, which can +communicate with EL3 Firmware using a dedicated shared memory region, and +notifications are passed through by Xen. + + Status, ARM64: Tech Preview + ### ARM: Guest PSCI support Emulated PSCI interface exposed to guests. We support all mandatory
docs/misc/arm/device-tree/booting.txt +195 -0
204 lines not on this page · raw message
xen/arch/arm/dom0less-build.c +17 -0
@@ -293,6 +293,23 @@ static int __init domu_dt_sci_parse(struct dt_device_node *node, d_cfg->arch.arm_sci_type =XEN_DOMCTL_CONFIG_ARM_SCI_SCMI_SMC ; } +else if ( !strcmp (sci_type,"scmi_smc_multiagent" ) ) + { +uint32_t agent_id =0 ; + +if ( !IS_ENABLED (CONFIG_SCMI_SMC_MA ) ) + { +printk (XENLOG_ERR "xen,sci_type=scmi_smc_multiagent requested, but CONFIG_SCMI_SMC_MA not set\n" ); +return -EINVAL ; + } + +if ( !dt_property_read_u32 (node,"xen,sci-agent-id" , &agent_id) || + agent_id >=UINT8_MAX ) +return -EINVAL ; + + d_cfg->arch.arm_sci_type =XEN_DOMCTL_CONFIG_ARM_SCI_SCMI_SMC_MA ; + d_cfg->arch.arm_sci_agent_id = agent_id; + }else { printk(XENLOG_ERR "xen,sci_type in not valid (%s) for domain %s\n",
xen/arch/arm/domain_build.c +43 -0
61 lines not on this page · raw message
xen/arch/arm/firmware/Kconfig +12 -0
@@ -29,6 +29,18 @@ config SCMI_SMC driver domain. Use with EL3 firmware which supports only single SCMI OSPM agent. +config SCMI_SMC_MA + bool "Enable ARM SCMI SMC multi-agent driver" + depends on ARM_64 + select ARM_SCI + help + Enables SCMI SMC/HVC multi-agent in XEN to pass SCMI requests from Domains + to EL3 firmware (TF-A) which supports multi-agent feature. + This feature allows to enable SCMI per Domain using unique SCMI agent_id, + so Domain is identified by EL3 firmware as an SCMI Agent and can access + allowed platform resources through dedicated SMC/HVC Shared memory based + transport. + endchoice endmenu
xen/arch/arm/firmware/Makefile +1 -0
@@ -1,2 +1,3 @@ obj-$(CONFIG_ARM_SCI) += sci.o obj-$(CONFIG_SCMI_SMC) += scmi-smc.o +obj-$(CONFIG_SCMI_SMC_MA) += scmi-shmem.o scmi-smc-multiagent.o
xen/arch/arm/firmware/scmi-proto.h new file +174 -0
174 lines not on this page · raw message
xen/arch/arm/firmware/scmi-shmem.c new file +129 -0
129 lines not on this page · raw message
xen/arch/arm/firmware/scmi-shmem.h new file +45 -0
45 lines not on this page · raw message
xen/arch/arm/firmware/scmi-smc-multiagent.c new file +800 -0
800 lines not on this page · raw message
xen/include/public/arch-arm.h +4 -1
@@ -329,6 +329,7 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t);#define XEN_DOMCTL_CONFIG_ARM_SCI_NONE 0#define XEN_DOMCTL_CONFIG_ARM_SCI_SCMI_SMC 1 +#define XEN_DOMCTL_CONFIG_ARM_SCI_SCMI_SMC_MA 2#define XEN_DOMCTL_CONFIG_ARM_V8R_EL1_MSA_NONE 0#define XEN_DOMCTL_CONFIG_ARM_V8R_EL1_MSA_PMSA 1
@@ -347,7 +348,9 @@ struct xen_arch_domainconfig {uint8_t arm_sci_type;/* IN */ uint8_t v8r_el1_msa; - uint16_t pad; +/* IN */ +uint8_t arm_sci_agent_id; + uint8_t pad; };#endif /* __XEN__ || __XEN_TOOLS__ */
Signature · 1 line
2.43.0
Re: [PATCH v15 4/6] xen/arm: scmi: introduce SCI SCMI SMC multi-agent driver
Hi Oleksii,
Quoted 296 lines · Oleksii Moisieiev
This patch introduces SCI driver to support for ARM EL3 Trusted Firmware-A (TF-A) which provides SCMI interface with multi-agent support, as shown below.
+-----------------------------------------+ | | | EL3 TF-A SCMI | +-------+--+-------+--+-------+--+-------++ |shmem1 | |shmem0 | |shmem2 | |shmemX | +-----+-+ +---+---+ +--+----+ +---+---+ smc-id1 | | | | agent1 | | | | +-----v--------+---------+-----------+----+ | | | | | | | | | | +--------------+---------+-----------+----+ smc-id0 | smc-id2| smc-idX| agent0 | agent2 | agentX | | | | +----v---+ +--v-----+ +--v-----+ | | | | | | | Dom0 | | Dom1 | | DomX | | | | | | | | | | | | | +--------+ +--------+ +--------+The EL3 SCMI multi-agent firmware is expected to provide SCMI SMC shared memory transport for every Agent in the system.
The SCMI Agent transport channel defined by pair:
- smc-id: SMC id used for Doorbell
- shmem: shared memory for messages transfer, Xen page aligned. Shared memory is mapped with the following flags:
MT_DEVICE_nGnRE.The following SCMI Agents are expected to be defined by SCMI FW to enable SCMI multi-agent functionality under Xen:
- Xen management agent: trusted agents that accesses to the Base Protocol commands to configure agent specific permissions
- OSPM VM agents: non-trusted agent, one for each Guest domain which is allowed direct HW access. At least one OSPM VM agent has to be provided by FW if HW is handled only by Dom0 or Driver Domain.The EL3 SCMI FW is expected to implement following Base protocol messages:
-BASE_DISCOVER_AGENT(required for Xen and secondary agents without reg)
-BASE_RESET_AGENT_CONFIGURATION(optional)
-BASE_SET_DEVICE_PERMISSIONS(optional)The driver binds to the arm,scmi-smc management node inside a Xen-specific container compatible with xen,sci under /chosen/xen. Other SCMI nodes, including the host /firmware/scmi, are ignored by the mediator.
Describe secondary agents as xen,scmi-agent children of an agents node inside the same container. The agents node uses #address-cells = <1> and
#size-cells = <0>. Each child provides arm,smc-id and a single shmem phandle. The optional single-cell reg property supplies the SCMI agent ID (0..254). When reg is absent, Xen discovers the ID usingBASE_DISCOVER_AGENTon that channel. Use agent@<id> for an explicit ID, and a node name without a unit address for discovery. Disabled agent nodes are ignored; at least one enabled secondary agent is required.Resolve discovered IDs before adding channels to the list, so duplicate IDs are rejected consistently, including clashes with Xen's management agent. Explicit IDs avoid mapping and probing secondary channels during initialization. Xen always discovers its own management agent ID.
Keep shared-memory nodes under
xen_scmi_configand leave the platform's existing /firmware/scmi and host OSPM shared-memory node unchanged. Channel nodes describe locations, rather than reserve memory: if firmware buffers occupy system RAM, the platform DT must reserve the whole firmware-owned range in /reserved-memory before Xen boots. A single reservation may cover multiple channels, including unused ones. SRAM outside system RAM does not require a RAM reservation. Channel nodes need not be moved into /reserved-memory.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>; #address-cells = <1>; #size-cells = <0>; shmem = <&scmi_shm_0>; }; }; 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-id = <0>; /* 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>; #address-cells = <1>; #size-cells = <0>; #access-controller-cells = <1>; shmem = <&scmi_shm_1>; }; agents { #address-cells = <1>; #size-cells = <0>; agent@0 { compatible = "xen,scmi-agent"; reg = <0>; arm,smc-id = <0x82000002>; shmem = <&scmi_shm_0>; }; agent@2 { compatible = "xen,scmi-agent"; reg = <2>; arm,smc-id = <0x82000004>; shmem = <&scmi_shm_2>; }; agent@3 { compatible = "xen,scmi-agent"; reg = <3>; arm,smc-id = <0x82000005>; shmem = <&scmi_shm_3>; }; }; }; }; }; };To discover a secondary agent ID instead, omit reg from its node:
agent-domu { compatible = "xen,scmi-agent"; arm,smc-id = <0x82000004>; shmem = <&scmi_shm_2>; };The agents child nodes replace the former scmi-secondary-agents list and
#scmi-secondary-agents-cellsproperty. The xen,sci subtree is omitted from Dom0's DT; the host OSPM channel is passed through when SCMI is enabled for Dom0. Full configuration and domain examples are included in the binding documentation and the hypervisor guide in patch 6.SMC ID Configuration and SCMI Connection Compatibility:
The configuration allows the same device tree to work for both baremetal Linux and Linux Dom0. This is achieved because:
- Baremetal Linux uses:
func_id0x82000002, scmi-shmem0x47ff0000
- Dom0 Linux uses:func_id0x82000002, scmi-shmem0x47ff0000
- Xen management uses:func_id0x82000003, scmi-shmem0x47ff1000This works because the privileged SCMI connection in EL3 firmware is not tied exclusively to
func_id0x82000002. The EL3 firmware supports multiple SCMI agents with different SMC IDs and shared memory regions. Each agent (Dom0 via0x82000002, Xen via0x82000003, other domains via additionalfunc_ids) has an independent communication channel to the firmware.The key distinction is that Xen's management channel (
0x82000003) is used for privileged operations like agent configuration and device permissions (BASE_SET_DEVICE_PERMISSIONS,BASE_RESET_AGENT_CONFIGURATION), while Dom0's channel (0x82000002) is used for standard SCMI protocol operations (power, clock, sensor management, etc.). The firmware enforces different permission levels for each agent based on theiragent_id, not the SMC ID.Therefore, there is no conflict: Linux Dom0 retains its standard SCMI connection for hardware management, while Xen uses its separate privileged channel for mediating access between multiple domains.
- It implements the SCI subsystem interface required for configuring and enabling SCMI functionality for Dom0/hwdom and Guest domains. To enable SCMI functionality for domain it has to be configured with unique supported SCMI
Agent_idand use corresponding SCMI SMC shared memory transport [smc-id, shmem] defined for this SCMIAgent_id.
- Once Xen domain is configured it can communicate with EL3 SCMI FW:
-- zero-copy, the guest domain puts SCMI message in shmem;
-- the guest triggers SMC exception with smc-id (doorbell); -- the Xen driver catches exception, do checks and synchronously forwards it to EL3 FW.
- the Xen driver sendsBASE_RESET_AGENT_CONFIGURATIONmessage to Xen management agent channel on domain destroy event. This allows to reset resources used by domain and so implement use-case like domain reboot.Dom0 Enable SCMI SMC:
- set xen,dom0-sci-agent-id=<agent_id> under the xen,sci container in the Host DT. If the property is absent, SCMI is disabled for Dom0 and all SCMI nodes are removed from the Dom0 DT. The driver updates the Dom0 DT SCMI node "arm,smc-id" value and fixes up the shmem node according to the assignedagent_id.- pass dom0=sci-agent-id=<agent_id> in Xen command line. if not provided SCMI will be disabled for Dom0 and all SCMI nodes removed from Dom0 DT. The driver updates Dom0 DT SCMI node "arm,smc-id" value and fix up shmem node according to assigned
agent_id.Guest domains enable SCMI SMC:
- xl.cfg: add configuration option as below
arm_sci= "type=scmi_smc_multiagent,agent_id=2"- xl.cfg: enable access to the "arm,scmi-shmem" which should correspond assigned
agent_idfor the domain, for example:iomem = [
"47ff2,1@22001",]
- DT: add SCMI nodes to the Driver domain partial device tree as in the below example. The "arm,smc-id" should correspond assigned
agent_idfor the domain:passthrough { scmi_shm_0: sram@22001000 { compatible = "arm,scmi-shmem"; reg = <0x0 0x22001000 0x0 0x1000>; }; firmware { compatible = "simple-bus"; scmi: scmi { compatible = "arm,scmi-smc"; arm,smc-id = <0x82000004>; shmem = <&scmi_shm_0>; ... } } }SCMI "4.2.1.1 Device specific access control"
The XEN SCI SCMI SMC multi-agent driver performs "access-controller" provider function in case EL3 SCMI FW implements SCMI "4.2.1.1 Device specific access control" and provides the
BASE_SET_DEVICE_PERMISSIONScommand to configure the devices that an agents have access to. The DT SCMI node should "#access-controller-cells=<1>" property and DT devices should be bound to the Xen SCMI.&i2c1 { access-controllers = <&scmi 0>; };The Dom0 and dom0less domains DT devices will be processed automatically through
sci_assign_dt_device()call, but to assign SCMI devices from toolstack the xl.cfg:"dtdev" property
shall be used:dtdev = [
"/soc/i2c@e6508000",]
xl.cfg:dtdev will contain all nodes which are under SCMI management (not only those which are behind IOMMU).
Additionally, this patch adds documentation for the pre-existing scmi-smc-passthrough command line option, which was previously undocumented.
Quoted 6 lines
[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.yamlSigned-off-by Grygorii Strashko <[email protected]>Signed-off-by Oleksii Moisieiev <[email protected]>
[...]
--
WBR, Volodymyr
PATCH v15 5/6 tools/xl/libxl: wire up SCMI SMC multi-agent configuration
In reply to Oleksii MoisieievPlumb the SCMI SMC multi-agent type through the toolstack:
- Extend libxl_arm_sci_type enumeration with scmi_smc_multiagent (value 2)
- Add agent_id field to libxl_arm_sci structure for per-domain agent assignment
- Update libxl_arm.c to translate libxl config to XEN_DOMCTL_CONFIG_ARM_SCI_SCMI_SMC_MA and pass agent_id to the hypervisor via xen_domctl_createdomain
- Add xl.cfg parsing for arm_sci="type=scmi_smc_multiagent,agent_id=N"
- Document the new xl.cfg options in xl.cfg.5.pod.in
This completes the userspace side of multi-agent SCMI, allowing xl create and dom0less configurations to assign unique agent_id values to domains.
Series-changes 12:
- reject agent_id in xl.cfg when the ARM_SCI type is not scmi_smc_multiagent, instead of parsing it and discarding it
- perform the check after the option loop, as type and agent_id may be given in either order
---
(no changes since v11)
Changes in v11:
- Fix agent_id documentation: clarify it applies to SCMI SMC multi-agent support only, not plain SCMI SMC (reviewer feedback)
- Remove "non-zero" from agent_id description to match accepted range [0..254]
- Remove "UINT8_MAX (255) is treated as invalid" from user documentation as unnecessary implementation detail
- Add LIBXL_HAVE_SCMI_SMC_MULTIAGENT feature macro in libxl.h to advertise the new scmi_smc_multiagent type and agent_id field
- Add agent_id validation in libxl__arch_domain_build_info_setdefault() to reject invalid values at the libxl level, not only in xl
Changes in v10:
- Split hypervisor and toolstack changes into separate commits
docs/man/xl.cfg.5.pod.in | 13 +++++++++++++ tools/include/libxl.h | 8 ++++++++ tools/libs/light/libxl_arm.c | 13 +++++++++++++ tools/libs/light/libxl_types.idl | 4 +++- tools/xl/xl_parse.c | 27 +++++++++++++++++++++++++++ 5 files changed, 64 insertions(+), 1 deletion(-)
docs/man/xl.cfg.5.pod.in +13 -0
@@ -3184,8 +3184,21 @@ single SCMI OSPM agent support. Should be used together with B<scmi-smc-passthrough> Xen command line option. +=item B<scmi_smc_multiagent> + +Enables ARM SCMI SMC multi-agent support for the guest by enabling SCMI over +SMC calls forwarding from domain to the EL3 firmware (like Trusted Firmware-A) +with a multi SCMI OSPM agent support. The SCMI B<agent_id> should be +specified for the guest. + =back +=item B<agent_id=NUMBER> + +Specifies an ARM SCI agent id for the guest. This option is mandatory +if the SCMI SMC multi-agent support is enabled for the guest. The agent ids of +domains existing on a single host must be unique and in the range [0..254]. + =back =back
tools/include/libxl.h +8 -0
@@ -326,6 +326,14 @@*/ #define LIBXL_HAVE_BUILDINFO_ARCH_ARM_SCI 1 +/* +* LIBXL_HAVE_SCMI_SMC_MULTIAGENT indicates that the +* LIBXL_ARM_SCI_TYPE_SCMI_SMC_MULTIAGENT value is available in the +* libxl_arm_sci_type enumeration and the agent_id field is available +* in the libxl_arm_sci structure. +*/ +#define LIBXL_HAVE_SCMI_SMC_MULTIAGENT 1 +/* * LIBXL_HAVE_SOFT_RESET indicates that libxl supports performing * 'soft reset' for domains and there is 'soft_reset' shutdown reason
tools/libs/light/libxl_arm.c +13 -0
@@ -237,6 +237,10 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc,case LIBXL_ARM_SCI_TYPE_SCMI_SMC : config->arch.arm_sci_type =XEN_DOMCTL_CONFIG_ARM_SCI_SCMI_SMC ;break ; +case LIBXL_ARM_SCI_TYPE_SCMI_SMC_MULTIAGENT : + config->arch.arm_sci_type =XEN_DOMCTL_CONFIG_ARM_SCI_SCMI_SMC_MA ; + config->arch.arm_sci_agent_id = d_config->b_info.arch_arm.arm_sci.agent_id; +break ;default :LOG (ERROR ,"Unknown ARM_SCI type %d" , d_config->b_info.arch_arm.arm_sci.type);
@@ -1897,6 +1901,15 @@ int libxl__arch_domain_build_info_setdefault(libxl__gc *gc, } } +/* Sanitise ARM SCI agent_id parameter */ +if (b_info->arch_arm.arm_sci.type ==LIBXL_ARM_SCI_TYPE_SCMI_SMC_MULTIAGENT && + b_info->arch_arm.arm_sci.agent_id >=UINT8_MAX ) { +LOG (ERROR , +"Invalid ARM SCI agent_id: %u. Valid range is [0..254]" , + b_info->arch_arm.arm_sci.agent_id); +return ERROR_FAIL ; + } +if (b_info->type !=LIBXL_DOMAIN_TYPE_PV )return 0 ;
tools/libs/light/libxl_types.idl +3 -1
@@ -555,11 +555,13 @@ libxl_sve_type = Enumeration("sve_type", [ libxl_arm_sci_type = Enumeration("arm_sci_type", [ (0, "none"), - (1, "scmi_smc") + (1, "scmi_smc"), + (2, "scmi_smc_multiagent") ], init_val = "LIBXL_ARM_SCI_TYPE_NONE") libxl_arm_sci = Struct("arm_sci", [ ("type", libxl_arm_sci_type), + ("agent_id", uint8) ]) libxl_rdm_reserve = Struct("rdm_reserve", [
tools/xl/xl_parse.c +27 -0
@@ -1290,6 +1290,7 @@ static int parse_arm_sci_config(XLU_Config *cfg, libxl_arm_sci *arm_sci, const char *str) {int ret =0 ; +int agent_id_set =0 ;char *buf2, *ptr;char *oparg;
@@ -1308,9 +1309,35 @@ static int parse_arm_sci_config(XLU_Config *cfg, libxl_arm_sci *arm_sci, } } +if (MATCH_OPTION ("agent_id" , ptr, oparg)) { +unsigned long val =parse_ulong (oparg); + +if ( val >=UINT8_MAX ) { +fprintf (stderr,"An invalid ARM_SCI agent_id specified (%lu). Valid range [0..254]\n" , + val); + ret =ERROR_INVAL ; + goto out; + } + arm_sci->agent_id = val; + agent_id_set =1 ; + } + ptr =strtok (NULL ,"," ); } +/* +* agent_id only means something to the multi-agent driver, and +* libxl__arch_domain_prepare_config() only reads it for that type. +* Reject it elsewhere instead of silently dropping it. The check is done +* after the loop because the options may be given in any order. +*/ +if (agent_id_set && + arm_sci->type !=LIBXL_ARM_SCI_TYPE_SCMI_SMC_MULTIAGENT ) { +fprintf (stderr, +"ARM_SCI agent_id is only supported with type=scmi_smc_multiagent\n" ); + ret =ERROR_INVAL ; + } + out:free (buf2);return ret;
Signature · 1 line
2.43.0
PATCH v15 6/6 docs: arm: add SCI SCMI SMC multi-agent driver docs
In reply to Oleksii MoisieievFrom: Grygorii Strashko <[email protected]>
Add SCI SCMI SMC multi-agent driver documentation.
It includes a detailed description of the SCMI multi-agent driver. This document explains the driver's functionality, configuration, and the compilation process. The Xen SCMI multi-agent driver is designed to provide SCMI access to system resources from different domains.
---
(no changes since v14)
Changes in v14:
- describe secondary agents as xen,scmi-agent nodes under agents
- update host, discovery and dom0less examples for the child-node format
- clarify shared-memory placement and platform RAM reservations
Changes in v10:
- rephrase section about /firmware/scmi. Mentioned that this node is taken from Host DT and copied unmodified.
- fix xen,reg address for secondary domains for Dom0less configuration
Changes in v8:
- update documentation to match the last DT format
- fixed RST: "... code-block:: dts" -> ".. code-block:: dts"
- update documentation with dom0less configuration example
- update documentation with new param xen,dom0-sci-agent-id instead of the command line parameter
Changes in v7:
- update documentation in section of the xen_scmi configuration which is matched by "xen,sci" compatible instead of the direct path.
Changes in v6:
- remove all HVC mentions from the multi-agent doc
- update sci-agent-id parameter description in the documentation
- add missing Sign-of
- minor fixes across the document
Changes in v5:
- rework multi-agent driver to leave Host Device-tree unmodified
.../arm/firmware/arm-scmi.rst | 405 ++++++++++++++++++ 1 file changed, 405 insertions(+)
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +405 -0
@@ -36,6 +36,8 @@ The below sections describe SCMI support options available for Xen. | [1] `Arm SCMI <https://developer.arm.com/documentation/den0056/latest/>`_ | [2] `System Control and Management Interface (SCMI) bindings <https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/firmware/arm,scmi.yaml>`_ +| [3] `Generic Domain Access Controllers bindings <https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/access-controllers/access-controllers.yaml>`_ + Simple SCMI over SMC calls forwarding driver (EL3) ------------------------------------------------------
@@ -189,3 +191,406 @@ except explicitly enabling SCMI with "arm_sci" xl.cfg option. -> xen,reg = <0x0 0x47ff0000 0x0 0x1000 0x0 0x22001000>; -> xen,force-assign-without-iommu; }; + +SCMI SMC multi-agent driver (EL3) +------------------------------------- + +The SCMI SMC multi-agent driver enables support for ARM EL3 Trusted Firmware-A (TF-A) which +provides SCMI interface with multi-agent support, as shown below. + +:: + + +-----------------------------------------+ + | | + | EL3 TF-A SCMI | + +-------+--+-------+--+-------+--+-------++ + |shmem1 | |shmem0 | |shmem2 | |shmemX | + +-----+-+ +---+---+ +--+----+ +---+---+ + smc-id1 | | | | + agent1 | | | | + +-----v--------+---------+-----------+----+ + | | | | | + | | | | | + +--------------+---------+-----------+----+ + smc-id0 | smc-id2| smc-idX| + agent0 | agent2 | agentX | + | | | + +----v---+ +--v-----+ +--v-----+ + | | | | | | + | Dom0 | | Dom1 | | DomX | + | | | | | | + | | | | | | + +--------+ +--------+ +--------+ + +The EL3 SCMI multi-agent firmware is expected to provide SCMI SMC shared-memory transport +for every Agent in the system. The SCMI Agent transport channel defined by pair: + +- smc-id: SMC function id used for Doorbell +- shmem: shared memory for messages transfer, **Xen page aligned**. + Shared memory is mapped with the following flags: MT_DEVICE_nGnRE and _PAGE_DEVICE, indicating that this + memory is mapped as device memory. + +The following SCMI Agents are expected to be defined by SCMI FW to enable SCMI multi-agent functionality +under Xen: + +- Xen management agent: trusted agents that accesses to the Base Protocol commands to configure + agent specific permissions +- OSPM VM agents: non-trusted agent, one for each Guest domain which is allowed direct HW access. + At least one OSPM VM agent has to be provided by FW if HW is handled only by Dom0 or Driver Domain. + +The EL3 SCMI FW is expected to implement following Base protocol messages: + +- BASE_DISCOVER_AGENT (required for Xen; required for secondary agents without ``reg``) +- BASE_RESET_AGENT_CONFIGURATION (optional) +- BASE_SET_DEVICE_PERMISSIONS (optional) + +The number of supported SCMI agents and their transport specifications are SCMI FW implementation +specific. + +Compiling with multi-agent support +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +To build with the SCMI SMC multi-agent driver support, enable Kconfig option: + +:: + + CONFIG_SCMI_SMC_MA + + +Driver functionality +^^^^^^^^^^^^^^^^^^^^ + +The SCI SCMI SMC multi-agent driver implements following functionality: + +- The driver is initialized from the Xen SCMI container ``xen_scmi_config`` + under ``/chosen/xen`` (for example ``/chosen/xen/xen_scmi_config/scmi``). + Only one SCMI interface is supported. The SCMI configuration must live under + the Xen SCMI container ``xen,sci`` beneath ``/chosen``. + The Xen SCMI mediator will bind only to the "arm,scmi-smc" node that is a child of + this "xen,sci" container; any other "arm,scmi-smc" nodes (for example under + "/firmware") are ignored to avoid stealing the host's SCMI OSPM instance. + +.. code-block:: dts + + scmi_shm_1: sram@47ff1000 { + compatible = "arm,scmi-shmem"; + reg = <0x0 0x47ff1000 0x0 0x1000>; + }; + scmi_xen: scmi { + compatible = "arm,scmi-smc"; + arm,smc-id = <0x82000003>; /* Xen management agent */ + #address-cells = < 1>; + #size-cells = < 0>; + #access-controller-cells = < 1>; + shmem = <&scmi_shm_1>; /* Xen management shared memory */ + }; + +.. note:: + This layout keeps the Host DT unchanged for Dom0 and baremetal Linux by + using func_id 0x82000002 / shmem 0x47ff0000 for Dom0, while Xen uses a + separate privileged channel func_id 0x82000003 / shmem 0x47ff1000. EL3 + firmware enforces permissions per agent_id, so there is no conflict between + Dom0 and Xen channels. + +- The driver reads secondary agents from an ``agents`` child of the + ``xen,sci`` container. This child has ``#address-cells = <1>`` and + ``#size-cells = <0>``. Each enabled ``xen,scmi-agent`` child specifies its + doorbell in ``arm,smc-id`` and a single shared-memory phandle in ``shmem``. + The optional single-cell ``reg`` property supplies the SCMI agent ID + (0..254). IDs must be unique and distinct from Xen's management agent. + At least one enabled secondary agent is required. + + The shared-memory nodes remain under ``xen_scmi_config``; the host OSPM + shared-memory node and ``/firmware/scmi`` remain in the platform DT. + A shared-memory node describes a channel location and does not reserve RAM. + If buffers occupy system RAM, the platform must reserve the entire + firmware-owned range in ``/reserved-memory`` before Xen boots. A single + reservation may cover multiple channels, including unused ones. SRAM + outside system RAM does not require a RAM reservation. The channel nodes + do not have to be moved into ``/reserved-memory``. + +.. code-block:: dts + + / { + #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-id = <0>; + + /* 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>; + + agent@0 { + compatible = "xen,scmi-agent"; + reg = <0>; + arm,smc-id = <0x82000002>; + shmem = <&scmi_shm_0>; + }; + + agent@2 { + compatible = "xen,scmi-agent"; + reg = <2>; + arm,smc-id = <0x82000004>; + shmem = <&scmi_shm_2>; + }; + + agent@3 { + compatible = "xen,scmi-agent"; + reg = <3>; + arm,smc-id = <0x82000005>; + shmem = <&scmi_shm_3>; + }; + }; + }; + }; + }; + }; + +The ``xen,sci`` subtree is omitted from Dom0's DT. The host OSPM channel is +copied to Dom0 when SCMI is enabled for it. Xen uses its separate privileged +management channel to configure the other agents. + +To discover a secondary agent ID through ``BASE_DISCOVER_AGENT``, omit +``reg`` and use a node name without a unit address. For example, replace +only ``agent@2`` above with: + +.. code-block:: dts + + agent-domu { + compatible = "xen,scmi-agent"; + arm,smc-id = <0x82000004>; + shmem = <&scmi_shm_2>; + }; + +Providing ``reg`` skips mapping and probing that secondary channel during +initialization. A malformed ``reg`` is rejected. Xen always discovers its +own management agent ID. Thus ``BASE_DISCOVER_AGENT`` is mandatory for the +management channel and for secondary channels whose ``reg`` is omitted. +The former flat secondary-agent properties are replaced by these nodes. + +.. note:: + + Note that Xen is the only one entry in the system which need to know about SCMI multi-agent support. + +- The driver implements the SCI subsystem interface required for configuring and enabling SCMI + functionality for Dom0/hwdom and Guest domains. To enable SCMI functionality for guest domain + it has to be configured with unique supported SCMI Agent_id and use corresponding SCMI SMC + shared-memory transport ``[smc-id, shmem]`` defined for this SCMI Agent_id. + +- Once Xen domain is configured it can communicate with EL3 SCMI FW: + + - zero-copy, the guest domain puts/gets SCMI message in/from shmem; + - the guest triggers SMC exception with agent "smc-id" (doorbell); + - the Xen driver catches exception, do checks and synchronously forwards it to EL3 FW. + +- the Xen driver sends BASE_RESET_AGENT_CONFIGURATION message to Xen management agent channel on + domain destroy event. This allows to reset resources used by domain and so implement use-case + like domain reboot. + + +Configure SCMI for Dom0 +^^^^^^^^^^^^^^^^^^^^^^^ +Set the Dom0 SCMI agent ID in the device tree using the Xen SCMI container under ``/chosen``. +Add ``xen,dom0-sci-agent-id`` to the ``xen,sci`` node. If the property is absent, SCMI stays +disabled for Dom0 and the SCMI nodes are removed from Dom0 DT. + +.. code-block:: dts + + chosen { + xen { + ranges; + xen_scmi_config { + compatible = "xen,sci"; + xen,dom0-sci-agent-id = <0>; /* Dom0 agent ID */ + /* agents, shared memory and scmi_xen as shown above */ + }; + }; + }; + +The Host DT ``/firmware/scmi`` node is copied to the Dom0 DT unmodified. However, for Dom0 SCMI +configuration, Xen relies on the ``agents`` child and the ``xen,dom0-sci-agent-id`` +property from the ``xen,sci`` container under ``/chosen``. If the ``/firmware/scmi`` node is +missing or disabled, or if ``xen,dom0-sci-agent-id`` is not provided, the Dom0 SCMI agent will not +be configured. + +.. note:: + + The ``xen,dom0-sci-agent-id`` value must match the ``func_id`` and ``shmem`` pairing provided by + the EL3 firmware for Dom0 (for example in the ``/firmware/scmi`` node). + +Configure SCMI for for guest domain with toolstack +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +* In domain's xl.cfg file add **"arm_sci"** option as below + +:: + + arm_sci = "type=scmi_smc_multiagent,agent_id=2" + +* In domain's xl.cfg file enable access to the "arm,scmi-shmem" which should correspond + assigned "agent_id" for the domain, for example: + +:: + + iomem = [ + "47ff2,1@22001", + ] + +.. note:: It's up to the user to select guest IPA for mapping SCMI shared-memory. + +* Add SCMI nodes to the Driver domain partial device tree as in the below example. + The "arm,smc-id" should correspond assigned agent_id for the domain: + +.. code:: + + passthrough { + scmi_shm_0: sram@22001000 { + compatible = "arm,scmi-shmem"; + reg = <0x0 0x22001000 0x0 0x1000>; + }; + + firmware { + compatible = "simple-bus"; + scmi: scmi { + compatible = "arm,scmi-smc"; + arm,smc-id = <0x82000004>; <--- smc-id for agent_id=2 + shmem = <&scmi_shm_0>; + ... + } + } + } + +**Device specific access control** + +The XEN SCMI SMC multi-agent driver performs "access-controller" provider function in case +EL3 SCMI FW implements SCMI "4.2.1.1 Device specific access control" and provides the +BASE_SET_DEVICE_PERMISSIONS command to configure the devices that an agents have access to. +The Host DT SCMI node should have "#access-controller-cells=<1>" property and DT devices should +be bound to the SCMI node using Access Controllers bindings [3]. + +For example: + +.. code-block:: dts + + &i2c1 { + access-controllers = <&scmi 0>; + }; + +Use domain's xl.cfg file **"dtdev"** property to assign SCMI devices from toolstack to the guest: + +:: + + dtdev = [ + "/soc/i2c@e6508000", + ] + +.. note:: + + xl.cfg:"dtdev" need contain all nodes which are under SCMI management (not only those which are + behind IOMMU) and passed-through to the guest domain. + +Configure SCMI for predefined domains (dom0less) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +* add "xen,sci_type" and "xen,sci-agent-id" properties for required DomU ("xen,domain") node + +:: + + xen,sci_type="scmi_smc_multiagent" + xen,sci-agent-id=2 + +* add scmi nodes to the Driver domain partial device tree the same way as above (toolstack case) and + enable access to the "arm,scmi-shmem" according to the dom0less documentation. For example: + +.. code-block:: dts + + scmi_shm_0: sram@22001000 { + compatible = "arm,scmi-shmem"; + reg = <0x00 0x22001000 0x00 0x1000>; + -> xen,reg = <0x0 0x47ff2000 0x0 0x1000 0x0 0x22001000>; + -> xen,force-assign-without-iommu; + }; + +* For SCMI device access control configure pass-through devices in the guest partial DT according to + the dom0less documentation and ensure that devices SCMI management has "xen,path" property set: + +Use the complete Xen SCMI configuration above. Remove +``xen,dom0-sci-agent-id`` if Dom0 does not use SCMI. The guest selects the +secondary channel described by ``agent@2``: + +.. code-block:: dts + + chosen { + xen,domain@1 { + compatible = "xen,domain"; + xen,sci_type = "scmi_smc_multiagent"; + xen,sci-agent-id = <2>; + /* other domain properties here */ + }; + }; + +.. code-block:: dts + + i2c@e6508000 { + ... + reg = <0x00 0xe6508000 0x00 0x1000>; + -> xen,path = "/soc/i2c@e6508000" + -> xen,reg = <0x0 0xe6508000 0x0 0x1000 0x0 0xe6508000>; + -> xen,force-assign-without-iommu; + };
Signature · 1 line
2.43.0
Re: [PATCH v15 6/6] docs: arm: add SCI SCMI SMC multi-agent driver docs
Hi,
I'm sorry, I postponed documentation review till we finished with code part. This was my mistake. I didn't expected that it require serious proofreading. Anyway, I tried to highlight most glaring mistakes, but it would be great if you proofread it by yourself once again.
Quoted 76 lines · Oleksii Moisieiev
From: Grygorii Strashko <[email protected]>
Add SCI SCMI SMC multi-agent driver documentation.
It includes a detailed description of the SCMI multi-agent driver. This document explains the driver's functionality, configuration, and the compilation process. The Xen SCMI multi-agent driver is designed to provide SCMI access to system resources from different domains.Signed-off-by Grygorii Strashko <[email protected]>Signed-off-by Oleksii Moisieiev <[email protected]>---
(no changes since v14)
Changes in v14:
- describe secondary agents as xen,scmi-agent nodes under agents
- update host, discovery and dom0less examples for the child-node format
- clarify shared-memory placement and platform RAM reservationsChanges in v10:
- rephrase section about /firmware/scmi. Mentioned that this node is taken from Host DT and copied unmodified.
- fix xen,reg address for secondary domains for Dom0less configurationChanges in v8:
- update documentation to match the last DT format
- fixed RST: "... code-block:: dts" -> ".. code-block:: dts"
- update documentation with dom0less configuration example
- update documentation with new param xen,dom0-sci-agent-id instead of the command line parameterChanges in v7:
- update documentation in section of thexen_scmiconfiguration which is matched by "xen,sci" compatible instead of the direct path.Changes in v6:
- remove all HVC mentions from the multi-agent doc
- update sci-agent-id parameter description in the documentation
- add missing Sign-of
- minor fixes across the documentChanges in v5:
- rework multi-agent driver to leave Host Device-tree unmodified.../arm/firmware/arm-scmi.rst | 405 ++++++++++++++++++ 1 file changed, 405 insertions(+)docs/hypervisor-guide/arm/firmware/arm-scmi.rst +2
-0@@ -36,6 +36,8 @@ The below sections describe SCMI support options available for Xen. | [1] `Arm SCMI | <https://developer.arm.com/documentation/den0056/latest/>`_ | [2] `System Control and Management Interface (SCMI) bindings | <https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/firmware/arm,scmi.yaml>`_ +| [3] `Generic Domain Access Controllers bindings <https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/access-controllers/access-controllers.yaml>`_ +Simple SCMI over SMC calls forwarding driver (EL3)
------------------------------------------------------docs/hypervisor-guide/arm/firmware/arm-scmi.rst +9
-0@@ -189,3 +191,406 @@ except explicitly enabling SCMI with "arm_sci" xl.cfg option. -> xen,reg = <0x0 0x47ff0000 0x0 0x1000 0x0 0x22001000>; -> xen,force-assign-without-iommu; }; + +SCMI SMC multi-agent driver (EL3) +------------------------------------- + +The SCMI SMC multi-agent driver enables support for ARM EL3 Trusted Firmware-A (TF-A) which +provides SCMI interface with multi-agent support, as shown below. + +:: +
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 212
Quoted 10 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +10
-0+ +-----------------------------------------+ + | | + | EL3 TF-A SCMI | + +-------+--+-------+--+-------+--+-------++ + |shmem1 | |shmem0 | |shmem2 | |shmemX | + +-----+-+ +---+---+ +--+----+ +---+---+ + smc-id1 | | | | + agent1 | | | | + +-----v--------+---------+-----------+----+ + | | | | |
Xen, I believe?
Quoted 8 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +8
-0+ | | | | | + +--------------+---------+-----------+----+ + smc-id0 | smc-id2| smc-idX| + agent0 | agent2 | agentX | + | | | + +----v---+ +--v-----+ +--v-----+ + | | | | | | + | Dom0 | | Dom1 | | DomX |
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 230
Quoted 10 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +10
-0+ | | | | | | + | | | | | | + +--------+ +--------+ +--------+ + +The EL3 SCMI multi-agent firmware is expected to provide SCMI SMC shared-memory transport +for every Agent in the system. The SCMI Agent transport channel defined by pair: + +- smc-id: SMC function id used for Doorbell +- shmem: shared memory for messages transfer, **Xen page aligned**. + Shared memory is mapped with the following flags: MT_DEVICE_nGnRE and _PAGE_DEVICE, indicating that this
Do we have any line length limitation for .rst files? This one is 114 characters long.
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 236
Quoted 6 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +6
-0+ memory is mapped as device memory. + +The following SCMI Agents are expected to be defined by SCMI FW to enable SCMI multi-agent functionality +under Xen: + +- Xen management agent: trusted agents that accesses to the Base Protocol commands to configure
"trusted agent", not "agents"
also, "that accesses the Base Protocol commands to configure..." or "that has access to the Base Protocol commands to configure..."
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 237
Quoted 1 line
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +1
-0+ agent specific permissions
"agent-specific"
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 238
Quoted 1 line
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +1
-0+- OSPM VM agents: non-trusted agent, one for each Guest domain which is allowed direct HW access.
"non-trusted agents". Also, double space between "is" and "allowed"
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 239
Quoted 1 line
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +1
-0+ At least one OSPM VM agent has to be provided by FW if HW is handled only by Dom0 or Driver Domain.
"Hardware Domain", probably
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 244
Quoted 5 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +5
-0+ +The EL3 SCMI FW is expected to implement following Base protocol messages: + +- BASE_DISCOVER_AGENT (required for Xen; required for secondary agents without ``reg``) +- BASE_RESET_AGENT_CONFIGURATION (optional)
How Xen can guarantee that SCMI state is sane, if it can't reset agent during domain destruction?
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 245
Quoted 1 line
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +1
-0+- BASE_SET_DEVICE_PERMISSIONS (optional)
If this is optional, does it mean that each agent will have access to all devices in the system?
Quoted 10 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +10
-0+ +The number of supported SCMI agents and their transport specifications are SCMI FW implementation +specific. + +Compiling with multi-agent support +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +To build with the SCMI SMC multi-agent driver support, enable Kconfig option: + +::
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 265
Quoted 10 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +10
-0+ + CONFIG_SCMI_SMC_MA + + +Driver functionality +^^^^^^^^^^^^^^^^^^^^ + +The SCI SCMI SMC multi-agent driver implements following functionality: + +- The driver is initialized from the Xen SCMI container ``xen_scmi_config``
Why "container"? It is called "node" in Device Tree lingo.
Quoted 20 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +20
-0+ under ``/chosen/xen`` (for example ``/chosen/xen/xen_scmi_config/scmi``). + Only one SCMI interface is supported. The SCMI configuration must live under + the Xen SCMI container ``xen,sci`` beneath ``/chosen``. + The Xen SCMI mediator will bind only to the "arm,scmi-smc" node that is a child of + this "xen,sci" container; any other "arm,scmi-smc" nodes (for example under + "/firmware") are ignored to avoid stealing the host's SCMI OSPM instance. + +.. code-block:: dts + + scmi_shm_1: sram@47ff1000 { + compatible = "arm,scmi-shmem"; + reg = <0x0 0x47ff1000 0x0 0x1000>; + }; + scmi_xen: scmi { + compatible = "arm,scmi-smc"; + arm,smc-id = <0x82000003>; /* Xen management agent */ + #address-cells = < 1>; + #size-cells = < 0>; + #access-controller-cells = < 1>; + shmem = <&scmi_shm_1>; /* Xen management shared memory */
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 295
Quoted 10 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +10
-0+ }; + +.. note:: + This layout keeps the Host DT unchanged for Dom0 and baremetal Linux by + using func_id 0x82000002 / shmem 0x47ff0000 for Dom0, while Xen uses a + separate privileged channel func_id 0x82000003 / shmem 0x47ff1000. EL3 + firmware enforces permissions per agent_id, so there is no conflict between + Dom0 and Xen channels. + +- The driver reads secondary agents from an ``agents`` child of the
"child node"
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 303
Quoted 8 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +8
-0+ ``xen,sci`` container. This child has ``#address-cells = <1>`` and + ``#size-cells = <0>``. Each enabled ``xen,scmi-agent`` child specifies its + doorbell in ``arm,smc-id`` and a single shared-memory phandle in ``shmem``. + The optional single-cell ``reg`` property supplies the SCMI agent ID + (0..254). IDs must be unique and distinct from Xen's management agent. + At least one enabled secondary agent is required. + + The shared-memory nodes remain under ``xen_scmi_config``; the host OSPM
I don't think that "remain" is a correct word here. Maybe "stay?". Or reword it altogether: "The SCMI-specific ``shared-memory`` nodes should be placed in ``xen_scmi_config`` node"
Quoted 119 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +119
-0+ shared-memory node and ``/firmware/scmi`` remain in the platform DT. + A shared-memory node describes a channel location and does not reserve RAM. + If buffers occupy system RAM, the platform must reserve the entire + firmware-owned range in ``/reserved-memory`` before Xen boots. A single + reservation may cover multiple channels, including unused ones. SRAM + outside system RAM does not require a RAM reservation. The channel nodes + do not have to be moved into ``/reserved-memory``. + +.. code-block:: dts + + / { + #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-id = <0>; + + /* 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>; + + agent@0 { + compatible = "xen,scmi-agent"; + reg = <0>; + arm,smc-id = <0x82000002>; + shmem = <&scmi_shm_0>; + }; + + agent@2 { + compatible = "xen,scmi-agent"; + reg = <2>; + arm,smc-id = <0x82000004>; + shmem = <&scmi_shm_2>; + }; + + agent@3 { + compatible = "xen,scmi-agent"; + reg = <3>; + arm,smc-id = <0x82000005>; + shmem = <&scmi_shm_3>; + }; + }; + }; + }; + }; + }; + +The ``xen,sci`` subtree is omitted from Dom0's DT. The host OSPM channel is +copied to Dom0 when SCMI is enabled for it. Xen uses its separate privileged +management channel to configure the other agents. + +To discover a secondary agent ID through ``BASE_DISCOVER_AGENT``, omit +``reg`` and use a node name without a unit address. For example, replace +only ``agent@2`` above with: + +.. code-block:: dts + + agent-domu { + compatible = "xen,scmi-agent"; + arm,smc-id = <0x82000004>; + shmem = <&scmi_shm_2>; + }; + +Providing ``reg`` skips mapping and probing that secondary channel during +initialization. A malformed ``reg`` is rejected. Xen always discovers its
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 432
Quoted 10 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +10
-0+own management agent ID. Thus ``BASE_DISCOVER_AGENT`` is mandatory for the +management channel and for secondary channels whose ``reg`` is omitted. +The former flat secondary-agent properties are replaced by these nodes. + +.. note:: + + Note that Xen is the only one entry in the system which need to know about SCMI multi-agent support. + +- The driver implements the SCI subsystem interface required for configuring and enabling SCMI + functionality for Dom0/hwdom and Guest domains. To enable SCMI functionality for guest domain
"for a guest domain"
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 433
Quoted 1 line
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +1
-0+ it has to be configured with unique supported SCMI Agent_id and use corresponding SCMI SMC
sometimes you write "agent_id" and sometimes "Agent_id"...
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 438
Quoted 5 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +5
-0+ shared-memory transport ``[smc-id, shmem]`` defined for this SCMI Agent_id. + +- Once Xen domain is configured it can communicate with EL3 SCMI FW: + + - zero-copy, the guest domain puts/gets SCMI message in/from shmem;
"to/from shmem". Also, "zero-copy: ", maybe?
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 440
Quoted 2 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +2
-0+ - the guest triggers SMC exception with agent "smc-id" (doorbell); + - the Xen driver catches exception, do checks and synchronously forwards it to EL3 FW.
not "do checks". "Perform checks", maybe?
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 443
Quoted 3 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +3
-0+ +- the Xen driver sends BASE_RESET_AGENT_CONFIGURATION message to Xen management agent channel on + domain destroy event. This allows to reset resources used by domain and so implement use-case
s/so//
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 447
Quoted 4 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +4
-0+ like domain reboot. + + +Configure SCMI for Dom0
"How to configure..." or "Configuring..."
Quoted 10 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +10
-0+^^^^^^^^^^^^^^^^^^^^^^^ +Set the Dom0 SCMI agent ID in the device tree using the Xen SCMI container under ``/chosen``. +Add ``xen,dom0-sci-agent-id`` to the ``xen,sci`` node. If the property is absent, SCMI stays +disabled for Dom0 and the SCMI nodes are removed from Dom0 DT. + +.. code-block:: dts + + chosen { + xen { + ranges;
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 467
Quoted 10 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +10
-0+ xen_scmi_config { + compatible = "xen,sci"; + xen,dom0-sci-agent-id = <0>; /* Dom0 agent ID */ + /* agents, shared memory and scmi_xen as shown above */ + }; + }; + }; + +The Host DT ``/firmware/scmi`` node is copied to the Dom0 DT unmodified. However, for Dom0 SCMI +configuration, Xen relies on the ``agents`` child and the ``xen,dom0-sci-agent-id``
"child node"
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 475
Quoted 9 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +8
-0+property from the ``xen,sci`` container under ``/chosen``. If the ``/firmware/scmi`` node is +missing or disabled, or if ``xen,dom0-sci-agent-id`` is not provided, the Dom0 SCMI agent will not +be configured. + +.. note:: + + The ``xen,dom0-sci-agent-id`` value must match the ``func_id`` and ``shmem`` pairing provided by + the EL3 firmware for Dom0 (for example in the ``/firmware/scmi`` node).
Well, maybe better to use phandle then? Like
xen,dom0-sci-agent-id=<&agent@0>
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 477
Quoted 2 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +2
-0+ +Configure SCMI for for guest domain with toolstack
"How to configure..." or "Configuring..."
Quoted 58 lines
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +57
-0+ +* In domain's xl.cfg file add **"arm_sci"** option as below + +:: + + arm_sci = "type=scmi_smc_multiagent,agent_id=2" + +* In domain's xl.cfg file enable access to the "arm,scmi-shmem" which should correspond + assigned "agent_id" for the domain, for example: + +:: + + iomem = [ + "47ff2,1@22001", + ] + +.. note:: It's up to the user to select guest IPA for mapping SCMI shared-memory. + +* Add SCMI nodes to the Driver domain partial device tree as in the below example. + The "arm,smc-id" should correspond assigned agent_id for the domain: + +.. code:: + + passthrough { + scmi_shm_0: sram@22001000 { + compatible = "arm,scmi-shmem"; + reg = <0x0 0x22001000 0x0 0x1000>; + }; + + firmware { + compatible = "simple-bus"; + scmi: scmi { + compatible = "arm,scmi-smc"; + arm,smc-id = <0x82000004>; <--- smc-id for agent_id=2 + shmem = <&scmi_shm_0>; + ... + } + } + } + +**Device specific access control** + +The XEN SCMI SMC multi-agent driver performs "access-controller" provider function in case +EL3 SCMI FW implements SCMI "4.2.1.1 Device specific access control" and provides the +BASE_SET_DEVICE_PERMISSIONS command to configure the devices that an agents have access to. +The Host DT SCMI node should have "#access-controller-cells=<1>" property and DT devices should +be bound to the SCMI node using Access Controllers bindings [3]. + +For example: + +.. code-block:: dts + + &i2c1 { + access-controllers = <&scmi 0>; + }; + +Use domain's xl.cfg file **"dtdev"** property to assign SCMI devices from toolstack to the guest:
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 545
Quoted 10 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +10
-0+ +:: + + dtdev = [ + "/soc/i2c@e6508000", + ] + +.. note:: + + xl.cfg:"dtdev" need contain all nodes which are under SCMI management (not only those which are
"need to contain"
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 548
Quoted 3 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +3
-0+ behind IOMMU) and passed-through to the guest domain. + +Configure SCMI for predefined domains (dom0less)
(the same as for previous section header)
Quoted 38 lines
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +37
-0+ +* add "xen,sci_type" and "xen,sci-agent-id" properties for required DomU ("xen,domain") node + +:: + + xen,sci_type="scmi_smc_multiagent" + xen,sci-agent-id=2 + +* add scmi nodes to the Driver domain partial device tree the same way as above (toolstack case) and + enable access to the "arm,scmi-shmem" according to the dom0less documentation. For example: + +.. code-block:: dts + + scmi_shm_0: sram@22001000 { + compatible = "arm,scmi-shmem"; + reg = <0x00 0x22001000 0x00 0x1000>; + -> xen,reg = <0x0 0x47ff2000 0x0 0x1000 0x0 0x22001000>; + -> xen,force-assign-without-iommu; + }; + +* For SCMI device access control configure pass-through devices in the guest partial DT according to + the dom0less documentation and ensure that devices SCMI management has "xen,path" property set: + +Use the complete Xen SCMI configuration above. Remove +``xen,dom0-sci-agent-id`` if Dom0 does not use SCMI. The guest selects the +secondary channel described by ``agent@2``: + +.. code-block:: dts + + chosen { + xen,domain@1 { + compatible = "xen,domain"; + xen,sci_type = "scmi_smc_multiagent"; + xen,sci-agent-id = <2>; + /* other domain properties here */ + }; + };
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 596
Quoted 10 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +10
-0+ +.. code-block:: dts + + i2c@e6508000 { + ... + reg = <0x00 0xe6508000 0x00 0x1000>; + -> xen,path = "/soc/i2c@e6508000" + -> xen,reg = <0x0 0xe6508000 0x0 0x1000 0x0 0xe6508000>; + -> xen,force-assign-without-iommu; + };
--
WBR, Volodymyr
Re: [PATCH v15 6/6] docs: arm: add SCI SCMI SMC multi-agent driver docs
Hi Volodymyr,
Thank you for the review. please see below:
Quoted 89 lines · Volodymyr Babchuk
Hi,
I'm sorry, I postponed documentation review till we finished with code part. This was my mistake. I didn't expected that it require serious proofreading. Anyway, I tried to highlight most glaring mistakes, but it would be great if you proofread it by yourself once again.
Quoted 79 lines · Oleksii Moisieiev
From: Grygorii Strashko <[email protected]>
Add SCI SCMI SMC multi-agent driver documentation.
It includes a detailed description of the SCMI multi-agent driver. This document explains the driver's functionality, configuration, and the compilation process. The Xen SCMI multi-agent driver is designed to provide SCMI access to system resources from different domains.Signed-off-by Grygorii Strashko <[email protected]>Signed-off-by Oleksii Moisieiev <[email protected]>---
(no changes since v14)
Changes in v14:
- describe secondary agents as xen,scmi-agent nodes under agents
- update host, discovery and dom0less examples for the child-node format
- clarify shared-memory placement and platform RAM reservationsChanges in v10:
- rephrase section about /firmware/scmi. Mentioned that this node is taken from Host DT and copied unmodified.
- fix xen,reg address for secondary domains for Dom0less configurationChanges in v8:
- update documentation to match the last DT format
- fixed RST: "... code-block:: dts" -> ".. code-block:: dts"
- update documentation with dom0less configuration example
- update documentation with new param xen,dom0-sci-agent-id instead of the command line parameterChanges in v7:
- update documentation in section of thexen_scmiconfiguration which is matched by "xen,sci" compatible instead of the direct path.Changes in v6:
- remove all HVC mentions from the multi-agent doc
- update sci-agent-id parameter description in the documentation
- add missing Sign-of
- minor fixes across the documentChanges in v5:
- rework multi-agent driver to leave Host Device-tree unmodified.../arm/firmware/arm-scmi.rst | 405 ++++++++++++++++++ 1 file changed, 405 insertions(+)docs/hypervisor-guide/arm/firmware/arm-scmi.rst +2
-0@@ -36,6 +36,8 @@ The below sections describe SCMI support options available for Xen. | [1] `Arm SCMI | <https://developer.arm.com/documentation/den0056/latest/>`_ | [2] `System Control and Management Interface (SCMI) bindings | <https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/firmware/arm,scmi.yaml>`_ +| [3] `Generic Domain Access Controllers bindings <https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/access-controllers/access-controllers.yaml>`_ +Simple SCMI over SMC calls forwarding driver (EL3)
------------------------------------------------------docs/hypervisor-guide/arm/firmware/arm-scmi.rst +12
-0@@ -189,3 +191,406 @@ except explicitly enabling SCMI with "arm_sci" xl.cfg option. -> xen,reg = <0x0 0x47ff0000 0x0 0x1000 0x0 0x22001000>; -> xen,force-assign-without-iommu; }; + +SCMI SMC multi-agent driver (EL3) +------------------------------------- + +The SCMI SMC multi-agent driver enables support for ARM EL3 Trusted Firmware-A (TF-A) which +provides SCMI interface with multi-agent support, as shown below. + +:: + + +-----------------------------------------+ + | | + | EL3 TF-A SCMI |
Quoted 8 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 212
Quoted 7 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +7
-0+ +-------+--+-------+--+-------+--+-------++ + |shmem1 | |shmem0 | |shmem2 | |shmemX | + +-----+-+ +---+---+ +--+----+ +---+---+ + smc-id1 | | | | + agent1 | | | | + +-----v--------+---------+-----------+----+ + | | | | |Xen, I believe?
It is. But in terms of SCMI this is privileged agent. Haven't mentioned Xen here for the sake of
diagram simplicity (just don't see a good place whre I can place "Xen" in this diagram. The main idea is
that driver leaves scmi privileged agent for itself (agent1 in our case) regardless where this driver runs.
This format was taken since driver itself is avare about the domains and channels.
Quoted 12 lines
Quoted 12 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +12
-0+ | | | | | + +--------------+---------+-----------+----+ + smc-id0 | smc-id2| smc-idX| + agent0 | agent2 | agentX | + | | | + +----v---+ +--v-----+ +--v-----+ + | | | | | | + | Dom0 | | Dom1 | | DomX | + | | | | | | + | | | | | | + +--------+ +--------+ +--------+ +
Quoted 8 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 230
Quoted 6 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +6
-0+The EL3 SCMI multi-agent firmware is expected to provide SCMI SMC shared-memory transport +for every Agent in the system. The SCMI Agent transport channel defined by pair: + +- smc-id: SMC function id used for Doorbell +- shmem: shared memory for messages transfer, **Xen page aligned**. + Shared memory is mapped with the following flags: MT_DEVICE_nGnRE and _PAGE_DEVICE, indicating that thisDo we have any line length limitation for .rst files? This one is 114 characters long.
rstcheck gives 0 errors, but I can reformat it with maxline 120.
Quoted 20 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 236
Quoted 6 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +6
-0+ memory is mapped as device memory. + +The following SCMI Agents are expected to be defined by SCMI FW to enable SCMI multi-agent functionality +under Xen: + +- Xen management agent: trusted agents that accesses to the Base Protocol commands to configure"trusted agent", not "agents"
also, "that accesses the Base Protocol commands to configure..." or "that has access to the Base Protocol commands to configure..."
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 237
Quoted 1 line
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +1
-0+ agent specific permissions"agent-specific"
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 238
Quoted 1 line
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +1
-0+- OSPM VM agents: non-trusted agent, one for each Guest domain which is allowed direct HW access."non-trusted agents". Also, double space between "is" and "allowed"
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 239
Quoted 1 line
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +1
-0+ At least one OSPM VM agent has to be provided by FW if HW is handled only by Dom0 or Driver Domain."Hardware Domain", probably
Quoted 7 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 244
Quoted 5 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +5
-0+ +The EL3 SCMI FW is expected to implement following Base protocol messages: + +- BASE_DISCOVER_AGENT (required for Xen; required for secondary agents without ``reg``) +- BASE_RESET_AGENT_CONFIGURATION (optional)How Xen can guarantee that SCMI state is sane, if it can't reset agent during domain destruction?
If this command is not implemented by the SCP firmware, but the firmware provides agent_num > 1, then it is the responsibility of the SCP firmware. We made this optional to cover exactly this case — where we don't have RESET_AGENT_CONFIGURATION but still have agent_num > 1, which could be applicable to a dom0less configuration (for example) and should be used carefully by developers.
Quoted 4 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 245
Quoted 2 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +1
-0+- BASE_SET_DEVICE_PERMISSIONS (optional)If this is optional, does it mean that each agent will have access to all devices in the system?
Probably. But that doesn't mean it's the only case. For example, a resource could be acquired on first access (not a real-world case, but it's possible). So we can't make this decision on behalf of the SCP firmware.
Quoted 62 lines
Quoted 10 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +10
-0+ +The number of supported SCMI agents and their transport specifications are SCMI FW implementation +specific. + +Compiling with multi-agent support +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +To build with the SCMI SMC multi-agent driver support, enable Kconfig option: + +::docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 265
Quoted 10 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +10
-0+ + CONFIG_SCMI_SMC_MA + + +Driver functionality +^^^^^^^^^^^^^^^^^^^^ + +The SCI SCMI SMC multi-agent driver implements following functionality: + +- The driver is initialized from the Xen SCMI container ``xen_scmi_config``Why "container"? It is called "node" in Device Tree lingo.
Quoted 20 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +20
-0+ under ``/chosen/xen`` (for example ``/chosen/xen/xen_scmi_config/scmi``). + Only one SCMI interface is supported. The SCMI configuration must live under + the Xen SCMI container ``xen,sci`` beneath ``/chosen``. + The Xen SCMI mediator will bind only to the "arm,scmi-smc" node that is a child of + this "xen,sci" container; any other "arm,scmi-smc" nodes (for example under + "/firmware") are ignored to avoid stealing the host's SCMI OSPM instance. + +.. code-block:: dts + + scmi_shm_1: sram@47ff1000 { + compatible = "arm,scmi-shmem"; + reg = <0x0 0x47ff1000 0x0 0x1000>; + }; + scmi_xen: scmi { + compatible = "arm,scmi-smc"; + arm,smc-id = <0x82000003>; /* Xen management agent */ + #address-cells = < 1>; + #size-cells = < 0>; + #access-controller-cells = < 1>; + shmem = <&scmi_shm_1>; /* Xen management shared memory */docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 295
Quoted 10 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +10
-0+ }; + +.. note:: + This layout keeps the Host DT unchanged for Dom0 and baremetal Linux by + using func_id 0x82000002 / shmem 0x47ff0000 for Dom0, while Xen uses a + separate privileged channel func_id 0x82000003 / shmem 0x47ff1000. EL3 + firmware enforces permissions per agent_id, so there is no conflict between + Dom0 and Xen channels. + +- The driver reads secondary agents from an ``agents`` child of the"child node"
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 303
Quoted 8 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +8
-0+ ``xen,sci`` container. This child has ``#address-cells = <1>`` and + ``#size-cells = <0>``. Each enabled ``xen,scmi-agent`` child specifies its + doorbell in ``arm,smc-id`` and a single shared-memory phandle in ``shmem``. + The optional single-cell ``reg`` property supplies the SCMI agent ID + (0..254). IDs must be unique and distinct from Xen's management agent. + At least one enabled secondary agent is required. + + The shared-memory nodes remain under ``xen_scmi_config``; the host OSPM
Quoted 3 lines
I don't think that "remain" is a correct word here. Maybe "stay?". Or reword it altogether: "The SCMI-specific ``shared-memory`` nodes should be placed in ``xen_scmi_config`` node"
+
Quoted 189 lines
Quoted 119 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +119
-0+ shared-memory node and ``/firmware/scmi`` remain in the platform DT. + A shared-memory node describes a channel location and does not reserve RAM. + If buffers occupy system RAM, the platform must reserve the entire + firmware-owned range in ``/reserved-memory`` before Xen boots. A single + reservation may cover multiple channels, including unused ones. SRAM + outside system RAM does not require a RAM reservation. The channel nodes + do not have to be moved into ``/reserved-memory``. + +.. code-block:: dts + + / { + #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-id = <0>; + + /* 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>; + + agent@0 { + compatible = "xen,scmi-agent"; + reg = <0>; + arm,smc-id = <0x82000002>; + shmem = <&scmi_shm_0>; + }; + + agent@2 { + compatible = "xen,scmi-agent"; + reg = <2>; + arm,smc-id = <0x82000004>; + shmem = <&scmi_shm_2>; + }; + + agent@3 { + compatible = "xen,scmi-agent"; + reg = <3>; + arm,smc-id = <0x82000005>; + shmem = <&scmi_shm_3>; + }; + }; + }; + }; + }; + }; + +The ``xen,sci`` subtree is omitted from Dom0's DT. The host OSPM channel is +copied to Dom0 when SCMI is enabled for it. Xen uses its separate privileged +management channel to configure the other agents. + +To discover a secondary agent ID through ``BASE_DISCOVER_AGENT``, omit +``reg`` and use a node name without a unit address. For example, replace +only ``agent@2`` above with: + +.. code-block:: dts + + agent-domu { + compatible = "xen,scmi-agent"; + arm,smc-id = <0x82000004>; + shmem = <&scmi_shm_2>; + }; + +Providing ``reg`` skips mapping and probing that secondary channel during +initialization. A malformed ``reg`` is rejected. Xen always discovers itsdocs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 432
Quoted 10 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +10
-0+own management agent ID. Thus ``BASE_DISCOVER_AGENT`` is mandatory for the +management channel and for secondary channels whose ``reg`` is omitted. +The former flat secondary-agent properties are replaced by these nodes. + +.. note:: + + Note that Xen is the only one entry in the system which need to know about SCMI multi-agent support. + +- The driver implements the SCI subsystem interface required for configuring and enabling SCMI + functionality for Dom0/hwdom and Guest domains. To enable SCMI functionality for guest domain"for a guest domain"
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 433
Quoted 1 line
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +1
-0+ it has to be configured with unique supported SCMI Agent_id and use corresponding SCMI SMCsometimes you write "
agent_id" and sometimes "Agent_id"...docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 438
Quoted 5 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +5
-0+ shared-memory transport ``[smc-id, shmem]`` defined for this SCMI Agent_id. + +- Once Xen domain is configured it can communicate with EL3 SCMI FW: + + - zero-copy, the guest domain puts/gets SCMI message in/from shmem;"to/from shmem". Also, "zero-copy: ", maybe?
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 440
Quoted 2 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +2
-0+ - the guest triggers SMC exception with agent "smc-id" (doorbell); + - the Xen driver catches exception, do checks and synchronously forwards it to EL3 FW.not "do checks". "Perform checks", maybe?
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 443
Quoted 3 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +3
-0+ +- the Xen driver sends BASE_RESET_AGENT_CONFIGURATION message to Xen management agent channel on + domain destroy event. This allows to reset resources used by domain and so implement use-cases/so//
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 447
Quoted 4 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +4
-0+ like domain reboot. + + +Configure SCMI for Dom0"How to configure..." or "Configuring..."
Quoted 10 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +10
-0+^^^^^^^^^^^^^^^^^^^^^^^ +Set the Dom0 SCMI agent ID in the device tree using the Xen SCMI container under ``/chosen``. +Add ``xen,dom0-sci-agent-id`` to the ``xen,sci`` node. If the property is absent, SCMI stays +disabled for Dom0 and the SCMI nodes are removed from Dom0 DT. + +.. code-block:: dts + + chosen { + xen { + ranges;docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 467
Quoted 10 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +10
-0+ xen_scmi_config { + compatible = "xen,sci"; + xen,dom0-sci-agent-id = <0>; /* Dom0 agent ID */ + /* agents, shared memory and scmi_xen as shown above */ + }; + }; + }; + +The Host DT ``/firmware/scmi`` node is copied to the Dom0 DT unmodified. However, for Dom0 SCMI +configuration, Xen relies on the ``agents`` child and the ``xen,dom0-sci-agent-id``"child node"
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 475
Quoted 8 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +8
-0+property from the ``xen,sci`` container under ``/chosen``. If the ``/firmware/scmi`` node is +missing or disabled, or if ``xen,dom0-sci-agent-id`` is not provided, the Dom0 SCMI agent will not +be configured. + +.. note:: + + The ``xen,dom0-sci-agent-id`` value must match the ``func_id`` and ``shmem`` pairing provided by + the EL3 firmware for Dom0 (for example in the ``/firmware/scmi`` node).Well, maybe better to use phandle then? Like
Quoted 1 line
xen,dom0-sci-agent-id=<&agent@0>
It is used to set arm_sci_agent_id in the config and works the same way as libxl, so we maintain consistent approaches for setting dom_id in both libxl and the device-tree.
Additionally, the agent_id is used when acquiring the scmi_channel.
I don't see any particular benefits to using a phandle here, but perhaps I've missed something. Could you clarify?
Quoted 127 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 477
Quoted 2 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +2
-0+ +Configure SCMI for for guest domain with toolstack"How to configure..." or "Configuring..."
Quoted 58 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +58
-0+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +* In domain's xl.cfg file add **"arm_sci"** option as below + +:: + + arm_sci = "type=scmi_smc_multiagent,agent_id=2" + +* In domain's xl.cfg file enable access to the "arm,scmi-shmem" which should correspond + assigned "agent_id" for the domain, for example: + +:: + + iomem = [ + "47ff2,1@22001", + ] + +.. note:: It's up to the user to select guest IPA for mapping SCMI shared-memory. + +* Add SCMI nodes to the Driver domain partial device tree as in the below example. + The "arm,smc-id" should correspond assigned agent_id for the domain: + +.. code:: + + passthrough { + scmi_shm_0: sram@22001000 { + compatible = "arm,scmi-shmem"; + reg = <0x0 0x22001000 0x0 0x1000>; + }; + + firmware { + compatible = "simple-bus"; + scmi: scmi { + compatible = "arm,scmi-smc"; + arm,smc-id = <0x82000004>; <--- smc-id for agent_id=2 + shmem = <&scmi_shm_0>; + ... + } + } + } + +**Device specific access control** + +The XEN SCMI SMC multi-agent driver performs "access-controller" provider function in case +EL3 SCMI FW implements SCMI "4.2.1.1 Device specific access control" and provides the +BASE_SET_DEVICE_PERMISSIONS command to configure the devices that an agents have access to. +The Host DT SCMI node should have "#access-controller-cells=<1>" property and DT devices should +be bound to the SCMI node using Access Controllers bindings [3]. + +For example: + +.. code-block:: dts + + &i2c1 { + access-controllers = <&scmi 0>; + }; + +Use domain's xl.cfg file **"dtdev"** property to assign SCMI devices from toolstack to the guest:docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 545
Quoted 10 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +10
-0+ +:: + + dtdev = [ + "/soc/i2c@e6508000", + ] + +.. note:: + + xl.cfg:"dtdev" need contain all nodes which are under SCMI management (not only those which are"need to contain"
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 548
Quoted 3 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +3
-0+ behind IOMMU) and passed-through to the guest domain. + +Configure SCMI for predefined domains (dom0less)(the same as for previous section header)
Quoted 48 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +48
-0+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +* add "xen,sci_type" and "xen,sci-agent-id" properties for required DomU ("xen,domain") node + +:: + + xen,sci_type="scmi_smc_multiagent" + xen,sci-agent-id=2 + +* add scmi nodes to the Driver domain partial device tree the same way as above (toolstack case) and + enable access to the "arm,scmi-shmem" according to the dom0less documentation. For example: + +.. code-block:: dts + + scmi_shm_0: sram@22001000 { + compatible = "arm,scmi-shmem"; + reg = <0x00 0x22001000 0x00 0x1000>; + -> xen,reg = <0x0 0x47ff2000 0x0 0x1000 0x0 0x22001000>; + -> xen,force-assign-without-iommu; + }; + +* For SCMI device access control configure pass-through devices in the guest partial DT according to + the dom0less documentation and ensure that devices SCMI management has "xen,path" property set: + +Use the complete Xen SCMI configuration above. Remove +``xen,dom0-sci-agent-id`` if Dom0 does not use SCMI. The guest selects the +secondary channel described by ``agent@2``: + +.. code-block:: dts + + chosen { + xen,domain@1 { + compatible = "xen,domain"; + xen,sci_type = "scmi_smc_multiagent"; + xen,sci-agent-id = <2>; + /* other domain properties here */ + }; + }; + +.. code-block:: dts + + i2c@e6508000 { + ... + reg = <0x00 0xe6508000 0x00 0x1000>; + -> xen,path = "/soc/i2c@e6508000" + -> xen,reg = <0x0 0xe6508000 0x0 0x1000 0x0 0xe6508000>; + -> xen,force-assign-without-iommu; + };
Re: [PATCH v15 6/6] docs: arm: add SCI SCMI SMC multi-agent driver docs
Hi Oleksii,
Quoted 103 lines · Oleksii Moisieiev
Hi Volodymyr,
Thank you for the review. please see below:
Quoted 89 lines · Volodymyr Babchuk
Hi,
I'm sorry, I postponed documentation review till we finished with code part. This was my mistake. I didn't expected that it require serious proofreading. Anyway, I tried to highlight most glaring mistakes, but it would be great if you proofread it by yourself once again.
Quoted 79 lines · Oleksii Moisieiev
From: Grygorii Strashko <[email protected]>
Add SCI SCMI SMC multi-agent driver documentation.
It includes a detailed description of the SCMI multi-agent driver. This document explains the driver's functionality, configuration, and the compilation process. The Xen SCMI multi-agent driver is designed to provide SCMI access to system resources from different domains.Signed-off-by Grygorii Strashko <[email protected]>Signed-off-by Oleksii Moisieiev <[email protected]>---
(no changes since v14)
Changes in v14:
- describe secondary agents as xen,scmi-agent nodes under agents
- update host, discovery and dom0less examples for the child-node format
- clarify shared-memory placement and platform RAM reservationsChanges in v10:
- rephrase section about /firmware/scmi. Mentioned that this node is taken from Host DT and copied unmodified.
- fix xen,reg address for secondary domains for Dom0less configurationChanges in v8:
- update documentation to match the last DT format
- fixed RST: "... code-block:: dts" -> ".. code-block:: dts"
- update documentation with dom0less configuration example
- update documentation with new param xen,dom0-sci-agent-id instead of the command line parameterChanges in v7:
- update documentation in section of thexen_scmiconfiguration which is matched by "xen,sci" compatible instead of the direct path.Changes in v6:
- remove all HVC mentions from the multi-agent doc
- update sci-agent-id parameter description in the documentation
- add missing Sign-of
- minor fixes across the documentChanges in v5:
- rework multi-agent driver to leave Host Device-tree unmodified.../arm/firmware/arm-scmi.rst | 405 ++++++++++++++++++ 1 file changed, 405 insertions(+)docs/hypervisor-guide/arm/firmware/arm-scmi.rst +2
-0@@ -36,6 +36,8 @@ The below sections describe SCMI support options available for Xen. | [1] `Arm SCMI | <https://developer.arm.com/documentation/den0056/latest/>`_ | [2] `System Control and Management Interface (SCMI) bindings | <https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/firmware/arm,scmi.yaml>`_ +| [3] `Generic Domain Access Controllers bindings <https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/access-controllers/access-controllers.yaml>`_ +Simple SCMI over SMC calls forwarding driver (EL3)
------------------------------------------------------docs/hypervisor-guide/arm/firmware/arm-scmi.rst +12
-0@@ -189,3 +191,406 @@ except explicitly enabling SCMI with "arm_sci" xl.cfg option. -> xen,reg = <0x0 0x47ff0000 0x0 0x1000 0x0 0x22001000>; -> xen,force-assign-without-iommu; }; + +SCMI SMC multi-agent driver (EL3) +------------------------------------- + +The SCMI SMC multi-agent driver enables support for ARM EL3 Trusted Firmware-A (TF-A) which +provides SCMI interface with multi-agent support, as shown below. + +:: + + +-----------------------------------------+ + | | + | EL3 TF-A SCMI |Quoted 8 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 212
Quoted 7 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +7
-0+ +-------+--+-------+--+-------+--+-------++ + |shmem1 | |shmem0 | |shmem2 | |shmemX | + +-----+-+ +---+---+ +--+----+ +---+---+ + smc-id1 | | | | + agent1 | | | | + +-----v--------+---------+-----------+----+ + | | | | |Xen, I believe?
Quoted 5 lines
It is. But in terms of SCMI this is privileged agent. Haven't mentioned Xen here for the sake of
diagram simplicity (just don't see a good place whre I can place "Xen" in this diagram. The main idea is
I think you can place "Xen" in the centre. There is free space for it fit. Just add a new line, so it is nice and centered, like this:
+ | | Xen | | |
Quoted 56 lines
that driver leaves scmi privileged agent for itself (agent1 in our case) regardless where this driver runs.
This format was taken since driver itself is avare about the domains and channels.
Quoted 12 lines
Quoted 12 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +12
-0+ | | | | | + +--------------+---------+-----------+----+ + smc-id0 | smc-id2| smc-idX| + agent0 | agent2 | agentX | + | | | + +----v---+ +--v-----+ +--v-----+ + | | | | | | + | Dom0 | | Dom1 | | DomX | + | | | | | | + | | | | | | + +--------+ +--------+ +--------+ +Quoted 8 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 230
Quoted 6 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +6
-0+The EL3 SCMI multi-agent firmware is expected to provide SCMI SMC shared-memory transport +for every Agent in the system. The SCMI Agent transport channel defined by pair: + +- smc-id: SMC function id used for Doorbell +- shmem: shared memory for messages transfer, **Xen page aligned**. + Shared memory is mapped with the following flags: MT_DEVICE_nGnRE and _PAGE_DEVICE, indicating that thisDo we have any line length limitation for .rst files? This one is 114 characters long.
rstcheck gives 0 errors, but I can reformat it with maxline 120.
Quoted 20 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 236
Quoted 6 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +6
-0+ memory is mapped as device memory. + +The following SCMI Agents are expected to be defined by SCMI FW to enable SCMI multi-agent functionality +under Xen: +- +- Xen management agent: trusted agents that accesses to the Base Protocol commands to configure"trusted agent", not "agents"
also, "that accesses the Base Protocol commands to configure..." or "that has access to the Base Protocol commands to configure..."
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 237
Quoted 1 line
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +1
-0+ agent specific permissions"agent-specific"
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 238
Quoted 1 line
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +1
-0+- OSPM VM agents: non-trusted agent, one for each Guest domain which is allowed direct HW access."non-trusted agents". Also, double space between "is" and "allowed"
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 239
Quoted 1 line
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +1
-0+ At least one OSPM VM agent has to be provided by FW if HW is handled only by Dom0 or Driver Domain."Hardware Domain", probably
Quoted 7 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 244
Quoted 5 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +5
-0+ +The EL3 SCMI FW is expected to implement following Base protocol messages: + +- BASE_DISCOVER_AGENT (required for Xen; required for secondary agents without ``reg``) +- BASE_RESET_AGENT_CONFIGURATION (optional)How Xen can guarantee that SCMI state is sane, if it can't reset agent during domain destruction?
Quoted 6 lines
If this command is not implemented by the SCP firmware, but the firmware provides
agent_num> 1, then it is the responsibility of the SCP firmware. We made this optional to cover exactly this case — where we don't haveRESET_AGENT_CONFIGURATIONbut still haveagent_num> 1, which could be applicable to a dom0less configuration (for example) and should be used carefully by developers.
Okay, I see... On one hand it is not worse than the current state of affairs, when we just destroying a domain and leaving its devices in undetermined state. On other hand, SCMI is meant to resolve this particular problem, so it will be strange to have SCMI but not to have this particular feature. Maybe it is worth to write a huge warning if a SCMI-enabled domain is destroyed, but we can't call RESET for it?
Looks like I overlooked this case when reviewed "xen/arm: scmi:
introduce SCI SCMI SMC multi-agent driver"
Quoted 11 lines
Quoted 6 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 245
Quoted 4 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +1
-0+- BASE_SET_DEVICE_PERMISSIONS (optional)If this is optional, does it mean that each agent will have access to all devices in the system?
Probably. But that doesn't mean it's the only case. For example, a resource could be acquired on first access (not a real-world case, but it's possible). So we can't make this decision on behalf of the SCP firmware.
Again, this might be not what user wants or expects. And it is even worse then the previous case, because without SCMI I am sure that if I didn't gave a domain access to a peripheral, then it can't affects its state. If you really want to support such case, then you should ensure that only HWDOM can access SCMI of SCP does not support SET_DEVICE_PERMISSIONS.
[...]
Quoted 37 lines
Quoted 35 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 447
Quoted 1 line
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +1
-0+Configure SCMI for Dom0"How to configure..." or "Configuring..."
Quoted 10 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +10
-0+^^^^^^^^^^^^^^^^^^^^^^^ +Set the Dom0 SCMI agent ID in the device tree using the Xen SCMI container under ``/chosen``. +Add ``xen,dom0-sci-agent-id`` to the ``xen,sci`` node. If the property is absent, SCMI stays +disabled for Dom0 and the SCMI nodes are removed from Dom0 DT. + +.. code-block:: dts + + chosen { + xen { + ranges;docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 467
Quoted 10 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +10
-0+ xen_scmi_config { + compatible = "xen,sci"; + xen,dom0-sci-agent-id = <0>; /* Dom0 agent ID */ + /* agents, shared memory and scmi_xen as shown above */ + }; + }; + }; + +The Host DT ``/firmware/scmi`` node is copied to the Dom0 DT unmodified. However, for Dom0 SCMI +configuration, Xen relies on the ``agents`` child and the ``xen,dom0-sci-agent-id``"child node"
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 475
Quoted 8 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +8
-0+property from the ``xen,sci`` container under ``/chosen``. If the ``/firmware/scmi`` node is +missing or disabled, or if ``xen,dom0-sci-agent-id`` is not provided, the Dom0 SCMI agent will not +be configured. + +.. note:: + + The ``xen,dom0-sci-agent-id`` value must match the ``func_id`` and ``shmem`` pairing provided by + the EL3 firmware for Dom0 (for example in the ``/firmware/scmi`` node).Well, maybe better to use phandle then? Like
Quoted 1 line
xen,dom0-sci-agent-id=<&agent@0>
Quoted 8 lines
It is used to set
arm_sci_agent_idin the config and works the same way as libxl, so we maintain consistent approaches for settingdom_idin both libxl and the device-tree.Additionally, the
agent_idis used when acquiring thescmi_channel.I don't see any particular benefits to using a phandle here, but perhaps I've missed something. Could you clarify?
Having less room for user error. Having phandle, you can extract both func_id and shmem from it. But, thinking of it, you can extract shmem just by looking at func_id... On other hand, it is better to move checks to the compilation time. 'dtc' will tell you if it can't find a phandle, but it will not tell you if numeric agent_id does not match any entry in that agents array.
[...]
--
WBR, Volodymyr
Re: [PATCH v15 6/6] docs: arm: add SCI SCMI SMC multi-agent driver docs
Quoted 183 lines · Volodymyr Babchuk
Hi Oleksii,
Quoted 102 lines · Oleksii Moisieiev
Hi Volodymyr,
Thank you for the review. please see below:
Quoted 89 lines · Volodymyr Babchuk
Hi,
I'm sorry, I postponed documentation review till we finished with code part. This was my mistake. I didn't expected that it require serious proofreading. Anyway, I tried to highlight most glaring mistakes, but it would be great if you proofread it by yourself once again.
Quoted 79 lines · Oleksii Moisieiev
From: Grygorii Strashko <[email protected]>
Add SCI SCMI SMC multi-agent driver documentation.
It includes a detailed description of the SCMI multi-agent driver. This document explains the driver's functionality, configuration, and the compilation process. The Xen SCMI multi-agent driver is designed to provide SCMI access to system resources from different domains.Signed-off-by Grygorii Strashko <[email protected]>Signed-off-by Oleksii Moisieiev <[email protected]>---
(no changes since v14)
Changes in v14:
- describe secondary agents as xen,scmi-agent nodes under agents
- update host, discovery and dom0less examples for the child-node format
- clarify shared-memory placement and platform RAM reservationsChanges in v10:
- rephrase section about /firmware/scmi. Mentioned that this node is taken from Host DT and copied unmodified.
- fix xen,reg address for secondary domains for Dom0less configurationChanges in v8:
- update documentation to match the last DT format
- fixed RST: "... code-block:: dts" -> ".. code-block:: dts"
- update documentation with dom0less configuration example
- update documentation with new param xen,dom0-sci-agent-id instead of the command line parameterChanges in v7:
- update documentation in section of thexen_scmiconfiguration which is matched by "xen,sci" compatible instead of the direct path.Changes in v6:
- remove all HVC mentions from the multi-agent doc
- update sci-agent-id parameter description in the documentation
- add missing Sign-of
- minor fixes across the documentChanges in v5:
- rework multi-agent driver to leave Host Device-tree unmodified.../arm/firmware/arm-scmi.rst | 405 ++++++++++++++++++ 1 file changed, 405 insertions(+)docs/hypervisor-guide/arm/firmware/arm-scmi.rst +2
-0@@ -36,6 +36,8 @@ The below sections describe SCMI support options available for Xen. | [1] `Arm SCMI | <https://developer.arm.com/documentation/den0056/latest/>`_ | [2] `System Control and Management Interface (SCMI) bindings | <https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/firmware/arm,scmi.yaml>`_ +| [3] `Generic Domain Access Controllers bindings <https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/access-controllers/access-controllers.yaml>`_ +Simple SCMI over SMC calls forwarding driver (EL3)
------------------------------------------------------docs/hypervisor-guide/arm/firmware/arm-scmi.rst +12
-0@@ -189,3 +191,406 @@ except explicitly enabling SCMI with "arm_sci" xl.cfg option. -> xen,reg = <0x0 0x47ff0000 0x0 0x1000 0x0 0x22001000>; -> xen,force-assign-without-iommu; }; + +SCMI SMC multi-agent driver (EL3) +------------------------------------- + +The SCMI SMC multi-agent driver enables support for ARM EL3 Trusted Firmware-A (TF-A) which +provides SCMI interface with multi-agent support, as shown below. + +:: + + +-----------------------------------------+ + | | + | EL3 TF-A SCMI |Quoted 8 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 212
Quoted 7 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +7
-0+ +-------+--+-------+--+-------+--+-------++ + |shmem1 | |shmem0 | |shmem2 | |shmemX | + +-----+-+ +---+---+ +--+----+ +---+---+ + smc-id1 | | | | + agent1 | | | | + +-----v--------+---------+-----------+----+ + | | | | |Xen, I believe?
Quoted 5 lines
It is. But in terms of SCMI this is privileged agent. Haven't mentioned Xen here for the sake of
diagram simplicity (just don't see a good place whre I can place "Xen" in this diagram. The main idea is
I think you can place "Xen" in the centre. There is free space for it fit. Just add a new line, so it is nice and centered, like this:
+ | | Xen | | |
Quoted 54 lines
that driver leaves scmi privileged agent for itself (agent1 in our case) regardless where this driver runs.
This format was taken since driver itself is avare about the domains and channels.
Quoted 12 lines
Quoted 12 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +12
-0+ | | | | | + +--------------+---------+-----------+----+ + smc-id0 | smc-id2| smc-idX| + agent0 | agent2 | agentX | + | | | + +----v---+ +--v-----+ +--v-----+ + | | | | | | + | Dom0 | | Dom1 | | DomX | + | | | | | | + | | | | | | + +--------+ +--------+ +--------+ +Quoted 8 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 230
Quoted 6 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +6
-0+The EL3 SCMI multi-agent firmware is expected to provide SCMI SMC shared-memory transport +for every Agent in the system. The SCMI Agent transport channel defined by pair: + +- smc-id: SMC function id used for Doorbell +- shmem: shared memory for messages transfer, **Xen page aligned**. + Shared memory is mapped with the following flags: MT_DEVICE_nGnRE and _PAGE_DEVICE, indicating that thisDo we have any line length limitation for .rst files? This one is 114 characters long.
rstcheck gives 0 errors, but I can reformat it with maxline 120.
Quoted 20 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 236
Quoted 6 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +6
-0+ memory is mapped as device memory. + +The following SCMI Agents are expected to be defined by SCMI FW to enable SCMI multi-agent functionality +under Xen: +- +- Xen management agent: trusted agents that accesses to the Base Protocol commands to configure"trusted agent", not "agents"
also, "that accesses the Base Protocol commands to configure..." or "that has access to the Base Protocol commands to configure..."
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 237
Quoted 1 line
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +1
-0+ agent specific permissions"agent-specific"
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 238
Quoted 1 line
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +1
-0+- OSPM VM agents: non-trusted agent, one for each Guest domain which is allowed direct HW access."non-trusted agents". Also, double space between "is" and "allowed"
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 239
Quoted 1 line
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +1
-0+ At least one OSPM VM agent has to be provided by FW if HW is handled only by Dom0 or Driver Domain."Hardware Domain", probably
Quoted 7 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 244
Quoted 5 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +5
-0+ +The EL3 SCMI FW is expected to implement following Base protocol messages: + +- BASE_DISCOVER_AGENT (required for Xen; required for secondary agents without ``reg``) +- BASE_RESET_AGENT_CONFIGURATION (optional)How Xen can guarantee that SCMI state is sane, if it can't reset agent during domain destruction?
Quoted 6 lines
If this command is not implemented by the SCP firmware, but the firmware provides
agent_num> 1, then it is the responsibility of the SCP firmware. We made this optional to cover exactly this case — where we don't haveRESET_AGENT_CONFIGURATIONbut still haveagent_num> 1, which could be applicable to a dom0less configuration (for example) and should be used carefully by developers.Okay, I see... On one hand it is not worse than the current state of affairs, when we just destroying a domain and leaving its devices in undetermined state. On other hand, SCMI is meant to resolve this particular problem, so it will be strange to have SCMI but not to have this particular feature. Maybe it is worth to write a huge warning if a SCMI-enabled domain is destroyed, but we can't call RESET for it?
Quoted 2 lines
Looks like I overlooked this case when reviewed "xen/arm: scmi:
introduce SCI SCMI SMC multi-agent driver"
this could be done. Will add huge warning.
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 245
Quoted 2 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +1
-0+- BASE_SET_DEVICE_PERMISSIONS (optional)If this is optional, does it mean that each agent will have access to all devices in the system?
Probably. But that doesn't mean it's the only case. For example, a resource could be acquired on first access (not a real-world case, but it's possible). So we can't make this decision on behalf of the SCP firmware.
Quoted 7 lines
Again, this might be not what user wants or expects. And it is even worse then the previous case, because without SCMI I am sure that if I didn't gave a domain access to a peripheral, then it can't affects its state. If you really want to support such case, then you should ensure that only HWDOM can access SCMI of SCP does not support
SET_DEVICE_PERMISSIONS.
When only the HWDOM has access to the SCMI of the SCP without SET_DEVICE_PERMISSIONS support, there is no point in using scmi-multiagent at all. In this case, scmi-single-agent (which has already been merged) should be used instead.
So I think we should probably make SET_DEVICE_PERMISSIONS support mandatory in this case and fail if it is not supported. We should also mention this in the documentation.
What do you think?
Quoted 47 lines
[...]
Quoted 36 lines
Quoted 35 lines
Quoted 1 line
+Configure SCMI for Dom0
"How to configure..." or "Configuring..."
Quoted 10 lines
+^^^^^^^^^^^^^^^^^^^^^^^
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +9
-0+Set the Dom0 SCMI agent ID in the device tree using the Xen SCMI container under ``/chosen``. +Add ``xen,dom0-sci-agent-id`` to the ``xen,sci`` node. If the property is absent, SCMI stays +disabled for Dom0 and the SCMI nodes are removed from Dom0 DT. + +.. code-block:: dts + + chosen { + xen { + ranges;docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 467
Quoted 10 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +10
-0+ xen_scmi_config { + compatible = "xen,sci"; + xen,dom0-sci-agent-id = <0>; /* Dom0 agent ID */ + /* agents, shared memory and scmi_xen as shown above */ + }; + }; + }; + +The Host DT ``/firmware/scmi`` node is copied to the Dom0 DT unmodified. However, for Dom0 SCMI +configuration, Xen relies on the ``agents`` child and the ``xen,dom0-sci-agent-id``"child node"
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 475
Quoted 8 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +8
-0+property from the ``xen,sci`` container under ``/chosen``. If the ``/firmware/scmi`` node is +missing or disabled, or if ``xen,dom0-sci-agent-id`` is not provided, the Dom0 SCMI agent will not +be configured. + +.. note:: + + The ``xen,dom0-sci-agent-id`` value must match the ``func_id`` and ``shmem`` pairing provided by + the EL3 firmware for Dom0 (for example in the ``/firmware/scmi`` node).Well, maybe better to use phandle then? Like
Quoted 1 line
xen,dom0-sci-agent-id=<&agent@0>
Quoted 8 lines
It is used to set
arm_sci_agent_idin the config and works the same way as libxl, so we maintain consistent approaches for settingdom_idin both libxl and the device-tree.Additionally, the
agent_idis used when acquiring thescmi_channel.I don't see any particular benefits to using a phandle here, but perhaps I've missed something. Could you clarify?
Quoted 8 lines
Having less room for user error. Having phandle, you can extract both
func_idand shmem from it. But, thinking of it, you can extract shmem just by looking atfunc_id... On other hand, it is better to move checks to the compilation time. 'dtc' will tell you if it can't find a phandle, but it will not tell you if numericagent_iddoes not match any entry in that agents array.[...]
Moving the checks to 'dtc' compilation time sounds reasonable.
I can reorganize this in the following way:
1) Make it look like:
xen,dom0-sci-agent = <&agent@0>;
2) For dom0less configuration:
change: xen,sci-agent-id = <2>;
to look like xen,sci-agent = <&agent@X>;
3) for xen-scmi-agent node add xen,sci-agent-id optional property.
Does this match what you had in mind?
This could actually simplify the configuration when we rely on the mechanism where Xen requests an agent_id for each func_id.
Overall, I like your idea and will think about it further.
Thank you!
Re: [PATCH v15 6/6] docs: arm: add SCI SCMI SMC multi-agent driver docs
Hi,
Quoted 208 lines · Oleksii Moisieiev
Quoted 183 lines · Volodymyr Babchuk
Hi Oleksii,
Quoted 102 lines · Oleksii Moisieiev
Hi Volodymyr,
Thank you for the review. please see below:
Quoted 89 lines · Volodymyr Babchuk
Hi,
I'm sorry, I postponed documentation review till we finished with code part. This was my mistake. I didn't expected that it require serious proofreading. Anyway, I tried to highlight most glaring mistakes, but it would be great if you proofread it by yourself once again.
Quoted 79 lines · Oleksii Moisieiev
From: Grygorii Strashko <[email protected]>
Add SCI SCMI SMC multi-agent driver documentation.
It includes a detailed description of the SCMI multi-agent driver. This document explains the driver's functionality, configuration, and the compilation process. The Xen SCMI multi-agent driver is designed to provide SCMI access to system resources from different domains.Signed-off-by Grygorii Strashko <[email protected]>Signed-off-by Oleksii Moisieiev <[email protected]>---
(no changes since v14)
Changes in v14:
- describe secondary agents as xen,scmi-agent nodes under agents
- update host, discovery and dom0less examples for the child-node format
- clarify shared-memory placement and platform RAM reservationsChanges in v10:
- rephrase section about /firmware/scmi. Mentioned that this node is taken from Host DT and copied unmodified.
- fix xen,reg address for secondary domains for Dom0less configurationChanges in v8:
- update documentation to match the last DT format
- fixed RST: "... code-block:: dts" -> ".. code-block:: dts"
- update documentation with dom0less configuration example
- update documentation with new param xen,dom0-sci-agent-id instead of the command line parameterChanges in v7:
- update documentation in section of thexen_scmiconfiguration which is matched by "xen,sci" compatible instead of the direct path.Changes in v6:
- remove all HVC mentions from the multi-agent doc
- update sci-agent-id parameter description in the documentation
- add missing Sign-of
- minor fixes across the documentChanges in v5:
- rework multi-agent driver to leave Host Device-tree unmodified.../arm/firmware/arm-scmi.rst | 405 ++++++++++++++++++ 1 file changed, 405 insertions(+)docs/hypervisor-guide/arm/firmware/arm-scmi.rst +2
-0@@ -36,6 +36,8 @@ The below sections describe SCMI support options available for Xen. | [1] `Arm SCMI | <https://developer.arm.com/documentation/den0056/latest/>`_ | [2] `System Control and Management Interface (SCMI) bindings | <https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/firmware/arm,scmi.yaml>`_ +| [3] `Generic Domain Access Controllers bindings <https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/access-controllers/access-controllers.yaml>`_ +Simple SCMI over SMC calls forwarding driver (EL3)
------------------------------------------------------docs/hypervisor-guide/arm/firmware/arm-scmi.rst +12
-0@@ -189,3 +191,406 @@ except explicitly enabling SCMI with "arm_sci" xl.cfg option. -> xen,reg = <0x0 0x47ff0000 0x0 0x1000 0x0 0x22001000>; -> xen,force-assign-without-iommu; }; + +SCMI SMC multi-agent driver (EL3) +------------------------------------- + +The SCMI SMC multi-agent driver enables support for ARM EL3 Trusted Firmware-A (TF-A) which +provides SCMI interface with multi-agent support, as shown below. + +:: + + +-----------------------------------------+ + | | + | EL3 TF-A SCMI |Quoted 8 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 212
Quoted 7 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +7
-0+ +-------+--+-------+--+-------+--+-------++ + |shmem1 | |shmem0 | |shmem2 | |shmemX | + +-----+-+ +---+---+ +--+----+ +---+---+ + smc-id1 | | | | + agent1 | | | | + +-----v--------+---------+-----------+----+ + | | | | |Xen, I believe?
Quoted 5 lines
It is. But in terms of SCMI this is privileged agent. Haven't mentioned Xen here for the sake of
diagram simplicity (just don't see a good place whre I can place "Xen" in this diagram. The main idea is
I think you can place "Xen" in the centre. There is free space for it fit. Just add a new line, so it is nice and centered, like this:
+ | | Xen | | |
Quoted 54 lines
that driver leaves scmi privileged agent for itself (agent1 in our case) regardless where this driver runs.
This format was taken since driver itself is avare about the domains and channels.
Quoted 12 lines
Quoted 12 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +12
-0+ | | | | | + +--------------+---------+-----------+----+ + smc-id0 | smc-id2| smc-idX| + agent0 | agent2 | agentX | + | | | + +----v---+ +--v-----+ +--v-----+ + | | | | | | + | Dom0 | | Dom1 | | DomX | + | | | | | | + | | | | | | + +--------+ +--------+ +--------+ +Quoted 8 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 230
Quoted 6 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +6
-0+The EL3 SCMI multi-agent firmware is expected to provide SCMI SMC shared-memory transport +for every Agent in the system. The SCMI Agent transport channel defined by pair: + +- smc-id: SMC function id used for Doorbell +- shmem: shared memory for messages transfer, **Xen page aligned**. + Shared memory is mapped with the following flags: MT_DEVICE_nGnRE and _PAGE_DEVICE, indicating that thisDo we have any line length limitation for .rst files? This one is 114 characters long.
rstcheck gives 0 errors, but I can reformat it with maxline 120.
Quoted 20 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 236
Quoted 6 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +6
-0+ memory is mapped as device memory. + +The following SCMI Agents are expected to be defined by SCMI FW to enable SCMI multi-agent functionality +under Xen: +- +- Xen management agent: trusted agents that accesses to the Base Protocol commands to configure"trusted agent", not "agents"
also, "that accesses the Base Protocol commands to configure..." or "that has access to the Base Protocol commands to configure..."
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 237
Quoted 1 line
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +1
-0+ agent specific permissions"agent-specific"
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 238
Quoted 1 line
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +1
-0+- OSPM VM agents: non-trusted agent, one for each Guest domain which is allowed direct HW access."non-trusted agents". Also, double space between "is" and "allowed"
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 239
Quoted 1 line
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +1
-0+ At least one OSPM VM agent has to be provided by FW if HW is handled only by Dom0 or Driver Domain."Hardware Domain", probably
Quoted 7 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 244
Quoted 5 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +5
-0+ +The EL3 SCMI FW is expected to implement following Base protocol messages: + +- BASE_DISCOVER_AGENT (required for Xen; required for secondary agents without ``reg``) +- BASE_RESET_AGENT_CONFIGURATION (optional)How Xen can guarantee that SCMI state is sane, if it can't reset agent during domain destruction?
Quoted 6 lines
If this command is not implemented by the SCP firmware, but the firmware provides
agent_num> 1, then it is the responsibility of the SCP firmware. We made this optional to cover exactly this case — where we don't haveRESET_AGENT_CONFIGURATIONbut still haveagent_num> 1, which could be applicable to a dom0less configuration (for example) and should be used carefully by developers.Okay, I see... On one hand it is not worse than the current state of affairs, when we just destroying a domain and leaving its devices in undetermined state. On other hand, SCMI is meant to resolve this particular problem, so it will be strange to have SCMI but not to have this particular feature. Maybe it is worth to write a huge warning if a SCMI-enabled domain is destroyed, but we can't call RESET for it?
Quoted 2 lines
Looks like I overlooked this case when reviewed "xen/arm: scmi:
introduce SCI SCMI SMC multi-agent driver"this could be done. Will add huge warning.
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 245
Quoted 2 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +1
-0+- BASE_SET_DEVICE_PERMISSIONS (optional)If this is optional, does it mean that each agent will have access to all devices in the system?
Probably. But that doesn't mean it's the only case. For example, a resource could be acquired on first access (not a real-world case, but it's possible). So we can't make this decision on behalf of the SCP firmware.
Quoted 7 lines
Again, this might be not what user wants or expects. And it is even worse then the previous case, because without SCMI I am sure that if I didn't gave a domain access to a peripheral, then it can't affects its state. If you really want to support such case, then you should ensure that only HWDOM can access SCMI of SCP does not support
SET_DEVICE_PERMISSIONS.When only the HWDOM has access to the SCMI of the SCP without
SET_DEVICE_PERMISSIONSsupport, there is no point in using scmi-multiagent at all. In this case, scmi-single-agent (which has already been merged) should be used instead.
Quoted 5 lines
So I think we should probably make
SET_DEVICE_PERMISSIONSsupport mandatory in this case and fail if it is not supported. We should also mention this in the documentation.What do you think?
Well, this certainly is an option. In other words, I am fine with that.
Quoted 61 lines
Quoted 47 lines
[...]
Quoted 36 lines
Quoted 35 lines
Quoted 1 line
+Configure SCMI for Dom0
"How to configure..." or "Configuring..."
Quoted 10 lines
+^^^^^^^^^^^^^^^^^^^^^^^
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +9
-0+Set the Dom0 SCMI agent ID in the device tree using the Xen SCMI container under ``/chosen``. +Add ``xen,dom0-sci-agent-id`` to the ``xen,sci`` node. If the property is absent, SCMI stays +disabled for Dom0 and the SCMI nodes are removed from Dom0 DT. + +.. code-block:: dts + + chosen { + xen { + ranges;docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 467
Quoted 10 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +10
-0+ xen_scmi_config { + compatible = "xen,sci"; + xen,dom0-sci-agent-id = <0>; /* Dom0 agent ID */ + /* agents, shared memory and scmi_xen as shown above */ + }; + }; + }; + +The Host DT ``/firmware/scmi`` node is copied to the Dom0 DT unmodified. However, for Dom0 SCMI +configuration, Xen relies on the ``agents`` child and the ``xen,dom0-sci-agent-id``"child node"
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 475
Quoted 8 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +8
-0+property from the ``xen,sci`` container under ``/chosen``. If the ``/firmware/scmi`` node is +missing or disabled, or if ``xen,dom0-sci-agent-id`` is not provided, the Dom0 SCMI agent will not +be configured. + +.. note:: + + The ``xen,dom0-sci-agent-id`` value must match the ``func_id`` and ``shmem`` pairing provided by + the EL3 firmware for Dom0 (for example in the ``/firmware/scmi`` node).Well, maybe better to use phandle then? Like
Quoted 1 line
xen,dom0-sci-agent-id=<&agent@0>
Quoted 8 lines
It is used to set
arm_sci_agent_idin the config and works the same way as libxl, so we maintain consistent approaches for settingdom_idin both libxl and the device-tree.Additionally, the
agent_idis used when acquiring thescmi_channel.I don't see any particular benefits to using a phandle here, but perhaps I've missed something. Could you clarify?
Quoted 8 lines
Having less room for user error. Having phandle, you can extract both
func_idand shmem from it. But, thinking of it, you can extract shmem just by looking atfunc_id... On other hand, it is better to move checks to the compilation time. 'dtc' will tell you if it can't find a phandle, but it will not tell you if numericagent_iddoes not match any entry in that agents array.[...]
Moving the checks to 'dtc' compilation time sounds reasonable.
I can reorganize this in the following way:
1) Make it look like:xen,dom0-sci-agent = <&agent@0>;
Quoted 7 lines
2) For dom0less configuration:
change: xen,sci-agent-id = <2>; to look like xen,sci-agent = <&agent@X>;3) for xen-scmi-agent node add xen,sci-agent-id optional property.
Does this match what you had in mind?
Yes.
Just a small note: it will not work exactly like that, because agent@x is a node name, not a node label. You'll encounter an error if you'll try to compile device tree with this exact code.
[...]
--
WBR, Volodymyr
Re: [PATCH v15 6/6] docs: arm: add SCI SCMI SMC multi-agent driver docs
Quoted 284 lines · Volodymyr Babchuk
Hi,
Quoted 206 lines · Oleksii Moisieiev
Quoted 183 lines · Volodymyr Babchuk
Hi Oleksii,
Quoted 102 lines · Oleksii Moisieiev
Hi Volodymyr,
Thank you for the review. please see below:
Quoted 89 lines · Volodymyr Babchuk
Hi,
I'm sorry, I postponed documentation review till we finished with code part. This was my mistake. I didn't expected that it require serious proofreading. Anyway, I tried to highlight most glaring mistakes, but it would be great if you proofread it by yourself once again.
Quoted 79 lines · Oleksii Moisieiev
From: Grygorii Strashko <[email protected]>
Add SCI SCMI SMC multi-agent driver documentation.
It includes a detailed description of the SCMI multi-agent driver. This document explains the driver's functionality, configuration, and the compilation process. The Xen SCMI multi-agent driver is designed to provide SCMI access to system resources from different domains.Signed-off-by Grygorii Strashko <[email protected]>Signed-off-by Oleksii Moisieiev <[email protected]>---
(no changes since v14)
Changes in v14:
- describe secondary agents as xen,scmi-agent nodes under agents
- update host, discovery and dom0less examples for the child-node format
- clarify shared-memory placement and platform RAM reservationsChanges in v10:
- rephrase section about /firmware/scmi. Mentioned that this node is taken from Host DT and copied unmodified.
- fix xen,reg address for secondary domains for Dom0less configurationChanges in v8:
- update documentation to match the last DT format
- fixed RST: "... code-block:: dts" -> ".. code-block:: dts"
- update documentation with dom0less configuration example
- update documentation with new param xen,dom0-sci-agent-id instead of the command line parameterChanges in v7:
- update documentation in section of thexen_scmiconfiguration which is matched by "xen,sci" compatible instead of the direct path.Changes in v6:
- remove all HVC mentions from the multi-agent doc
- update sci-agent-id parameter description in the documentation
- add missing Sign-of
- minor fixes across the documentChanges in v5:
- rework multi-agent driver to leave Host Device-tree unmodified.../arm/firmware/arm-scmi.rst | 405 ++++++++++++++++++ 1 file changed, 405 insertions(+)docs/hypervisor-guide/arm/firmware/arm-scmi.rst +2
-0@@ -36,6 +36,8 @@ The below sections describe SCMI support options available for Xen. | [1] `Arm SCMI | <https://developer.arm.com/documentation/den0056/latest/>`_ | [2] `System Control and Management Interface (SCMI) bindings | <https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/firmware/arm,scmi.yaml>`_ +| [3] `Generic Domain Access Controllers bindings <https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/access-controllers/access-controllers.yaml>`_ +Simple SCMI over SMC calls forwarding driver (EL3)
------------------------------------------------------docs/hypervisor-guide/arm/firmware/arm-scmi.rst +12
-0@@ -189,3 +191,406 @@ except explicitly enabling SCMI with "arm_sci" xl.cfg option. -> xen,reg = <0x0 0x47ff0000 0x0 0x1000 0x0 0x22001000>; -> xen,force-assign-without-iommu; }; + +SCMI SMC multi-agent driver (EL3) +------------------------------------- + +The SCMI SMC multi-agent driver enables support for ARM EL3 Trusted Firmware-A (TF-A) which +provides SCMI interface with multi-agent support, as shown below. + +:: + + +-----------------------------------------+ + | | + | EL3 TF-A SCMI |Quoted 8 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 212
Quoted 7 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +7
-0+ +-------+--+-------+--+-------+--+-------++ + |shmem1 | |shmem0 | |shmem2 | |shmemX | + +-----+-+ +---+---+ +--+----+ +---+---+ + smc-id1 | | | | + agent1 | | | | + +-----v--------+---------+-----------+----+ + | | | | |Xen, I believe?
Quoted 5 lines
It is. But in terms of SCMI this is privileged agent. Haven't mentioned Xen here for the sake of
diagram simplicity (just don't see a good place whre I can place "Xen" in this diagram. The main idea is
I think you can place "Xen" in the centre. There is free space for it fit. Just add a new line, so it is nice and centered, like this:
+ | | Xen | | |
Quoted 54 lines
that driver leaves scmi privileged agent for itself (agent1 in our case) regardless where this driver runs.
This format was taken since driver itself is avare about the domains and channels.
Quoted 12 lines
Quoted 12 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +12
-0+ | | | | | + +--------------+---------+-----------+----+ + smc-id0 | smc-id2| smc-idX| + agent0 | agent2 | agentX | + | | | + +----v---+ +--v-----+ +--v-----+ + | | | | | | + | Dom0 | | Dom1 | | DomX | + | | | | | | + | | | | | | + +--------+ +--------+ +--------+ +Quoted 8 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 230
Quoted 6 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +6
-0+The EL3 SCMI multi-agent firmware is expected to provide SCMI SMC shared-memory transport +for every Agent in the system. The SCMI Agent transport channel defined by pair: + +- smc-id: SMC function id used for Doorbell +- shmem: shared memory for messages transfer, **Xen page aligned**. + Shared memory is mapped with the following flags: MT_DEVICE_nGnRE and _PAGE_DEVICE, indicating that thisDo we have any line length limitation for .rst files? This one is 114 characters long.
rstcheck gives 0 errors, but I can reformat it with maxline 120.
Quoted 20 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 236
Quoted 6 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +6
-0+ memory is mapped as device memory. + +The following SCMI Agents are expected to be defined by SCMI FW to enable SCMI multi-agent functionality +under Xen: +- +- Xen management agent: trusted agents that accesses to the Base Protocol commands to configure"trusted agent", not "agents"
also, "that accesses the Base Protocol commands to configure..." or "that has access to the Base Protocol commands to configure..."
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 237
Quoted 1 line
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +1
-0+ agent specific permissions"agent-specific"
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 238
Quoted 1 line
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +1
-0+- OSPM VM agents: non-trusted agent, one for each Guest domain which is allowed direct HW access."non-trusted agents". Also, double space between "is" and "allowed"
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 239
Quoted 1 line
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +1
-0+ At least one OSPM VM agent has to be provided by FW if HW is handled only by Dom0 or Driver Domain."Hardware Domain", probably
Quoted 7 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 244
Quoted 5 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +5
-0+ +The EL3 SCMI FW is expected to implement following Base protocol messages: + +- BASE_DISCOVER_AGENT (required for Xen; required for secondary agents without ``reg``) +- BASE_RESET_AGENT_CONFIGURATION (optional)How Xen can guarantee that SCMI state is sane, if it can't reset agent during domain destruction?
Quoted 6 lines
If this command is not implemented by the SCP firmware, but the firmware provides
agent_num> 1, then it is the responsibility of the SCP firmware. We made this optional to cover exactly this case — where we don't haveRESET_AGENT_CONFIGURATIONbut still haveagent_num> 1, which could be applicable to a dom0less configuration (for example) and should be used carefully by developers.Okay, I see... On one hand it is not worse than the current state of affairs, when we just destroying a domain and leaving its devices in undetermined state. On other hand, SCMI is meant to resolve this particular problem, so it will be strange to have SCMI but not to have this particular feature. Maybe it is worth to write a huge warning if a SCMI-enabled domain is destroyed, but we can't call RESET for it?
Quoted 2 lines
Looks like I overlooked this case when reviewed "xen/arm: scmi:
introduce SCI SCMI SMC multi-agent driver"this could be done. Will add huge warning.
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 245
Quoted 1 line
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +1
-0+- BASE_SET_DEVICE_PERMISSIONS (optional)If this is optional, does it mean that each agent will have access to all devices in the system?
Probably. But that doesn't mean it's the only case. For example, a resource could be acquired on first access (not a real-world case, but it's possible). So we can't make this decision on behalf of the SCP firmware.
Quoted 7 lines
Again, this might be not what user wants or expects. And it is even worse then the previous case, because without SCMI I am sure that if I didn't gave a domain access to a peripheral, then it can't affects its state. If you really want to support such case, then you should ensure that only HWDOM can access SCMI of SCP does not support
SET_DEVICE_PERMISSIONS.When only the HWDOM has access to the SCMI of the SCP without
SET_DEVICE_PERMISSIONSsupport, there is no point in using scmi-multiagent at all. In this case, scmi-single-agent (which has already been merged) should be used instead.Quoted 5 lines
So I think we should probably make
SET_DEVICE_PERMISSIONSsupport mandatory in this case and fail if it is not supported. We should also mention this in the documentation.What do you think?
Well, this certainly is an option. In other words, I am fine with that.
Quoted 67 lines
Quoted 47 lines
[...]
Quoted 36 lines
Quoted 35 lines
Quoted 1 line
+Configure SCMI for Dom0
"How to configure..." or "Configuring..."
Quoted 10 lines
+^^^^^^^^^^^^^^^^^^^^^^^
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +9
-0+Set the Dom0 SCMI agent ID in the device tree using the Xen SCMI container under ``/chosen``. +Add ``xen,dom0-sci-agent-id`` to the ``xen,sci`` node. If the property is absent, SCMI stays +disabled for Dom0 and the SCMI nodes are removed from Dom0 DT. + +.. code-block:: dts + + chosen { + xen { + ranges;docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 467
Quoted 10 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +10
-0+ xen_scmi_config { + compatible = "xen,sci"; + xen,dom0-sci-agent-id = <0>; /* Dom0 agent ID */ + /* agents, shared memory and scmi_xen as shown above */ + }; + }; + }; + +The Host DT ``/firmware/scmi`` node is copied to the Dom0 DT unmodified. However, for Dom0 SCMI +configuration, Xen relies on the ``agents`` child and the ``xen,dom0-sci-agent-id``"child node"
docs/hypervisor-guide/arm/firmware/arm-scmi.rst except explicitly enabling SCMI with "arm_sci" xl.cfg option. · line 475
Quoted 8 lines
docs/hypervisor-guide/arm/firmware/arm-scmi.rst +8
-0+property from the ``xen,sci`` container under ``/chosen``. If the ``/firmware/scmi`` node is +missing or disabled, or if ``xen,dom0-sci-agent-id`` is not provided, the Dom0 SCMI agent will not +be configured. + +.. note:: + + The ``xen,dom0-sci-agent-id`` value must match the ``func_id`` and ``shmem`` pairing provided by + the EL3 firmware for Dom0 (for example in the ``/firmware/scmi`` node).Well, maybe better to use phandle then? Like
Quoted 1 line
xen,dom0-sci-agent-id=<&agent@0>
Quoted 8 lines
It is used to set
arm_sci_agent_idin the config and works the same way as libxl, so we maintain consistent approaches for settingdom_idin both libxl and the device-tree.Additionally, the
agent_idis used when acquiring thescmi_channel.I don't see any particular benefits to using a phandle here, but perhaps I've missed something. Could you clarify?
Quoted 8 lines
Having less room for user error. Having phandle, you can extract both
func_idand shmem from it. But, thinking of it, you can extract shmem just by looking atfunc_id... On other hand, it is better to move checks to the compilation time. 'dtc' will tell you if it can't find a phandle, but it will not tell you if numericagent_iddoes not match any entry in that agents array.[...]
Moving the checks to 'dtc' compilation time sounds reasonable.
I can reorganize this in the following way:
1) Make it look like:xen,dom0-sci-agent = <&agent@0>;2) For dom0less configuration:
change: xen,sci-agent-id = <2>; to look like xen,sci-agent = <&agent@X>;3) for xen-scmi-agent node add xen,sci-agent-id optional property.
Quoted 8 lines
Quoted 1 line
Does this match what you had in mind?
Yes.
Just a small note: it will not work exactly like that, because agent@x is a node name, not a node label. You'll encounter an error if you'll try to compile device tree with this exact code.
[...]
One note regarding this approach that I just noticed:
If we move to the following format:
xen,dom0-sci-agent = <&scmi_agent_dom0>; //
&scmi_agent_dom0 is link to agent@0:
we run into the following problem:
scmi_agent_dom0: agent@0 {
reg = <0>; /* optional field */
compatible = "xen,scmi-agent";
arm,smc-id = <0x82000002>;
shmem = <&scmi_shm_0>;
};Here, we store the agent_id for agent@0 in the reg property. The issue is that reg is optional, and if it is omitted, we have to request the agent_ids using the SCMI_BASE_DISCOVER_AGENT SCMI call.
This means that when we set arm_sci_agent_id in the create_dom0 function, we need to access the scmi_multiagent driver, which requires an additional callback to be added to the sci.h interface.
I'm writing this to let you know that these changes will require modifications to the sci interface. Please reach out if you have any thoughts or questions.
Thank you!