pvmfw: Move DT sanitization to main()
Move it so that it can re-use other inputs e.g. VBMeta capabilities.
This should not compromise the integrity of pvmfw as it still happens
before the DT is used to initialize the PCI bus and swiotlb region.
Move the shared memory setup to main(), so that it only happens when
actually needed i.e. when the instance.img is used, requiring a shared
region for the VirtIO transport.
Bug: 339782511
Bug: 377276983
Test: m pvmfw_bin
Change-Id: I6de6e4607d110c2f8fffd9a3d9527716dca92565
diff --git a/guest/pvmfw/src/entry.rs b/guest/pvmfw/src/entry.rs
index 2f0b391..2463984 100644
--- a/guest/pvmfw/src/entry.rs
+++ b/guest/pvmfw/src/entry.rs
@@ -120,13 +120,7 @@
let config_entries = appended.get_entries();
- let slices = memory::MemorySlices::new(
- fdt,
- payload,
- payload_size,
- config_entries.vm_dtbo,
- config_entries.vm_ref_dt,
- )?;
+ let slices = memory::MemorySlices::new(fdt, payload, payload_size)?;
// This wrapper allows main() to be blissfully ignorant of platform details.
let (next_bcc, debuggable_payload) = crate::main(
@@ -135,6 +129,8 @@
slices.ramdisk,
config_entries.bcc,
config_entries.debug_policy,
+ config_entries.vm_dtbo,
+ config_entries.vm_ref_dt,
)?;
// Writable-dirty regions will be flushed when MemoryTracker is dropped.