Skip to content

Scmi rcar#218

Merged
otyshchenko1 merged 14 commits intoxen-troops:xen-4.19-xt0.2_v4h_demofrom
GrygiriiS:scmi_rcar
Oct 26, 2024
Merged

Scmi rcar#218
otyshchenko1 merged 14 commits intoxen-troops:xen-4.19-xt0.2_v4h_demofrom
GrygiriiS:scmi_rcar

Conversation

@GrygiriiS
Copy link
Copy Markdown

This PR is in general the same as #216
except number of build issues fixed.

On Gen4 V4H

  • boot tested without SCMI enabled in DT.
  • boot tested with SCMI enabled in DT (not integrated).

@GrygiriiS
Copy link
Copy Markdown
Author

lorc and others added 14 commits October 26, 2024 11:32
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 <volodymyr_babchuk@epam.com>
Reviewed-by: Grygorii Strashko <grygorii_strashko@epam.com>
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 <volodymyr_babchuk@epam.com>
Reviewed-by: Grygorii Strashko <grygorii_strashko@epam.com>
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 <oleksii_moisieiev@epam.com>
Signed-off-by: Ihor Usyk <ihor.usyk@gmail.com>
Reviewed-by: Grygorii Strashko <grygorii_strashko@epam.com>
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 <oleksii_moisieiev@epam.com>
Signed-off-by: Ihor Usyk <ihor.usyk@gmail.com>
Reviewed-by: Grygorii Strashko <grygorii_strashko@epam.com>
dt_find_node_by_phandle definition lacks description comment.
Add function description to the public call.

Signed-off-by: Ihor Usyk <ihor_usyk@epam.com>
Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
Reviewed-by: Grygorii Strashko <grygorii_strashko@epam.com>
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 <volodymyr_babchuk@epam.com>
Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
Reviewed-by: Grygorii Strashko <grygorii_strashko@epam.com>
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 <oleksii_moisieiev@epam.com>
Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
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 <oleksii_moisieiev@epam.com>
Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
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 <oleksii_moisieiev@epam.com>
Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
Mapping for the hardware domain should be done during domain
construciton as it is done for other domains.

Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
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 <oleksii_moisieiev@epam.com>
Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
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 <oleksii_moisieiev@epam.com>
Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
Remove space before function definition.

Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@epam.com>
Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
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 <oleksii_moisieiev@epam.com>
Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
@GrygiriiS
Copy link
Copy Markdown
Author

Can it be merged pls?

@otyshchenko1 otyshchenko1 merged commit 6ef6bb8 into xen-troops:xen-4.19-xt0.2_v4h_demo Oct 26, 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.

5 participants