[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 13/22] x86: coldplug cpus
From: |
Igor Mammedov |
Subject: |
Re: [PATCH v3 13/22] x86: coldplug cpus |
Date: |
Wed, 20 May 2020 16:07:01 +0200 |
On Wed, 20 May 2020 15:19:54 +0200
Gerd Hoffmann <address@hidden> wrote:
> microvm needs this, for correct madt creation
> (make sure enable bit is set).
>
> Signed-off-by: Gerd Hoffmann <address@hidden>
> ---
> hw/i386/x86.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/hw/i386/x86.c b/hw/i386/x86.c
> index 7a3bc7ab6639..ac7a0a958781 100644
> --- a/hw/i386/x86.c
> +++ b/hw/i386/x86.c
> @@ -118,6 +118,7 @@ uint32_t x86_cpu_apic_id_from_index(X86MachineState
> *x86ms,
>
> void x86_cpu_new(X86MachineState *x86ms, int64_t apic_id, Error **errp)
> {
> + MachineClass *mc = MACHINE_GET_CLASS(x86ms);
> Object *cpu = NULL;
> Error *local_err = NULL;
>
> @@ -126,6 +127,16 @@ void x86_cpu_new(X86MachineState *x86ms, int64_t
> apic_id, Error **errp)
> object_property_set_uint(cpu, apic_id, "apic-id", &local_err);
> object_property_set_bool(cpu, true, "realized", &local_err);
>
> + if (!mc->has_hotpluggable_cpus) {
> + /* coldplug cpu */
> + MachineState *ms = MACHINE(x86ms);
> + int i = 0;
> + while (ms->possible_cpus->cpus[i].arch_id != apic_id) {
> + i++;
> + }
> + ms->possible_cpus->cpus[i].cpu = cpu;
> + }
I'm thinking about removing x86_cpu_new alogether (in favor of device_add),
so I'd preffer avoid adding direct access to possible_cpus here.
that's the job of pc_cpu_plug (and possibly pc_cpu_pre_plug) in combination with
static const TypeInfo pc_machine_info = {
.name = TYPE_PC_MACHINE,
...
.interfaces = (InterfaceInfo[]) {
{ TYPE_HOTPLUG_HANDLER },
{ }
},
};
I'd reuse common code if possible in microvm or make microvm specific
simplified version of it
if it makes job easier.
> object_unref(cpu);
> error_propagate(errp, local_err);
> }
- Re: [PATCH v3 14/22] microvm: use 2G split unconditionally, (continued)
- [PATCH v3 21/22] [RfC] acpi: add per machine type acpi default, Gerd Hoffmann, 2020/05/20
- [PATCH v3 20/22] microvm/acpi: disable virtio-mmio cmdline hack, Gerd Hoffmann, 2020/05/20
- [PATCH v3 22/22] [RfC] acpi: flip default to off for microvm, Gerd Hoffmann, 2020/05/20
- [PATCH v3 09/22] acpi: ged: rename event memory region, Gerd Hoffmann, 2020/05/20
- [PATCH v3 16/22] microvm/acpi: add minimal acpi support, Gerd Hoffmann, 2020/05/20
- [PATCH v3 13/22] x86: coldplug cpus, Gerd Hoffmann, 2020/05/20
- Re: [PATCH v3 13/22] x86: coldplug cpus,
Igor Mammedov <=
- [PATCH v3 11/22] acpi: ged: add x86 device variant., Gerd Hoffmann, 2020/05/20
- [PATCH v3 04/22] [testing] seabios: update binaries to master snapshot, Gerd Hoffmann, 2020/05/20
- Re: [PATCH v3 00/22] microvm: add acpi support, no-reply, 2020/05/20
- Re: [PATCH v3 00/22] microvm: add acpi support, no-reply, 2020/05/20
- Re: [PATCH v3 00/22] microvm: add acpi support, no-reply, 2020/05/20
- Re: [PATCH v3 00/22] microvm: add acpi support, no-reply, 2020/05/20