vmbase: Only share if hyp has DYNAMIC_MEM_SHARE
For correctness, always check that DYNAMIC_MEM_SHARE is supported by the
hypervisor before calling its backend functions to share/unshare memory
in MemorySharer.
Note that Gunyah (only hyp without DYNAMIC_MEM_SHARE) already defines
those functions as unimplemented!(), meaning that the logic surrounding
the newly-introduced checks can be assumed to already prevent those
functions from being called so that this patch should not result in any
noticeable change.
This also adds support for using MemorySharer (and therefore the VirtIO
devices) on platforms that don't support DYNAMIC_MEM_SHARE but also
don't provide a static swiotlb e.g. non-protected KVM.
Test: atest DebugPolicyHostTests#testNoAdbInDebugPolicy_withDebugLevelNone_boots
Test: atest rialto_test vmbase_example.integration_test
Change-Id: I327000188faa3b8dd74c7029999729ef7516ef66
diff --git a/libs/hyp/src/lib.rs b/libs/hyp/src/lib.rs
index 32a59d1..3b3b30a 100644
--- a/libs/hyp/src/lib.rs
+++ b/libs/hyp/src/lib.rs
@@ -21,6 +21,8 @@
mod util;
pub use error::{Error, Result};
-pub use hypervisor::{get_hypervisor, Hypervisor, HypervisorCap, KvmError, MMIO_GUARD_GRANULE_SIZE};
+pub use hypervisor::{
+ get_hypervisor, Hypervisor, HypervisorCap, KvmError, MMIO_GUARD_GRANULE_SIZE,
+};
use hypervisor::GeniezoneError;