Revert "ANDROID: KVM: arm64: pkvm: Manage the non-protected guest dirty state from EL1"

This reverts commit 28f12f0fa0.

Bug: 233587962
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: I9356bcade5fa5f1bdc7cb8a917b7d27750598c4e
This commit is contained in:
Will Deacon
2022-07-07 15:51:18 +01:00
parent effcb9d307
commit 7de7e7cad5
2 changed files with 1 additions and 31 deletions

View File

@@ -585,10 +585,6 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)
kvm_call_hyp(__vgic_v3_save_vmcr_aprs,
&vcpu->arch.vgic_cpu.vgic_v3);
kvm_call_hyp_nvhe(__pkvm_vcpu_put, vcpu);
/* __pkvm_vcpu_put implies a sync of the state */
if (!kvm_vm_is_protected(vcpu->kvm))
vcpu->arch.flags |= KVM_ARM64_PKVM_STATE_DIRTY;
}
kvm_arch_vcpu_put_debug_state_flags(vcpu);
@@ -795,12 +791,8 @@ int kvm_arch_vcpu_run_pid_change(struct kvm_vcpu *vcpu)
static_branch_inc(&userspace_irqchip_in_use);
}
if (is_protected_kvm_enabled()) {
/* Start with the vcpu in a dirty state */
if (!kvm_vm_is_protected(vcpu->kvm))
vcpu->arch.flags |= KVM_ARM64_PKVM_STATE_DIRTY;
if (is_protected_kvm_enabled())
ret = create_el2_shadow(kvm);
}
return ret;
}

View File

@@ -201,21 +201,6 @@ static int handle_trap_exceptions(struct kvm_vcpu *vcpu)
{
int handled;
/*
* If we run a non-protected VM when protection is enabled
* system-wide, resync the state from the hypervisor and mark
* it as dirty on the host side if it wasn't dirty already
* (which could happen if preemption has taken place).
*/
if (is_protected_kvm_enabled() && !kvm_vm_is_protected(vcpu->kvm)) {
preempt_disable();
if (!(vcpu->arch.flags & KVM_ARM64_PKVM_STATE_DIRTY)) {
kvm_call_hyp_nvhe(__pkvm_vcpu_sync_state, vcpu);
vcpu->arch.flags |= KVM_ARM64_PKVM_STATE_DIRTY;
}
preempt_enable();
}
/*
* See ARM ARM B1.14.1: "Hyp traps on instructions
* that fail their condition code check"
@@ -283,13 +268,6 @@ int handle_exit(struct kvm_vcpu *vcpu, int exception_index)
/* For exit types that need handling before we can be preempted */
void handle_exit_early(struct kvm_vcpu *vcpu, int exception_index)
{
/*
* We just exited, so the state is clean from a hypervisor
* perspective.
*/
if (is_protected_kvm_enabled())
vcpu->arch.flags &= ~KVM_ARM64_PKVM_STATE_DIRTY;
if (ARM_SERROR_PENDING(exception_index)) {
if (this_cpu_has_cap(ARM64_HAS_RAS_EXTN)) {
u64 disr = kvm_vcpu_get_disr(vcpu);