diff --git a/src/libs/kata-types/src/config/hypervisor/mod.rs b/src/libs/kata-types/src/config/hypervisor/mod.rs index 08a95bf8dfdb..189e143c4cc7 100644 --- a/src/libs/kata-types/src/config/hypervisor/mod.rs +++ b/src/libs/kata-types/src/config/hypervisor/mod.rs @@ -447,6 +447,12 @@ pub struct DeviceInfo { #[serde(default)] pub default_bridges: u32, + /// Enable PCI hotplug support, default false + /// + /// Enabling this will result in hotplugin VFIO devices (see below). + #[serde(default)] + pub pci_hotplug: bool, + /// VFIO devices are hotplugged on a bridge by default. /// /// Enable hotplugging on root bus. This may be required for devices with a large PCI bar, diff --git a/src/runtime-rs/Makefile b/src/runtime-rs/Makefile index c380ca7b7dbb..fd4bb484143b 100644 --- a/src/runtime-rs/Makefile +++ b/src/runtime-rs/Makefile @@ -130,6 +130,7 @@ DEFMEMSLOTS := 10 DEFMAXMEMSZ := 0 ##VAR DEFBRIDGES= Default number of bridges DEFBRIDGES := 0 +DEFPCIHOTPLUG := false DEFENABLEANNOTATIONS := [\"kernel_params\"] DEFDISABLEGUESTSECCOMP := true DEFDISABLEGUESTEMPTYDIR := false @@ -362,6 +363,7 @@ USER_VARS += DEFMEMSZ USER_VARS += DEFMEMSLOTS USER_VARS += DEFMAXMEMSZ USER_VARS += DEFBRIDGES +USER_VARS += DEFPCIHOTPLUG USER_VARS += DEFNETWORKMODEL_DB USER_VARS += DEFNETWORKMODEL_CLH USER_VARS += DEFNETWORKMODEL_QEMU diff --git a/src/runtime-rs/config/configuration-dragonball.toml.in b/src/runtime-rs/config/configuration-dragonball.toml.in index 5a0a6db20a56..d538815acd75 100644 --- a/src/runtime-rs/config/configuration-dragonball.toml.in +++ b/src/runtime-rs/config/configuration-dragonball.toml.in @@ -97,6 +97,11 @@ default_maxvcpus = @DEFMAXVCPUS_DB@ # > 5 --> will be set to 5 default_bridges = @DEFBRIDGES@ +# PCI hotplug +# Enable or disable pci_hotplug +# will be set to @DEFPCIHOTPLUG@ +pci_hotplug = @DEFPCIHOTPLUG@ + # Default memory size in MiB for SB/VM. # If unspecified then it will be set @DEFMEMSZ@ MiB. default_memory = @DEFMEMSZ@ diff --git a/src/runtime-rs/crates/hypervisor/src/dragonball/inner.rs b/src/runtime-rs/crates/hypervisor/src/dragonball/inner.rs index e0bd30e8e890..97d0fa6763fd 100644 --- a/src/runtime-rs/crates/hypervisor/src/dragonball/inner.rs +++ b/src/runtime-rs/crates/hypervisor/src/dragonball/inner.rs @@ -220,7 +220,7 @@ impl DragonballInner { max_vcpu_count: self.config.cpu_info.default_maxvcpus as u8, mem_type, mem_file_path, - pci_hotplug_enabled: true, + pci_hotplug_enabled: self.hypervisor_config().device_info.pci_hotplug, ..Default::default() }; info!(sl!(), "vm config: {:?}", vm_config);