Revert "ANDROID: KVM: arm64: Do not allow memslot modifications once a PVM has run"

This reverts commit 4d5aa4280a.

Bug: 233587962
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: Ib0661ad68724a4667eaa8ab3e7a335eeac887457
This commit is contained in:
Will Deacon
2022-07-07 15:48:51 +01:00
parent 9a287c833f
commit bb4b2952f4

View File

@@ -1800,13 +1800,6 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
change != KVM_MR_FLAGS_ONLY)
return 0;
/* In protected mode, cannot modify memslots once a VM has run. */
if (is_protected_kvm_enabled() &&
(change == KVM_MR_DELETE || change == KVM_MR_MOVE) &&
kvm->arch.pkvm.shadow_handle) {
return -EPERM;
}
/*
* Prevent userspace from creating a memory region outside of the IPA
* space addressable by the KVM guest IPA space.
@@ -1876,10 +1869,6 @@ void kvm_arch_flush_shadow_memslot(struct kvm *kvm,
gpa_t gpa = slot->base_gfn << PAGE_SHIFT;
phys_addr_t size = slot->npages << PAGE_SHIFT;
/* Stage-2 is managed by hyp in protected mode. */
if (is_protected_kvm_enabled())
return;
spin_lock(&kvm->mmu_lock);
unmap_stage2_range(&kvm->arch.mmu, gpa, size);
spin_unlock(&kvm->mmu_lock);