From: Glauber Costa <glommer@redhat.com>
To: kvm@vger.kernel.org
Cc: avi@redhat.com
Subject: [PATCH v2 1/9] replace USE_KVM with CONFIG_KVM
Date: Fri, 10 Jul 2009 16:17:52 -0400 [thread overview]
Message-ID: <1247257080-18549-2-git-send-email-glommer@redhat.com> (raw)
In-Reply-To: <1247257080-18549-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 +++++++-------
kvm-all.c | 2 ++
libkvm-all.h | 6 +++---
qemu-kvm.h | 2 +-
target-i386/kvm.c | 2 ++
vl.c | 6 +++---
7 files changed, 24 insertions(+), 28 deletions(-)
diff --git a/Makefile.target b/Makefile.target
index 660a855..11a6da8 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 3a224d1..fd76259 100755
--- a/configure
+++ b/configure
@@ -2125,8 +2125,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
@@ -2163,9 +2163,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
@@ -2187,9 +2187,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"
@@ -2284,7 +2284,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/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 e16646c..3e3e1b4 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>
@@ -952,10 +952,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 4c185fd..96dc85f 100644
--- a/qemu-kvm.h
+++ b/qemu-kvm.h
@@ -136,7 +136,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 0af2f55..d26161a 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
@@ -959,3 +960,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 5d86e69..ae02ef7 100644
--- a/vl.c
+++ b/vl.c
@@ -5644,14 +5644,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;
@@ -5948,7 +5948,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");
--
1.6.2.2
next prev parent reply other threads:[~2009-07-10 20:18 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-10 20:17 [PATCH v2 0/9] Move closer to upstream Glauber Costa
2009-07-10 20:17 ` Glauber Costa [this message]
2009-07-10 20:17 ` [PATCH v2 2/9] Do not compile qemu-kvm.c and qemu-kvm-x86.c Glauber Costa
2009-07-10 20:17 ` [PATCH v2 3/9] replace malloc with qemu_malloc Glauber Costa
2009-07-10 20:17 ` [PATCH v2 4/9] remove leftover: Glauber Costa
2009-07-10 20:17 ` [PATCH v2 5/9] fold libkvm-all into standard qemu header Glauber Costa
2009-07-10 20:17 ` [PATCH v2 6/9] duplicate KVMState Glauber Costa
2009-07-10 20:17 ` [PATCH v2 7/9] provide env->kvm_fd Glauber Costa
2009-07-10 20:17 ` [PATCH v2 8/9] use kvm_upstream sw_breakpoints structure Glauber Costa
2009-07-10 20:18 ` [PATCH v2 9/9] reuse upstream breakpoint code Glauber Costa
2009-07-12 9:30 ` Gleb Natapov
2009-07-12 9:01 ` [PATCH v2 0/9] Move closer to upstream 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=1247257080-18549-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