mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 04:10:18 +09:00
Revert "ANDROID: KVM: arm64: Create EL2 shadow for VMs when pKVM is enabled"
This reverts commit 08a460da6c.
Bug: 233587962
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: I3175fc312cac51fb610c77a8971c3d0bd4601a8c
This commit is contained in:
@@ -163,7 +163,6 @@ struct kvm_pinned_page {
|
||||
struct kvm_protected_vm {
|
||||
bool enabled;
|
||||
int shadow_handle;
|
||||
struct mutex shadow_lock;
|
||||
struct kvm_hyp_memcache teardown_mc;
|
||||
struct list_head pinned_pages;
|
||||
};
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
#define HYP_MEMBLOCK_REGIONS 128
|
||||
|
||||
int create_el2_shadow(struct kvm *kvm);
|
||||
|
||||
/*
|
||||
* Definitions for features to be allowed or restricted for guest virtual
|
||||
* machines, depending on the mode KVM is running in and on the type of guest
|
||||
|
||||
@@ -777,9 +777,6 @@ int kvm_arch_vcpu_run_pid_change(struct kvm_vcpu *vcpu)
|
||||
static_branch_inc(&userspace_irqchip_in_use);
|
||||
}
|
||||
|
||||
if (is_protected_kvm_enabled())
|
||||
ret = create_el2_shadow(kvm);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -115,13 +115,16 @@ static void update_vcpu_state(struct kvm_vcpu *vcpu, int shadow_handle)
|
||||
*
|
||||
* Return 0 on success, negative error code on failure.
|
||||
*/
|
||||
static int __create_el2_shadow(struct kvm *kvm)
|
||||
static int create_el2_shadow(struct kvm *kvm)
|
||||
{
|
||||
size_t pgd_sz, shadow_sz;
|
||||
void *pgd, *shadow_addr;
|
||||
int shadow_handle;
|
||||
int ret, i;
|
||||
|
||||
if (kvm->arch.pkvm.shadow_handle)
|
||||
return -EEXIST;
|
||||
|
||||
if (kvm->created_vcpus < 1)
|
||||
return -EINVAL;
|
||||
|
||||
@@ -168,14 +171,20 @@ free_pgd:
|
||||
return ret;
|
||||
}
|
||||
|
||||
int create_el2_shadow(struct kvm *kvm)
|
||||
int pkvm_init_el2_context(struct kvm *kvm)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
mutex_lock(&kvm->arch.pkvm.shadow_lock);
|
||||
if (!kvm->arch.pkvm.shadow_handle)
|
||||
ret = __create_el2_shadow(kvm);
|
||||
mutex_unlock(&kvm->arch.pkvm.shadow_lock);
|
||||
mutex_lock(&kvm->lock);
|
||||
ret = create_el2_shadow(kvm);
|
||||
mutex_unlock(&kvm->lock);
|
||||
|
||||
return ret;
|
||||
if (ret < 0) {
|
||||
kvm_err("Creating shadow structures for protected VM failed: %d\n",
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
kvm_pr_unimpl("Stage-2 protection is a work-in-progress: civilization phase III\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user