pvmfw: Handle config version 1.1

This CL is the initial step toward provisioning device assignment
with the VM DTBO in the pvmfw config payload.

Test: TH, and test locally with config 1.1 and config 1.0
Bug: 291191157, Bug: 291190552
Change-Id: I85553e692003b81d91e7ab7845b6d77a96f6da5c
diff --git a/pvmfw/src/config.rs b/pvmfw/src/config.rs
index 8a24347..db27001 100644
--- a/pvmfw/src/config.rs
+++ b/pvmfw/src/config.rs
@@ -18,6 +18,7 @@
 use core::mem;
 use core::ops::Range;
 use core::result;
+use log::info;
 use static_assertions::const_assert_eq;
 use vmbase::util::RangeExt;
 use zerocopy::{FromBytes, LayoutVerified};
@@ -81,6 +82,7 @@
 impl Header {
     const MAGIC: u32 = u32::from_ne_bytes(*b"pvmf");
     const VERSION_1_0: Version = Version { major: 1, minor: 0 };
+    const VERSION_1_1: Version = Version { major: 1, minor: 1 };
 
     pub fn total_size(&self) -> usize {
         self.total_size as usize
@@ -101,6 +103,7 @@
     pub fn entry_count(&self) -> Result<usize> {
         let last_entry = match self.version {
             Self::VERSION_1_0 => Entry::DebugPolicy,
+            Self::VERSION_1_1 => Entry::VmDtbo,
             v => return Err(Error::UnsupportedVersion(v)),
         };
 
@@ -112,6 +115,7 @@
 pub enum Entry {
     Bcc,
     DebugPolicy,
+    VmDtbo,
     #[allow(non_camel_case_types)] // TODO: Use mem::variant_count once stable.
     _VARIANT_COUNT,
 }
@@ -181,6 +185,8 @@
             return Err(Error::InvalidFlags(header.flags));
         }
 
+        info!("pvmfw config version: {}", header.version);
+
         // Validate that we won't get an invalid alignment in the following due to padding to u64.
         const_assert_eq!(HEADER_SIZE % mem::size_of::<u64>(), 0);
 
@@ -206,6 +212,7 @@
             // `core::marker::Copy` is not implemented for `core::ops::Range<usize>`.
             Self::validated_body_range(Entry::Bcc, &header_entries, &limits)?,
             Self::validated_body_range(Entry::DebugPolicy, &header_entries, &limits)?,
+            Self::validated_body_range(Entry::VmDtbo, &header_entries, &limits)?,
         ];
 
         Ok(Self { body, ranges })
@@ -216,6 +223,11 @@
         // This assumes that the blobs are in-order w.r.t. the entries.
         let bcc_range = self.get_entry_range(Entry::Bcc).ok_or(Error::MissingEntry(Entry::Bcc))?;
         let dp_range = self.get_entry_range(Entry::DebugPolicy);
+        let vm_dtbo_range = self.get_entry_range(Entry::VmDtbo);
+        // TODO(b/291191157): Provision device assignment with this.
+        if let Some(vm_dtbo_range) = vm_dtbo_range {
+            info!("Found VM DTBO at {:?}", vm_dtbo_range);
+        }
         let bcc_start = bcc_range.start;
         let bcc_end = bcc_range.len();
         let (_, rest) = self.body.split_at_mut(bcc_start);