kvm_host.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549
  1. #ifndef __KVM_HOST_H
  2. #define __KVM_HOST_H
  3. /*
  4. * This work is licensed under the terms of the GNU GPL, version 2. See
  5. * the COPYING file in the top-level directory.
  6. */
  7. #include <linux/types.h>
  8. #include <linux/hardirq.h>
  9. #include <linux/list.h>
  10. #include <linux/mutex.h>
  11. #include <linux/spinlock.h>
  12. #include <linux/signal.h>
  13. #include <linux/sched.h>
  14. #include <linux/mm.h>
  15. #include <linux/preempt.h>
  16. #include <linux/marker.h>
  17. #include <linux/msi.h>
  18. #include <asm/signal.h>
  19. #include <linux/kvm.h>
  20. #include <linux/kvm_para.h>
  21. #include <linux/kvm_types.h>
  22. #include <asm/kvm_host.h>
  23. /*
  24. * vcpu->requests bit members
  25. */
  26. #define KVM_REQ_TLB_FLUSH 0
  27. #define KVM_REQ_MIGRATE_TIMER 1
  28. #define KVM_REQ_REPORT_TPR_ACCESS 2
  29. #define KVM_REQ_MMU_RELOAD 3
  30. #define KVM_REQ_TRIPLE_FAULT 4
  31. #define KVM_REQ_PENDING_TIMER 5
  32. #define KVM_REQ_UNHALT 6
  33. #define KVM_REQ_MMU_SYNC 7
  34. #define KVM_REQ_KVMCLOCK_UPDATE 8
  35. #define KVM_REQ_KICK 9
  36. #define KVM_USERSPACE_IRQ_SOURCE_ID 0
  37. struct kvm;
  38. struct kvm_vcpu;
  39. extern struct kmem_cache *kvm_vcpu_cache;
  40. /*
  41. * It would be nice to use something smarter than a linear search, TBD...
  42. * Thankfully we dont expect many devices to register (famous last words :),
  43. * so until then it will suffice. At least its abstracted so we can change
  44. * in one place.
  45. */
  46. struct kvm_io_bus {
  47. int dev_count;
  48. #define NR_IOBUS_DEVS 6
  49. struct kvm_io_device *devs[NR_IOBUS_DEVS];
  50. };
  51. void kvm_io_bus_init(struct kvm_io_bus *bus);
  52. void kvm_io_bus_destroy(struct kvm_io_bus *bus);
  53. int kvm_io_bus_write(struct kvm_io_bus *bus, gpa_t addr, int len,
  54. const void *val);
  55. int kvm_io_bus_read(struct kvm_io_bus *bus, gpa_t addr, int len,
  56. void *val);
  57. void __kvm_io_bus_register_dev(struct kvm_io_bus *bus,
  58. struct kvm_io_device *dev);
  59. void kvm_io_bus_register_dev(struct kvm *kvm, struct kvm_io_bus *bus,
  60. struct kvm_io_device *dev);
  61. struct kvm_vcpu {
  62. struct kvm *kvm;
  63. #ifdef CONFIG_PREEMPT_NOTIFIERS
  64. struct preempt_notifier preempt_notifier;
  65. #endif
  66. int vcpu_id;
  67. struct mutex mutex;
  68. int cpu;
  69. struct kvm_run *run;
  70. unsigned long requests;
  71. unsigned long guest_debug;
  72. int fpu_active;
  73. int guest_fpu_loaded;
  74. wait_queue_head_t wq;
  75. int sigset_active;
  76. sigset_t sigset;
  77. struct kvm_vcpu_stat stat;
  78. #ifdef CONFIG_HAS_IOMEM
  79. int mmio_needed;
  80. int mmio_read_completed;
  81. int mmio_is_write;
  82. int mmio_size;
  83. unsigned char mmio_data[8];
  84. gpa_t mmio_phys_addr;
  85. #endif
  86. struct kvm_vcpu_arch arch;
  87. };
  88. struct kvm_memory_slot {
  89. gfn_t base_gfn;
  90. unsigned long npages;
  91. unsigned long flags;
  92. unsigned long *rmap;
  93. unsigned long *dirty_bitmap;
  94. struct {
  95. unsigned long rmap_pde;
  96. int write_count;
  97. } *lpage_info[KVM_NR_PAGE_SIZES - 1];
  98. unsigned long userspace_addr;
  99. int user_alloc;
  100. };
  101. struct kvm_kernel_irq_routing_entry {
  102. u32 gsi;
  103. u32 type;
  104. int (*set)(struct kvm_kernel_irq_routing_entry *e,
  105. struct kvm *kvm, int level);
  106. union {
  107. struct {
  108. unsigned irqchip;
  109. unsigned pin;
  110. } irqchip;
  111. struct msi_msg msi;
  112. };
  113. struct list_head link;
  114. };
  115. struct kvm {
  116. spinlock_t mmu_lock;
  117. spinlock_t requests_lock;
  118. struct rw_semaphore slots_lock;
  119. struct mm_struct *mm; /* userspace tied to this vm */
  120. int nmemslots;
  121. struct kvm_memory_slot memslots[KVM_MEMORY_SLOTS +
  122. KVM_PRIVATE_MEM_SLOTS];
  123. #ifdef CONFIG_KVM_APIC_ARCHITECTURE
  124. u32 bsp_vcpu_id;
  125. struct kvm_vcpu *bsp_vcpu;
  126. #endif
  127. struct kvm_vcpu *vcpus[KVM_MAX_VCPUS];
  128. atomic_t online_vcpus;
  129. struct list_head vm_list;
  130. struct mutex lock;
  131. struct kvm_io_bus mmio_bus;
  132. struct kvm_io_bus pio_bus;
  133. #ifdef CONFIG_HAVE_KVM_EVENTFD
  134. struct {
  135. spinlock_t lock;
  136. struct list_head items;
  137. } irqfds;
  138. #endif
  139. struct kvm_vm_stat stat;
  140. struct kvm_arch arch;
  141. atomic_t users_count;
  142. #ifdef KVM_COALESCED_MMIO_PAGE_OFFSET
  143. struct kvm_coalesced_mmio_dev *coalesced_mmio_dev;
  144. struct kvm_coalesced_mmio_ring *coalesced_mmio_ring;
  145. #endif
  146. struct mutex irq_lock;
  147. #ifdef CONFIG_HAVE_KVM_IRQCHIP
  148. struct list_head irq_routing; /* of kvm_kernel_irq_routing_entry */
  149. struct hlist_head mask_notifier_list;
  150. #endif
  151. #ifdef KVM_ARCH_WANT_MMU_NOTIFIER
  152. struct mmu_notifier mmu_notifier;
  153. unsigned long mmu_notifier_seq;
  154. long mmu_notifier_count;
  155. #endif
  156. };
  157. /* The guest did something we don't support. */
  158. #define pr_unimpl(vcpu, fmt, ...) \
  159. do { \
  160. if (printk_ratelimit()) \
  161. printk(KERN_ERR "kvm: %i: cpu%i " fmt, \
  162. current->tgid, (vcpu)->vcpu_id , ## __VA_ARGS__); \
  163. } while (0)
  164. #define kvm_printf(kvm, fmt ...) printk(KERN_DEBUG fmt)
  165. #define vcpu_printf(vcpu, fmt...) kvm_printf(vcpu->kvm, fmt)
  166. static inline struct kvm_vcpu *kvm_get_vcpu(struct kvm *kvm, int i)
  167. {
  168. smp_rmb();
  169. return kvm->vcpus[i];
  170. }
  171. #define kvm_for_each_vcpu(idx, vcpup, kvm) \
  172. for (idx = 0, vcpup = kvm_get_vcpu(kvm, idx); \
  173. idx < atomic_read(&kvm->online_vcpus) && vcpup; \
  174. vcpup = kvm_get_vcpu(kvm, ++idx))
  175. int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id);
  176. void kvm_vcpu_uninit(struct kvm_vcpu *vcpu);
  177. void vcpu_load(struct kvm_vcpu *vcpu);
  178. void vcpu_put(struct kvm_vcpu *vcpu);
  179. int kvm_init(void *opaque, unsigned int vcpu_size,
  180. struct module *module);
  181. void kvm_exit(void);
  182. void kvm_get_kvm(struct kvm *kvm);
  183. void kvm_put_kvm(struct kvm *kvm);
  184. #define HPA_MSB ((sizeof(hpa_t) * 8) - 1)
  185. #define HPA_ERR_MASK ((hpa_t)1 << HPA_MSB)
  186. static inline int is_error_hpa(hpa_t hpa) { return hpa >> HPA_MSB; }
  187. struct page *gva_to_page(struct kvm_vcpu *vcpu, gva_t gva);
  188. extern struct page *bad_page;
  189. extern pfn_t bad_pfn;
  190. int is_error_page(struct page *page);
  191. int is_error_pfn(pfn_t pfn);
  192. int kvm_is_error_hva(unsigned long addr);
  193. int kvm_set_memory_region(struct kvm *kvm,
  194. struct kvm_userspace_memory_region *mem,
  195. int user_alloc);
  196. int __kvm_set_memory_region(struct kvm *kvm,
  197. struct kvm_userspace_memory_region *mem,
  198. int user_alloc);
  199. int kvm_arch_set_memory_region(struct kvm *kvm,
  200. struct kvm_userspace_memory_region *mem,
  201. struct kvm_memory_slot old,
  202. int user_alloc);
  203. void kvm_disable_largepages(void);
  204. void kvm_arch_flush_shadow(struct kvm *kvm);
  205. gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn);
  206. struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn);
  207. unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn);
  208. void kvm_release_page_clean(struct page *page);
  209. void kvm_release_page_dirty(struct page *page);
  210. void kvm_set_page_dirty(struct page *page);
  211. void kvm_set_page_accessed(struct page *page);
  212. pfn_t gfn_to_pfn(struct kvm *kvm, gfn_t gfn);
  213. void kvm_release_pfn_dirty(pfn_t);
  214. void kvm_release_pfn_clean(pfn_t pfn);
  215. void kvm_set_pfn_dirty(pfn_t pfn);
  216. void kvm_set_pfn_accessed(pfn_t pfn);
  217. void kvm_get_pfn(pfn_t pfn);
  218. int kvm_read_guest_page(struct kvm *kvm, gfn_t gfn, void *data, int offset,
  219. int len);
  220. int kvm_read_guest_atomic(struct kvm *kvm, gpa_t gpa, void *data,
  221. unsigned long len);
  222. int kvm_read_guest(struct kvm *kvm, gpa_t gpa, void *data, unsigned long len);
  223. int kvm_write_guest_page(struct kvm *kvm, gfn_t gfn, const void *data,
  224. int offset, int len);
  225. int kvm_write_guest(struct kvm *kvm, gpa_t gpa, const void *data,
  226. unsigned long len);
  227. int kvm_clear_guest_page(struct kvm *kvm, gfn_t gfn, int offset, int len);
  228. int kvm_clear_guest(struct kvm *kvm, gpa_t gpa, unsigned long len);
  229. struct kvm_memory_slot *gfn_to_memslot(struct kvm *kvm, gfn_t gfn);
  230. int kvm_is_visible_gfn(struct kvm *kvm, gfn_t gfn);
  231. void mark_page_dirty(struct kvm *kvm, gfn_t gfn);
  232. void kvm_vcpu_block(struct kvm_vcpu *vcpu);
  233. void kvm_resched(struct kvm_vcpu *vcpu);
  234. void kvm_load_guest_fpu(struct kvm_vcpu *vcpu);
  235. void kvm_put_guest_fpu(struct kvm_vcpu *vcpu);
  236. void kvm_flush_remote_tlbs(struct kvm *kvm);
  237. void kvm_reload_remote_mmus(struct kvm *kvm);
  238. long kvm_arch_dev_ioctl(struct file *filp,
  239. unsigned int ioctl, unsigned long arg);
  240. long kvm_arch_vcpu_ioctl(struct file *filp,
  241. unsigned int ioctl, unsigned long arg);
  242. int kvm_dev_ioctl_check_extension(long ext);
  243. int kvm_get_dirty_log(struct kvm *kvm,
  244. struct kvm_dirty_log *log, int *is_dirty);
  245. int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm,
  246. struct kvm_dirty_log *log);
  247. int kvm_vm_ioctl_set_memory_region(struct kvm *kvm,
  248. struct
  249. kvm_userspace_memory_region *mem,
  250. int user_alloc);
  251. long kvm_arch_vm_ioctl(struct file *filp,
  252. unsigned int ioctl, unsigned long arg);
  253. int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu);
  254. int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu);
  255. int kvm_arch_vcpu_ioctl_translate(struct kvm_vcpu *vcpu,
  256. struct kvm_translation *tr);
  257. int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs);
  258. int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs);
  259. int kvm_arch_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu,
  260. struct kvm_sregs *sregs);
  261. int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
  262. struct kvm_sregs *sregs);
  263. int kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu,
  264. struct kvm_mp_state *mp_state);
  265. int kvm_arch_vcpu_ioctl_set_mpstate(struct kvm_vcpu *vcpu,
  266. struct kvm_mp_state *mp_state);
  267. int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu,
  268. struct kvm_guest_debug *dbg);
  269. int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run);
  270. int kvm_arch_init(void *opaque);
  271. void kvm_arch_exit(void);
  272. int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu);
  273. void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu);
  274. void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu);
  275. void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu);
  276. void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu);
  277. struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id);
  278. int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu);
  279. void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu);
  280. int kvm_arch_vcpu_reset(struct kvm_vcpu *vcpu);
  281. void kvm_arch_hardware_enable(void *garbage);
  282. void kvm_arch_hardware_disable(void *garbage);
  283. int kvm_arch_hardware_setup(void);
  284. void kvm_arch_hardware_unsetup(void);
  285. void kvm_arch_check_processor_compat(void *rtn);
  286. int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu);
  287. int kvm_arch_interrupt_allowed(struct kvm_vcpu *vcpu);
  288. void kvm_free_physmem(struct kvm *kvm);
  289. struct kvm *kvm_arch_create_vm(void);
  290. void kvm_arch_destroy_vm(struct kvm *kvm);
  291. void kvm_free_all_assigned_devices(struct kvm *kvm);
  292. void kvm_arch_sync_events(struct kvm *kvm);
  293. int kvm_cpu_get_interrupt(struct kvm_vcpu *v);
  294. int kvm_cpu_has_interrupt(struct kvm_vcpu *v);
  295. int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu);
  296. void kvm_vcpu_kick(struct kvm_vcpu *vcpu);
  297. int kvm_is_mmio_pfn(pfn_t pfn);
  298. struct kvm_irq_ack_notifier {
  299. struct hlist_node link;
  300. unsigned gsi;
  301. void (*irq_acked)(struct kvm_irq_ack_notifier *kian);
  302. };
  303. #define KVM_ASSIGNED_MSIX_PENDING 0x1
  304. struct kvm_guest_msix_entry {
  305. u32 vector;
  306. u16 entry;
  307. u16 flags;
  308. };
  309. struct kvm_assigned_dev_kernel {
  310. struct kvm_irq_ack_notifier ack_notifier;
  311. struct work_struct interrupt_work;
  312. struct list_head list;
  313. int assigned_dev_id;
  314. int host_busnr;
  315. int host_devfn;
  316. unsigned int entries_nr;
  317. int host_irq;
  318. bool host_irq_disabled;
  319. struct msix_entry *host_msix_entries;
  320. int guest_irq;
  321. struct kvm_guest_msix_entry *guest_msix_entries;
  322. unsigned long irq_requested_type;
  323. int irq_source_id;
  324. int flags;
  325. struct pci_dev *dev;
  326. struct kvm *kvm;
  327. spinlock_t assigned_dev_lock;
  328. };
  329. struct kvm_irq_mask_notifier {
  330. void (*func)(struct kvm_irq_mask_notifier *kimn, bool masked);
  331. int irq;
  332. struct hlist_node link;
  333. };
  334. void kvm_register_irq_mask_notifier(struct kvm *kvm, int irq,
  335. struct kvm_irq_mask_notifier *kimn);
  336. void kvm_unregister_irq_mask_notifier(struct kvm *kvm, int irq,
  337. struct kvm_irq_mask_notifier *kimn);
  338. void kvm_fire_mask_notifiers(struct kvm *kvm, int irq, bool mask);
  339. int kvm_set_irq(struct kvm *kvm, int irq_source_id, int irq, int level);
  340. void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin);
  341. void kvm_register_irq_ack_notifier(struct kvm *kvm,
  342. struct kvm_irq_ack_notifier *kian);
  343. void kvm_unregister_irq_ack_notifier(struct kvm *kvm,
  344. struct kvm_irq_ack_notifier *kian);
  345. int kvm_request_irq_source_id(struct kvm *kvm);
  346. void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id);
  347. /* For vcpu->arch.iommu_flags */
  348. #define KVM_IOMMU_CACHE_COHERENCY 0x1
  349. #ifdef CONFIG_IOMMU_API
  350. int kvm_iommu_map_pages(struct kvm *kvm, gfn_t base_gfn,
  351. unsigned long npages);
  352. int kvm_iommu_map_guest(struct kvm *kvm);
  353. int kvm_iommu_unmap_guest(struct kvm *kvm);
  354. int kvm_assign_device(struct kvm *kvm,
  355. struct kvm_assigned_dev_kernel *assigned_dev);
  356. int kvm_deassign_device(struct kvm *kvm,
  357. struct kvm_assigned_dev_kernel *assigned_dev);
  358. #else /* CONFIG_IOMMU_API */
  359. static inline int kvm_iommu_map_pages(struct kvm *kvm,
  360. gfn_t base_gfn,
  361. unsigned long npages)
  362. {
  363. return 0;
  364. }
  365. static inline int kvm_iommu_map_guest(struct kvm *kvm)
  366. {
  367. return -ENODEV;
  368. }
  369. static inline int kvm_iommu_unmap_guest(struct kvm *kvm)
  370. {
  371. return 0;
  372. }
  373. static inline int kvm_assign_device(struct kvm *kvm,
  374. struct kvm_assigned_dev_kernel *assigned_dev)
  375. {
  376. return 0;
  377. }
  378. static inline int kvm_deassign_device(struct kvm *kvm,
  379. struct kvm_assigned_dev_kernel *assigned_dev)
  380. {
  381. return 0;
  382. }
  383. #endif /* CONFIG_IOMMU_API */
  384. static inline void kvm_guest_enter(void)
  385. {
  386. account_system_vtime(current);
  387. current->flags |= PF_VCPU;
  388. }
  389. static inline void kvm_guest_exit(void)
  390. {
  391. account_system_vtime(current);
  392. current->flags &= ~PF_VCPU;
  393. }
  394. static inline int memslot_id(struct kvm *kvm, struct kvm_memory_slot *slot)
  395. {
  396. return slot - kvm->memslots;
  397. }
  398. static inline gpa_t gfn_to_gpa(gfn_t gfn)
  399. {
  400. return (gpa_t)gfn << PAGE_SHIFT;
  401. }
  402. static inline hpa_t pfn_to_hpa(pfn_t pfn)
  403. {
  404. return (hpa_t)pfn << PAGE_SHIFT;
  405. }
  406. static inline void kvm_migrate_timers(struct kvm_vcpu *vcpu)
  407. {
  408. set_bit(KVM_REQ_MIGRATE_TIMER, &vcpu->requests);
  409. }
  410. enum kvm_stat_kind {
  411. KVM_STAT_VM,
  412. KVM_STAT_VCPU,
  413. };
  414. struct kvm_stats_debugfs_item {
  415. const char *name;
  416. int offset;
  417. enum kvm_stat_kind kind;
  418. struct dentry *dentry;
  419. };
  420. extern struct kvm_stats_debugfs_item debugfs_entries[];
  421. extern struct dentry *kvm_debugfs_dir;
  422. #ifdef KVM_ARCH_WANT_MMU_NOTIFIER
  423. static inline int mmu_notifier_retry(struct kvm_vcpu *vcpu, unsigned long mmu_seq)
  424. {
  425. if (unlikely(vcpu->kvm->mmu_notifier_count))
  426. return 1;
  427. /*
  428. * Both reads happen under the mmu_lock and both values are
  429. * modified under mmu_lock, so there's no need of smb_rmb()
  430. * here in between, otherwise mmu_notifier_count should be
  431. * read before mmu_notifier_seq, see
  432. * mmu_notifier_invalidate_range_end write side.
  433. */
  434. if (vcpu->kvm->mmu_notifier_seq != mmu_seq)
  435. return 1;
  436. return 0;
  437. }
  438. #endif
  439. #ifdef CONFIG_HAVE_KVM_IRQCHIP
  440. #define KVM_MAX_IRQ_ROUTES 1024
  441. int kvm_setup_default_irq_routing(struct kvm *kvm);
  442. int kvm_set_irq_routing(struct kvm *kvm,
  443. const struct kvm_irq_routing_entry *entries,
  444. unsigned nr,
  445. unsigned flags);
  446. void kvm_free_irq_routing(struct kvm *kvm);
  447. #else
  448. static inline void kvm_free_irq_routing(struct kvm *kvm) {}
  449. #endif
  450. #ifdef CONFIG_HAVE_KVM_EVENTFD
  451. void kvm_irqfd_init(struct kvm *kvm);
  452. int kvm_irqfd(struct kvm *kvm, int fd, int gsi, int flags);
  453. void kvm_irqfd_release(struct kvm *kvm);
  454. #else
  455. static inline void kvm_irqfd_init(struct kvm *kvm) {}
  456. static inline int kvm_irqfd(struct kvm *kvm, int fd, int gsi, int flags)
  457. {
  458. return -EINVAL;
  459. }
  460. static inline void kvm_irqfd_release(struct kvm *kvm) {}
  461. #endif /* CONFIG_HAVE_KVM_EVENTFD */
  462. #ifdef CONFIG_KVM_APIC_ARCHITECTURE
  463. static inline bool kvm_vcpu_is_bsp(struct kvm_vcpu *vcpu)
  464. {
  465. return vcpu->kvm->bsp_vcpu_id == vcpu->vcpu_id;
  466. }
  467. #endif
  468. #endif