ANDROID: KVM: arm64: memory balloon: Notify hyp when ballooning

When running as a protected VM, the hypervisor isolates the VM's
memory pages from the host. Returning ownership of a VM page
therefore requires hypervisor involvement, and acknowledgement from
the protected VM that it is voluntarily cooperating.

To this end, notify pages via the new relinquish hypercall when they
are entered into the memory balloon.

Bug: 240239989
Change-Id: Ic89b45312a7478ddff081a934d99e693eded92dc
Signed-off-by: Keir Fraser <keirf@google.com>
Signed-off-by: Quentin Perret <qperret@google.com>
This commit is contained in:
Keir Fraser 2022-11-09 13:53:28 +00:00 committed by Quentin Perret
parent 102dcecb67
commit 23cfd30bb3

View File

@ -43,6 +43,7 @@
#include <linux/err.h>
#include <linux/fs.h>
#include <linux/list.h>
#include <linux/mem_relinquish.h>
/*
* Balloon device information descriptor.
@ -95,6 +96,7 @@ static inline void balloon_page_insert(struct balloon_dev_info *balloon,
__SetPageMovable(page, &balloon_mops);
set_page_private(page, (unsigned long)balloon);
list_add(&page->lru, &balloon->pages);
page_relinquish(page);
}
/*
@ -139,6 +141,7 @@ static inline void balloon_page_insert(struct balloon_dev_info *balloon,
{
__SetPageOffline(page);
list_add(&page->lru, &balloon->pages);
page_relinquish(page);
}
static inline void balloon_page_delete(struct page *page)