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

hvf: support ARM PSCI SYSTEM_OFF #196

Merged
merged 1 commit into from
Jun 7, 2024
Merged

hvf: support ARM PSCI SYSTEM_OFF #196

merged 1 commit into from
Jun 7, 2024

Conversation

djs55
Copy link
Contributor

@djs55 djs55 commented Jun 7, 2024

This is part of the ARM Power State Coordination Interface, see https://developer.arm.com/documentation/den0022/f/?lang=en

There are 2 calls: 1 for "system off" and one for "system reset". Previously we supported only "system reset", add support for "system off" as well.

I tested with a small Go init process which ran:

func main() {
        _ = syscall.Reboot(syscall.LINUX_REBOOT_CMD_POWER_OFF)
}

Before the patch it would keep running. After this patch it powers off as expected.

@@ -389,7 +389,8 @@ impl<'a> HvfVcpu<'a> {
let ret = match val {
0x8400_0000 => Some(2),
0x8400_0006 => Some(2),
0x8400_0009 => return Ok(VcpuExit::Shutdown),
0x8400_0008 => return Ok(VcpuExit::Shutdown), // ARM Power State Coordination Interface SYSTEM_OFF
0x8400_0009 => return Ok(VcpuExit::Shutdown), // ARM Power State Coorgination Interface SYSTEM_RESET
Copy link
Contributor

Choose a reason for hiding this comment

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

Coordination

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! I've pushed a fix

This is part of the ARM Power State Coordination Interface, see
https://developer.arm.com/documentation/den0022/f/?lang=en

There are 2 calls: 1 for "system off" and one for "system reset". Previously
we supported only "system reset", add support for "system off" as well.

I tested with a small Go `init` process which ran:
```
func main() {
        _ = syscall.Reboot(syscall.LINUX_REBOOT_CMD_POWER_OFF)
}
```
Before the patch it would keep running. After this patch it powers off as expected.

Signed-off-by: David Scott <dave@recoil.org>
@slp
Copy link
Contributor

slp commented Jun 7, 2024

Tested here with systemctl poweroff and works fine. All checks are green, so let's get this one merged. Thanks!

@slp slp merged commit aac636a into containers:main Jun 7, 2024
5 checks passed
@djs55 djs55 deleted the power branch June 7, 2024 12:43
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