All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC v2 0/8] Introduce SCI-mediator feature
@ 2022-02-08 18:00 Oleksii Moisieiev
  2022-02-08 18:00 ` [RFC v2 1/8] xen/hypfs: support fo nested dynamic hypfs nodes Oleksii Moisieiev
                   ` (7 more replies)
  0 siblings, 8 replies; 45+ messages in thread
From: Oleksii Moisieiev @ 2022-02-08 18:00 UTC (permalink / raw)
  To: xen-devel
  Cc: Oleksii Moisieiev, Juergen Gross, Wei Liu, Stefano Stabellini,
	Julien Grall, Volodymyr Babchuk, Bertrand Marquis, Andrew Cooper,
	George Dunlap, Jan Beulich, Nick Rosbrook, Anthony PERARD,
	Paul Durrant

Introducing the feature, called SCI mediator.
It's purpose is to redirect SCMI requests from the domains to firmware
(SCP, ATF etc), which controls the power/clock/resets etc.
The idea is to make SCP firmware (or similar, such as AT-F) responsible for
control power/clock/resets and provide SCMI interface so controls can be shared
between the Domains.
Originally, we've met a problem, that the devices, shared between different
Domains, can't have an access to HW registers to work with clocks/resets/power
etc. You have to pass cpg to the Domain, so the devices can access HW directly.
The solution for this is to move HW controls over power/clock/resets to
SCP firmware and use Linux-kernel SCMI drivers to pass requests to SCP.
Xen is responsible for permissions setting, so Domain can access only to
power/clock/resets which are related to this Domain. Also XEN is the mediator
which redirects SCMI requests, adding agentID so firmware should know the
sender.
SMC is currently used as transport, but this should be configurable.

Here is the high level design:

ARM_SCI (System Control Interface) feature can be enabled in xen_config:
> CONFIG_ARM_SCI=y
Mediator can be configured:
> CONFIG_SCMI_SMC=y

Currently, only SCMI_SMC mediator is implemented, which using shared memory
region to communicate with firmware and SMC as transport.

Xen scmi should be configured in the device-tree.
Format is the following:
	cpu_scp_shm: scp-shmem@0x53FF0000 {
		compatible = "arm,scmi-shmem";
		reg = <0x0 0x53FF0000 0x0 0x1000>;
	};

	firmware {
		scmi {
			compatible = "arm,scmi-smc";
			arm,smc-id = <0x82000002>;
			shmem = <&cpu_scp_shm>;
			#address-cells = <1>;
			#size-cells = <0>;

			scmi_power: protocol@11 {
				reg = <0x11>;
				#power-domain-cells = <1>;
			};

			scmi_clock: protocol@14 {
				reg = <0x14>;
				#clock-cells = <1>;
			};

			scmi_reset: protocol@16 {
				reg = <0x16>;
				#reset-cells = <1>;
			};
		};
	};

Where:
&cpu_scp_shm is the shared memory for scmi buffers;
0x53FF0000, size 0x1000 is the platform specific free address, which provide
space for the communication.
&scmi node, which should be copied to Dom0 device-tree.

Device configured to use scmi: 
&avb {
	scmi_devid = <0>;
	clocks = <&scmi_clock 0>;
	power-domains = <&scmi_power 0>;
	resets = <&scmi_reset 0>;
};

Where:
scmi_devid - id from the firmware, which is assigned for AVB.

During initialization, XEN scans probes the first SCI-mediator driver which has
matching node in the device-tree. If no device-tree was provided, then the
first registered mediator driver should be probed.

DomX should be configured:
Device-tree should include the same nodes, described above.
&cpu_scp_shm should be altered during domain creation. Xen allocates free page
from the memory region, provided in &cpu_scp_shm in XEN device-tree, so each
domain should have unique page. Nodes &cpu_scp_shm and /firmware/scmi should be
copied from partial device-tree to domain device-tree, so kernel can initialize
scmi driver.

