move MAX_CPUS to cpu.h
PATCH 1/1 move MAX_CPUS to cpu.h
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.
--- 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(-)
qemu/qemu-kvm.c +1 -1
@@ -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 ;
qemu/target-alpha/cpu.h +2 -0
@@ -25,6 +25,8 @@#define TARGET_LONG_BITS 64 +#define MAX_CPUS 1 +#include "cpu-defs.h" #include <setjmp.h>
qemu/target-cris/cpu.h +2 -0
@@ -23,6 +23,8 @@#define TARGET_LONG_BITS 32 +#define MAX_CPUS 1 +#include "cpu-defs.h" #define TARGET_HAS_ICE 1
qemu/target-i386/cpu.h +2 -0
@@ -22,6 +22,8 @@#include "config.h" +#define MAX_CPUS 255 +#ifdef TARGET_X86_64 #define TARGET_LONG_BITS 64#else
qemu/target-ia64/cpu.h +2 -0
@@ -32,6 +32,8 @@#define TARGET_PAGE_BITS 16 +#define MAX_CPUS 4 +#define ELF_MACHINE EM_IA_64#define NB_MMU_MODES 2
qemu/target-m68k/cpu.h +2 -0
@@ -23,6 +23,8 @@#define TARGET_LONG_BITS 32 +#define MAX_CPUS 1 +#include "cpu-defs.h" #include "softfloat.h"
qemu/target-mips/cpu.h +2 -0
@@ -3,6 +3,8 @@#define TARGET_HAS_ICE 1 +#define MAX_CPUS 1 +#define ELF_MACHINE EM_MIPS#include "config.h"
qemu/target-ppc/cpu.h +2 -0
@@ -23,6 +23,8 @@#include "config.h" #include <inttypes.h> +#define MAX_CPUS 1 +//#define PPC_EMULATE_32BITS_HYPV #if defined (TARGET_PPC64 )
qemu/target-sh4/cpu.h +2 -0
@@ -22,6 +22,8 @@#include "config.h" +#define MAX_CPUS 1 +#define TARGET_LONG_BITS 32#define TARGET_HAS_ICE 1
qemu/target-sparc/cpu.h +2 -0
@@ -3,6 +3,8 @@#include "config.h" +#define MAX_CPUS 16 +#if !defined(TARGET_SPARC64 )#define TARGET_LONG_BITS 32#define TARGET_FPREGS 32
qemu/vl.c +0 -9
@@ -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 ;
Quoted 6 lines · Jes Sorensen
Hi,
I noticed that
qemu-kvm.chardcodes the array of structvcpu_infoto 256, instead of using theMAX_CPUS#define. This patch corrects this by moving the definition ofMAX_CPUStocpu.hfromvl.cand then fixesqemu-kvm.c
This should be send to qemu-devel (without the kvm change), and after the next merge we can fix qemu-kvm.c.
Signature · 2 lines
I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.