From b2097003ecad43a34851e57969eadf74181d0080 Mon Sep 17 00:00:00 2001 From: aliguori Date: Tue, 7 Oct 2008 20:39:39 +0000 Subject: machine struct - specify max_cpus at the per machine level (Jes Sorensen) Introduce a max_cpus per-machine variable, allowing individual boards to limit it's number of CPUs. Check requested number of CPUs in setup code and exit if it exceeds the supported number for the machine. This also renders the static MAX_CPUS check obsolete, so remove this from vl.c. Signed-off-by: Jes Sorensen Signed-off-by: Anthony Liguori git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5443 c046a42c-6fe2-441c-8c8c-71466251a162 --- vl.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'vl.c') diff --git a/vl.c b/vl.c index 439d317784..5fe288e086 100644 --- a/vl.c +++ b/vl.c @@ -213,13 +213,6 @@ int usb_enabled = 0; 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 -#else -#define MAX_CPUS 1 -#endif int acpi_enabled = 1; int fd_bootchk = 1; int no_reboot = 0; @@ -9195,7 +9188,7 @@ int main(int argc, char **argv) break; case QEMU_OPTION_smp: smp_cpus = atoi(optarg); - if (smp_cpus < 1 || smp_cpus > MAX_CPUS) { + if (smp_cpus < 1) { fprintf(stderr, "Invalid number of CPUs\n"); exit(1); } @@ -9312,6 +9305,13 @@ int main(int argc, char **argv) } } + if (smp_cpus > machine->max_cpus) { + fprintf(stderr, "Number of SMP cpus requested (%d), exceeds max cpus " + "supported by machine `%s' (%d)\n", smp_cpus, machine->name, + machine->max_cpus); + exit(1); + } + if (nographic) { if (serial_device_index == 0) serial_devices[0] = "stdio"; -- cgit v1.2.3