mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 03:15:31 +09:00
ANDROID: KVM: arm64: Update pKVM hyp state series to v6
aosp/2257747 merged v5 of the pKVM hypervisor state series as FROMLIST. Since then, version 6 was posted and queued by the upstream maintainer: https://lore.kernel.org/r/166819337067.3836113.13147674500457473286.b4-ty@kernel.org Rather than revert v5 from android (and the dozens of dependent patches), snap to v6 so that we're in-sync with upstream. Bug: 233587962 [willdeacon@: Fix conflicts with 'stage2_mc' introduced by accounting work] Signed-off-by: Will Deacon <willdeacon@google.com> Change-Id: I137bbd611c180cbe03e63a55705150f8f9c2ae31 Signed-off-by: Quentin Perret <qperret@google.com>
This commit is contained in:
committed by
Quentin Perret
parent
b97d00514a
commit
a596e6423e
@@ -1455,7 +1455,7 @@ static int check_donation(struct pkvm_mem_donation *donation)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
switch (tx->completer.id){
|
||||
switch (tx->completer.id) {
|
||||
case PKVM_ID_HOST:
|
||||
ret = host_ack_donation(completer_addr, tx);
|
||||
break;
|
||||
@@ -1492,7 +1492,7 @@ static int __do_donate(struct pkvm_mem_donation *donation)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
switch (tx->completer.id){
|
||||
switch (tx->completer.id) {
|
||||
case PKVM_ID_HOST:
|
||||
ret = host_complete_donation(completer_addr, tx);
|
||||
break;
|
||||
|
||||
@@ -99,6 +99,7 @@ static void __hyp_attach_page(struct hyp_pool *pool,
|
||||
|
||||
memset(hyp_page_to_virt(p), 0, PAGE_SIZE << p->order);
|
||||
|
||||
/* Skip coalescing for 'external' pages being freed into the pool. */
|
||||
if (phys < pool->range_start || phys >= pool->range_end)
|
||||
goto insert;
|
||||
|
||||
|
||||
@@ -654,7 +654,7 @@ static void unmap_donated_memory_noclear(void *va, size_t size)
|
||||
*
|
||||
* Unmaps the donated memory from the host at stage 2.
|
||||
*
|
||||
* kvm: A pointer to the host's struct kvm.
|
||||
* host_kvm: A pointer to the host's struct kvm.
|
||||
* vm_hva: The host va of the area being donated for the VM state.
|
||||
* Must be page aligned.
|
||||
* pgd_hva: The host va of the area being donated for the stage-2 PGD for
|
||||
@@ -802,6 +802,7 @@ int __pkvm_teardown_vm(pkvm_handle_t handle)
|
||||
size_t vm_size, last_ran_size;
|
||||
int __percpu *last_vcpu_ran;
|
||||
struct pkvm_hyp_vm *hyp_vm;
|
||||
struct kvm *host_kvm;
|
||||
unsigned int idx;
|
||||
int err;
|
||||
|
||||
@@ -817,21 +818,21 @@ int __pkvm_teardown_vm(pkvm_handle_t handle)
|
||||
goto err_unlock;
|
||||
}
|
||||
|
||||
host_kvm = hyp_vm->host_kvm;
|
||||
|
||||
/* Ensure the VMID is clean before it can be reallocated */
|
||||
__kvm_tlb_flush_vmid(&hyp_vm->kvm.arch.mmu);
|
||||
remove_vm_table_entry(handle);
|
||||
hyp_spin_unlock(&vm_table_lock);
|
||||
|
||||
mc = &hyp_vm->host_kvm->arch.pkvm.teardown_mc;
|
||||
stage2_mc = &hyp_vm->host_kvm->arch.pkvm.teardown_stage2_mc;
|
||||
mc = &host_kvm->arch.pkvm.teardown_mc;
|
||||
stage2_mc = &host_kvm->arch.pkvm.teardown_stage2_mc;
|
||||
|
||||
/* Reclaim guest pages (including page-table pages) */
|
||||
reclaim_guest_pages(hyp_vm, stage2_mc);
|
||||
unpin_host_vcpus(hyp_vm->vcpus, hyp_vm->nr_vcpus);
|
||||
|
||||
/* Push the metadata pages to the teardown memcache */
|
||||
hyp_unpin_shared_mem(hyp_vm->host_kvm, hyp_vm->host_kvm + 1);
|
||||
|
||||
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;
|
||||
@@ -854,6 +855,7 @@ int __pkvm_teardown_vm(pkvm_handle_t handle)
|
||||
|
||||
vm_size = pkvm_get_hyp_vm_size(hyp_vm->kvm.created_vcpus);
|
||||
teardown_donated_memory(mc, hyp_vm, vm_size);
|
||||
hyp_unpin_shared_mem(host_kvm, host_kvm + 1);
|
||||
return 0;
|
||||
|
||||
err_unlock:
|
||||
|
||||
Reference in New Issue
Block a user