mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-10-01 11:05:46 +00:00
vmm: Only generate GED event when new DIMM added
Avoid the ACPI scan in the guest OS when no new DIMM is hotplugged. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
211786ab42
commit
0ab22fea2c
@ -451,12 +451,14 @@ impl MemoryManager {
|
|||||||
Ok(slot)
|
Ok(slot)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn resize(&mut self, desired_ram: u64) -> Result<(), Error> {
|
pub fn resize(&mut self, desired_ram: u64) -> Result<bool, Error> {
|
||||||
if desired_ram >= self.current_ram {
|
if desired_ram > self.current_ram {
|
||||||
self.hotplug_ram_region((desired_ram - self.current_ram) as usize)?;
|
self.hotplug_ram_region((desired_ram - self.current_ram) as usize)?;
|
||||||
self.current_ram = desired_ram;
|
self.current_ram = desired_ram;
|
||||||
|
Ok(true)
|
||||||
|
} else {
|
||||||
|
Ok(false)
|
||||||
}
|
}
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -500,14 +500,17 @@ impl Vm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let Some(desired_memory) = desired_memory {
|
if let Some(desired_memory) = desired_memory {
|
||||||
self.memory_manager
|
if self
|
||||||
|
.memory_manager
|
||||||
.lock()
|
.lock()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.resize(desired_memory)
|
.resize(desired_memory)
|
||||||
.map_err(Error::MemoryManager)?;
|
.map_err(Error::MemoryManager)?
|
||||||
self.devices
|
{
|
||||||
.notify_hotplug(HotPlugNotificationFlags::MEMORY_DEVICES_CHANGED)
|
self.devices
|
||||||
.map_err(Error::DeviceManager)?;
|
.notify_hotplug(HotPlugNotificationFlags::MEMORY_DEVICES_CHANGED)
|
||||||
|
.map_err(Error::DeviceManager)?;
|
||||||
|
}
|
||||||
self.config.lock().unwrap().memory.size = desired_memory;
|
self.config.lock().unwrap().memory.size = desired_memory;
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
Loading…
Reference in New Issue
Block a user