diff options
Diffstat (limited to 'libkvm')
-rw-r--r-- | libkvm/libkvm.c | 8 | ||||
-rw-r--r-- | libkvm/libkvm.h | 2 |
2 files changed, 6 insertions, 4 deletions
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c index f6ddfde0..d4b1a734 100644 --- a/libkvm/libkvm.c +++ b/libkvm/libkvm.c @@ -832,9 +832,11 @@ int try_push_interrupts(kvm_context_t kvm) return kvm->callbacks->try_push_interrupts(kvm->opaque); } -void push_nmi(kvm_context_t kvm) +static inline void push_nmi(kvm_context_t kvm) { +#ifdef KVM_CAP_USER_NMI kvm->callbacks->push_nmi(kvm->opaque); +#endif /* KVM_CAP_USER_NMI */ } void post_kvm_run(kvm_context_t kvm, void *env) @@ -868,9 +870,7 @@ int kvm_run(kvm_context_t kvm, int vcpu, void *env) struct kvm_run *run = kvm->run[vcpu]; again: -#ifdef KVM_CAP_NMI push_nmi(kvm); -#endif #if !defined(__s390__) if (!kvm->irqchip_in_kernel) run->request_interrupt_window = try_push_interrupts(kvm); @@ -1032,7 +1032,7 @@ int kvm_has_sync_mmu(kvm_context_t kvm) int kvm_inject_nmi(kvm_context_t kvm, int vcpu) { -#ifdef KVM_CAP_NMI +#ifdef KVM_CAP_USER_NMI return ioctl(kvm->vcpu_fd[vcpu], KVM_NMI); #else return -ENOSYS; diff --git a/libkvm/libkvm.h b/libkvm/libkvm.h index 963b184e..392065ba 100644 --- a/libkvm/libkvm.h +++ b/libkvm/libkvm.h @@ -66,7 +66,9 @@ struct kvm_callbacks { int (*shutdown)(void *opaque, void *env); int (*io_window)(void *opaque); int (*try_push_interrupts)(void *opaque); +#ifdef KVM_CAP_USER_NMI void (*push_nmi)(void *opaque); +#endif void (*post_kvm_run)(void *opaque, void *env); int (*pre_kvm_run)(void *opaque, void *env); int (*tpr_access)(void *opaque, int vcpu, uint64_t rip, int is_write); |