mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-28 19:54:35 +00:00
hotplug: add room for future acpi hotplug mechanism
In order to support ACPI hotplug in the future with the cooperative work from the Kata community, we add ACPI feature and dbs-upcall feature to add room for ACPI hotplug. Signed-off-by: Chao Wu <chaowu@linux.alibaba.com>
This commit is contained in:
parent
8bb00a3dc8
commit
71db2dd5b8
@ -45,8 +45,9 @@ slog-term = "2.9.0"
|
||||
slog-async = "2.7.0"
|
||||
|
||||
[features]
|
||||
acpi = []
|
||||
atomic-guest-memory = []
|
||||
hotplug = ["dbs-upcall", "virtio-vsock"]
|
||||
hotplug = ["virtio-vsock"]
|
||||
virtio-vsock = ["dbs-virtio-devices/virtio-vsock", "virtio-queue"]
|
||||
|
||||
[patch.'crates-io']
|
||||
|
@ -29,10 +29,10 @@ use dbs_virtio_devices::{
|
||||
VirtioDevice,
|
||||
};
|
||||
|
||||
#[cfg(feature = "hotplug")]
|
||||
#[cfg(all(feature = "hotplug", feature = "dbs-upcall"))]
|
||||
use dbs_upcall::{
|
||||
MmioDevRequest, DevMgrRequest, DevMgrService, UpcallClient, UpcallClientError,
|
||||
UpcallClientRequest, UpcallClientResponse
|
||||
DevMgrRequest, DevMgrService, MmioDevRequest, UpcallClient, UpcallClientError,
|
||||
UpcallClientRequest, UpcallClientResponse,
|
||||
};
|
||||
|
||||
use crate::address_space_manager::GuestAddressSpaceImpl;
|
||||
@ -90,7 +90,7 @@ pub enum DeviceMgrError {
|
||||
#[error(transparent)]
|
||||
Virtio(virtio::Error),
|
||||
|
||||
#[cfg(feature = "hotplug")]
|
||||
#[cfg(all(feature = "hotplug", feature = "dbs-upcall"))]
|
||||
/// Failed to hotplug the device.
|
||||
#[error("failed to hotplug virtual device")]
|
||||
HotplugDevice(#[source] UpcallClientError),
|
||||
@ -199,7 +199,7 @@ pub struct DeviceOpContext {
|
||||
logger: slog::Logger,
|
||||
is_hotplug: bool,
|
||||
|
||||
#[cfg(feature = "hotplug")]
|
||||
#[cfg(all(feature = "hotplug", feature = "dbs-upcall"))]
|
||||
upcall_client: Option<Arc<UpcallClient<DevMgrService>>>,
|
||||
#[cfg(feature = "dbs-virtio-devices")]
|
||||
virtio_devices: Vec<Arc<DbsMmioV2Device>>,
|
||||
@ -233,7 +233,7 @@ impl DeviceOpContext {
|
||||
address_space,
|
||||
logger,
|
||||
is_hotplug,
|
||||
#[cfg(feature = "hotplug")]
|
||||
#[cfg(all(feature = "hotplug", feature = "dbs-upcall"))]
|
||||
upcall_client: None,
|
||||
#[cfg(feature = "dbs-virtio-devices")]
|
||||
virtio_devices: Vec::new(),
|
||||
@ -301,7 +301,7 @@ impl DeviceOpContext {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "hotplug")]
|
||||
#[cfg(all(feature = "hotplug", feature = "dbs-upcall"))]
|
||||
impl DeviceOpContext {
|
||||
fn call_hotplug_device(
|
||||
&self,
|
||||
@ -362,6 +362,11 @@ impl DeviceOpContext {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "hotplug", feature = "acpi"))]
|
||||
impl DeviceOpContext {
|
||||
// TODO: We will implement this when we develop ACPI virtualization
|
||||
}
|
||||
|
||||
/// Device manager for virtual machines, which manages all device for a virtual machine.
|
||||
pub struct DeviceManager {
|
||||
io_manager: Arc<ArcSwap<IoManager>>,
|
||||
|
@ -15,7 +15,7 @@ use std::sync::mpsc::{channel, Receiver, RecvError, RecvTimeoutError, Sender};
|
||||
use std::sync::{Arc, Barrier, Mutex, RwLock};
|
||||
use std::time::Duration;
|
||||
|
||||
#[cfg(feature = "hotplug")]
|
||||
#[cfg(all(feature = "hotplug", feature = "dbs-upcall"))]
|
||||
use dbs_upcall::{DevMgrService, UpcallClient};
|
||||
use dbs_utils::epoll_manager::{EpollManager, EventOps, EventSet, Events, MutEventSubscriber};
|
||||
use dbs_utils::time::TimestampUs;
|
||||
@ -206,7 +206,7 @@ pub struct VcpuManager {
|
||||
vcpus_in_action: (VcpuAction, Vec<u8>),
|
||||
pub(crate) reset_event_fd: Option<EventFd>,
|
||||
|
||||
#[cfg(feature = "hotplug")]
|
||||
#[cfg(all(feature = "hotplug", feature = "dbs-upcall"))]
|
||||
upcall_channel: Option<Arc<UpcallClient<DevMgrService>>>,
|
||||
|
||||
// X86 specific fields.
|
||||
@ -290,7 +290,7 @@ impl VcpuManager {
|
||||
action_sycn_tx: None,
|
||||
vcpus_in_action: (VcpuAction::None, Vec::new()),
|
||||
reset_event_fd: None,
|
||||
#[cfg(feature = "hotplug")]
|
||||
#[cfg(all(feature = "hotplug", feature = "dbs-upcall"))]
|
||||
upcall_channel: None,
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
supported_cpuid,
|
||||
@ -794,6 +794,7 @@ mod hotplug {
|
||||
#[cfg(all(target_arch = "aarch64", not(test)))]
|
||||
const APIC_VERSION: u8 = 0;
|
||||
|
||||
#[cfg(feature = "dbs-upcall")]
|
||||
impl VcpuManager {
|
||||
/// add upcall channel for vcpu manager
|
||||
pub fn set_upcall_channel(
|
||||
|
Loading…
Reference in New Issue
Block a user