From f019fbcac24d97f0f0aca7a4f0762cdf9919dd69 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Wed, 9 Nov 2022 13:53:28 +0000 Subject: [PATCH] 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: 357781595 Change-Id: Ic89b45312a7478ddff081a934d99e693eded92dc Signed-off-by: Keir Fraser --- include/linux/balloon_compaction.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/balloon_compaction.h b/include/linux/balloon_compaction.h index 5ca2d5699620..318cfe8b57a6 100644 --- a/include/linux/balloon_compaction.h +++ b/include/linux/balloon_compaction.h @@ -43,6 +43,7 @@ #include #include #include +#include /* * 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)