All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jes Sorensen <jes@sgi.com>
To: kvm-ia64@vger.kernel.org
Subject: [patch] move MAX_CPUS to cpu.h
Date: Thu, 18 Sep 2008 14:31:56 +0000	[thread overview]
Message-ID: <48D2665C.5090306@sgi.com> (raw)

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

WARNING: multiple messages have this Message-ID (diff)
From: Jes Sorensen <jes@sgi.com>
To: Anthony Liguori <aliguori@us.ibm.com>
Cc: kvm@vger.kernel.org, kvm-ia64@vger.kernel.org
Subject: [patch] move MAX_CPUS to cpu.h
Date: Thu, 18 Sep 2008 16:31:56 +0200	[thread overview]
Message-ID: <48D2665C.5090306@sgi.com> (raw)

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

             reply	other threads:[~2008-09-18 14:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-18 14:31 Jes Sorensen [this message]
2008-09-18 14:31 ` [patch] move MAX_CPUS to cpu.h Jes Sorensen
2008-09-20  0:14 ` Avi Kivity
2008-09-20  0:14   ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48D2665C.5090306@sgi.com \
    --to=jes@sgi.com \
    --cc=kvm-ia64@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.