vmm: hypervisor: split set_user_memory_region to two functions

Previously the same function was used to both create and remove regions.
This worked on KVM because it uses size 0 to indicate removal.

MSHV has two calls -- one for creation and one for removal. It also
requires having the size field available because it is not slot based.

Split set_user_memory_region to {create/remove}_user_memory_region. For
KVM they still use set_user_memory_region underneath, but for MSHV they
map to different functions.

This fixes user memory region removal on MSHV.

Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
Wei Liu
2021-07-03 13:58:39 +00:00
committed by Sebastien Boeuf
parent 63b8d2eb58
commit 1f2915bff0
7 changed files with 65 additions and 33 deletions
+1 -1
View File
@@ -2551,7 +2551,7 @@ pub fn test_vm() {
false,
);
vm.set_user_memory_region(mem_region)
vm.create_user_memory_region(mem_region)
.expect("Cannot configure guest memory");
}
mem.write_slice(&code, load_addr)