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
1 changed files with 14 additions and 0 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue