public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] move MAX_CPUS to cpu.h
@ 2008-09-18 14:31 Jes Sorensen
  2008-09-20  0:14 ` Avi Kivity
  0 siblings, 1 reply; 2+ messages in thread
From: Jes Sorensen @ 2008-09-18 14:31 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: kvm, kvm-ia64

[-- Attachment #1: Type: text/plain, Size: 239 bytes --]

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


[-- Attachment #2: 1000-qemu-kvm-vcpu-info.patch --]
[-- Type: text/plain, Size: 4666 bytes --]

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 <jes@sgi.com>

---
 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 <setjmp.h>
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 <inttypes.h>
 
+#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;

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-09-20  0:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-18 14:31 [patch] move MAX_CPUS to cpu.h Jes Sorensen
2008-09-20  0:14 ` Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox