ANDROID: KVM: arm64: Fix psci_mem_protect_dec() on VM reclaim

On VM teardown, the host will reclaim all the pages. We have to account
for PSCI MEM_PROTECT properly there. A typo was preventing a proper
accounting and hence the whole system would be stuck with the
MEM_PROTECT flag on.

Bug: 278749606
Bug: 278011447
Fixes: 39c6e8914d ("ANDROID: KVM: arm64: Huge page support for pKVM guest memory reclaim")
Change-Id: Id2987c9d07dbf2f87d015debddf4fd0524025b07
Signed-off-by: Vincent Donnefort <vdonnefort@google.com>
This commit is contained in:
Vincent Donnefort 2024-07-01 16:30:16 +01:00 committed by Treehugger Robot
parent 013c5ddc64
commit 437e699ef9

View File

@ -2826,7 +2826,7 @@ int __pkvm_host_reclaim_page(struct pkvm_hyp_vm *vm, u64 pfn, u64 ipa, u8 order)
case PKVM_PAGE_OWNED:
WARN_ON(__host_check_page_state_range(phys, page_size, PKVM_NOPAGE));
hyp_poison_page(phys);
psci_mem_protect_dec(order);
psci_mem_protect_dec(1 << order);
break;
case PKVM_PAGE_SHARED_BORROWED:
case PKVM_PAGE_SHARED_BORROWED | PKVM_PAGE_RESTRICTED_PROT: