They are identical, no need for private copies. This requires replacing qemu-kvm.h includes with kvm.h, a good thing anyway, and reveals that there is no need for QEMU_KVM_NO_CPU protection. Signed-off-by: Jan Kiszka <jan.kiszka@xxxxxxxxxxx> --- hw/i8254.c | 2 +- hw/i8259.c | 2 +- hw/ioapic.c | 2 +- hw/msix.c | 3 +-- hw/pc.c | 2 +- hw/piix_pci.c | 2 +- kvm.h | 7 +++---- qemu-kvm.h | 41 ----------------------------------------- vl.c | 3 ++- 9 files changed, 11 insertions(+), 53 deletions(-) diff --git a/hw/i8254.c b/hw/i8254.c index c4f8d2e..db9e94a 100644 --- a/hw/i8254.c +++ b/hw/i8254.c @@ -25,7 +25,7 @@ #include "pc.h" #include "isa.h" #include "qemu-timer.h" -#include "qemu-kvm.h" +#include "kvm.h" #include "i8254.h" //#define DEBUG_PIT diff --git a/hw/i8259.c b/hw/i8259.c index 7a484c0..b64c6fb 100644 --- a/hw/i8259.c +++ b/hw/i8259.c @@ -27,7 +27,7 @@ #include "monitor.h" #include "qemu-timer.h" -#include "qemu-kvm.h" +#include "kvm.h" /* debug PIC */ //#define DEBUG_PIC diff --git a/hw/ioapic.c b/hw/ioapic.c index a66325d..0adb0ac 100644 --- a/hw/ioapic.c +++ b/hw/ioapic.c @@ -26,7 +26,7 @@ #include "qemu-timer.h" #include "host-utils.h" -#include "qemu-kvm.h" +#include "kvm.h" //#define DEBUG_IOAPIC diff --git a/hw/msix.c b/hw/msix.c index 87f125b..faee0b2 100644 --- a/hw/msix.c +++ b/hw/msix.c @@ -14,8 +14,7 @@ #include "hw.h" #include "msix.h" #include "pci.h" -#define QEMU_KVM_NO_CPU -#include "qemu-kvm.h" +#include "kvm.h" /* Declaration from linux/pci_regs.h */ #define PCI_CAP_ID_MSIX 0x11 /* MSI-X */ diff --git a/hw/pc.c b/hw/pc.c index 97e16ce..dac373e 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -47,7 +47,7 @@ #include "multiboot.h" #include "device-assignment.h" -#include "qemu-kvm.h" +#include "kvm.h" /* output Bochs bios info messages */ //#define DEBUG_BIOS diff --git a/hw/piix_pci.c b/hw/piix_pci.c index 155587b..170f858 100644 --- a/hw/piix_pci.c +++ b/hw/piix_pci.c @@ -28,7 +28,7 @@ #include "pci_host.h" #include "isa.h" #include "sysbus.h" -#include "qemu-kvm.h" +#include "kvm.h" /* * I440FX chipset data sheet. diff --git a/kvm.h b/kvm.h index 9fa4e25..d0f4bbe 100644 --- a/kvm.h +++ b/kvm.h @@ -18,8 +18,6 @@ #include "qemu-queue.h" #include "qemu-kvm.h" -#ifdef KVM_UPSTREAM - #ifdef CONFIG_KVM extern int kvm_allowed; @@ -28,6 +26,7 @@ extern int kvm_allowed; #define kvm_enabled() (0) #endif +#ifdef KVM_UPSTREAM struct kvm_run; /* external API */ @@ -138,6 +137,8 @@ int kvm_check_extension(KVMState *s, unsigned int extension); uint32_t kvm_arch_get_supported_cpuid(CPUState *env, uint32_t function, int reg); +#endif + void kvm_cpu_synchronize_state(CPUState *env); /* generic hooks - to be moved/refactored once there are more users */ @@ -150,5 +151,3 @@ static inline void cpu_synchronize_state(CPUState *env) } #endif - -#endif diff --git a/qemu-kvm.h b/qemu-kvm.h index 465aeac..a6e3271 100644 --- a/qemu-kvm.h +++ b/qemu-kvm.h @@ -8,9 +8,7 @@ #ifndef THE_ORIGINAL_AND_TRUE_QEMU_KVM_H #define THE_ORIGINAL_AND_TRUE_QEMU_KVM_H -#ifndef QEMU_KVM_NO_CPU #include "cpu.h" -#endif #include <signal.h> #include <stdlib.h> @@ -94,8 +92,6 @@ void kvm_show_code(CPUState *env); int handle_halt(CPUState *env); -#ifndef QEMU_KVM_NO_CPU - int handle_shutdown(kvm_context_t kvm, CPUState *env); void post_kvm_run(kvm_context_t kvm, CPUState *env); int pre_kvm_run(kvm_context_t kvm, CPUState *env); @@ -113,8 +109,6 @@ struct kvm_x86_mce; int kvm_set_mce(CPUState *env, struct kvm_x86_mce *mce); #endif -#endif - /*! * \brief Create new KVM context * @@ -880,8 +874,6 @@ static inline int kvm_init(int smp_cpus) return 0; } -#ifndef QEMU_KVM_NO_CPU - static inline void kvm_inject_x86_mce(CPUState *cenv, int bank, uint64_t status, uint64_t mcg_status, uint64_t addr, uint64_t misc, @@ -891,16 +883,11 @@ static inline void kvm_inject_x86_mce(CPUState *cenv, int bank, abort(); } -#endif - -extern int kvm_allowed; - #endif /* !CONFIG_KVM */ int kvm_main_loop(void); int kvm_init_ap(void); -#ifndef QEMU_KVM_NO_CPU int kvm_vcpu_inited(CPUState *env); void kvm_load_mpstate(CPUState *env); void kvm_save_mpstate(CPUState *env); @@ -914,7 +901,6 @@ int kvm_update_guest_debug(CPUState *env, unsigned long reinject_trap); void kvm_apic_init(CPUState *env); /* called from vcpu initialization */ void qemu_kvm_load_lapic(CPUState *env); -#endif void kvm_hpet_enable_kpit(void); void kvm_hpet_disable_kpit(void); @@ -923,13 +909,11 @@ int kvm_set_irq(int irq, int level, int *status); int kvm_physical_memory_set_dirty_tracking(int enable); int kvm_update_dirty_pages_log(void); -#ifndef QEMU_KVM_NO_CPU void qemu_kvm_call_with_env(void (*func)(void *), void *data, CPUState *env); void qemu_kvm_cpuid_on_env(CPUState *env); void kvm_inject_interrupt(CPUState *env, int mask); void kvm_update_after_sipi(CPUState *env); void kvm_update_interrupt_request(CPUState *env); -#endif void kvm_set_phys_mem(target_phys_addr_t start_addr, ram_addr_t size, ram_addr_t phys_offset); void *kvm_cpu_create_phys_mem(target_phys_addr_t start_addr, unsigned long size, @@ -946,7 +930,6 @@ int kvm_qemu_destroy_memory_alias(uint64_t phys_start); int kvm_arch_qemu_create_context(void); -#ifndef QEMU_KVM_NO_CPU void kvm_arch_save_regs(CPUState *env); void kvm_arch_load_regs(CPUState *env); void kvm_arch_load_mpstate(CPUState *env); @@ -988,19 +971,15 @@ int kvm_arch_remove_hw_breakpoint(target_ulong addr, target_ulong len, void kvm_arch_remove_all_hw_breakpoints(void); void kvm_arch_update_guest_debug(CPUState *env, struct kvm_guest_debug *dbg); -#endif - void qemu_kvm_aio_wait_start(void); void qemu_kvm_aio_wait(void); void qemu_kvm_aio_wait_end(void); void qemu_kvm_notify_work(void); -#ifndef QEMU_KVM_NO_CPU void kvm_tpr_opt_setup(void); void kvm_tpr_access_report(CPUState *env, uint64_t rip, int is_write); void kvm_tpr_vcpu_start(CPUState *env); -#endif int qemu_kvm_get_dirty_pages(unsigned long phys_addr, void *buf); int kvm_coalesce_mmio_region(target_phys_addr_t start, ram_addr_t size); @@ -1021,14 +1000,11 @@ void kvm_arch_do_ioperm(void *_data); #endif #define ALIGN(x, y) (((x)+(y)-1) & ~((y)-1)) -#ifndef QEMU_KVM_NO_CPU #define BITMAP_SIZE(m) (ALIGN(((m)>>TARGET_PAGE_BITS), HOST_LONG_BITS) / 8) -#endif #ifdef CONFIG_KVM #include "qemu-queue.h" -extern int kvm_allowed; extern int kvm_irqchip; extern int kvm_pit; extern int kvm_pit_reinject; @@ -1048,7 +1024,6 @@ int handle_tpr_access(void *opaque, CPUState *env, uint64_t rip, int is_write); int kvm_has_sync_mmu(void); -#define kvm_enabled() (kvm_allowed) #define qemu_kvm_pit_in_kernel() kvm_pit_in_kernel(kvm_context) #define qemu_kvm_has_gsi_routing() kvm_has_gsi_routing(kvm_context) #ifdef TARGET_I386 @@ -1058,11 +1033,9 @@ void kvm_init_vcpu(CPUState *env); void kvm_load_tsc(CPUState *env); #else #define kvm_has_sync_mmu() (0) -#define kvm_enabled() (0) #define kvm_nested 0 #define qemu_kvm_pit_in_kernel() (0) #define qemu_kvm_has_gsi_routing() (0) -#ifndef QEMU_KVM_NO_CPU #ifdef TARGET_I386 #define qemu_kvm_has_pit_state2() (0) #endif @@ -1076,7 +1049,6 @@ static inline void kvm_load_tsc(CPUState *env) { } #endif -#endif void kvm_mutex_unlock(void); void kvm_mutex_lock(void); @@ -1093,22 +1065,9 @@ static inline int kvm_sync_vcpus(void) return 0; } -#ifndef QEMU_KVM_NO_CPU -void kvm_cpu_synchronize_state(CPUState *env); - -static inline void cpu_synchronize_state(CPUState *env) -{ - if (kvm_enabled()) { - kvm_cpu_synchronize_state(env); - } -} - uint32_t kvm_arch_get_supported_cpuid(CPUState *env, uint32_t function, int reg); - -#endif - static inline int kvm_set_migration_log(int enable) { return kvm_physical_memory_set_dirty_tracking(enable); diff --git a/vl.c b/vl.c index 4ef6a78..25af448 100644 --- a/vl.c +++ b/vl.c @@ -157,7 +157,6 @@ int main(int argc, char **argv) #include "qemu-option.h" #include "qemu-config.h" #include "qemu-objects.h" -#include "qemu-kvm.h" #include "hw/device-assignment.h" #include "disas.h" @@ -5799,8 +5798,10 @@ int main(int argc, char **argv, char **envp) fprintf(stderr, "failed to initialize KVM\n"); exit(1); #endif +#ifdef CONFIG_KVM fprintf(stderr, "Could not initialize KVM, will disable KVM support\n"); kvm_allowed = 0; +#endif } } -- 1.6.0.2 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html