mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: Implement the power button method for AArch64
This commit implements the power button method for AArch64 using the PL061 GPIO controller. Signed-off-by: Henry Wang <Henry.Wang@arm.com>
This commit is contained in:
@@ -403,6 +403,10 @@ pub enum DeviceManagerError {
|
||||
/// Failed to do power button notification
|
||||
PowerButtonNotification(io::Error),
|
||||
|
||||
/// Failed to do AArch64 GPIO power button notification
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
AArch64PowerButtonNotification(devices::legacy::GPIODeviceError),
|
||||
|
||||
/// Failed to set O_DIRECT flag to file descriptor
|
||||
SetDirectIo,
|
||||
|
||||
@@ -3521,6 +3525,7 @@ impl DeviceManager {
|
||||
}
|
||||
|
||||
#[cfg(feature = "acpi")]
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
pub fn notify_power_button(&self) -> DeviceManagerResult<()> {
|
||||
self.ged_notification_device
|
||||
.as_ref()
|
||||
@@ -3530,6 +3535,17 @@ impl DeviceManager {
|
||||
.notify(AcpiNotificationFlags::POWER_BUTTON_CHANGED)
|
||||
.map_err(DeviceManagerError::PowerButtonNotification)
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
pub fn notify_power_button(&self) -> DeviceManagerResult<()> {
|
||||
self.gpio_device
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.lock()
|
||||
.unwrap()
|
||||
.trigger_key(3)
|
||||
.map_err(DeviceManagerError::AArch64PowerButtonNotification)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "acpi")]
|
||||
|
||||
Reference in New Issue
Block a user