Commit b2097003ecad43a34851e57969eadf74181d0080
1 parent
4b32e168
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 <jes@sgi.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5443 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
30 changed files
with
59 additions
and
8 deletions
hw/an5206.c
hw/boards.h
hw/dummy_m68k.c
hw/etraxfs.c
hw/gumstix.c
... | ... | @@ -126,6 +126,7 @@ QEMUMachine connex_machine = { |
126 | 126 | .desc = "Gumstix Connex (PXA255)", |
127 | 127 | .init = connex_init, |
128 | 128 | .ram_require = (0x05000000 + PXA2XX_INTERNAL_SIZE) | RAMSIZE_FIXED, |
129 | + .max_cpus = 1, | |
129 | 130 | }; |
130 | 131 | |
131 | 132 | QEMUMachine verdex_machine = { |
... | ... | @@ -133,4 +134,5 @@ QEMUMachine verdex_machine = { |
133 | 134 | .desc = "Gumstix Verdex (PXA270)", |
134 | 135 | .init = verdex_init, |
135 | 136 | .ram_require = (0x12000000 + PXA2XX_INTERNAL_SIZE) | RAMSIZE_FIXED, |
137 | + .max_cpus = 1, | |
136 | 138 | }; | ... | ... |
hw/integratorcp.c
hw/mainstone.c
hw/mcf5208.c
hw/mips_jazz.c
... | ... | @@ -278,6 +278,7 @@ QEMUMachine mips_magnum_machine = { |
278 | 278 | .init = mips_magnum_init, |
279 | 279 | .ram_require = MAGNUM_BIOS_SIZE + VGA_RAM_SIZE, |
280 | 280 | .nodisk_ok = 1, |
281 | + .max_cpus = 1, | |
281 | 282 | }; |
282 | 283 | |
283 | 284 | QEMUMachine mips_pica61_machine = { |
... | ... | @@ -286,4 +287,5 @@ QEMUMachine mips_pica61_machine = { |
286 | 287 | .init = mips_pica61_init, |
287 | 288 | .ram_require = MAGNUM_BIOS_SIZE + VGA_RAM_SIZE, |
288 | 289 | .nodisk_ok = 1, |
290 | + .max_cpus = 1, | |
289 | 291 | }; | ... | ... |
hw/mips_malta.c
hw/mips_mipssim.c
hw/mips_r4k.c
hw/musicpal.c
hw/nseries.c
... | ... | @@ -1408,6 +1408,7 @@ QEMUMachine n800_machine = { |
1408 | 1408 | .desc = "Nokia N800 tablet aka. RX-34 (OMAP2420)", |
1409 | 1409 | .init = n800_init, |
1410 | 1410 | .ram_require = (0x08000000 + 0x00010000 + OMAP242X_SRAM_SIZE) | RAMSIZE_FIXED, |
1411 | + .max_cpus = 1, | |
1411 | 1412 | }; |
1412 | 1413 | |
1413 | 1414 | QEMUMachine n810_machine = { |
... | ... | @@ -1415,4 +1416,5 @@ QEMUMachine n810_machine = { |
1415 | 1416 | .desc = "Nokia N810 tablet aka. RX-44 (OMAP2420)", |
1416 | 1417 | .init = n810_init, |
1417 | 1418 | .ram_require = (0x08000000 + 0x00010000 + OMAP242X_SRAM_SIZE) | RAMSIZE_FIXED, |
1419 | + .max_cpus = 1, | |
1418 | 1420 | }; | ... | ... |
hw/palm.c
hw/pc.c
... | ... | @@ -1097,6 +1097,7 @@ QEMUMachine pc_machine = { |
1097 | 1097 | .desc = "Standard PC", |
1098 | 1098 | .init = pc_init_pci, |
1099 | 1099 | .ram_require = VGA_RAM_SIZE + PC_MAX_BIOS_SIZE, |
1100 | + .max_cpus = 255, | |
1100 | 1101 | }; |
1101 | 1102 | |
1102 | 1103 | QEMUMachine isapc_machine = { |
... | ... | @@ -1104,4 +1105,5 @@ QEMUMachine isapc_machine = { |
1104 | 1105 | .desc = "ISA-only PC", |
1105 | 1106 | .init = pc_init_isa, |
1106 | 1107 | .ram_require = VGA_RAM_SIZE + PC_MAX_BIOS_SIZE, |
1108 | + .max_cpus = 1, | |
1107 | 1109 | }; | ... | ... |
hw/ppc405_boards.c
... | ... | @@ -359,6 +359,7 @@ QEMUMachine ref405ep_machine = { |
359 | 359 | .desc = "ref405ep", |
360 | 360 | .init = ref405ep_init, |
361 | 361 | .ram_require = (128 * 1024 * 1024 + 4096 + 512 * 1024 + BIOS_SIZE) | RAMSIZE_FIXED, |
362 | + .max_cpus = 1, | |
362 | 363 | }; |
363 | 364 | |
364 | 365 | /*****************************************************************************/ | ... | ... |
hw/ppc_chrp.c
hw/ppc_oldworld.c
hw/ppc_prep.c
hw/r2d.c
hw/realview.c
hw/shix.c
hw/spitz.c
... | ... | @@ -1014,6 +1014,7 @@ QEMUMachine akitapda_machine = { |
1014 | 1014 | .desc = "Akita PDA (PXA270)", |
1015 | 1015 | .init = akita_init, |
1016 | 1016 | .ram_require = SPITZ_RAM + SPITZ_ROM + PXA2XX_INTERNAL_SIZE + RAMSIZE_FIXED, |
1017 | + .max_cpus = 1, | |
1017 | 1018 | }; |
1018 | 1019 | |
1019 | 1020 | QEMUMachine spitzpda_machine = { |
... | ... | @@ -1021,6 +1022,7 @@ QEMUMachine spitzpda_machine = { |
1021 | 1022 | .desc = "Spitz PDA (PXA270)", |
1022 | 1023 | .init = spitz_init, |
1023 | 1024 | .ram_require = SPITZ_RAM + SPITZ_ROM + PXA2XX_INTERNAL_SIZE + RAMSIZE_FIXED, |
1025 | + .max_cpus = 1, | |
1024 | 1026 | }; |
1025 | 1027 | |
1026 | 1028 | QEMUMachine borzoipda_machine = { |
... | ... | @@ -1028,6 +1030,7 @@ QEMUMachine borzoipda_machine = { |
1028 | 1030 | .desc = "Borzoi PDA (PXA270)", |
1029 | 1031 | .init = borzoi_init, |
1030 | 1032 | .ram_require = SPITZ_RAM + SPITZ_ROM + PXA2XX_INTERNAL_SIZE + RAMSIZE_FIXED, |
1033 | + .max_cpus = 1, | |
1031 | 1034 | }; |
1032 | 1035 | |
1033 | 1036 | QEMUMachine terrierpda_machine = { |
... | ... | @@ -1035,4 +1038,5 @@ QEMUMachine terrierpda_machine = { |
1035 | 1038 | .desc = "Terrier PDA (PXA270)", |
1036 | 1039 | .init = terrier_init, |
1037 | 1040 | .ram_require = SPITZ_RAM + SPITZ_ROM + PXA2XX_INTERNAL_SIZE + RAMSIZE_FIXED, |
1041 | + .max_cpus = 1, | |
1038 | 1042 | }; | ... | ... |
hw/stellaris.c
... | ... | @@ -1417,6 +1417,7 @@ QEMUMachine lm3s811evb_machine = { |
1417 | 1417 | .desc = "Stellaris LM3S811EVB", |
1418 | 1418 | .init = lm3s811evb_init, |
1419 | 1419 | .ram_require = (64 * 1024 + 8 * 1024) | RAMSIZE_FIXED, |
1420 | + .max_cpus = 1, | |
1420 | 1421 | }; |
1421 | 1422 | |
1422 | 1423 | QEMUMachine lm3s6965evb_machine = { |
... | ... | @@ -1424,4 +1425,5 @@ QEMUMachine lm3s6965evb_machine = { |
1424 | 1425 | .desc = "Stellaris LM3S6965EVB", |
1425 | 1426 | .init = lm3s6965evb_init, |
1426 | 1427 | .ram_require = (256 * 1024 + 64 * 1024) | RAMSIZE_FIXED, |
1428 | + .max_cpus = 1, | |
1427 | 1429 | }; | ... | ... |
hw/sun4m.c
... | ... | @@ -1291,6 +1291,7 @@ QEMUMachine ss5_machine = { |
1291 | 1291 | .ram_require = PROM_SIZE_MAX + TCX_SIZE, |
1292 | 1292 | .nodisk_ok = 1, |
1293 | 1293 | .use_scsi = 1, |
1294 | + .max_cpus = 16, | |
1294 | 1295 | }; |
1295 | 1296 | |
1296 | 1297 | QEMUMachine ss10_machine = { |
... | ... | @@ -1300,6 +1301,7 @@ QEMUMachine ss10_machine = { |
1300 | 1301 | .ram_require = PROM_SIZE_MAX + TCX_SIZE, |
1301 | 1302 | .nodisk_ok = 1, |
1302 | 1303 | .use_scsi = 1, |
1304 | + .max_cpus = 16, | |
1303 | 1305 | }; |
1304 | 1306 | |
1305 | 1307 | QEMUMachine ss600mp_machine = { |
... | ... | @@ -1309,6 +1311,7 @@ QEMUMachine ss600mp_machine = { |
1309 | 1311 | .ram_require = PROM_SIZE_MAX + TCX_SIZE, |
1310 | 1312 | .nodisk_ok = 1, |
1311 | 1313 | .use_scsi = 1, |
1314 | + .max_cpus = 16, | |
1312 | 1315 | }; |
1313 | 1316 | |
1314 | 1317 | QEMUMachine ss20_machine = { |
... | ... | @@ -1318,6 +1321,7 @@ QEMUMachine ss20_machine = { |
1318 | 1321 | .ram_require = PROM_SIZE_MAX + TCX_SIZE, |
1319 | 1322 | .nodisk_ok = 1, |
1320 | 1323 | .use_scsi = 1, |
1324 | + .max_cpus = 16, | |
1321 | 1325 | }; |
1322 | 1326 | |
1323 | 1327 | QEMUMachine ss2_machine = { |
... | ... | @@ -1327,6 +1331,7 @@ QEMUMachine ss2_machine = { |
1327 | 1331 | .ram_require = PROM_SIZE_MAX + TCX_SIZE, |
1328 | 1332 | .nodisk_ok = 1, |
1329 | 1333 | .use_scsi = 1, |
1334 | + .max_cpus = 16, | |
1330 | 1335 | }; |
1331 | 1336 | |
1332 | 1337 | QEMUMachine voyager_machine = { |
... | ... | @@ -1336,6 +1341,7 @@ QEMUMachine voyager_machine = { |
1336 | 1341 | .ram_require = PROM_SIZE_MAX + TCX_SIZE, |
1337 | 1342 | .nodisk_ok = 1, |
1338 | 1343 | .use_scsi = 1, |
1344 | + .max_cpus = 16, | |
1339 | 1345 | }; |
1340 | 1346 | |
1341 | 1347 | QEMUMachine ss_lx_machine = { |
... | ... | @@ -1345,6 +1351,7 @@ QEMUMachine ss_lx_machine = { |
1345 | 1351 | .ram_require = PROM_SIZE_MAX + TCX_SIZE, |
1346 | 1352 | .nodisk_ok = 1, |
1347 | 1353 | .use_scsi = 1, |
1354 | + .max_cpus = 16, | |
1348 | 1355 | }; |
1349 | 1356 | |
1350 | 1357 | QEMUMachine ss4_machine = { |
... | ... | @@ -1354,6 +1361,7 @@ QEMUMachine ss4_machine = { |
1354 | 1361 | .ram_require = PROM_SIZE_MAX + TCX_SIZE, |
1355 | 1362 | .nodisk_ok = 1, |
1356 | 1363 | .use_scsi = 1, |
1364 | + .max_cpus = 16, | |
1357 | 1365 | }; |
1358 | 1366 | |
1359 | 1367 | QEMUMachine scls_machine = { |
... | ... | @@ -1363,6 +1371,7 @@ QEMUMachine scls_machine = { |
1363 | 1371 | .ram_require = PROM_SIZE_MAX + TCX_SIZE, |
1364 | 1372 | .nodisk_ok = 1, |
1365 | 1373 | .use_scsi = 1, |
1374 | + .max_cpus = 16, | |
1366 | 1375 | }; |
1367 | 1376 | |
1368 | 1377 | QEMUMachine sbook_machine = { |
... | ... | @@ -1372,6 +1381,7 @@ QEMUMachine sbook_machine = { |
1372 | 1381 | .ram_require = PROM_SIZE_MAX + TCX_SIZE, |
1373 | 1382 | .nodisk_ok = 1, |
1374 | 1383 | .use_scsi = 1, |
1384 | + .max_cpus = 16, | |
1375 | 1385 | }; |
1376 | 1386 | |
1377 | 1387 | static const struct sun4d_hwdef sun4d_hwdefs[] = { |
... | ... | @@ -1620,6 +1630,7 @@ QEMUMachine ss1000_machine = { |
1620 | 1630 | .ram_require = PROM_SIZE_MAX + TCX_SIZE, |
1621 | 1631 | .nodisk_ok = 1, |
1622 | 1632 | .use_scsi = 1, |
1633 | + .max_cpus = 16, | |
1623 | 1634 | }; |
1624 | 1635 | |
1625 | 1636 | QEMUMachine ss2000_machine = { |
... | ... | @@ -1629,4 +1640,5 @@ QEMUMachine ss2000_machine = { |
1629 | 1640 | .ram_require = PROM_SIZE_MAX + TCX_SIZE, |
1630 | 1641 | .nodisk_ok = 1, |
1631 | 1642 | .use_scsi = 1, |
1643 | + .max_cpus = 16, | |
1632 | 1644 | }; | ... | ... |
hw/sun4u.c
... | ... | @@ -589,6 +589,7 @@ QEMUMachine sun4u_machine = { |
589 | 589 | .init = sun4u_init, |
590 | 590 | .ram_require = PROM_SIZE_MAX + VGA_RAM_SIZE, |
591 | 591 | .nodisk_ok = 1, |
592 | + .max_cpus = 16, | |
592 | 593 | }; |
593 | 594 | |
594 | 595 | QEMUMachine sun4v_machine = { |
... | ... | @@ -597,6 +598,7 @@ QEMUMachine sun4v_machine = { |
597 | 598 | .init = sun4v_init, |
598 | 599 | .ram_require = PROM_SIZE_MAX + VGA_RAM_SIZE, |
599 | 600 | .nodisk_ok = 1, |
601 | + .max_cpus = 16, | |
600 | 602 | }; |
601 | 603 | |
602 | 604 | QEMUMachine niagara_machine = { |
... | ... | @@ -605,4 +607,5 @@ QEMUMachine niagara_machine = { |
605 | 607 | .init = niagara_init, |
606 | 608 | .ram_require = PROM_SIZE_MAX + VGA_RAM_SIZE, |
607 | 609 | .nodisk_ok = 1, |
610 | + .max_cpus = 16, | |
608 | 611 | }; | ... | ... |
hw/tosa.c
hw/versatilepb.c
... | ... | @@ -320,6 +320,7 @@ QEMUMachine versatilepb_machine = { |
320 | 320 | .desc = "ARM Versatile/PB (ARM926EJ-S)", |
321 | 321 | .init = vpb_init, |
322 | 322 | .use_scsi = 1, |
323 | + .max_cpus = 1, | |
323 | 324 | }; |
324 | 325 | |
325 | 326 | QEMUMachine versatileab_machine = { |
... | ... | @@ -327,4 +328,5 @@ QEMUMachine versatileab_machine = { |
327 | 328 | .desc = "ARM Versatile/AB (ARM926EJ-S)", |
328 | 329 | .init = vab_init, |
329 | 330 | .use_scsi = 1, |
331 | + .max_cpus = 1, | |
330 | 332 | }; | ... | ... |
vl.c
... | ... | @@ -213,13 +213,6 @@ int usb_enabled = 0; |
213 | 213 | static VLANState *first_vlan; |
214 | 214 | int smp_cpus = 1; |
215 | 215 | const char *vnc_display; |
216 | -#if defined(TARGET_SPARC) | |
217 | -#define MAX_CPUS 16 | |
218 | -#elif defined(TARGET_I386) | |
219 | -#define MAX_CPUS 255 | |
220 | -#else | |
221 | -#define MAX_CPUS 1 | |
222 | -#endif | |
223 | 216 | int acpi_enabled = 1; |
224 | 217 | int fd_bootchk = 1; |
225 | 218 | int no_reboot = 0; |
... | ... | @@ -9195,7 +9188,7 @@ int main(int argc, char **argv) |
9195 | 9188 | break; |
9196 | 9189 | case QEMU_OPTION_smp: |
9197 | 9190 | smp_cpus = atoi(optarg); |
9198 | - if (smp_cpus < 1 || smp_cpus > MAX_CPUS) { | |
9191 | + if (smp_cpus < 1) { | |
9199 | 9192 | fprintf(stderr, "Invalid number of CPUs\n"); |
9200 | 9193 | exit(1); |
9201 | 9194 | } |
... | ... | @@ -9312,6 +9305,13 @@ int main(int argc, char **argv) |
9312 | 9305 | } |
9313 | 9306 | } |
9314 | 9307 | |
9308 | + if (smp_cpus > machine->max_cpus) { | |
9309 | + fprintf(stderr, "Number of SMP cpus requested (%d), exceeds max cpus " | |
9310 | + "supported by machine `%s' (%d)\n", smp_cpus, machine->name, | |
9311 | + machine->max_cpus); | |
9312 | + exit(1); | |
9313 | + } | |
9314 | + | |
9315 | 9315 | if (nographic) { |
9316 | 9316 | if (serial_device_index == 0) |
9317 | 9317 | serial_devices[0] = "stdio"; | ... | ... |