We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 81efe04 commit f41c8bdCopy full SHA for f41c8bd
arch/loongarch/kvm/exit.c
@@ -194,3 +194,23 @@ int kvm_complete_iocsr_read(struct kvm_vcpu *vcpu, struct kvm_run *run)
194
195
return er;
196
}
197
+
198
+int kvm_emu_idle(struct kvm_vcpu *vcpu)
199
+{
200
+ ++vcpu->stat.idle_exits;
201
+ trace_kvm_exit_idle(vcpu, KVM_TRACE_EXIT_IDLE);
202
203
+ if (!kvm_arch_vcpu_runnable(vcpu)) {
204
+ /*
205
+ * Switch to the software timer before halt-polling/blocking as
206
+ * the guest's timer may be a break event for the vCPU, and the
207
+ * hypervisor timer runs only when the CPU is in guest mode.
208
+ * Switch before halt-polling so that KVM recognizes an expired
209
+ * timer before blocking.
210
+ */
211
+ kvm_save_timer(vcpu);
212
+ kvm_vcpu_block(vcpu);
213
+ }
214
215
+ return EMULATE_DONE;
216
+}
0 commit comments