qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Sergio Lopez <slp@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>
Cc: ehabkost@redhat.com, mst@redhat.com, qemu-devel@nongnu.org,
	kraxel@redhat.com, pbonzini@redhat.com, imammedo@redhat.com,
	sgarzare@redhat.com, lersek@redhat.com, rth@twiddle.net
Subject: Re: [PATCH v5 02/10] hw/i386/pc: rename functions shared with non-PC machines
Date: Thu, 03 Oct 2019 12:04:44 +0200	[thread overview]
Message-ID: <87mueii1qb.fsf@redhat.com> (raw)
In-Reply-To: <5d305923-d640-25ae-c539-cc0206ac9f2a@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 8488 bytes --]


Philippe Mathieu-Daudé <philmd@redhat.com> writes:

> Hi Sergio,
>
> Depending of the IDE developers use, the patch subject is not always
> prepended to the patch description.
>
> You can add: "The following functions are named *pc* but are not
> PC-machine specific but generic to the X86 architecture, rename them:"

OK, thanks for the tip.

> On 10/2/19 1:30 PM, Sergio Lopez wrote:
>> load_linux                 -> x86_load_linux
>> pc_new_cpu                 -> x86_new_cpu
>
> Maybe we can rename this one 'x86_cpu_new'?

OK.

>> 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
>
> This one as 'x86_bios_rom_init'?

Probably that's a better name.

> Nit: Adding 2 spaces before each line would ease readability.

Ack.

>>
>> Signed-off-by: Sergio Lopez <slp@redhat.com>
>> ---
>>   hw/i386/pc.c         | 28 ++++++++++++++--------------
>>   hw/i386/pc_piix.c    |  2 +-
>>   hw/i386/pc_q35.c     |  2 +-
>>   hw/i386/pc_sysfw.c   |  6 +++---
>>   include/hw/i386/pc.h |  2 +-
>>   5 files changed, 20 insertions(+), 20 deletions(-)
>>
>> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
>> index bcda50efcc..029bc23e7c 100644
>> --- a/hw/i386/pc.c
>> +++ b/hw/i386/pc.c
>> @@ -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;
>> @@ -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_new_cpu(PCMachineState *pcms, int64_t apic_id, Error **errp)
>>   {
>>       Object *cpu = NULL;
>>       Error *local_err = NULL;
>> @@ -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_new_cpu(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;
>> @@ -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_new_cpu(pcms, possible_cpus->cpus[i].arch_id, &error_fatal);
>>       }
>>   }
>>   @@ -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") ||
>> @@ -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++) {
>> @@ -2678,7 +2678,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);
>> @@ -2687,7 +2687,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);
>> @@ -2699,7 +2699,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;
>> @@ -2801,9 +2801,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";
>> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
>> index 6824b72124..de09e076cd 100644
>> --- a/hw/i386/pc_piix.c
>> +++ b/hw/i386/pc_piix.c
>> @@ -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();
>> diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
>> index 8fad20f314..894989b64e 100644
>> --- a/hw/i386/pc_q35.c
>> +++ b/hw/i386/pc_q35.c
>> @@ -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();
>>   diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c
>> index a9983f0bfb..1ee254b15e 100644
>> --- a/hw/i386/pc_sysfw.c
>> +++ b/hw/i386/pc_sysfw.c
>> @@ -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_system_rom_init(MemoryRegion *rom_memory, bool isapc_ram_fw)
>>   {
>>       char *filename;
>>       MemoryRegion *bios, *isa_bios;
>> @@ -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_system_rom_init(rom_memory, true);
>>           return;
>>       }
>>   @@ -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_system_rom_init(rom_memory, false);
>>       } else {
>>           if (kvm_enabled() && !kvm_readonly_mem_enabled()) {
>>               /*
>> diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
>> index 6df4f4b6fb..d12f42e9e5 100644
>> --- a/include/hw/i386/pc.h
>> +++ b/include/hw/i386/pc.h
>> @@ -195,7 +195,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);
>>   
>>
>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Thanks,
Sergio.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

  reply	other threads:[~2019-10-03 10:05 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-02 11:30 [PATCH v5 00/10] Introduce the microvm machine type Sergio Lopez
2019-10-02 11:30 ` [PATCH v5 01/10] hw/virtio: Factorize virtio-mmio headers Sergio Lopez
2019-10-03 10:15   ` Philippe Mathieu-Daudé
2019-10-03 11:26     ` Sergio Lopez
2019-10-03 13:11       ` Eric Blake
2019-10-03 13:47         ` Philippe Mathieu-Daudé
2019-10-07  9:32         ` Markus Armbruster
2019-10-02 11:30 ` [PATCH v5 02/10] hw/i386/pc: rename functions shared with non-PC machines Sergio Lopez
2019-10-02 15:14   ` Philippe Mathieu-Daudé
2019-10-03 10:04     ` Sergio Lopez [this message]
2019-10-02 11:30 ` [PATCH v5 03/10] hw/i386/pc: move shared x86 functions to x86.c and export them Sergio Lopez
2019-10-03 10:27   ` Philippe Mathieu-Daudé
2019-10-03 11:14     ` Sergio Lopez
2019-10-02 11:30 ` [PATCH v5 04/10] hw/i386: split PCMachineState deriving X86MachineState from it Sergio Lopez
2019-10-03 10:24   ` Philippe Mathieu-Daudé
2019-10-03 11:15     ` Sergio Lopez
2019-10-02 11:30 ` [PATCH v5 05/10] hw/i386: make x86.c independent from PCMachineState Sergio Lopez
2019-10-02 11:30 ` [PATCH v5 06/10] fw_cfg: add "modify" functions for all types Sergio Lopez
2019-10-02 11:31 ` [PATCH v5 07/10] hw/intc/apic: reject pic ints if isa_pic == NULL Sergio Lopez
2019-10-02 11:31 ` [PATCH v5 08/10] roms: add microvm-bios (qboot) as binary and git submodule Sergio Lopez
2019-10-03 10:07   ` Sergio Lopez
2019-10-03 10:19     ` Paolo Bonzini
2019-10-03 11:16       ` Sergio Lopez
2019-10-02 11:31 ` [PATCH v5 09/10] docs/microvm.rst: document the new microvm machine type Sergio Lopez
2019-10-02 13:22   ` Paolo Bonzini
2019-10-02 13:37     ` Sergio Lopez
2019-10-02 11:31 ` [PATCH v5 10/10] hw/i386: Introduce the " Sergio Lopez
2019-10-02 12:05   ` Thomas Huth
2019-10-02 13:24     ` Sergio Lopez
2019-10-02 12:03 ` [PATCH v5 00/10] " no-reply
2019-10-02 12:14 ` no-reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mueii1qb.fsf@redhat.com \
    --to=slp@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=lersek@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=sgarzare@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).