From patchwork Fri Jul 10 20:17:52 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Glauber Costa X-Patchwork-Id: 35101 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n6AKI9gR020538 for ; Fri, 10 Jul 2009 20:18:09 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756323AbZGJUSG (ORCPT ); Fri, 10 Jul 2009 16:18:06 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756070AbZGJUSF (ORCPT ); Fri, 10 Jul 2009 16:18:05 -0400 Received: from mx2.redhat.com ([66.187.237.31]:53913 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753171AbZGJUSC (ORCPT ); Fri, 10 Jul 2009 16:18:02 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n6AKI2VI018110 for ; Fri, 10 Jul 2009 16:18:02 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n6AKI1PG007783; Fri, 10 Jul 2009 16:18:01 -0400 Received: from localhost.localdomain (virtlab1.virt.bos.redhat.com [10.16.72.21]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n6AKI0uN026979; Fri, 10 Jul 2009 16:18:01 -0400 From: Glauber Costa 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 Message-Id: <1247257080-18549-2-git-send-email-glommer@redhat.com> In-Reply-To: <1247257080-18549-1-git-send-email-glommer@redhat.com> References: <1247257080-18549-1-git-send-email-glommer@redhat.com> X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org 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 --- 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 @@ -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");