On Wed, 03 Apr 2013 20:22:17 +0200 Andreas Färber <afaer...@suse.de> wrote:
> Am 03.04.2013 19:58, schrieb Igor Mammedov: > > On Wed, 27 Mar 2013 12:19:01 +0100 > > Paolo Bonzini <pbonz...@redhat.com> wrote: > > > >> Il 21/03/2013 15:28, Igor Mammedov ha scritto: > >>> + if (x86_cpu_is_cpu_exist(qdev_get_machine(), &apic_id)) { > >> > >> Similarly, can this be done in qmp_cpu_set? And should it really be an > > I've tried to abstract qmp part from target/implementation details. > > We could introduce global func like, and then use it if from QMP subsystem: > > bool is_cpu_exist(int64_t id) { > > ... iterate over CPUs ... > > if (cpu->get_firmware_id() == id) > > return true; > > ... > > } > > > > Andreas, Is it acceptable if I add it to qom/cpu.h, > > If you make it cpu_exists() then sure, > > > qom/cpu.c ? > > but this is not going to work yet, you may need to place it in cpus.c > due to first_cpu and next_cpu operating on CPUArchState. I actually do recursive search on QOM tree /machine for TYPE_CPU avoiding usage of first_cpu and next_cpu. So it's abstracted from CPUArchState. > > Andreas > > -- > SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany > GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg > -- Regards, Igor