From 0859c4b2cbb44b8f1b50cf5c114b2f479e8593bd 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: 240239989 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 338aa27e4773..6b72060c76bf 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. @@ -103,6 +104,7 @@ static inline void balloon_page_insert(struct balloon_dev_info *balloon, __SetPageMovable(page, balloon->inode->i_mapping); set_page_private(page, (unsigned long)balloon); list_add(&page->lru, &balloon->pages); + page_relinquish(page); } /* @@ -147,6 +149,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)