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
2 files changed
tree: eaa34c9b1d385d44f3142a9d5852cc8b380cf09a
  1. apex/
  2. apkdmverity/
  3. authfs/
  4. compos/
  5. demo/
  6. demo_native/
  7. docs/
  8. encryptedstore/
  9. javalib/
  10. launcher/
  11. libs/
  12. microdroid/
  13. microdroid_manager/
  14. pvmfw/
  15. rialto/
  16. service_vm/
  17. tests/
  18. virtualizationmanager/
  19. virtualizationservice/
  20. vm/
  21. vm_payload/
  22. vmbase/
  23. vmclient/
  24. zipfuse/
  25. .clang-format
  26. .gitignore
  27. Android.bp
  28. OWNERS
  29. PREUPLOAD.cfg
  30. README.md
  31. TEST_MAPPING
README.md

Virtualization

This repository contains userspace services related to running virtual machines on Android, especially protected virtual machines. See the getting started documentation and Microdroid README for more information.