mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-12-22 05:35:20 +00:00
devices: Add support for pvpanic device
Introduce emulation of pvpanic device to allow cloud hypervisor to get the notify from guest's pvpanic driver when guest kernel crash. Signed-off-by: Yi Wang <foxywang@tencent.com>
This commit is contained in:
parent
569a2a5f07
commit
ef67eab8c3
@ -19,6 +19,7 @@ pub mod interrupt_controller;
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
pub mod ioapic;
|
||||
pub mod legacy;
|
||||
pub mod pvpanic;
|
||||
pub mod tpm;
|
||||
|
||||
pub use self::acpi::{AcpiGedDevice, AcpiPmTimerDevice, AcpiShutdownDevice};
|
||||
|
24
devices/src/pvpanic.rs
Normal file
24
devices/src/pvpanic.rs
Normal file
@ -0,0 +1,24 @@
|
||||
// Copyright © 2023 Tencent Corporation
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
const PVPANIC_PANICKED: u8 = 1 << 0;
|
||||
const PVPANIC_CRASH_LOADED: u8 = 1 << 1;
|
||||
|
||||
/// A device for handling guest panic event
|
||||
pub struct PvPanicDevice {
|
||||
_id: String,
|
||||
_events: u8,
|
||||
}
|
||||
|
||||
impl PvPanicDevice {
|
||||
pub fn new() -> PvPanicDevice {
|
||||
let events = PVPANIC_PANICKED | PVPANIC_CRASH_LOADED;
|
||||
|
||||
PvPanicDevice {
|
||||
_id: String::from("_pvpanic"),
|
||||
_events: events,
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user