vmbase: Move MMIO_GUARD granule check out of ::hyp
Validate the granule where it's being used to prepare for non-4KiB
granule sizes.
Note: No functional change intended.
Test: m libpvmfw libvmbase_example librialto
Change-Id: Ic8af83b8565815412127c8bc881e3bc795ae2639
diff --git a/vmbase/src/entry.rs b/vmbase/src/entry.rs
index 8b1d7c6..892dc9f 100644
--- a/vmbase/src/entry.rs
+++ b/vmbase/src/entry.rs
@@ -15,7 +15,9 @@
//! Rust entry point.
use crate::{
- bionic, console, heap, hyp, logger,
+ bionic, console, heap,
+ hyp::{self, MMIO_GUARD_GRANULE_SIZE},
+ logger,
power::{reboot, shutdown},
rand,
};
@@ -26,7 +28,11 @@
if let Some(mmio_guard) = hyp::get_mmio_guard() {
mmio_guard.enroll()?;
- mmio_guard.validate_granule()?;
+
+ // TODO(ptosi): Use MmioSharer::share() to properly track this MMIO_GUARD_MAP.
+ //
+ // MmioSharer only supports MMIO_GUARD_GRANULE_SIZE so fail early here if needed.
+ assert_eq!(mmio_guard.granule()?, MMIO_GUARD_GRANULE_SIZE);
mmio_guard.map(console::BASE_ADDRESS)?;
}