]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
Revert "LoongArch: KVM: Invalidate guest steal time address on vCPU reset"
authorHuacai Chen <chenhuacai@loongson.cn>
Tue, 1 Oct 2024 08:55:21 +0000 (16:55 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 4 Oct 2024 14:33:29 +0000 (16:33 +0200)
This reverts commit 05969a6944713f159e8f28be2388500174521818 which is
commit 4956e07f05e239b274d042618a250c9fa3e92629 upstream.

LoongArch's PV steal time support is add after 6.10, so 6.10.y doesn't
need this fix.

Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/loongarch/include/asm/kvm_vcpu.h
arch/loongarch/kvm/timer.c
arch/loongarch/kvm/vcpu.c

index d741c3e9933a51b5f9721316f80f7c58d47a42ca..590a92cb54165c1831d14812d66cff80fe53ba58 100644 (file)
@@ -76,6 +76,7 @@ static inline void kvm_restore_lasx(struct loongarch_fpu *fpu) { }
 #endif
 
 void kvm_init_timer(struct kvm_vcpu *vcpu, unsigned long hz);
+void kvm_reset_timer(struct kvm_vcpu *vcpu);
 void kvm_save_timer(struct kvm_vcpu *vcpu);
 void kvm_restore_timer(struct kvm_vcpu *vcpu);
 
index 74a4b5c272d60e99523e12e89d5e663d53009c2b..bcc6b6d063d914dbf820b43f2c1308803646b395 100644 (file)
@@ -188,3 +188,10 @@ void kvm_save_timer(struct kvm_vcpu *vcpu)
        kvm_save_hw_gcsr(csr, LOONGARCH_CSR_ESTAT);
        preempt_enable();
 }
+
+void kvm_reset_timer(struct kvm_vcpu *vcpu)
+{
+       write_gcsr_timercfg(0);
+       kvm_write_sw_gcsr(vcpu->arch.csr, LOONGARCH_CSR_TCFG, 0);
+       hrtimer_cancel(&vcpu->arch.swtimer);
+}
index 0b53f4d9fddf91351484c87a9ad8de799c7558d3..9e8030d4512902656a17597a186566118bdc6891 100644 (file)
@@ -572,7 +572,7 @@ static int kvm_set_one_reg(struct kvm_vcpu *vcpu,
                                vcpu->kvm->arch.time_offset = (signed long)(v - drdtime());
                        break;
                case KVM_REG_LOONGARCH_VCPU_RESET:
-                       vcpu->arch.st.guest_addr = 0;
+                       kvm_reset_timer(vcpu);
                        memset(&vcpu->arch.irq_pending, 0, sizeof(vcpu->arch.irq_pending));
                        memset(&vcpu->arch.irq_clear, 0, sizeof(vcpu->arch.irq_clear));
                        break;