Revision ca821806
b/kvm-all.c | ||
---|---|---|
1151 | 1151 |
|
1152 | 1152 |
return r; |
1153 | 1153 |
} |
1154 |
|
|
1155 |
#ifdef KVM_IOEVENTFD |
|
1156 |
int kvm_set_ioeventfd_pio_word(int fd, uint16_t addr, uint16_t val, bool assign) |
|
1157 |
{ |
|
1158 |
struct kvm_ioeventfd kick = { |
|
1159 |
.datamatch = val, |
|
1160 |
.addr = addr, |
|
1161 |
.len = 2, |
|
1162 |
.flags = KVM_IOEVENTFD_FLAG_DATAMATCH | KVM_IOEVENTFD_FLAG_PIO, |
|
1163 |
.fd = fd, |
|
1164 |
}; |
|
1165 |
int r; |
|
1166 |
if (!kvm_enabled()) |
|
1167 |
return -ENOSYS; |
|
1168 |
if (!assign) |
|
1169 |
kick.flags |= KVM_IOEVENTFD_FLAG_DEASSIGN; |
|
1170 |
r = kvm_vm_ioctl(kvm_state, KVM_IOEVENTFD, &kick); |
|
1171 |
if (r < 0) |
|
1172 |
return r; |
|
1173 |
return 0; |
|
1174 |
} |
|
1175 |
#endif |
b/kvm.h | ||
---|---|---|
14 | 14 |
#ifndef QEMU_KVM_H |
15 | 15 |
#define QEMU_KVM_H |
16 | 16 |
|
17 |
#include <stdbool.h> |
|
18 |
#include <errno.h> |
|
17 | 19 |
#include "config-host.h" |
18 | 20 |
#include "qemu-queue.h" |
19 | 21 |
|
20 |
extern int kvm_allowed; |
|
22 |
#ifdef CONFIG_KVM |
|
23 |
#include <linux/kvm.h> |
|
24 |
#endif |
|
21 | 25 |
|
22 | 26 |
#ifdef CONFIG_KVM |
27 |
extern int kvm_allowed; |
|
23 | 28 |
#define kvm_enabled() (kvm_allowed) |
24 | 29 |
#else |
25 | 30 |
#define kvm_enabled() (0) |
... | ... | |
161 | 166 |
kvm_cpu_synchronize_post_init(env); |
162 | 167 |
} |
163 | 168 |
} |
169 |
|
|
170 |
#if defined(KVM_IOEVENTFD) && defined(CONFIG_KVM) |
|
171 |
int kvm_set_ioeventfd_pio_word(int fd, uint16_t adr, uint16_t val, bool assign); |
|
172 |
#else |
|
173 |
static inline |
|
174 |
int kvm_set_ioeventfd_pio_word(int fd, uint16_t adr, uint16_t val, bool assign) |
|
175 |
{ |
|
176 |
return -ENOSYS; |
|
177 |
} |
|
178 |
#endif |
|
179 |
|
|
164 | 180 |
#endif |
165 | 181 |
#endif |
Also available in: Unified diff