Skip to content

Commit

Permalink
hw/i386/pc: rename functions shared with non-PC machines
Browse files Browse the repository at this point in the history
The following functions are named *pc* but are not PC-machine specific
but generic to the X86 architecture, rename them:

  load_linux                 -> x86_load_linux
  pc_new_cpu                 -> x86_new_cpu
  pc_cpus_init               -> x86_cpus_init
  pc_cpu_index_to_props      -> x86_cpu_index_to_props
  pc_get_default_cpu_node_id -> x86_get_default_cpu_node_id
  pc_possible_cpu_arch_ids   -> x86_possible_cpu_arch_ids
  old_pc_system_rom_init     -> x86_system_rom_init

Signed-off-by: Sergio Lopez <slp@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
  • Loading branch information
slp authored and bonzini committed Oct 22, 2019
1 parent bca964b commit 81ef68e
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
28 changes: 14 additions & 14 deletions hw/i386/pc.c
Expand Up @@ -1019,8 +1019,8 @@ static bool load_elfboot(const char *kernel_filename,
return true;
}

static void load_linux(PCMachineState *pcms,
FWCfgState *fw_cfg)
static void x86_load_linux(PCMachineState *pcms,
FWCfgState *fw_cfg)
{
uint16_t protocol;
int setup_size, kernel_size, cmdline_size;
Expand Down Expand Up @@ -1374,7 +1374,7 @@ void pc_acpi_smi_interrupt(void *opaque, int irq, int level)
}
}

static void pc_new_cpu(PCMachineState *pcms, int64_t apic_id, Error **errp)
static void x86_cpu_new(PCMachineState *pcms, int64_t apic_id, Error **errp)
{
Object *cpu = NULL;
Error *local_err = NULL;
Expand Down Expand Up @@ -1490,14 +1490,14 @@ void pc_hot_add_cpu(MachineState *ms, const int64_t id, Error **errp)
return;
}

pc_new_cpu(PC_MACHINE(ms), apic_id, &local_err);
x86_cpu_new(PC_MACHINE(ms), apic_id, &local_err);
if (local_err) {
error_propagate(errp, local_err);
return;
}
}

void pc_cpus_init(PCMachineState *pcms)
void x86_cpus_init(PCMachineState *pcms)
{
int i;
const CPUArchIdList *possible_cpus;
Expand All @@ -1518,7 +1518,7 @@ void pc_cpus_init(PCMachineState *pcms)
ms->smp.max_cpus - 1) + 1;
possible_cpus = mc->possible_cpu_arch_ids(ms);
for (i = 0; i < ms->smp.cpus; i++) {
pc_new_cpu(pcms, possible_cpus->cpus[i].arch_id, &error_fatal);
x86_cpu_new(pcms, possible_cpus->cpus[i].arch_id, &error_fatal);
}
}

Expand Down Expand Up @@ -1621,7 +1621,7 @@ void xen_load_linux(PCMachineState *pcms)
fw_cfg_add_i16(fw_cfg, FW_CFG_NB_CPUS, pcms->boot_cpus);
rom_set_fw(fw_cfg);

