mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-27 13:30:52 +00:00
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
This commit is contained in:
parent
4b32e16880
commit
b2097003ec
@ -92,4 +92,5 @@ QEMUMachine an5206_machine = {
|
||||
.desc = "Arnewsh 5206",
|
||||
.init = an5206_init,
|
||||
.ram_require = 512,
|
||||
.max_cpus = 1,
|
||||
};
|
||||
|
@ -18,6 +18,7 @@ typedef struct QEMUMachine {
|
||||
ram_addr_t ram_require;
|
||||
int nodisk_ok;
|
||||
int use_scsi;
|
||||
int max_cpus;
|
||||
struct QEMUMachine *next;
|
||||
} QEMUMachine;
|
||||
|
||||
|
@ -66,4 +66,5 @@ QEMUMachine dummy_m68k_machine = {
|
||||
.name = "dummy",
|
||||
.desc = "Dummy board",
|
||||
.init = dummy_m68k_init,
|
||||
.max_cpus = 1,
|
||||
};
|
||||
|
@ -145,4 +145,5 @@ QEMUMachine bareetraxfs_machine = {
|
||||
.desc = "Bare ETRAX FS board",
|
||||
.init = bareetraxfs_init,
|
||||
.ram_require = 0x8000000,
|
||||
.max_cpus = 1,
|
||||
};
|
||||
|
@ -126,6 +126,7 @@ QEMUMachine connex_machine = {
|
||||
.desc = "Gumstix Connex (PXA255)",
|
||||
.init = connex_init,
|
||||
.ram_require = (0x05000000 + PXA2XX_INTERNAL_SIZE) | RAMSIZE_FIXED,
|
||||
.max_cpus = 1,
|
||||
};
|
||||
|
||||
QEMUMachine verdex_machine = {
|
||||
@ -133,4 +134,5 @@ QEMUMachine verdex_machine = {
|
||||
.desc = "Gumstix Verdex (PXA270)",
|
||||
.init = verdex_init,
|
||||
.ram_require = (0x12000000 + PXA2XX_INTERNAL_SIZE) | RAMSIZE_FIXED,
|
||||
.max_cpus = 1,
|
||||
};
|
||||
|
@ -544,4 +544,5 @@ QEMUMachine integratorcp_machine = {
|
||||
.desc = "ARM Integrator/CP (ARM926EJ-S)",
|
||||
.init = integratorcp_init,
|
||||
.ram_require = 0x100000,
|
||||
.max_cpus = 1,
|
||||
};
|
||||
|
@ -149,4 +149,5 @@ QEMUMachine mainstone2_machine = {
|
||||
.init = mainstone_init,
|
||||
.ram_require = (MAINSTONE_RAM + MAINSTONE_ROM + 2 * MAINSTONE_FLASH +
|
||||
PXA2XX_INTERNAL_SIZE) | RAMSIZE_FIXED,
|
||||
.max_cpus = 1,
|
||||
};
|
||||
|
@ -309,4 +309,5 @@ QEMUMachine mcf5208evb_machine = {
|
||||
.desc = "MCF5206EVB",
|
||||
.init = mcf5208evb_init,
|
||||
.ram_require = 16384,
|
||||
.max_cpus = 1,
|
||||
};
|
||||
|
@ -278,6 +278,7 @@ QEMUMachine mips_magnum_machine = {
|
||||
.init = mips_magnum_init,
|
||||
.ram_require = MAGNUM_BIOS_SIZE + VGA_RAM_SIZE,
|
||||
.nodisk_ok = 1,
|
||||
.max_cpus = 1,
|
||||
};
|
||||
|
||||
QEMUMachine mips_pica61_machine = {
|
||||
@ -286,4 +287,5 @@ QEMUMachine mips_pica61_machine = {
|
||||
.init = mips_pica61_init,
|
||||
.ram_require = MAGNUM_BIOS_SIZE + VGA_RAM_SIZE,
|
||||
.nodisk_ok = 1,
|
||||
.max_cpus = 1,
|
||||
};
|
||||
|
@ -950,4 +950,5 @@ QEMUMachine mips_malta_machine = {
|
||||
.init = mips_malta_init,
|
||||
.ram_require = VGA_RAM_SIZE + BIOS_SIZE,
|
||||
.nodisk_ok = 1,
|
||||
.max_cpus = 1,
|
||||
};
|
||||
|
@ -196,4 +196,5 @@ QEMUMachine mips_mipssim_machine = {
|
||||
.init = mips_mipssim_init,
|
||||
.ram_require = BIOS_SIZE + VGA_RAM_SIZE /* unused */,
|
||||
.nodisk_ok = 1,
|
||||
.max_cpus = 1,
|
||||
};
|
||||
|
@ -287,4 +287,5 @@ QEMUMachine mips_machine = {
|
||||
.init = mips_r4k_init,
|
||||
.ram_require = VGA_RAM_SIZE + BIOS_SIZE,
|
||||
.nodisk_ok = 1,
|
||||
.max_cpus = 1,
|
||||
};
|
||||
|
@ -1513,4 +1513,5 @@ QEMUMachine musicpal_machine = {
|
||||
.desc = "Marvell 88w8618 / MusicPal (ARM926EJ-S)",
|
||||
.init = musicpal_init,
|
||||
.ram_require = MP_RAM_DEFAULT_SIZE + MP_SRAM_SIZE + MP_FLASH_SIZE_MAX + RAMSIZE_FIXED,
|
||||
.max_cpus = 1,
|
||||
};
|
||||
|
@ -1408,6 +1408,7 @@ QEMUMachine n800_machine = {
|
||||
.desc = "Nokia N800 tablet aka. RX-34 (OMAP2420)",
|
||||
.init = n800_init,
|
||||
.ram_require = (0x08000000 + 0x00010000 + OMAP242X_SRAM_SIZE) | RAMSIZE_FIXED,
|
||||
.max_cpus = 1,
|
||||
};
|
||||
|
||||
QEMUMachine n810_machine = {
|
||||
@ -1415,4 +1416,5 @@ QEMUMachine n810_machine = {
|
||||
.desc = "Nokia N810 tablet aka. RX-44 (OMAP2420)",
|
||||
.init = n810_init,
|
||||
.ram_require = (0x08000000 + 0x00010000 + OMAP242X_SRAM_SIZE) | RAMSIZE_FIXED,
|
||||
.max_cpus = 1,
|
||||
};
|
||||
|
@ -286,4 +286,5 @@ QEMUMachine palmte_machine = {
|
||||
.desc = "Palm Tungsten|E aka. Cheetah PDA (OMAP310)",
|
||||
.init = palmte_init,
|
||||
.ram_require = (0x02000000 + 0x00800000 + OMAP15XX_SRAM_SIZE) | RAMSIZE_FIXED,
|
||||
.max_cpus = 1,
|
||||
};
|
||||
|
2
hw/pc.c
2
hw/pc.c
@ -1097,6 +1097,7 @@ QEMUMachine pc_machine = {
|
||||
.desc = "Standard PC",
|
||||
.init = pc_init_pci,
|
||||
.ram_require = VGA_RAM_SIZE + PC_MAX_BIOS_SIZE,
|
||||
.max_cpus = 255,
|
||||
};
|
||||
|
||||
QEMUMachine isapc_machine = {
|
||||
@ -1104,4 +1105,5 @@ QEMUMachine isapc_machine = {
|
||||
.desc = "ISA-only PC",
|
||||
.init = pc_init_isa,
|
||||
.ram_require = VGA_RAM_SIZE + PC_MAX_BIOS_SIZE,
|
||||
.max_cpus = 1,
|
||||
};
|
||||
|
@ -359,6 +359,7 @@ QEMUMachine ref405ep_machine = {
|
||||
.desc = "ref405ep",
|
||||
.init = ref405ep_init,
|
||||
.ram_require = (128 * 1024 * 1024 + 4096 + 512 * 1024 + BIOS_SIZE) | RAMSIZE_FIXED,
|
||||
.max_cpus = 1,
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -335,4 +335,5 @@ QEMUMachine core99_machine = {
|
||||
.desc = "Mac99 based PowerMAC",
|
||||
.init = ppc_core99_init,
|
||||
.ram_require = BIOS_SIZE + VGA_RAM_SIZE,
|
||||
.max_cpus = 1,
|
||||
};
|
||||
|
@ -370,4 +370,5 @@ QEMUMachine heathrow_machine = {
|
||||
.desc = "Heathrow based PowerMAC",
|
||||
.init = ppc_heathrow_init,
|
||||
.ram_require = BIOS_SIZE + VGA_RAM_SIZE,
|
||||
.max_cpus = 1,
|
||||
};
|
||||
|
@ -762,4 +762,5 @@ QEMUMachine prep_machine = {
|
||||
.desc = "PowerPC PREP platform",
|
||||
.init = ppc_prep_init,
|
||||
.ram_require = BIOS_SIZE + VGA_RAM_SIZE,
|
||||
.max_cpus = 1,
|
||||
};
|
||||
|
1
hw/r2d.c
1
hw/r2d.c
@ -168,4 +168,5 @@ QEMUMachine r2d_machine = {
|
||||
.desc = "r2d-plus board",
|
||||
.init = r2d_init,
|
||||
.ram_require = SDRAM_SIZE | RAMSIZE_FIXED,
|
||||
.max_cpus = 1,
|
||||
};
|
||||
|
@ -202,4 +202,5 @@ QEMUMachine realview_machine = {
|
||||
.init = realview_init,
|
||||
.ram_require = 0x1000,
|
||||
.use_scsi = 1,
|
||||
.max_cpus = 1,
|
||||
};
|
||||
|
@ -112,4 +112,5 @@ QEMUMachine shix_machine = {
|
||||
.desc = "shix card",
|
||||
.init = shix_init,
|
||||
.ram_require = (0x00004000 + 0x01000000 + 0x01000000) | RAMSIZE_FIXED,
|
||||
.max_cpus = 1,
|
||||
};
|
||||
|
@ -1014,6 +1014,7 @@ QEMUMachine akitapda_machine = {
|
||||
.desc = "Akita PDA (PXA270)",
|
||||
.init = akita_init,
|
||||
.ram_require = SPITZ_RAM + SPITZ_ROM + PXA2XX_INTERNAL_SIZE + RAMSIZE_FIXED,
|
||||
.max_cpus = 1,
|
||||
};
|
||||
|
||||
QEMUMachine spitzpda_machine = {
|
||||
@ -1021,6 +1022,7 @@ QEMUMachine spitzpda_machine = {
|
||||
.desc = "Spitz PDA (PXA270)",
|
||||
.init = spitz_init,
|
||||
.ram_require = SPITZ_RAM + SPITZ_ROM + PXA2XX_INTERNAL_SIZE + RAMSIZE_FIXED,
|
||||
.max_cpus = 1,
|
||||
};
|
||||
|
||||
QEMUMachine borzoipda_machine = {
|
||||
@ -1028,6 +1030,7 @@ QEMUMachine borzoipda_machine = {
|
||||
.desc = "Borzoi PDA (PXA270)",
|
||||
.init = borzoi_init,
|
||||
.ram_require = SPITZ_RAM + SPITZ_ROM + PXA2XX_INTERNAL_SIZE + RAMSIZE_FIXED,
|
||||
.max_cpus = 1,
|
||||
};
|
||||
|
||||
QEMUMachine terrierpda_machine = {
|
||||
@ -1035,4 +1038,5 @@ QEMUMachine terrierpda_machine = {
|
||||
.desc = "Terrier PDA (PXA270)",
|
||||
.init = terrier_init,
|
||||
.ram_require = SPITZ_RAM + SPITZ_ROM + PXA2XX_INTERNAL_SIZE + RAMSIZE_FIXED,
|
||||
.max_cpus = 1,
|
||||
};
|
||||
|
@ -1417,6 +1417,7 @@ QEMUMachine lm3s811evb_machine = {
|
||||
.desc = "Stellaris LM3S811EVB",
|
||||
.init = lm3s811evb_init,
|
||||
.ram_require = (64 * 1024 + 8 * 1024) | RAMSIZE_FIXED,
|
||||
.max_cpus = 1,
|
||||
};
|
||||
|
||||
QEMUMachine lm3s6965evb_machine = {
|
||||
@ -1424,4 +1425,5 @@ QEMUMachine lm3s6965evb_machine = {
|
||||
.desc = "Stellaris LM3S6965EVB",
|
||||
.init = lm3s6965evb_init,
|
||||
.ram_require = (256 * 1024 + 64 * 1024) | RAMSIZE_FIXED,
|
||||
.max_cpus = 1,
|
||||
};
|
||||
|
12
hw/sun4m.c
12
hw/sun4m.c
@ -1291,6 +1291,7 @@ QEMUMachine ss5_machine = {
|
||||
.ram_require = PROM_SIZE_MAX + TCX_SIZE,
|
||||
.nodisk_ok = 1,
|
||||
.use_scsi = 1,
|
||||
.max_cpus = 16,
|
||||
};
|
||||
|
||||
QEMUMachine ss10_machine = {
|
||||
@ -1300,6 +1301,7 @@ QEMUMachine ss10_machine = {
|
||||
.ram_require = PROM_SIZE_MAX + TCX_SIZE,
|
||||
.nodisk_ok = 1,
|
||||
.use_scsi = 1,
|
||||
.max_cpus = 16,
|
||||
};
|
||||
|
||||
QEMUMachine ss600mp_machine = {
|
||||
@ -1309,6 +1311,7 @@ QEMUMachine ss600mp_machine = {
|
||||
.ram_require = PROM_SIZE_MAX + TCX_SIZE,
|
||||
.nodisk_ok = 1,
|
||||
.use_scsi = 1,
|
||||
.max_cpus = 16,
|
||||
};
|
||||
|
||||
QEMUMachine ss20_machine = {
|
||||
@ -1318,6 +1321,7 @@ QEMUMachine ss20_machine = {
|
||||
.ram_require = PROM_SIZE_MAX + TCX_SIZE,
|
||||
.nodisk_ok = 1,
|
||||
.use_scsi = 1,
|
||||
.max_cpus = 16,
|
||||
};
|
||||
|
||||
QEMUMachine ss2_machine = {
|
||||
@ -1327,6 +1331,7 @@ QEMUMachine ss2_machine = {
|
||||
.ram_require = PROM_SIZE_MAX + TCX_SIZE,
|
||||
.nodisk_ok = 1,
|
||||
.use_scsi = 1,
|
||||
.max_cpus = 16,
|
||||
};
|
||||
|
||||
QEMUMachine voyager_machine = {
|
||||
@ -1336,6 +1341,7 @@ QEMUMachine voyager_machine = {
|
||||
.ram_require = PROM_SIZE_MAX + TCX_SIZE,
|
||||
.nodisk_ok = 1,
|
||||
.use_scsi = 1,
|
||||
.max_cpus = 16,
|
||||
};
|
||||
|
||||
QEMUMachine ss_lx_machine = {
|
||||
@ -1345,6 +1351,7 @@ QEMUMachine ss_lx_machine = {
|
||||
.ram_require = PROM_SIZE_MAX + TCX_SIZE,
|
||||
.nodisk_ok = 1,
|
||||
.use_scsi = 1,
|
||||
.max_cpus = 16,
|
||||
};
|
||||
|
||||
QEMUMachine ss4_machine = {
|
||||
@ -1354,6 +1361,7 @@ QEMUMachine ss4_machine = {
|
||||
.ram_require = PROM_SIZE_MAX + TCX_SIZE,
|
||||
.nodisk_ok = 1,
|
||||
.use_scsi = 1,
|
||||
.max_cpus = 16,
|
||||
};
|
||||
|
||||
QEMUMachine scls_machine = {
|
||||
@ -1363,6 +1371,7 @@ QEMUMachine scls_machine = {
|
||||
.ram_require = PROM_SIZE_MAX + TCX_SIZE,
|
||||
.nodisk_ok = 1,
|
||||
.use_scsi = 1,
|
||||
.max_cpus = 16,
|
||||
};
|
||||
|
||||
QEMUMachine sbook_machine = {
|
||||
@ -1372,6 +1381,7 @@ QEMUMachine sbook_machine = {
|
||||
.ram_require = PROM_SIZE_MAX + TCX_SIZE,
|
||||
.nodisk_ok = 1,
|
||||
.use_scsi = 1,
|
||||
.max_cpus = 16,
|
||||
};
|
||||
|
||||
static const struct sun4d_hwdef sun4d_hwdefs[] = {
|
||||
@ -1620,6 +1630,7 @@ QEMUMachine ss1000_machine = {
|
||||
.ram_require = PROM_SIZE_MAX + TCX_SIZE,
|
||||
.nodisk_ok = 1,
|
||||
.use_scsi = 1,
|
||||
.max_cpus = 16,
|
||||
};
|
||||
|
||||
QEMUMachine ss2000_machine = {
|
||||
@ -1629,4 +1640,5 @@ QEMUMachine ss2000_machine = {
|
||||
.ram_require = PROM_SIZE_MAX + TCX_SIZE,
|
||||
.nodisk_ok = 1,
|
||||
.use_scsi = 1,
|
||||
.max_cpus = 16,
|
||||
};
|
||||
|
@ -589,6 +589,7 @@ QEMUMachine sun4u_machine = {
|
||||
.init = sun4u_init,
|
||||
.ram_require = PROM_SIZE_MAX + VGA_RAM_SIZE,
|
||||
.nodisk_ok = 1,
|
||||
.max_cpus = 16,
|
||||
};
|
||||
|
||||
QEMUMachine sun4v_machine = {
|
||||
@ -597,6 +598,7 @@ QEMUMachine sun4v_machine = {
|
||||
.init = sun4v_init,
|
||||
.ram_require = PROM_SIZE_MAX + VGA_RAM_SIZE,
|
||||
.nodisk_ok = 1,
|
||||
.max_cpus = 16,
|
||||
};
|
||||
|
||||
QEMUMachine niagara_machine = {
|
||||
@ -605,4 +607,5 @@ QEMUMachine niagara_machine = {
|
||||
.init = niagara_init,
|
||||
.ram_require = PROM_SIZE_MAX + VGA_RAM_SIZE,
|
||||
.nodisk_ok = 1,
|
||||
.max_cpus = 16,
|
||||
};
|
||||
|
@ -123,4 +123,5 @@ QEMUMachine tosapda_machine = {
|
||||
.desc = "Tosa PDA (PXA255)",
|
||||
.init = tosa_init,
|
||||
.ram_require = TOSA_RAM + TOSA_ROM + PXA2XX_INTERNAL_SIZE + RAMSIZE_FIXED,
|
||||
.max_cpus = 1,
|
||||
};
|
||||
|
@ -320,6 +320,7 @@ QEMUMachine versatilepb_machine = {
|
||||
.desc = "ARM Versatile/PB (ARM926EJ-S)",
|
||||
.init = vpb_init,
|
||||
.use_scsi = 1,
|
||||
.max_cpus = 1,
|
||||
};
|
||||
|
||||
QEMUMachine versatileab_machine = {
|
||||
@ -327,4 +328,5 @@ QEMUMachine versatileab_machine = {
|
||||
.desc = "ARM Versatile/AB (ARM926EJ-S)",
|
||||
.init = vab_init,
|
||||
.use_scsi = 1,
|
||||
.max_cpus = 1,
|
||||
};
|
||||
|
16
vl.c
16
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";
|
||||
|
Loading…
Reference in New Issue
Block a user