mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 18:23:57 -06:00
machine: Refactor smp-related call chains to pass MachineState
To get rid of the global smp_* variables we're currently using, it's recommended to pass MachineState in the list of incoming parameters for functions that use global smp variables, thus some redundant parameters are dropped. It's applied for legacy smbios_*(), *_machine_reset(), hot_add_cpu() and mips *_create_cpu(). Suggested-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Like Xu <like.xu@linux.intel.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-Id: <20190518205428.90532-3-like.xu@linux.intel.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
This commit is contained in:
parent
edeeec9117
commit
a0628599fa
14 changed files with 46 additions and 44 deletions
|
@ -184,7 +184,7 @@ static void acpi_get_pm_info(AcpiPmInfo *pm)
|
|||
pm->pcihp_io_len = 0;
|
||||
|
||||
assert(obj);
|
||||
init_common_fadt_data(obj, &pm->fadt);
|
||||
init_common_fadt_data(machine, obj, &pm->fadt);
|
||||
if (piix) {
|
||||
/* w2k requires FADT(rev1) or it won't boot, keep PC compatible */
|
||||
pm->fadt.rev = 1;
|
||||
|
|
|
@ -954,7 +954,7 @@ static void pc_build_smbios(PCMachineState *pcms)
|
|||
/* tell smbios about cpuid version and features */
|
||||
smbios_set_cpuid(cpu->env.cpuid_version, cpu->env.features[FEAT_1_EDX]);
|
||||
|
||||
smbios_tables = smbios_get_table_legacy(&smbios_tables_len);
|
||||
smbios_tables = smbios_get_table_legacy(ms, &smbios_tables_len);
|
||||
if (smbios_tables) {
|
||||
fw_cfg_add_bytes(pcms->fw_cfg, FW_CFG_SMBIOS_ENTRIES,
|
||||
smbios_tables, smbios_tables_len);
|
||||
|
@ -971,7 +971,7 @@ static void pc_build_smbios(PCMachineState *pcms)
|
|||
array_count++;
|
||||
}
|
||||
}
|
||||
smbios_get_tables(mem_array, array_count,
|
||||
smbios_get_tables(ms, mem_array, array_count,
|
||||
&smbios_tables, &smbios_tables_len,
|
||||
&smbios_anchor, &smbios_anchor_len);
|
||||
g_free(mem_array);
|
||||
|
@ -1526,9 +1526,8 @@ static void pc_new_cpu(const char *typename, int64_t apic_id, Error **errp)
|
|||
error_propagate(errp, local_err);
|
||||
}
|
||||
|
||||
void pc_hot_add_cpu(const int64_t id, Error **errp)
|
||||
void pc_hot_add_cpu(MachineState *ms, const int64_t id, Error **errp)
|
||||
{
|
||||
MachineState *ms = MACHINE(qdev_get_machine());
|
||||
PCMachineState *pcms = PC_MACHINE(ms);
|
||||
int64_t apic_id = x86_cpu_apic_id_from_index(pcms, id);
|
||||
Error *local_err = NULL;
|
||||
|
@ -2684,7 +2683,7 @@ static void pc_machine_initfn(Object *obj)
|
|||
pc_system_flash_create(pcms);
|
||||
}
|
||||
|
||||
static void pc_machine_reset(void)
|
||||
static void pc_machine_reset(MachineState *machine)
|
||||
{
|
||||
CPUState *cs;
|
||||
X86CPU *cpu;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue