@@ -60,7 +60,7 @@ static void clipper_init(MachineState *machine)
char *palcode_filename;
uint64_t palcode_entry;
uint64_t kernel_entry, kernel_low;
- unsigned int smp_cpus = machine->smp.cpus;
+ unsigned int smp_cpus = machine_topo_get_cpus(machine);
/* Create up to 4 cpus. */
memset(cpus, 0, sizeof(cpus));
@@ -124,7 +124,7 @@ static FWCfgState *create_fw_cfg(MachineState *ms)
uint64_t val;
fw_cfg = fw_cfg_init_mem(FW_CFG_IO_BASE, FW_CFG_IO_BASE + 4);
- fw_cfg_add_i16(fw_cfg, FW_CFG_NB_CPUS, ms->smp.cpus);
+ fw_cfg_add_i16(fw_cfg, FW_CFG_NB_CPUS, machine_topo_get_cpus(ms));
fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, HPPA_MAX_CPUS);
fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, ms->ram_size);
@@ -188,7 +188,7 @@ static void machine_hppa_init(MachineState *machine)
MemoryRegion *rom_region;
MemoryRegion *cpu_region;
long i;
- unsigned int smp_cpus = machine->smp.cpus;
+ unsigned int smp_cpus = machine_topo_get_cpus(machine);
SysBusDevice *s;
/* Create CPUs. */
@@ -410,7 +410,7 @@ static void machine_hppa_init(MachineState *machine)
static void hppa_machine_reset(MachineState *ms, ShutdownCause reason)
{
- unsigned int smp_cpus = ms->smp.cpus;
+ unsigned int smp_cpus = machine_topo_get_cpus(ms);
int i;
qemu_devices_reset(reason);
@@ -174,7 +174,8 @@ int kvmppc_xive_cpu_connect(XiveTCTX *tctx, Error **errp)
vcpu_id);
if (ret == -ENOSPC) {
error_append_hint(errp, "Try -smp maxcpus=N with N < %u\n",
- MACHINE(qdev_get_machine())->smp.max_cpus);
+ machine_topo_get_max_cpus(
+ MACHINE(qdev_get_machine())));
}
return ret;
}
@@ -169,7 +169,8 @@ void icp_kvm_realize(DeviceState *dev, Error **errp)
vcpu_id, strerror(errno));
if (errno == ENOSPC) {
error_append_hint(&local_err, "Try -smp maxcpus=N with N < %u\n",
- MACHINE(qdev_get_machine())->smp.max_cpus);
+ machine_topo_get_max_cpus(
+ MACHINE(qdev_get_machine())));
}
error_propagate(errp, local_err);
return;
@@ -291,7 +291,7 @@ static void openrisc_sim_init(MachineState *machine)
MemoryRegion *ram;
hwaddr load_addr;
int n;
- unsigned int smp_cpus = machine->smp.cpus;
+ unsigned int smp_cpus = machine_topo_get_cpus(machine);
assert(smp_cpus >= 1 && smp_cpus <= OR1KSIM_CPUS_MAX);
for (n = 0; n < smp_cpus; n++) {
@@ -476,7 +476,7 @@ static void openrisc_virt_init(MachineState *machine)
MemoryRegion *ram;
hwaddr load_addr;
int n;
- unsigned int smp_cpus = machine->smp.cpus;
+ unsigned int smp_cpus = machine_topo_get_cpus(machine);
int32_t pic_phandle;
assert(smp_cpus >= 1 && smp_cpus <= VIRT_CPUS_MAX);
@@ -829,8 +829,8 @@ static void sun4m_hw_init(MachineState *machine)
FWCfgState *fw_cfg;
DeviceState *dev, *ms_kb_orgate, *serial_orgate;
SysBusDevice *s;
- unsigned int smp_cpus = machine->smp.cpus;
- unsigned int max_cpus = machine->smp.max_cpus;
+ unsigned int smp_cpus = machine_topo_get_cpus(machine);
+ unsigned int max_cpus = machine_topo_get_max_cpus(machine);
HostMemoryBackend *ram_memdev = machine->memdev;
NICInfo *nd = &nd_table[0];
@@ -711,8 +711,10 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
&FW_CFG_IO(dev)->comb_iomem);
fw_cfg = FW_CFG(dev);
- fw_cfg_add_i16(fw_cfg, FW_CFG_NB_CPUS, (uint16_t)machine->smp.cpus);
- fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, (uint16_t)machine->smp.max_cpus);
+ fw_cfg_add_i16(fw_cfg, FW_CFG_NB_CPUS,
+ (uint16_t)machine_topo_get_cpus(machine));
+ fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS,
+ (uint16_t)machine_topo_get_max_cpus(machine));
fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)machine->ram_size);
fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, hwdef->machine_id);
fw_cfg_add_i64(fw_cfg, FW_CFG_KERNEL_ADDR, kernel_entry);
@@ -58,7 +58,7 @@ XtensaCPU *xtensa_sim_common_init(MachineState *machine)
ram_addr_t ram_size = machine->ram_size;
int n;
- for (n = 0; n < machine->smp.cpus; n++) {
+ for (n = 0; n < machine_topo_get_cpus(machine); n++) {
cpu = XTENSA_CPU(cpu_create(machine->cpu_type));
env = &cpu->env;
@@ -239,7 +239,7 @@ static void xtfpga_init(const XtfpgaBoardDesc *board, MachineState *machine)
const unsigned system_io_size = 224 * MiB;
uint32_t freq = 10000000;
int n;
- unsigned int smp_cpus = machine->smp.cpus;
+ unsigned int smp_cpus = machine_topo_get_cpus(machine);
if (smp_cpus > 1) {
mx_pic = xtensa_mx_pic_init(31);
@@ -262,7 +262,7 @@ target_ulong HELPER(mfspr)(CPUOpenRISCState *env, target_ulong rd,
return cpu->parent_obj.cpu_index;
case TO_SPR(0, 129): /* NUMCORES */
- return ms->smp.max_cpus;
+ return machine_topo_get_max_cpus(ms);
case TO_SPR(0, 1024) ... TO_SPR(0, 1024 + (16 * 32)): /* Shadow GPRs */
idx = (spr - 1024);