load_linux(pcms, fw_cfg);
x86_load_linux(pcms, fw_cfg);
for (i = 0; i < nb_option_roms; i++) {
assert(!strcmp(option_rom[i].name, "linuxboot.bin") ||
!strcmp(option_rom[i].name, "linuxboot_dma.bin") ||
Expand Down Expand Up @@ -1756,7 +1756,7 @@ void pc_memory_init(PCMachineState *pcms,
}

if (linux_boot) {
load_linux(pcms, fw_cfg);
x86_load_linux(pcms, fw_cfg);
}

for (i = 0; i < nb_option_roms; i++) {
Expand Down Expand Up @@ -2681,7 +2681,7 @@ static void pc_machine_wakeup(MachineState *machine)
}

static CpuInstanceProperties
pc_cpu_index_to_props(MachineState *ms, unsigned cpu_index)
x86_cpu_index_to_props(MachineState *ms, unsigned cpu_index)
{
MachineClass *mc = MACHINE_GET_CLASS(ms);
const CPUArchIdList *possible_cpus = mc->possible_cpu_arch_ids(ms);
Expand All @@ -2690,7 +2690,7 @@ pc_cpu_index_to_props(MachineState *ms, unsigned cpu_index)
return possible_cpus->cpus[cpu_index].props;
}

static int64_t pc_get_default_cpu_node_id(const MachineState *ms, int idx)
static int64_t x86_get_default_cpu_node_id(const MachineState *ms, int idx)
{
X86CPUTopoInfo topo;
PCMachineState *pcms = PC_MACHINE(ms);
Expand All @@ -2702,7 +2702,7 @@ static int64_t pc_get_default_cpu_node_id(const MachineState *ms, int idx)
return topo.pkg_id % ms->numa_state->num_nodes;
}

static const CPUArchIdList *pc_possible_cpu_arch_ids(MachineState *ms)
static const CPUArchIdList *x86_possible_cpu_arch_ids(MachineState *ms)
{
PCMachineState *pcms = PC_MACHINE(ms);
int i;
Expand Down Expand Up @@ -2804,9 +2804,9 @@ static void pc_machine_class_init(ObjectClass *oc, void *data)
assert(!mc->get_hotplug_handler);
mc->get_hotplug_handler = pc_get_hotplug_handler;
mc->hotplug_allowed = pc_hotplug_allowed;
mc->cpu_index_to_instance_props = pc_cpu_index_to_props;
mc->get_default_cpu_node_id = pc_get_default_cpu_node_id;
mc->possible_cpu_arch_ids = pc_possible_cpu_arch_ids;
mc->cpu_index_to_instance_props = x86_cpu_index_to_props;
mc->get_default_cpu_node_id = x86_get_default_cpu_node_id;
mc->possible_cpu_arch_ids = x86_possible_cpu_arch_ids;
mc->auto_enable_numa_with_memhp = true;
mc->has_hotpluggable_cpus = true;
mc->default_boot_order = "cad";
Expand Down
2 changes: 1 addition & 1 deletion hw/i386/pc_piix.c
Expand Up @@ -152,7 +152,7 @@ static void pc_init1(MachineState *machine,
}
}

pc_cpus_init(pcms);
x86_cpus_init(pcms);

if (kvm_enabled() && pcmc->kvmclock_enabled) {
kvmclock_create();
Expand Down
2 changes: 1 addition & 1 deletion hw/i386/pc_q35.c
Expand Up @@ -179,7 +179,7 @@ static void pc_q35_init(MachineState *machine)
xen_hvm_init(pcms, &ram_memory);
}

pc_cpus_init(pcms);
x86_cpus_init(pcms);

kvmclock_create();

Expand Down
6 changes: 3 additions & 3 deletions hw/i386/pc_sysfw.c
Expand Up @@ -211,7 +211,7 @@ static void pc_system_flash_map(PCMachineState *pcms,
}
}

static void old_pc_system_rom_init(MemoryRegion *rom_memory, bool isapc_ram_fw)
static void x86_bios_rom_init(MemoryRegion *rom_memory, bool isapc_ram_fw)
{
char *filename;
MemoryRegion *bios, *isa_bios;
Expand Down Expand Up @@ -272,7 +272,7 @@ void pc_system_firmware_init(PCMachineState *pcms,
BlockBackend *pflash_blk[ARRAY_SIZE(pcms->flash)];

if (!pcmc->pci_enabled) {
old_pc_system_rom_init(rom_memory, true);
x86_bios_rom_init(rom_memory, true);
return;
}

Expand All @@ -293,7 +293,7 @@ void pc_system_firmware_init(PCMachineState *pcms,

if (!pflash_blk[0]) {
/* Machine property pflash0 not set, use ROM mode */
old_pc_system_rom_init(rom_memory, false);
x86_bios_rom_init(rom_memory, false);
} else {
if (kvm_enabled() && !kvm_readonly_mem_enabled()) {
/*
Expand Down
2 changes: 1 addition & 1 deletion include/hw/i386/pc.h
Expand Up @@ -198,7 +198,7 @@ bool pc_machine_is_smm_enabled(PCMachineState *pcms);
void pc_register_ferr_irq(qemu_irq irq);
void pc_acpi_smi_interrupt(void *opaque, int irq, int level);

void pc_cpus_init(PCMachineState *pcms);
void x86_cpus_init(PCMachineState *pcms);
void pc_hot_add_cpu(MachineState *ms, const int64_t id, Error **errp);
void pc_smp_parse(MachineState *ms, QemuOpts *opts);

Expand Down

0 comments on commit 81ef68e

Please sign in to comment.