[patch] move MAX_CPUS to cpu.h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

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@xxxxxxx>

---
 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;

[Index of Archives]     [Linux KVM Devel]     [Linux Virtualization]     [Big List of Linux Books]     [Linux SCSI]     [Yosemite Forum]

  Powered by Linux