Revert "ANDROID: KVM: arm64: Do not pass host struct pointers to __pkvm_teardown_shadow()"

This reverts commit 0856ec2e53.

Bug: 233587962
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: I994e06c090d65f16ca663e517950b681cbcdc7a1
This commit is contained in:
Will Deacon
2022-07-07 15:49:11 +01:00
parent 37fca1139e
commit 52a268ea87
4 changed files with 10 additions and 7 deletions

View File

@@ -66,7 +66,7 @@ extern phys_addr_t pvmfw_base;
extern phys_addr_t pvmfw_size;
int __pkvm_init_shadow(struct kvm *kvm, void *shadow_va, size_t size, void *pgd);
int __pkvm_teardown_shadow(int shadow_handle);
int __pkvm_teardown_shadow(struct kvm *kvm);
struct kvm_vcpu *get_shadow_vcpu(int shadow_handle, int vcpu_idx);
void put_shadow_vcpu(struct kvm_vcpu *vcpu);

View File

@@ -966,9 +966,9 @@ static void handle___pkvm_init_shadow(struct kvm_cpu_context *host_ctxt)
static void handle___pkvm_teardown_shadow(struct kvm_cpu_context *host_ctxt)
{
DECLARE_REG(int, shadow_handle, host_ctxt, 1);
DECLARE_REG(struct kvm *, host_kvm, host_ctxt, 1);
cpu_reg(host_ctxt, 1) = __pkvm_teardown_shadow(shadow_handle);
cpu_reg(host_ctxt, 1) = __pkvm_teardown_shadow(host_kvm);
}
typedef void (*hcall_t)(struct kvm_cpu_context *);

View File

@@ -637,17 +637,21 @@ err:
return ret;
}
int __pkvm_teardown_shadow(int shadow_handle)
int __pkvm_teardown_shadow(struct kvm *kvm)
{
struct kvm_hyp_memcache *mc;
struct kvm_shadow_vm *vm;
struct kvm *host_kvm;
size_t shadow_size;
int err;
int err, shadow_handle;
u64 pfn;
u64 nr_pages;
void *addr;
kvm = kern_hyp_va(kvm);
shadow_handle = kvm->arch.pkvm.shadow_handle;
/* Lookup then remove entry from the shadow table. */
hyp_spin_lock(&shadow_lock);
vm = find_shadow_by_handle(shadow_handle);

View File

@@ -203,8 +203,7 @@ void kvm_shadow_destroy(struct kvm *kvm)
struct list_head *ppages;
if (kvm->arch.pkvm.shadow_handle)
WARN_ON(kvm_call_hyp_nvhe(__pkvm_teardown_shadow,
kvm->arch.pkvm.shadow_handle));
WARN_ON(kvm_call_hyp_nvhe(__pkvm_teardown_shadow, kvm));
free_hyp_memcache(&kvm->arch.pkvm.teardown_mc);