SCI mediator can be enabled in dom.cfg the following way:
>arm_sci = "scmi_smc"

which sets scmi_smc to be used for the domain.
--
Changes since v1:

- renamed sci to arm_sci
- updated golang bindings
- reused XEN_DOMCTL_assign_device logic to add arm_sci devices instead of
adding new hypercall
- minor style changes
- fixed arm32 compilation issues
- use ioremap_cache instead of vmap to map shared memory for SCMI
- introduced memcpy_fromio and memcpy_toio fucntions instead of memcpy, moved
from Linux kernel source code
- use DOMID_XEN for HYP_CHANNEL in channel_list
- export host device-tree to hypfs so toolstack can access host device-tree nodes
- create arm,scmi-shmem node from scratch for the domain device-tree
- create arm,scmi_smc from scratch if it wasn't provided in partial device-tree
- removed xc_domain_add_sci_device function 
- do not use linux,scmi_mem to describe scmi shared memory
- define static address for the SCMI page in the domU
- introduced config parameter force_assign_without_iommu = 1 to domain config
- require force_assign_without_iommu parameter to assign non-DMA masters
present in dtdev
- unmap memory after sending discover agent on SCMI init stage
--
Oleksii Moisieiev (8):
  xen/hypfs: support fo nested dynamic hypfs nodes
  libs: libxenhypfs - handle blob properties
  xen/arm: Export host device-tree to hypfs
  xen/arm: add generic SCI mediator framework
  xen/arm: introduce SCMI-SMC mediator driver
  tools/arm: Introduce force_assign_without_iommu option to xl.cfg
  tools/arm: add "arm_sci" option to xl.cfg
  xen/arm: add SCI mediator support for DomUs

 MAINTAINERS                           |   6 +
 docs/man/xl.cfg.5.pod.in              |  29 +
 tools/golang/xenlight/helpers.gen.go  |   7 +
 tools/golang/xenlight/types.gen.go    |   8 +
 tools/include/libxl.h                 |   5 +
 tools/include/xenctrl.h               |   3 +
 tools/libs/hypfs/core.c               |   2 -
 tools/libs/light/libxl_arm.c          | 217 +++++-
 tools/libs/light/libxl_create.c       |  44 +-
 tools/libs/light/libxl_internal.h     |   3 +
 tools/libs/light/libxl_types.idl      |   7 +
 tools/xl/xl_parse.c                   |  12 +
 xen/arch/arm/Kconfig                  |  19 +
 xen/arch/arm/Makefile                 |   2 +
 xen/arch/arm/domain.c                 |  22 +
 xen/arch/arm/domain_build.c           |  11 +
 xen/arch/arm/domctl.c                 |   7 +
 xen/arch/arm/host_dtb_export.c        | 307 +++++++++
 xen/arch/arm/sci/Kconfig              |  10 +
 xen/arch/arm/sci/Makefile             |   2 +
 xen/arch/arm/sci/sci.c                | 152 ++++
 xen/arch/arm/sci/scmi_smc.c           | 959 ++++++++++++++++++++++++++
 xen/arch/arm/setup.c                  |   1 +
 xen/arch/arm/vsmc.c                   |   5 +-
 xen/arch/arm/xen.lds.S                |   7 +
 xen/common/domain.c                   |   2 +-
 xen/common/hypfs.c                    |  83 ++-
 xen/drivers/passthrough/device_tree.c |  19 +-
 xen/drivers/passthrough/iommu.c       |   5 +-
 xen/include/asm-arm/domain.h          |   4 +
 xen/include/asm-arm/sci/sci.h         | 162 +++++
 xen/include/public/arch-arm.h         |  15 +
 xen/include/public/device_tree_defs.h |   1 +
 xen/include/public/domctl.h           |   5 +-
 xen/include/xen/hypfs.h               |  14 +-
 xen/include/xen/iommu.h               |   3 +
 36 files changed, 2122 insertions(+), 38 deletions(-)
 create mode 100644 xen/arch/arm/host_dtb_export.c
 create mode 100644 xen/arch/arm/sci/Kconfig
 create mode 100644 xen/arch/arm/sci/Makefile
 create mode 100644 xen/arch/arm/sci/sci.c
 create mode 100644 xen/arch/arm/sci/scmi_smc.c
 create mode 100644 xen/include/asm-arm/sci/sci.h

