vmbase: Use heap for non-protected SHARED_POOL

On non-protected platforms, buffers shared with devices (i.e. the host)
may be located on the heap as there are no security constraints given
that the host already has full access to guest memory. As the PCI/VirtIO
drivers expect SHARED_POOL to have been initialized and as the
init_{dynamic,static}_shared_pool() functions aren't appropriate for
non-protected VMs, provide a third method allowing clients to signal
that they want SHARED_POOL to be initialized to simply wrap the heap.

Use this mechanism in Rialto.

Test: atest DebugPolicyHostTests#testNoAdbInDebugPolicy_withDebugLevelNone_boots
Test: atest rialto_test vmbase_example.integration_test
Change-Id: I7098c8dfd3a5f2f447763f5f43ba880f2d8b008f
diff --git a/rialto/src/main.rs b/rialto/src/main.rs
index 5e693c8..e7b6386 100644
--- a/rialto/src/main.rs
+++ b/rialto/src/main.rs
@@ -104,8 +104,8 @@
             error!("Failed to initialize dynamically shared pool.");
             e
         })?;
-    } else {
-        let range = SwiotlbInfo::new_from_fdt(fdt)?.fixed_range().ok_or_else(|| {
+    } else if let Ok(swiotlb_info) = SwiotlbInfo::new_from_fdt(fdt) {
+        let range = swiotlb_info.fixed_range().ok_or_else(|| {
             error!("Pre-shared pool range not specified in swiotlb node");
             Error::from(FdtError::BadValue)
         })?;
@@ -113,6 +113,12 @@
             error!("Failed to initialize pre-shared pool.");
             e
         })?;
+    } else {
+        info!("No MEM_SHARE capability detected or swiotlb found: allocating buffers from heap.");
+        MEMORY.lock().as_mut().unwrap().init_heap_shared_pool().map_err(|e| {
+            error!("Failed to initialize heap-based pseudo-shared pool.");
+            e
+        })?;
     }
 
     let pci_info = PciInfo::from_fdt(fdt)?;