allocator: Add a basic resource allocation crate

This is based on the crosvm resource allocator from commit 107edb3e.
We only have PIO and MMIO address space to handle, and don't have a GPU
specific path and space.
Also, we support allocating a range at a specified address. This is
mostly useful for PIO, but might be also necessary for MMIO.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
Samuel Ortiz
2019-04-18 10:31:45 +02:00
parent 342bdc3619
commit db7937d47c
4 changed files with 421 additions and 0 deletions

18
vm-allocator/src/lib.rs Normal file
View File

@@ -0,0 +1,18 @@
// Copyright 2018 The Chromium OS Authors. All rights reserved.
// Copyright © 2019 Intel Corporation
// SPDX-License-Identifier: Apache-2.0 OR MIT
//
// Portions Copyright 2017 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the THIRD-PARTY file.
//! Manages system resources that can be allocated to VMs and their devices.
extern crate libc;
extern crate vm_memory;
mod address;
mod system;
pub use crate::address::AddressAllocator;
pub use crate::system::SystemAllocator;