Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-2.12-pull-request...
[qemu/ar7.git] / target / i386 / kvm_i386.h
blob1de9876cd9d74795481343e1b97645a3c856d579
1 /*
2 * QEMU KVM support -- x86 specific functions.
4 * Copyright (c) 2012 Linaro Limited
6 * This work is licensed under the terms of the GNU GPL, version 2 or later.
7 * See the COPYING file in the top-level directory.
9 */
11 #ifndef QEMU_KVM_I386_H
12 #define QEMU_KVM_I386_H
14 #include "sysemu/kvm.h"
16 #define kvm_apic_in_kernel() (kvm_irqchip_in_kernel())
18 #ifdef CONFIG_KVM
20 #define kvm_pit_in_kernel() \
21 (kvm_irqchip_in_kernel() && !kvm_irqchip_is_split())
22 #define kvm_pic_in_kernel() \
23 (kvm_irqchip_in_kernel() && !kvm_irqchip_is_split())
24 #define kvm_ioapic_in_kernel() \
25 (kvm_irqchip_in_kernel() && !kvm_irqchip_is_split())
27 #else
29 #define kvm_pit_in_kernel() 0
30 #define kvm_pic_in_kernel() 0
31 #define kvm_ioapic_in_kernel() 0
33 /* These constants must never be used at runtime if kvm_enabled() is false.
34 * They exist so we don't need #ifdefs around KVM-specific code that already
35 * checks kvm_enabled() properly.
37 #define KVM_CPUID_FEATURES 0
39 #endif /* CONFIG_KVM */
41 bool kvm_allows_irq0_override(void);
42 bool kvm_has_smm(void);
43 bool kvm_has_adjust_clock_stable(void);
44 void kvm_synchronize_all_tsc(void);
45 void kvm_arch_reset_vcpu(X86CPU *cs);
46 void kvm_arch_do_init_vcpu(X86CPU *cs);
48 int kvm_device_pci_assign(KVMState *s, PCIHostDeviceAddress *dev_addr,
49 uint32_t flags, uint32_t *dev_id);
50 int kvm_device_pci_deassign(KVMState *s, uint32_t dev_id);
52 int kvm_device_intx_assign(KVMState *s, uint32_t dev_id,
53 bool use_host_msi, uint32_t guest_irq);
54 int kvm_device_intx_set_mask(KVMState *s, uint32_t dev_id, bool masked);
55 int kvm_device_intx_deassign(KVMState *s, uint32_t dev_id, bool use_host_msi);
57 int kvm_device_msi_assign(KVMState *s, uint32_t dev_id, int virq);
58 int kvm_device_msi_deassign(KVMState *s, uint32_t dev_id);
60 bool kvm_device_msix_supported(KVMState *s);
61 int kvm_device_msix_init_vectors(KVMState *s, uint32_t dev_id,
62 uint32_t nr_vectors);
63 int kvm_device_msix_set_vector(KVMState *s, uint32_t dev_id, uint32_t vector,
64 int virq);
65 int kvm_device_msix_assign(KVMState *s, uint32_t dev_id);
66 int kvm_device_msix_deassign(KVMState *s, uint32_t dev_id);
68 void kvm_put_apicbase(X86CPU *cpu, uint64_t value);
70 bool kvm_enable_x2apic(void);
71 bool kvm_has_x2apic_api(void);
72 #endif