Forked from
LMODroid / platform_packages_modules_Virtualization
Source project has a limited visibility.
Pierre-Clément Tosi
authored
Instead of issuing memory sharing/unsharing HVCs every time alloc_shared and dealloc_shared are called, introduce a MemorySharer object to share pages from the global allocator on demand and keep them in a pool until its destructor is called, at which point, it unshares all the regions and returns them to the heap. This allows the backends for memory sharing to be unified behind a unique SHARED_POOL heap that is either populated by the MemorySharer on pKVM or covers the statically shared region on Gunyah. On pKVM, alloc_shared calls will only result in MEM_SHARE HVCs if SHARED_POOL isn't already large enough to fulfill the request. This also guarantees that all pages that have been been shared during pvmfw execution have been unshared by the time the guest OS is entered, even if an alloc_shared hasn't been matched with a dealloc_shared call. By caching the granule size in the MemorySharer ctor, this removes the need to issue a granule-discovery HVC every time memory is being shared or unshared with the host. Bug: 280644106 Test: atest MicrodroidHostTests Change-Id: I3992e7c59ea79897e93bccc043d4438acbc0586c Merged-In: I3992e7c59ea79897e93bccc043d4438acbc0586c
Name | Last commit | Last update |
---|