mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 02:03:56 -06:00
kvm: add API to set ioeventfd
Comment on kvm usage: rather than require users to do if (kvm_enabled()) and/or ifdefs, this patch adds an API that, internally, is defined to stub function on non-kvm build, and checks kvm_enabled for non-kvm run. While rest of qemu code still uses if (kvm_enabled()), I think this approach is cleaner, and we should convert rest of code to it long term. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
95d528a2fe
commit
ca82180603
2 changed files with 39 additions and 1 deletions
18
kvm.h
18
kvm.h
|
@ -14,12 +14,17 @@
|
|||
#ifndef QEMU_KVM_H
|
||||
#define QEMU_KVM_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <errno.h>
|
||||
#include "config-host.h"
|
||||
#include "qemu-queue.h"
|
||||
|
||||
extern int kvm_allowed;
|
||||
#ifdef CONFIG_KVM
|
||||
#include <linux/kvm.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_KVM
|
||||
extern int kvm_allowed;
|
||||
#define kvm_enabled() (kvm_allowed)
|
||||
#else
|
||||
#define kvm_enabled() (0)
|
||||
|
@ -161,5 +166,16 @@ static inline void cpu_synchronize_post_init(CPUState *env)
|
|||
kvm_cpu_synchronize_post_init(env);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(KVM_IOEVENTFD) && defined(CONFIG_KVM)
|
||||
int kvm_set_ioeventfd_pio_word(int fd, uint16_t adr, uint16_t val, bool assign);
|
||||
#else
|
||||
static inline
|
||||
int kvm_set_ioeventfd_pio_word(int fd, uint16_t adr, uint16_t val, bool assign)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue