Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introducing SCMI-mediator feature. #216

Open
wants to merge 14 commits into
base: xen-4.19-xt0.1
Choose a base branch
from

Conversation

oleksiimoisieiev
Copy link

This patchseries are taken from rpi5_dev branch and already reviewed.

SCMI-Mediator redistributes SCMI requests from the Domains to the SCMI Server(ARM-TF). SCMI Server support for the bootloader is required.
This feature allows Domains to access clocks/resets/power-domains etc. via SCMI protocol (see DEN0056 document for details).
Also it allows setting correct permissions to set the resources that can be used by the particular Domain.
Both toolstack and dom0less are supported.

Config parameters needed to enable scmi feature:

CONFIG_ARM_SCI=y
CONFIG_SCMI_SMC=y
CONFIG_HOST_DTB_EXPORT=y
CONFIG_ACCESS_CONTROLLER=y

DomU configuration:

arm_sci="scmi_smc"

DomU partial dtb:

/{
firmware {
scmi {
scmi_reset:protocol@16 {
};
scmi_pinctrl:protocol@19 {
mux1: mux1 {
};
mux2: mux2 {
};
};
};
passthrough {
dev1 {
resets = <&scmi_reset 1>;
pinctrl-0 = <&mux1>;
};
dev2 {
pinctrl-0 = <&mux2>;
};
};
};

TODO:
add new syscall to flask.

lorc and others added 14 commits October 8, 2024 18:42
access-controllers are generic binding from the Linux Kernel
for service/hardware that allow device partitioning.
In Xen it is used to provide SCMI device ID for the SCMI server.
This mechanism is used in BASE_SET_DEVICE_PERMISSIONS to
set permissions for Agents.

Signed-off-by: Volodymyr Babchuk <[email protected]>
Reviewed-by: Grygorii Strashko <[email protected]>
Assign arm,scmi-shmem compatible device device to Xen. This was done
to prevent copying this node to the Dom0 device tree. arm,scmi-shmem
node will be created for Domain-0 after assigning agent-id by the SCMI.

Signed-off-by: Volodymyr Babchuk <[email protected]>
Reviewed-by: Grygorii Strashko <[email protected]>
This patch adds the basic framework for SCI mediator.
SCI is System Control Interface, which is designed to redirect
requests from the Domains to Firmware. This will allow the devices,
passed-through to the different Domains, to access to the System Controls
(such as clocks/resets etc) by sending requests to the firmware.
Xen mediates requests between the Domains and the Firmware, also it is
responsible for permission handling during Domain crateion.

SCI mediator register itself with REGISTER_SCI_MEDIATOR() macro.

At run-time, during initialization, framework calls probe for the first
matching device in the device-tree. When no device-tree is present - the
first registered mediator should be probed.

Signed-off-by: Oleksii Moisieiev <[email protected]>
Signed-off-by: Ihor Usyk <[email protected]>
Reviewed-by: Grygorii Strashko <[email protected]>
This is the implementation of SCI interface, called SCMI-SMC driver,
which works as the mediator between XEN Domains and Firmware (SCP, ATF etc).
This allows devices from the Domains to work with clocks, resets and
power-domains without access to CPG.

Originally, cpg should be passed to the domain so it can work with
power-domains/clocks/resets etc. Considering that cpg can't be split between
the Domains, we get the limitation that the devices, which are using
power-domains/clocks/resets etc, couldn't be split between the domains.
The solution is to move the power-domain/clock/resets etc to the
Firmware (such as SCP firmware or ATF) and provide interface for the
Domains. XEN should have an entity, caled SCI-Mediator, which is
responsible for messages redirection between Domains and Firmware and
for permission handling.

The following features are implemented:
- request SCMI channels from ATF and pass channels to Domains;
- set device permissions for Domains based on the Domain partial
device-tree. Devices with permissions are able to work with clocks,
resets and power-domains via SCMI;
- redirect scmi messages from Domains to ATF.

Signed-off-by: Oleksii Moisieiev <[email protected]>
Signed-off-by: Ihor Usyk <[email protected]>
Reviewed-by: Grygorii Strashko <[email protected]>
dt_find_node_by_phandle definition lacks description comment.
Add function description to the public call.

Signed-off-by: Ihor Usyk <[email protected]>
Signed-off-by: Oleksii Moisieiev <[email protected]>
Reviewed-by: Grygorii Strashko <[email protected]>
This feature introduces SCMI support for Dom0less domains.
During domain creation the following configration is expected:
Partial device-tree example:

/ {
	firmware {
		scmi {
			scmi_reset: protocol@19 {
			};
			scmi_pinctrl: protocol@19 {
				sdio_mux: mux {
				};
			};
		};
	};
	passthrough {
		sdio {
			pinctrl-0 = <&sdio_mux>;
			resets = <&scmi_reset 0x1>;
		};
	};
};

Xen parses partial device three and gather nodes that are actually
used. This can be determined by phandle in partial-device tree for
this node. The next step is to create "scmi" node in Domain
device-tree and copy protocol information from Xen device tree
according to the setup provided in partial device-tree. Information
will be copied only for the nodes that are used by passthrough devices.

Signed-off-by: Volodymyr Babchuk <[email protected]>
Signed-off-by: Oleksii Moisieiev <[email protected]>
Reviewed-by: Grygorii Strashko <[email protected]>
libxenhypfs will return blob properties as is. This output can be used
to retrieve information from the hypfs. Caller is responsible for
parsing property value.

Signed-off-by: Oleksii Moisieiev <[email protected]>
Reviewed-by: Volodymyr Babchuk <[email protected]>
If enabled, host device-tree will be exported to hypfs and can be
accessed through /devicetree path.
Exported device-tree has the same format, as the device-tree
exported to the sysfs by the Linux kernel.
This is useful when XEN toolstack needs an access to the host device-tree.

Signed-off-by: Oleksii Moisieiev <[email protected]>
Reviewed-by: Volodymyr Babchuk <[email protected]>
This enumeration sets SCI type for the domain. Currently there is
two possible options: either 'none' or 'scmi_smc'.

'none' is the default value and it disables SCI support at all.

'scmi_smc' enables access to the Firmware from the domains using SCMI
protocol and SMC as transport.

Signed-off-by: Oleksii Moisieiev <[email protected]>
Reviewed-by: Volodymyr Babchuk <[email protected]>
Mapping for the hardware domain should be done during domain
construciton as it is done for other domains.

Signed-off-by: Oleksii Moisieiev <[email protected]>
Reviewed-by: Volodymyr Babchuk <[email protected]>
Integration of the SCMI-Mediator feature to the Domain-0 construction
process. It includes shared memory node creation and mapping with
phandle update on the scmi node.
When creating hardware domain there is a need to set correct phandle
to the "shmem" property on the scmi node. Shared memory node is
generated while scmi node is copied as is from Xen device-tree.
Correct shmem phandle is set during domain device-tree processing.

Signed-off-by: Oleksii Moisieiev <[email protected]>
Reviewed-by: Volodymyr Babchuk <[email protected]>
Assgin devices to the access-controller during Domain-0 build.
This registers devices in the SCMI server for the Domain-0.

Signed-off-by: Oleksii Moisieiev <[email protected]>
Reviewed-by: Volodymyr Babchuk <[email protected]>
Remove space before function definition.

Signed-off-by: Oleksii Moisieiev <[email protected]>
Reviewed-by: Volodymyr Babchuk <[email protected]>
Integration of the SCMI mediator with xen libs:
- add hypercalls to aquire SCI channel and set device permissions
for DomUs;
- add SCMI_SMC nodes to DomUs device-tree based on partial device-tree;
- SCI requests redirection from DomUs to Firmware.

Signed-off-by: Oleksii Moisieiev <[email protected]>
Reviewed-by: Volodymyr Babchuk <[email protected]>
@GrygiriiS GrygiriiS mentioned this pull request Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants