mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-21 19:02:30 +00:00
vm-allocator: Allow for freeing system resources
We allow freeing PIO and MMIO address ranges for now. Fixes: #27 Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
parent
4b451b01d9
commit
9f247751e7
@ -100,4 +100,18 @@ impl SystemAllocator {
|
||||
) -> Option<GuestAddress> {
|
||||
self.mmio_address_space.allocate(address, size)
|
||||
}
|
||||
|
||||
/// Free an IO address range.
|
||||
/// We can only free a range if it matches exactly an already allocated range.
|
||||
pub fn free_io_addresses(&mut self, address: GuestAddress, size: GuestUsize) {
|
||||
if let Some(io_address) = self.io_address_space.as_mut() {
|
||||
io_address.free(address, size)
|
||||
}
|
||||
}
|
||||
|
||||
/// Free an MMIO address range.
|
||||
/// We can only free a range if it matches exactly an already allocated range.
|
||||
pub fn free_mmio_addresses(&mut self, address: GuestAddress, size: GuestUsize) {
|
||||
self.mmio_address_space.free(address, size)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user