kvm: Enable user space NMI injection for kvm guest
Make use of the new KVM_NMI IOCTL to send NMIs into the KVM guest if the user space raised them. (example: qemu monitor's "nmi" command) Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com> Acked-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
This commit is contained in:
parent
b646968336
commit
276ce81563
3
configure
vendored
3
configure
vendored
@ -1671,6 +1671,9 @@ if test "$kvm" != "no" ; then
|
|||||||
#if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
|
#if !defined(KVM_CAP_DESTROY_MEMORY_REGION_WORKS)
|
||||||
#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
|
#error Missing KVM capability KVM_CAP_DESTROY_MEMORY_REGION_WORKS
|
||||||
#endif
|
#endif
|
||||||
|
#if !defined(KVM_CAP_USER_NMI)
|
||||||
|
#error Missing KVM capability KVM_CAP_USER_NMI
|
||||||
|
#endif
|
||||||
int main(void) { return 0; }
|
int main(void) { return 0; }
|
||||||
EOF
|
EOF
|
||||||
if test "$kerneldir" != "" ; then
|
if test "$kerneldir" != "" ; then
|
||||||
|
@ -1417,6 +1417,13 @@ int kvm_arch_get_registers(CPUState *env)
|
|||||||
|
|
||||||
int kvm_arch_pre_run(CPUState *env, struct kvm_run *run)
|
int kvm_arch_pre_run(CPUState *env, struct kvm_run *run)
|
||||||
{
|
{
|
||||||
|
/* Inject NMI */
|
||||||
|
if (env->interrupt_request & CPU_INTERRUPT_NMI) {
|
||||||
|
env->interrupt_request &= ~CPU_INTERRUPT_NMI;
|
||||||
|
DPRINTF("injected NMI\n");
|
||||||
|
kvm_vcpu_ioctl(env, KVM_NMI);
|
||||||
|
}
|
||||||
|
|
||||||
/* Try to inject an interrupt if the guest can accept it */
|
/* Try to inject an interrupt if the guest can accept it */
|
||||||
if (run->ready_for_interrupt_injection &&
|
if (run->ready_for_interrupt_injection &&
|
||||||
(env->interrupt_request & CPU_INTERRUPT_HARD) &&
|
(env->interrupt_request & CPU_INTERRUPT_HARD) &&
|
||||||
|
Loading…
x
Reference in New Issue
Block a user