FROMLIST: virt: geniezone: Add memory pin/unpin support
Protected VM's memory cannot be swapped out because the memory pages are protected from host access. Once host accesses to those protected pages, the hardware exception is triggered and may crash the host. So, we have to make those protected pages be ineligible for swapping or merging by the host kernel to avoid host access. To do so, we pin the page when it is assigned (donated) to VM and unpin when VM relinquish the pages or is destroyed. Besides, the protected VM’s memory requires hypervisor to clear the content before returning to host, but VMM may free those memory before clearing, it will result in those memory pages are reclaimed and reused before totally clearing. Using pin/unpin can also avoid the above problems. The implementation is described as follows. - Use rb_tree to store pinned memory pages. - Pin the page when handling page fault. Change-Id: I1c4338e409821cf1f8df46a4951803c4f4728f94 Signed-off-by:Jerry Wang <ze-yu.wang@mediatek.com> Signed-off-by:
Yingshiuan Pan <yingshiuan.pan@mediatek.com> Signed-off-by:
Liju-Clr Chen <liju-clr.chen@mediatek.com> Signed-off-by:
Yi-De Wu <yi-de.wu@mediatek.com> Bug: 301179926 Link: https://lore.kernel.org/all/20230919111210.19615-15-yi-de.wu@mediatek.com/
Loading
Please sign in to comment