mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 04:10:18 +09:00
Revert "ANDROID: KVM: arm64: pkvm: Make {flush,sync}_shadow_state() take the full state"
This reverts commit 342b0133f3.
Bug: 233587962
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: Id110cce06a1fc87ce92ba636d0f8e433c8f22377
This commit is contained in:
@@ -408,13 +408,8 @@ static void sync_vgic_state(struct kvm_vcpu *host_vcpu,
|
||||
host_cpu_if->vgic_lr[i] = shadow_cpu_if->vgic_lr[i];
|
||||
}
|
||||
|
||||
static void flush_timer_state(struct pkvm_loaded_state *state)
|
||||
static void flush_timer_state(struct kvm_vcpu *shadow_vcpu)
|
||||
{
|
||||
struct kvm_vcpu *shadow_vcpu = state->vcpu;
|
||||
|
||||
if (!state->is_protected)
|
||||
return;
|
||||
|
||||
/*
|
||||
* A shadow vcpu has no offset, and sees vtime == ptime. The
|
||||
* ptimer is fully emulated by EL1 and cannot be trusted.
|
||||
@@ -425,13 +420,8 @@ static void flush_timer_state(struct pkvm_loaded_state *state)
|
||||
write_sysreg_el0(__vcpu_sys_reg(shadow_vcpu, CNTV_CTL_EL0), SYS_CNTV_CTL);
|
||||
}
|
||||
|
||||
static void sync_timer_state(struct pkvm_loaded_state *state)
|
||||
static void sync_timer_state(struct kvm_vcpu *shadow_vcpu)
|
||||
{
|
||||
struct kvm_vcpu *shadow_vcpu = state->vcpu;
|
||||
|
||||
if (!state->is_protected)
|
||||
return;
|
||||
|
||||
/*
|
||||
* Preserve the vtimer state so that it is always correct,
|
||||
* even if the host tries to make a mess.
|
||||
@@ -440,9 +430,8 @@ static void sync_timer_state(struct pkvm_loaded_state *state)
|
||||
__vcpu_sys_reg(shadow_vcpu, CNTV_CTL_EL0) = read_sysreg_el0(SYS_CNTV_CTL);
|
||||
}
|
||||
|
||||
static void flush_shadow_state(struct pkvm_loaded_state *state)
|
||||
static void flush_shadow_state(struct kvm_vcpu *shadow_vcpu)
|
||||
{
|
||||
struct kvm_vcpu *shadow_vcpu = state->vcpu;
|
||||
struct kvm_vcpu *host_vcpu = shadow_vcpu->arch.pkvm.host_vcpu;
|
||||
u8 esr_ec;
|
||||
shadow_entry_exit_handler_fn ec_handler;
|
||||
@@ -451,7 +440,7 @@ static void flush_shadow_state(struct pkvm_loaded_state *state)
|
||||
pkvm_reset_vcpu(shadow_vcpu);
|
||||
|
||||
flush_vgic_state(host_vcpu, shadow_vcpu);
|
||||
flush_timer_state(state);
|
||||
flush_timer_state(shadow_vcpu);
|
||||
|
||||
switch (ARM_EXCEPTION_CODE(shadow_vcpu->arch.pkvm.exit_code)) {
|
||||
case ARM_EXCEPTION_IRQ:
|
||||
@@ -473,15 +462,14 @@ static void flush_shadow_state(struct pkvm_loaded_state *state)
|
||||
shadow_vcpu->arch.pkvm.exit_code = 0;
|
||||
}
|
||||
|
||||
static void sync_shadow_state(struct pkvm_loaded_state *state, u32 exit_reason)
|
||||
static void sync_shadow_state(struct kvm_vcpu *shadow_vcpu, u32 exit_reason)
|
||||
{
|
||||
struct kvm_vcpu *shadow_vcpu = state->vcpu;
|
||||
struct kvm_vcpu *host_vcpu = shadow_vcpu->arch.pkvm.host_vcpu;
|
||||
u8 esr_ec;
|
||||
shadow_entry_exit_handler_fn ec_handler;
|
||||
|
||||
sync_vgic_state(host_vcpu, shadow_vcpu);
|
||||
sync_timer_state(state);
|
||||
sync_timer_state(shadow_vcpu);
|
||||
|
||||
switch (ARM_EXCEPTION_CODE(exit_reason)) {
|
||||
case ARM_EXCEPTION_IRQ:
|
||||
@@ -591,11 +579,11 @@ static void handle___kvm_vcpu_run(struct kvm_cpu_context *host_ctxt)
|
||||
if (unlikely(is_protected_kvm_enabled())) {
|
||||
struct pkvm_loaded_state *state = this_cpu_ptr(&loaded_state);
|
||||
|
||||
flush_shadow_state(state);
|
||||
flush_shadow_state(state->vcpu);
|
||||
|
||||
ret = __kvm_vcpu_run(state->vcpu);
|
||||
|
||||
sync_shadow_state(state, ret);
|
||||
sync_shadow_state(state->vcpu, ret);
|
||||
|
||||
if (state->vcpu->arch.flags & KVM_ARM64_FP_ENABLED) {
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user