From: Glauber Costa <glommer@redhat.com>
To: kvm@vger.kernel.org
Cc: avi@redhat.com
Subject: [PATCH v3 1/8] replace USE_KVM with CONFIG_KVM
Date: Tue, 14 Jul 2009 11:35:11 -0400 [thread overview]
Message-ID: <1247585718-32738-2-git-send-email-glommer@redhat.com> (raw)
In-Reply-To: <1247585718-32738-1-git-send-email-glommer@redhat.com>
Make things less confuse, and we have KVM_UPSTREAM to differentiate
between the two versions anyway. kvm-all.c and kvm.c gets compiled now,
but protected with KVM_UPSTREAM too, so no function in there gets visible
in the final binary
Signed-off-by: Glauber Costa <glommer@redhat.com>
---
Makefile.target | 20 ++++++--------------
configure | 14 +++++++-------
hw/acpi.c | 4 ++--
hw/msix.c | 2 +-
hw/virtio-net.c | 4 ++--
kvm-all.c | 2 ++
libkvm-all.h | 6 +++---
qemu-kvm.h | 2 +-
target-i386/kvm.c | 2 ++
vl.c | 8 ++++----
10 files changed, 30 insertions(+), 34 deletions(-)
diff --git a/Makefile.target b/Makefile.target
index e3189a1..e0edd27 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -160,9 +160,7 @@ ifeq ($(ARCH),sparc64)
CPPFLAGS+=-I$(SRC_PATH)/tcg/sparc
endif
-ifeq ($(USE_KVM), 1)
-libobj-y += qemu-kvm.o
-endif
+libobj-$(CONFIG_KVM) += qemu-kvm.o
ifdef CONFIG_SOFTFLOAT
libobj-y += fpu/softfloat.o
else
@@ -173,18 +171,14 @@ libobj-y += op_helper.o helper.o
ifeq ($(TARGET_ARCH), i386)
libobj-y += helper.o
-ifeq ($(USE_KVM), 1)
-libobj-y += qemu-kvm-x86.o kvm-tpr-opt.o
-libobj-y += qemu-kvm-helper.o
-endif
+libobj-$(CONFIG_KVM) += qemu-kvm-x86.o kvm-tpr-opt.o
+libobj-$(CONFIG_KVM) += qemu-kvm-helper.o
endif
ifeq ($(TARGET_ARCH), x86_64)
libobj-y += helper.o
-ifeq ($(USE_KVM), 1)
-libobj-y += qemu-kvm-x86.o kvm-tpr-opt.o
-libobj-y += qemu-kvm-helper.o
-endif
+libobj-$(CONFIG_KVM) += qemu-kvm-x86.o kvm-tpr-opt.o
+libobj-$(CONFIG_KVM) += qemu-kvm-helper.o
endif
libobj-y += op_helper.o
@@ -203,9 +197,7 @@ endif
ifeq ($(TARGET_BASE_ARCH), ia64)
libobj-y += op_helper.o firmware.o
-ifeq ($(USE_KVM), 1)
-libobj-y += qemu-kvm-ia64.o
-endif
+libobj-$(CONFIG_KVM) += qemu-kvm-ia64.o
endif
ifeq ($(TARGET_BASE_ARCH), cris)
diff --git a/configure b/configure
index f8b80f2..9b744c5 100755
--- a/configure
+++ b/configure
@@ -2121,8 +2121,8 @@ disable_cpu_emulation() {
configure_kvm() {
if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
\( "$cpu" = "i386" -o "$cpu" = "x86_64" -o "$cpu" = "ia64" -o "$cpu" = "powerpc" \); then
- echo "#define USE_KVM 1" >> $config_h
- echo "USE_KVM=1" >> $config_mak
+ echo "#define CONFIG_KVM 1" >> $config_h
+ echo "CONFIG_KVM=y" >> $config_mak
echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
if test $kvm_cap_pit = "yes" ; then
echo "USE_KVM_PIT=1" >> $config_mak
@@ -2159,9 +2159,9 @@ case "$target_arch2" in
echo "#define CONFIG_KQEMU 1" >> $config_h
fi
if test "$target_kvm" = "yes" ; then
- echo "USE_KVM=yes" >> $config_mak
+ echo "CONFIG_KVM=y" >> $config_mak
echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
- echo "#define USE_KVM 1" >> $config_h
+ echo "#define CONFIG_KVM 1" >> $config_h
fi
if test "$xen" = "yes" -a "$target_softmmu" = "yes";
then
@@ -2183,9 +2183,9 @@ case "$target_arch2" in
fi
if [ use_upstream_kvm = yes ]; then
if test "$target_kvm" = "yes" ; then
- echo "USE_KVM=yes" >> $config_mak
+ echo "CONFIG_KVM=y" >> $config_mak
echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
- echo "#define USE_KVM 1" >> $config_h
+ echo "#define CONFIG_KVM 1" >> $config_h
fi
fi
if test "$xen" = "yes" -a "$target_softmmu" = "yes"
@@ -2281,7 +2281,7 @@ case "$target_arch2" in
if test "$target_kvm" = "yes" ; then
echo "CONFIG_KVM=y" >> $config_mak
echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
- echo "#define USE_KVM 1" >> $config_h
+ echo "#define CONFIG_KVM 1" >> $config_h
fi
fi
gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
diff --git a/hw/acpi.c b/hw/acpi.c
index 074e09f..7de9cb7 100644
--- a/hw/acpi.c
+++ b/hw/acpi.c
@@ -775,7 +775,7 @@ static void disable_processor(struct gpe_regs *g, int cpu)
}
#if defined(TARGET_I386) || defined(TARGET_X86_64)
-#ifdef USE_KVM
+#ifdef CONFIG_KVM
static CPUState *qemu_kvm_cpu_env(int index)
{
CPUState *penv;
@@ -798,7 +798,7 @@ void qemu_system_cpu_hot_add(int cpu, int state)
CPUState *env;
if (state
-#ifdef USE_KVM
+#ifdef CONFIG_KVM
&& (!qemu_kvm_cpu_env(cpu))
#endif
) {
diff --git a/hw/msix.c b/hw/msix.c
index 5f77dc9..b5dfa0b 100644
--- a/hw/msix.c
+++ b/hw/msix.c
@@ -63,7 +63,7 @@
/* Flag for interrupt controller to declare MSI-X support */
int msix_supported;
-#ifdef USE_KVM
+#ifdef CONFIG_KVM
/* KVM specific MSIX helpers */
static void kvm_msix_free(PCIDevice *dev)
{
diff --git a/hw/virtio-net.c b/hw/virtio-net.c
index 6b82232..bda2397 100644
--- a/hw/virtio-net.c
+++ b/hw/virtio-net.c
@@ -15,7 +15,7 @@
#include "net.h"
#include "qemu-timer.h"
#include "virtio-net.h"
-#ifdef USE_KVM
+#ifdef CONFIG_KVM
#include "qemu-kvm.h"
#endif
@@ -344,7 +344,7 @@ static void virtio_net_handle_rx(VirtIODevice *vdev, VirtQueue *vq)
qemu_flush_queued_packets(n->vc);
-#ifdef USE_KVM
+#ifdef CONFIG_KVM
/* We now have RX buffers, signal to the IO thread to break out of the
select to re-poll the tap file descriptor */
if (kvm_enabled())
diff --git a/kvm-all.c b/kvm-all.c
index 8567ac9..4c2fdf5 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -26,6 +26,7 @@
#include "gdbstub.h"
#include "kvm.h"
+#ifdef KVM_UPSTREAM
/* KVM uses PAGE_SIZE in it's definition of COALESCED_MMIO_MAX */
#define PAGE_SIZE TARGET_PAGE_SIZE
@@ -1027,3 +1028,4 @@ void kvm_remove_all_breakpoints(CPUState *current_env)
{
}
#endif /* !KVM_CAP_SET_GUEST_DEBUG */
+#endif
diff --git a/libkvm-all.h b/libkvm-all.h
index f36d3c3..e28f950 100644
--- a/libkvm-all.h
+++ b/libkvm-all.h
@@ -5,7 +5,7 @@
#ifndef LIBKVM_H
#define LIBKVM_H
-#ifdef USE_KVM
+#ifdef CONFIG_KVM
#if defined(__s390__)
#include <asm/ptrace.h>
@@ -925,10 +925,10 @@ int kvm_assign_set_msix_entry(kvm_context_t kvm,
uint32_t kvm_get_supported_cpuid(kvm_context_t kvm, uint32_t function, int reg);
-#else /* !USE_KVM */
+#else /* !CONFIG_KVM */
struct kvm_pit_state { };
-#endif /* !USE_KVM */
+#endif /* !CONFIG_KVM */
#endif
diff --git a/qemu-kvm.h b/qemu-kvm.h
index 2153afc..333109f 100644
--- a/qemu-kvm.h
+++ b/qemu-kvm.h
@@ -138,7 +138,7 @@ void kvm_arch_do_ioperm(void *_data);
#define ALIGN(x, y) (((x)+(y)-1) & ~((y)-1))
#define BITMAP_SIZE(m) (ALIGN(((m)>>TARGET_PAGE_BITS), HOST_LONG_BITS) / 8)
-#ifdef USE_KVM
+#ifdef CONFIG_KVM
#include "sys-queue.h"
extern int kvm_allowed;
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 1da1543..b7eb096 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -24,6 +24,7 @@
#include "cpu.h"
#include "gdbstub.h"
+#ifdef KVM_UPSTREAM
//#define DEBUG_KVM
#ifdef DEBUG_KVM
@@ -962,3 +963,4 @@ void kvm_arch_update_guest_debug(CPUState *env, struct kvm_guest_debug *dbg)
}
}
#endif /* KVM_CAP_SET_GUEST_DEBUG */
+#endif
diff --git a/vl.c b/vl.c
index 5949acb..357043a 100644
--- a/vl.c
+++ b/vl.c
@@ -5434,14 +5434,14 @@ int main(int argc, char **argv, char **envp)
break;
#endif
#ifdef CONFIG_KVM
+#ifdef KVM_UPSTREAM
case QEMU_OPTION_enable_kvm:
kvm_allowed = 1;
#ifdef CONFIG_KQEMU
kqemu_allowed = 0;
#endif
- break;
#endif
-#ifdef USE_KVM
+ break;
case QEMU_OPTION_no_kvm:
kvm_allowed = 0;
break;
@@ -5750,7 +5750,7 @@ int main(int argc, char **argv, char **envp)
signal(SIGTTIN, SIG_IGN);
}
-#ifdef USE_KVM
+#ifdef CONFIG_KVM
if (kvm_enabled()) {
if (kvm_qemu_init() < 0) {
fprintf(stderr, "Could not initialize KVM, will disable KVM support\n");
@@ -6023,7 +6023,7 @@ int main(int argc, char **argv, char **envp)
if (kvm_enabled()) {
kvm_init_ap();
-#ifdef USE_KVM
+#ifdef CONFIG_KVM
if (kvm_irqchip) {
if (!qemu_kvm_has_gsi_routing()) {
irq0override = 0;
--
1.6.2.2
next prev parent reply other threads:[~2009-07-14 15:35 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-14 15:35 [PATCH v3 0/8] Move closer to upstream Glauber Costa
2009-07-14 15:35 ` Glauber Costa [this message]
2009-07-14 15:35 ` [PATCH v3 2/8] Do not compile qemu-kvm.c and qemu-kvm-x86.c Glauber Costa
2009-07-14 15:35 ` [PATCH v3 3/8] replace malloc with qemu_malloc Glauber Costa
2009-07-14 15:35 ` [PATCH v3 4/8] fold libkvm-all into standard qemu header Glauber Costa
2009-07-14 15:35 ` [PATCH v3 5/8] duplicate KVMState Glauber Costa
2009-07-14 15:35 ` [PATCH v3 6/8] provide env->kvm_fd Glauber Costa
2009-07-14 15:35 ` [PATCH v3 7/8] use kvm_upstream sw_breakpoints structure Glauber Costa
2009-07-14 15:35 ` [PATCH v3 8/8] reuse upstream breakpoint code Glauber Costa
2009-07-14 20:45 ` Jan Kiszka
2009-07-14 21:01 ` Glauber Costa
2009-07-14 21:31 ` Marcelo Tosatti
2009-07-14 23:20 ` [PATCH v3 0/8] Move closer to upstream Marcelo Tosatti
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=1247585718-32738-2-git-send-email-glommer@redhat.com \
--to=glommer@redhat.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox