From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58165) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y1veW-0001IT-Tu for qemu-devel@nongnu.org; Fri, 19 Dec 2014 06:23:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y1veS-00043U-1R for qemu-devel@nongnu.org; Fri, 19 Dec 2014 06:23:24 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55263) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y1veR-000436-Oh for qemu-devel@nongnu.org; Fri, 19 Dec 2014 06:23:19 -0500 Message-ID: <54940A9B.7090800@redhat.com> Date: Fri, 19 Dec 2014 12:23:07 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1418956884-24022-1-git-send-email-ehabkost@redhat.com> <1418956884-24022-5-git-send-email-ehabkost@redhat.com> In-Reply-To: <1418956884-24022-5-git-send-email-ehabkost@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 4/8] target-i386: Keep track of apic-id setting List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost , qemu-devel@nongnu.org Cc: Gu Zheng , Igor Mammedov On 19/12/2014 03:41, Eduardo Habkost wrote: > Set a flag indicating that the apic-id property was set, so we can later > ensure we won't try to realize a X86CPU object before apic-id was set. > > Signed-off-by: Eduardo Habkost > Cc: Gu Zheng > --- > target-i386/cpu-qom.h | 1 + > target-i386/cpu.c | 3 ++- > 2 files changed, 3 insertions(+), 1 deletion(-) > > diff --git a/target-i386/cpu-qom.h b/target-i386/cpu-qom.h > index 4a6f48a..ba0ee15 100644 > --- a/target-i386/cpu-qom.h > +++ b/target-i386/cpu-qom.h > @@ -94,6 +94,7 @@ typedef struct X86CPU { > bool migratable; > bool host_features; > uint32_t apic_id; > + bool apic_id_set; > > /* if true the CPUID code directly forward host cache leaves to the guest */ > bool cache_info_passthrough; > diff --git a/target-i386/cpu.c b/target-i386/cpu.c > index cbed717..bb9525d 100644 > --- a/target-i386/cpu.c > +++ b/target-i386/cpu.c > @@ -1691,7 +1691,7 @@ static void x86_cpuid_get_apic_id(Object *obj, Visitor *v, void *opaque, > const char *name, Error **errp) > { > X86CPU *cpu = X86_CPU(obj); > - int64_t value = cpu->apic_id; > + int64_t value = cpu->apic_id_set ? cpu->apic_id : -1; Should this return an error if the apic_id was not set? Paolo > visit_type_int(v, &value, name, errp); > } > @@ -1729,6 +1729,7 @@ static void x86_cpuid_set_apic_id(Object *obj, Visitor *v, void *opaque, > return; > } > cpu->apic_id = value; > + cpu->apic_id_set = true; > } > > /* Generic getter for "feature-words" and "filtered-features" properties */ >