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

Add PSCI driver #30911

Merged
merged 2 commits into from
Jan 18, 2021
Merged

Add PSCI driver #30911

merged 2 commits into from
Jan 18, 2021

Conversation

carlocaione
Copy link
Collaborator

A bit of rationale behind this PR.

@MrVan submitted in #30676 the PR to enable SMP on AArch64. As I wrote in a review to that PR I do not particularly like the approach of using arch-specific code to interface with the PSCI firmware.

PSCI interface needs a proper driver that uses the DTS to detect the correct parameters, especially the conduit (and currently only that). This is particularly important because the choice of having SMC or HVC as conduit really depends on whether we are running an hypervisor or not in EL2, so this must be something configurable at DTS (board) level.

So here it is a proper PSCI driver with support for PSCI 0.2 and PSCI 1.0, enabled using the DT and also a tiny test to make sure that everything is working correctly.

@github-actions github-actions bot added area: API Changes to public APIs area: ARM ARM (32-bit) Architecture area: ARM_64 area: Boards area: Devicetree area: Devicetree Binding PR modifies or adds a Device Tree binding area: Tests Issues related to a particular existing or missing test labels Dec 19, 2020
@MrVan
Copy link
Collaborator

MrVan commented Dec 22, 2020

@carlocaione Thanks for adding psci support, your code looks good to me. Approved.

@MrVan MrVan mentioned this pull request Dec 25, 2020
@carlocaione
Copy link
Collaborator Author

Can we merge this?

Copy link
Contributor

@andrewboie andrewboie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks great but it would be better to have code coverage of the syscalls by running the test function in user mode, and have the test exercise all of the APIs.

Firmware implementing the PSCI functions described in ARM document
number ARM DEN 0022A ("Power State Coordination Interface System
Software on ARM processors") can be used by Zephyr to initiate various
CPU-centric power operations.

It is needed for virtualization, it is used to coordinate OSes and
hypervisors and it provides the functions used for SMP bring-up such as
CPU_ON and CPU_OFF.

A new PSCI driver is introduced to setup a proper subsystem used to
communicate with the PSCI firmware, implementing the basic operations:
get_version, cpu_on, cpu_off and affinity_info.

The current implementation only supports PSCI 0.2 and PSCI 1.0

The PSCI conduit (SMC or HVC) is setup reading the corresponding
property in the DTS node.

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
@carlocaione
Copy link
Collaborator Author

Overall looks great but it would be better to have code coverage of the syscalls by running the test function in user mode, and have the test exercise all of the APIs.

@andrewboie I addressed your points. The only API I couldn't test was psci_cpu_off (because that actually shuts the CPU off).

Add a simple test to the the PSCI driver

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: API Changes to public APIs area: ARM ARM (32-bit) Architecture area: Boards area: Devicetree Binding PR modifies or adds a Device Tree binding area: Devicetree area: Process area: Tests Issues related to a particular existing or missing test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants