From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jes Sorensen Subject: [patch] move MAX_CPUS to cpu.h Date: Thu, 18 Sep 2008 16:31:56 +0200 Message-ID: <48D2665C.5090306@sgi.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------090802010102000502090406" Cc: kvm@vger.kernel.org, kvm-ia64@vger.kernel.org To: Anthony Liguori Return-path: Received: from relay2.sgi.com ([192.48.171.30]:40603 "EHLO relay.sgi.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755918AbYIROcD (ORCPT ); Thu, 18 Sep 2008 10:32:03 -0400 Sender: kvm-owner@vger.kernel.org List-ID: This is a multi-part message in MIME format. --------------090802010102000502090406 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi, I noticed that qemu-kvm.c hardcodes the array of struct vcpu_info to 256, instead of using the MAX_CPUS #define. This patch corrects this by moving the definition of MAX_CPUS to cpu.h from vl.c and then fixes qemu-kvm.c Cheers, Jes --------------090802010102000502090406 Content-Type: text/plain; name="1000-qemu-kvm-vcpu-info.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="1000-qemu-kvm-vcpu-info.patch" Move definition of MAX_CPUS from vl.c to architecture specific cpu.h header file. Also change array of struct vcpu_info in qemu-kvm.c to use MAX_CPUS instead of hardcoded value of 256. Signed-off-by: Jes Sorensen --- qemu/qemu-kvm.c | 2 +- qemu/target-alpha/cpu.h | 2 ++ qemu/target-cris/cpu.h | 2 ++ qemu/target-i386/cpu.h | 2 ++ qemu/target-ia64/cpu.h | 2 ++ qemu/target-m68k/cpu.h | 2 ++ qemu/target-mips/cpu.h | 2 ++ qemu/target-ppc/cpu.h | 2 ++ qemu/target-sh4/cpu.h | 2 ++ qemu/target-sparc/cpu.h | 2 ++ qemu/vl.c | 9 --------- 11 files changed, 19 insertions(+), 10 deletions(-) Index: kvm-userspace.git/qemu/qemu-kvm.c =================================================================== --- kvm-userspace.git.orig/qemu/qemu-kvm.c +++ kvm-userspace.git/qemu/qemu-kvm.c @@ -65,7 +65,7 @@ int stopped; int created; struct qemu_kvm_work_item *queued_work_first, *queued_work_last; -} vcpu_info[256]; +} vcpu_info[MAX_CPUS]; pthread_t io_thread; static int io_thread_fd = -1; Index: kvm-userspace.git/qemu/target-alpha/cpu.h =================================================================== --- kvm-userspace.git.orig/qemu/target-alpha/cpu.h +++ kvm-userspace.git/qemu/target-alpha/cpu.h @@ -25,6 +25,8 @@ #define TARGET_LONG_BITS 64 +#define MAX_CPUS 1 + #include "cpu-defs.h" #include Index: kvm-userspace.git/qemu/target-cris/cpu.h =================================================================== --- kvm-userspace.git.orig/qemu/target-cris/cpu.h +++ kvm-userspace.git/qemu/target-cris/cpu.h @@ -23,6 +23,8 @@ #define TARGET_LONG_BITS 32 +#define MAX_CPUS 1 + #include "cpu-defs.h" #define TARGET_HAS_ICE 1 Index: kvm-userspace.git/qemu/target-i386/cpu.h =================================================================== --- kvm-userspace.git.orig/qemu/target-i386/cpu.h +++ kvm-userspace.git/qemu/target-i386/cpu.h @@ -22,6 +22,8 @@ #include "config.h" +#define MAX_CPUS 255 + #ifdef TARGET_X86_64 #define TARGET_LONG_BITS 64 #else Index: kvm-userspace.git/qemu/target-ia64/cpu.h =================================================================== --- kvm-userspace.git.orig/qemu/target-ia64/cpu.h +++ kvm-userspace.git/qemu/target-ia64/cpu.h @@ -32,6 +32,8 @@ #define TARGET_PAGE_BITS 16 +#define MAX_CPUS 4 + #define ELF_MACHINE EM_IA_64 #define NB_MMU_MODES 2 Index: kvm-userspace.git/qemu/target-m68k/cpu.h =================================================================== --- kvm-userspace.git.orig/qemu/target-m68k/cpu.h +++ kvm-userspace.git/qemu/target-m68k/cpu.h @@ -23,6 +23,8 @@ #define TARGET_LONG_BITS 32 +#define MAX_CPUS 1 + #include "cpu-defs.h" #include "softfloat.h" Index: kvm-userspace.git/qemu/target-mips/cpu.h =================================================================== --- kvm-userspace.git.orig/qemu/target-mips/cpu.h +++ kvm-userspace.git/qemu/target-mips/cpu.h @@ -3,6 +3,8 @@ #define TARGET_HAS_ICE 1 +#define MAX_CPUS 1 + #define ELF_MACHINE EM_MIPS #include "config.h" Index: kvm-userspace.git/qemu/target-ppc/cpu.h =================================================================== --- kvm-userspace.git.orig/qemu/target-ppc/cpu.h +++ kvm-userspace.git/qemu/target-ppc/cpu.h @@ -23,6 +23,8 @@ #include "config.h" #include +#define MAX_CPUS 1 + //#define PPC_EMULATE_32BITS_HYPV #if defined (TARGET_PPC64) Index: kvm-userspace.git/qemu/target-sh4/cpu.h =================================================================== --- kvm-userspace.git.orig/qemu/target-sh4/cpu.h +++ kvm-userspace.git/qemu/target-sh4/cpu.h @@ -22,6 +22,8 @@ #include "config.h" +#define MAX_CPUS 1 + #define TARGET_LONG_BITS 32 #define TARGET_HAS_ICE 1 Index: kvm-userspace.git/qemu/target-sparc/cpu.h =================================================================== --- kvm-userspace.git.orig/qemu/target-sparc/cpu.h +++ kvm-userspace.git/qemu/target-sparc/cpu.h @@ -3,6 +3,8 @@ #include "config.h" +#define MAX_CPUS 16 + #if !defined(TARGET_SPARC64) #define TARGET_LONG_BITS 32 #define TARGET_FPREGS 32 Index: kvm-userspace.git/qemu/vl.c =================================================================== --- kvm-userspace.git.orig/qemu/vl.c +++ kvm-userspace.git/qemu/vl.c @@ -215,15 +215,6 @@ static VLANState *first_vlan; int smp_cpus = 1; const char *vnc_display; -#if defined(TARGET_SPARC) -#define MAX_CPUS 16 -#elif defined(TARGET_I386) -#define MAX_CPUS 255 -#elif defined(TARGET_IA64) -#define MAX_CPUS 4 -#else -#define MAX_CPUS 1 -#endif int acpi_enabled = 1; int fd_bootchk = 1; int no_reboot = 0; --------------090802010102000502090406--