-- 
2.27.0


^ permalink raw reply	[flat|nested] 45+ messages in thread

end of thread, other threads:[~2022-06-03 13:44 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-08 18:00 [RFC v2 0/8] Introduce SCI-mediator feature Oleksii Moisieiev
2022-02-08 18:00 ` [RFC v2 1/8] xen/hypfs: support fo nested dynamic hypfs nodes Oleksii Moisieiev
2022-02-10  7:34   ` Juergen Gross
2022-02-11  8:16     ` Oleksii Moisieiev
2022-02-11 13:28       ` Juergen Gross
2022-02-11 13:32         ` Oleksii Moisieiev
2022-02-08 18:00 ` [RFC v2 2/8] libs: libxenhypfs - handle blob properties Oleksii Moisieiev
2022-02-09 13:47   ` Oleksandr Andrushchenko
2022-02-09 14:01     ` Jan Beulich
2022-02-09 14:04       ` Oleksandr Andrushchenko
2022-02-09 14:04   ` Juergen Gross
2022-02-08 18:00 ` [RFC v2 3/8] xen/arm: Export host device-tree to hypfs Oleksii Moisieiev
2022-02-08 18:26   ` Julien Grall
2022-02-09 10:20     ` Oleksii Moisieiev
2022-02-09 12:17       ` Julien Grall
2022-02-09 14:17         ` Oleksii Moisieiev
2022-02-09 18:51         ` Oleksii Moisieiev
2022-02-09 19:34           ` Julien Grall
2022-02-10  9:38             ` Oleksii Moisieiev
2022-02-09 14:03     ` Juergen Gross
2022-02-08 18:00 ` [RFC v2 4/8] xen/arm: add generic SCI mediator framework Oleksii Moisieiev
2022-02-08 18:00 ` [RFC v2 5/8] xen/arm: introduce SCMI-SMC mediator driver Oleksii Moisieiev
2022-02-09 15:02   ` Oleksandr Andrushchenko
2022-02-09 15:23     ` Julien Grall
2022-02-11  8:46   ` Bertrand Marquis
2022-02-11 10:44     ` Oleksii Moisieiev
2022-02-11 11:18       ` Bertrand Marquis
2022-02-11 11:55         ` Oleksii Moisieiev
2022-02-11 23:35           ` Stefano Stabellini
2022-02-12 12:43         ` Julien Grall
2022-02-14 11:13           ` Oleksii Moisieiev
2022-02-14 11:27             ` Bertrand Marquis
2022-02-14 11:51               ` Oleksii Moisieiev
2022-02-14 22:05                 ` Stefano Stabellini
2022-02-16 17:41                   ` Oleksii Moisieiev
2022-02-08 18:00 ` [RFC v2 6/8] tools/arm: Introduce force_assign_without_iommu option to xl.cfg Oleksii Moisieiev
2022-02-17 14:52   ` Anthony PERARD
2022-02-18  8:19     ` Oleksii Moisieiev
2022-02-17 15:20   ` Julien Grall
2022-02-18  9:16     ` Oleksii Moisieiev
2022-02-18 10:17       ` Julien Grall
2022-02-21 18:39         ` Oleksii Moisieiev
2022-06-03 13:43   ` Jan Beulich
2022-02-08 18:00 ` [RFC v2 7/8] tools/arm: add "arm_sci" " Oleksii Moisieiev
2022-02-08 18:00 ` [RFC v2 8/8] xen/arm: add SCI mediator support for DomUs Oleksii Moisieiev

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.