From: "Michael S. Tsirkin" <mst@redhat.com>
To: Avi Kivity <avi@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>, kvm@vger.kernel.org
Subject: Re: [PATCH 8/9] Protect qemu-kvm.h declarations with NEED_CPU_H
Date: Mon, 20 Sep 2010 19:05:00 +0200 [thread overview]
Message-ID: <20100920170500.GE29862@redhat.com> (raw)
In-Reply-To: <1284995210-32432-9-git-send-email-avi@redhat.com>
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@redhat.com>
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
next prev parent reply other threads:[~2010-09-20 17:10 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-20 15:06 [PATCH 0/9] msix/kvm integration cleanups Avi Kivity
2010-09-20 15:06 ` [PATCH 1/9] msix: avoid leaking kvm data on init failure Avi Kivity
2010-09-20 15:06 ` [PATCH 2/9] msix: make kvm specific initialization a function Avi Kivity
2010-09-20 15:06 ` [PATCH 3/9] msix: move kvm specific msix notify into " Avi Kivity
2010-09-20 15:06 ` [PATCH 4/9] msix: move definitions from msix.c to msix.h Avi Kivity
2010-09-20 16:56 ` Michael S. Tsirkin
2010-09-21 16:03 ` Avi Kivity
2010-09-20 15:06 ` [PATCH 5/9] Add missing #include to hw/irq.h Avi Kivity
2010-09-20 15:06 ` [PATCH 6/9] msix: move kvm support functions to kvm-all.c and kvm-stub.c Avi Kivity
2010-09-20 15:06 ` [PATCH 7/9] msix: Move kvm_enabled() guards to kvm-all.c functions Avi Kivity
2010-09-20 15:06 ` [PATCH 8/9] Protect qemu-kvm.h declarations with NEED_CPU_H Avi Kivity
2010-09-20 17:05 ` Michael S. Tsirkin [this message]
2010-09-21 16:03 ` Avi Kivity
2010-09-20 15:06 ` [PATCH 9/9] Move msix.o build back to Makefile.objs Avi Kivity
2010-09-20 17:02 ` [PATCH 0/9] msix/kvm integration cleanups Michael S. Tsirkin
2010-09-21 16:05 ` Avi Kivity
2010-09-21 16:14 ` Michael S. Tsirkin
2010-10-06 9:39 ` Michael S. Tsirkin
2010-10-06 9:50 ` Avi Kivity
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100920170500.GE29862@redhat.com \
--to=mst@redhat.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.