mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 01:55:51 +02:00
LoongArch: KVM: Deliver interrupt after IN_GUEST_MODE is set
Interrupt delivery should be called after IN_GUEST_MODE is set. Other threads may be posting interrupt however does not send IPI to the vCPU, since the vCPU is not in IN_GUEST_MODE yet. Here move function call with kvm_deliver_intr() after IN_GUEST_MODE is set, and set mode with OUTSIDE_GUEST_MODE with atomic method. Signed-off-by: Bibo Mao <maobibo@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
This commit is contained in:
parent
4298588361
commit
8c5cd2b9d6
|
|
@ -299,10 +299,10 @@ static int kvm_pre_enter_guest(struct kvm_vcpu *vcpu)
|
|||
* check vmid before vcpu enter guest
|
||||
*/
|
||||
local_irq_disable();
|
||||
kvm_deliver_intr(vcpu);
|
||||
kvm_deliver_exception(vcpu);
|
||||
/* Make sure the vcpu mode has been written */
|
||||
smp_store_mb(vcpu->mode, IN_GUEST_MODE);
|
||||
kvm_deliver_intr(vcpu);
|
||||
kvm_check_vpid(vcpu);
|
||||
|
||||
/*
|
||||
|
|
@ -339,7 +339,7 @@ static int kvm_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu)
|
|||
u32 intr = estat & CSR_ESTAT_IS;
|
||||
u32 ecode = (estat & CSR_ESTAT_EXC) >> CSR_ESTAT_EXC_SHIFT;
|
||||
|
||||
vcpu->mode = OUTSIDE_GUEST_MODE;
|
||||
smp_store_mb(vcpu->mode, OUTSIDE_GUEST_MODE);
|
||||
|
||||
/* Set a default exit reason */
|
||||
run->exit_reason = KVM_EXIT_UNKNOWN;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user