On Mon, Sep 20, 2010 at 05:06:49PM +0200, Avi Kivity wrote: > Target-specific definitions need to be qualified with NEED_CPU_H so kvm.h > can be included from non-target-specific files. > > Signed-off-by: Avi Kivity <avi@xxxxxxxxxx> Long term, would be cleaner to split this into two files ... > --- > kvm-stub.c | 1 + > qemu-kvm.h | 21 ++++++++++++++++++++- > 2 files changed, 21 insertions(+), 1 deletions(-) > > diff --git a/kvm-stub.c b/kvm-stub.c > index 37d2b7a..2e4bf00 100644 > --- a/kvm-stub.c > +++ b/kvm-stub.c > @@ -169,3 +169,4 @@ bool kvm_msix_notify(PCIDevice *dev, unsigned vector) > { > return false; > } > + intentional? > diff --git a/qemu-kvm.h b/qemu-kvm.h > index 9809574..66ae18f 100644 > --- a/qemu-kvm.h > +++ b/qemu-kvm.h > @@ -8,7 +8,9 @@ > #ifndef THE_ORIGINAL_AND_TRUE_QEMU_KVM_H > #define THE_ORIGINAL_AND_TRUE_QEMU_KVM_H > > +#ifdef NEED_CPU_H > #include "cpu.h" > +#endif > > #include <signal.h> > #include <stdlib.h> > @@ -794,6 +796,8 @@ typedef struct kvm_vcpu_context *kvm_vcpu_context_t; > struct kvm_pit_state { > }; > > +#ifdef NEED_CPU_H > + > static inline void kvm_inject_x86_mce(CPUState *cenv, int bank, > uint64_t status, uint64_t mcg_status, > uint64_t addr, uint64_t misc, > @@ -803,8 +807,9 @@ static inline void kvm_inject_x86_mce(CPUState *cenv, int bank, > abort(); > } > > -#endif /* !CONFIG_KVM */ > +#endif > > +#endif /* !CONFIG_KVM */ > > /*! > * \brief Create new KVM context > @@ -820,9 +825,11 @@ int kvm_init(int smp_cpus); > > int kvm_main_loop(void); > int kvm_init_ap(void); > +#ifdef NEED_CPU_H > int kvm_vcpu_inited(CPUState *env); > void kvm_save_lapic(CPUState *env); > void kvm_load_lapic(CPUState *env); > +#endif > > void kvm_hpet_enable_kpit(void); > void kvm_hpet_disable_kpit(void); > @@ -830,11 +837,13 @@ int kvm_set_irq(int irq, int level, int *status); > > int kvm_physical_memory_set_dirty_tracking(int enable); > > +#ifdef NEED_CPU_H > 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 > #ifndef CONFIG_USER_ONLY > void *kvm_cpu_create_phys_mem(target_phys_addr_t start_addr, unsigned long size, > int log, int writable); > @@ -850,6 +859,7 @@ int kvm_qemu_destroy_memory_alias(uint64_t phys_start); > > int kvm_arch_qemu_create_context(void); > > +#ifdef NEED_CPU_H > void kvm_arch_save_regs(CPUState *env); > void kvm_arch_load_regs(CPUState *env, int level); > int kvm_arch_has_work(CPUState *env); > @@ -858,12 +868,15 @@ int kvm_arch_try_push_interrupts(void *opaque); > void kvm_arch_push_nmi(void *opaque); > void kvm_arch_cpu_reset(CPUState *env); > int kvm_set_boot_cpu_id(uint32_t id); > +#endif > > void qemu_kvm_aio_wait_start(void); > void qemu_kvm_aio_wait(void); > void qemu_kvm_aio_wait_end(void); > > +#ifdef NEED_CPU_H > void kvm_tpr_access_report(CPUState *env, uint64_t rip, int is_write); > +#endif > > int kvm_arch_init_irq_routing(void); > > @@ -873,15 +886,20 @@ int kvm_mmio_write(void *opaque, uint64_t addr, uint8_t * data, int len); > #ifdef CONFIG_KVM_DEVICE_ASSIGNMENT > struct ioperm_data; > > +#ifdef NEED_CPU_H > void kvm_ioperm(CPUState *env, void *data); > void kvm_add_ioperm_data(struct ioperm_data *data); > void kvm_remove_ioperm_data(unsigned long start_port, unsigned long num); > void kvm_arch_do_ioperm(void *_data); > #endif > +#endif > > #define ALIGN(x, y) (((x)+(y)-1) & ~((y)-1)) > +#ifdef NEED_CPU_H > #define BITMAP_SIZE(m) (ALIGN(((m)>>TARGET_PAGE_BITS), HOST_LONG_BITS) / 8) > +#endif > > +#ifdef NEED_CPU_H > #ifdef CONFIG_KVM > #include "qemu-queue.h" > > @@ -915,6 +933,7 @@ int handle_tpr_access(void *opaque, CPUState *env, uint64_t rip, > #endif > #define qemu_kvm_cpu_stop(env) do {} while(0) > #endif > +#endif > > #ifdef CONFIG_KVM > > -- > 1.7.2.3 -- 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