Received: from eggs.gnu.org ([208.118.235.92]:40333) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TtRwt-0006E8-NH for qemu-devel@nongnu.org; Thu, 10 Jan 2013 18:54:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TtRwr-0007q9-CF for qemu-devel@nongnu.org; Thu, 10 Jan 2013 18:54:15 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33981) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TtRwr-0007q4-3m for qemu-devel@nongnu.org; Thu, 10 Jan 2013 18:54:13 -0500 Date: Thu, 10 Jan 2013 21:55:55 -0200 From: Eduardo Habkost Message-ID: <20130110235555.GE10683@otherpad.lan.raisama.net> References: <1357757632-1950-1-git-send-email-ehabkost@redhat.com> <1357757632-1950-13-git-send-email-ehabkost@redhat.com> <20130111003635.3eeb6f62@thinkpad.mammed.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130111003635.3eeb6f62@thinkpad.mammed.net> Subject: Re: [Qemu-devel] [RFC 12/12] pc: Generate APIC IDs according to CPU topology List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, Andreas =?iso-8859-1?Q?F=E4rber?= On Fri, Jan 11, 2013 at 12:36:35AM +0100, Igor Mammedov wrote: [...] > > diff --git a/target-i386/cpu.c b/target-i386/cpu.c > > index 33787dc..f34192c 100644 > > --- a/target-i386/cpu.c > > +++ b/target-i386/cpu.c > > @@ -23,6 +23,8 @@ > > > > #include "cpu.h" > > #include "sysemu/kvm.h" > > +#include "sysemu/cpus.h" > > +#include "topology.h" > > > > #include "qemu/option.h" > > #include "qemu/config-file.h" > > @@ -2192,6 +2194,14 @@ void x86_cpu_realize(Object *obj, Error **errp) > > cpu_reset(CPU(cpu)); > > } > > > > +/* Enables contiguous-apic-ID mode, for compatibility */ > > +static bool compat_apic_id_mode; > > + > > +void enable_compat_apic_id_mode(void) > > +{ > > + compat_apic_id_mode = true; > > +} > > + > > /* Calculates initial APIC ID for a specific CPU index > > * > > * Currently we need to be able to calculate the APIC ID from the CPU index > > @@ -2201,10 +2211,20 @@ void x86_cpu_realize(Object *obj, Error **errp) > > */ > > uint32_t apic_id_for_cpu(unsigned int cpu_index) > if you move ^^^ to board, there won't be need in [8/12] True. The previous version I had (apic-id-topology-using-apic-id-prop branch) didn't need it. But I just wanted to avoid touching the CPU creation code by now. BTW, *-user doesn't have a board but does have an APIC ID (because *-user has CPUID and CPUID exposes the APIC ID). This would mean we would need APIC ID calculation code present in two separated places (which I would like to avoid). > > { > > - /* right now APIC ID == CPU index. this will eventually change to use > > - * the CPU topology configuration properly > > - */ > > - return cpu_index; > > + uint32_t correct_id; > > + static bool warned; > > + > > + correct_id = topo_apicid_for_cpu(smp_cores, smp_threads, cpu_index); > > + if (compat_apic_id_mode) { > > + if (cpu_index != correct_id && !warned) { > > + error_report("APIC IDs set in compatibility mode, " > > + "CPU topology won't match the configuration"); > > + warned = true; > > + } > > + return cpu_index; > > + } else { > > + return correct_id; > > + } > > } > > > > static void x86_cpu_initfn(Object *obj) > > diff --git a/target-i386/cpu.h b/target-i386/cpu.h > > index dbd9899..d9a9e8f 100644 > > --- a/target-i386/cpu.h > > +++ b/target-i386/cpu.h > > @@ -1239,5 +1239,6 @@ void disable_kvm_pv_eoi(void); > > const char *get_register_name_32(unsigned int reg); > > > > uint32_t apic_id_for_cpu(unsigned int cpu_index); > > +void enable_compat_apic_id_mode(void); > > > > #endif /* CPU_I386_H */ > > -- > > 1.7.11.7 > > > > -- > > To unsubscribe from this list: send the line "unsubscribe kvm" in > > the body of a message to majordomo@vger.kernel.org > > More majordomo info at http://vger.kernel.org/majordomo-info.html > > > -- > Regards, > Igor -- Eduardo