mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
ANDROID: KVM: arm64: Flush nVHE hyp_vcpu memcache
When using nVHE in protected mode, the host donates pages through an arch specific memcache the hyp can then pours in its local vcpu copy. The latter should be flushed on VM teardown. Bug: 237506543 Change-Id: Ic37d794ac33e9f844fa6ae1b4943febcdad5b033 Signed-off-by: Vincent Donnefort <vdonnefort@google.com> Signed-off-by: Quentin Perret <qperret@google.com>
This commit is contained in:
committed by
Quentin Perret
parent
4a477ac0a9
commit
bf76ea0a21
@@ -830,6 +830,15 @@ int __pkvm_teardown_vm(pkvm_handle_t handle)
|
||||
|
||||
for (idx = 0; idx < hyp_vm->nr_vcpus; ++idx) {
|
||||
struct pkvm_hyp_vcpu *hyp_vcpu = hyp_vm->vcpus[idx];
|
||||
struct kvm_hyp_memcache *vcpu_mc;
|
||||
void *addr;
|
||||
|
||||
vcpu_mc = &hyp_vcpu->vcpu.arch.pkvm_memcache;
|
||||
while (vcpu_mc->nr_pages) {
|
||||
addr = pop_hyp_memcache(vcpu_mc, hyp_phys_to_virt);
|
||||
push_hyp_memcache(mc, addr, hyp_virt_to_phys);
|
||||
unmap_donated_memory_noclear(addr, PAGE_SIZE);
|
||||
}
|
||||
|
||||
teardown_donated_memory(mc, hyp_vcpu, sizeof(*hyp_vcpu));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user