qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] CPU hotplug, again


From: Bharata B Rao
Subject: Re: [Qemu-devel] CPU hotplug, again
Date: Tue, 23 Feb 2016 15:19:11 +0530
User-agent: Mutt/1.5.23 (2014-03-12)

On Tue, Feb 23, 2016 at 03:10:26PM +0530, Bharata B Rao wrote:
> 
> 5) QOM-links
> 
> Andreas, You have often talked about setting up links from machine object
> to the CPU objects. Would the below code correctly capture that idea of
> yours ?
> 
> #define SPAPR_MACHINE_CPU_CORE_PROP "core"
> 
> /* MachineClass.init for sPAPR */
> static void ppc_spapr_init(MachineState *machine)
> {
>     sPAPRMachineState *spapr = SPAPR_MACHINE(machine);
>     int spapr_smp_cores = smp_cpus / smp_threads;
>     int spapr_max_cores = max_cpus / smp_threads;
> 
>     ...
>     for (i = 0; i < spapr_max_cores; i++) {
>         Object *obj = object_new(TYPE_SPAPR_CPU_CORE);
>         sPAPRCPUCore *core = SPAPR_CPU_CORE(obj);
>         char name[32];
> 
>         snprintf(name, sizeof(name), "%s[%d]", SPAPR_MACHINE_CPU_CORE_PROP, 
> i);
> 
>         /*
>          * Create links from machine objects to all possible cores.
>          */
>         object_property_add_link(OBJECT(spapr), name, TYPE_SPAPR_CPU_CORE,
>                                  (Object **)&spapr->core[i],
>                                  NULL, NULL, &error_abort); 
> 
>         /*
>          * Set the QOM link from machine object to core object for all
>          * boot time CPUs specified with -smp. For rest of the hotpluggable
>          * cores this is done from the core hotplug path.
>          */
>         if (i < spapr_smp_cores) {
>             object_property_set_link(OBJECT(spapr), OBJECT(core),
>                                      SPAPR_MACHINE_CPU_CORE_PROP, 
> &error_abort);
>         }

BTW s/SPAPR_MACHINE_CPU_CORE_PROP/name in object_property_set_link() above.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]