|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v6 0/5] 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 0 - 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: - update iommu_do_dt_domctl() to check for dt_device_is_protected() and not fail if DT device is not protected by IOMMU -add chained call to sci_do_domctl() to do_domctl() Patch 3 - xen/arm: scmi: introduce SCI SCMI SMC multi-agent driver - added "scmi-secondary-agents" and "#scmi-secondary-agent-cells" property to "xen,config" node in "chosen" to inform SCI SCMI multi-agent driver about available agents and their configuration. It defines <agent_id> to <smc-id,scmi_shm> map. This option is Xen specific as Xen is the only one entry in the system which need to know about SCMI multi-agent support and configuration. - each guest using SCMI should be configured with SCMI agent_id, so SCMI FW can implement Agent-specific permission policy. -- dom0: dom0_scmi_agent_id=<agent_id> in Xen command line option -- toolstack: arm_sci = "type=scmi_smc_multiagent,agent_id=<agent_id>" -- dom0less: "xen,sci_type", "xen,sci_agent_id" properties in "xen,domain" nodes. - factored out SCMI generic definitions (re-usable) - factored out SCMI shmem code (re-usable) - the SCMI passthrough configuration for guest domains is similar to any other HW passthrough cfg. Patch 4 - docs: arm: add SCI SCMI SMC multi-agent driver docs - add SCI SCMI SMC multi-agent driver documentation. Add separate SCMI DT node for Xen management agent under "xen,config" node under chosen. All Xen-specific configuration provided under "/chosen" node. This approach allows to isolate modifications to Host DT only under "/chosen" node. This approach provides the following device tree (DT) parameters (placed under xen,config node): - "scmi-secondary-agents": A Xen-specific parameter under the "/chosen" node, which describes the SCMI agent configuration for the domains. - the SCMI configuration for Xen (privileged agent) and the shared memory configuration for all agents are provided under the "/chosen" node and are used strictly by Xen for its initial configuration. - the scmi_shm and SCMI configuration for Dom0 are placed in the "/firmware/scmi" node so that they can be moved to Dom0 without any changes. This configuration allows the use of Xen-specific nodes to provide information strictly needed by Xen while using the default SCMI configuration for Dom0 and other domains. As a result, no additional bindings need to be introduced to the device tree. This simplifies the Xen SCMI multi-agent configuration and utilizes generic device tree bindings for the domains. 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/cover.1644341635.git.oleksii_moisieiev@xxxxxxxx/ [2] RFC v3: https://patchwork.kernel.org/project/xen-devel/patch/20250311111618.1850927-1-grygorii_strashko@xxxxxxxx [3] RFC v5: https://lore.kernel.org/xen-devel/cover.1753184487.git.oleksii_moisieiev@xxxxxxxx/ [4] SCMI single-agent: https://lore.kernel.org/xen-devel/cover.1756995595.git.oleksii_moisieiev@xxxxxxxx/ 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 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: extend XEN_DOMCTL_assign_device to handle not only iommu docs: arm: add SCI SCMI SMC multi-agent driver docs Oleksii Moisieiev (3): 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 MAINTAINERS | 4 + SUPPORT.md | 11 + .../arm/firmware/arm-scmi.rst | 341 ++++++++ docs/man/xl.cfg.5.pod.in | 13 + docs/misc/arm/device-tree/booting.txt | 103 +++ docs/misc/xen-command-line.pandoc | 19 +- tools/libs/light/libxl_arm.c | 4 + tools/libs/light/libxl_types.idl | 4 +- tools/xl/xl_parse.c | 12 + xen/arch/arm/dom0less-build.c | 11 + xen/arch/arm/domain_build.c | 26 +- xen/arch/arm/firmware/Kconfig | 12 + xen/arch/arm/firmware/Makefile | 1 + xen/arch/arm/firmware/sci.c | 35 + xen/arch/arm/firmware/scmi-proto.h | 164 ++++ xen/arch/arm/firmware/scmi-shmem.c | 115 +++ xen/arch/arm/firmware/scmi-shmem.h | 45 + xen/arch/arm/firmware/scmi-smc-multiagent.c | 794 ++++++++++++++++++ xen/arch/arm/include/asm/firmware/sci.h | 14 + xen/arch/arm/include/asm/smccc.h | 1 + xen/common/domctl.c | 26 + xen/drivers/passthrough/device_tree.c | 6 + xen/include/public/arch-arm.h | 3 + xen/include/xen/lib/io.h | 83 ++ xen/lib/Makefile | 1 + xen/lib/arm/Makefile | 1 + xen/lib/arm/io.c | 102 +++ 27 files changed, 1948 insertions(+), 3 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/include/xen/lib/io.h create mode 100644 xen/lib/arm/Makefile create mode 100644 xen/lib/arm/io.c -- 2.34.1
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |