crosvm/linux: fix direct compilation error

Fix a compilation error in the --features=direct build caused by
CL:3696671.

BUG=None
TEST=cargo build --no-default-features --features=direct

Change-Id: Idb90d4712064b007672589db65d93b0168508a8f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3708388
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: David Stevens <stevensd@chromium.org>
This commit is contained in:
David Stevens 2022-06-17 15:03:38 +09:00 committed by Chromeos LUCI
parent 2dcbb98677
commit 89479b41db

View file

@ -48,6 +48,8 @@ use devices::{HostBackendDeviceProvider, XhciController};
use hypervisor::kvm::{Kvm, KvmVcpu, KvmVm};
use hypervisor::{HypervisorCap, ProtectionType, Vm, VmCap};
use minijail::{self, Minijail};
#[cfg(feature = "direct")]
use resources::Error as ResourceError;
use resources::{AddressRange, Alloc, SystemAllocator};
use rutabaga_gfx::RutabagaGralloc;
use sync::{Condvar, Mutex};
@ -1426,8 +1428,9 @@ where
#[cfg(feature = "direct")]
if let Some(mmio) = &cfg.direct_mmio {
for range in mmio.ranges.iter() {
sys_allocator
.reserve_mmio(range.base, range.len)
AddressRange::from_start_and_size(range.base, range.len)
.ok_or(ResourceError::OutOfSpace)
.and_then(|range| sys_allocator.reserve_mmio(range))
.with_context(|| {
format!(
"failed to reserved direct mmio: {:x}-{:x}",