diff options
author | Jan Kiszka <jan.kiszka@siemens.com> | 2008-12-11 16:54:57 +0100 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2008-12-14 10:11:21 +0200 |
commit | bb8cd029455a26e4d876deffe53c86b5ba93be61 (patch) | |
tree | ade9933a711aae81657b9ec5e158d081a2ff58e8 /libkvm | |
parent | bc92f062da9ae3520f1ec9abdba4eaaa639be37b (diff) |
kvm: qemu: Switch to KVM_CAP_USER_NMI
Adopt to new KVM_CAP_USER_NMI interface for injecting NMIs from qemu
user space. As this capability is only provided on archs actually
requiring it, we can also drop a lot of empty arch stubs.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
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); |