From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:57757) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TxFP2-0005lv-BG for qemu-devel@nongnu.org; Mon, 21 Jan 2013 06:19:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TxFP1-000443-AD for qemu-devel@nongnu.org; Mon, 21 Jan 2013 06:19:00 -0500 Received: from cantor2.suse.de ([195.135.220.15]:33050 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TxFP1-00043x-0i for qemu-devel@nongnu.org; Mon, 21 Jan 2013 06:18:59 -0500 Message-ID: <50FD241F.4050701@suse.de> Date: Mon, 21 Jan 2013 12:18:55 +0100 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1358456378-29248-1-git-send-email-ehabkost@redhat.com> <1358456378-29248-8-git-send-email-ehabkost@redhat.com> In-Reply-To: <1358456378-29248-8-git-send-email-ehabkost@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH for-1.4 07/12] target-i386/cpu: Introduce apic_id_for_cpu() function List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost Cc: Igor Mammedov , qemu-devel@nongnu.org, Anthony Liguori Am 17.01.2013 21:59, schrieb Eduardo Habkost: > This function will be used by both the CPU initialization code and the > fw_cfg table initialization code. >=20 > Later this function will be updated to generate APIC IDs according to > the CPU topology. >=20 > Signed-off-by: Eduardo Habkost > --- > target-i386/cpu.c | 17 ++++++++++++++++- > target-i386/cpu.h | 2 ++ > 2 files changed, 18 insertions(+), 1 deletion(-) >=20 > diff --git a/target-i386/cpu.c b/target-i386/cpu.c > index d1a14d5..d90789d 100644 > --- a/target-i386/cpu.c > +++ b/target-i386/cpu.c > @@ -2194,6 +2194,21 @@ void x86_cpu_realize(Object *obj, Error **errp) > cpu_reset(CPU(cpu)); > } > =20 > +/* Calculates initial APIC ID for a specific CPU index > + * > + * Currently we need to be able to calculate the APIC ID from the CPU = index > + * alone (without requiring a CPU object), as the QEMU<->Seabios inter= faces have > + * no concept of "CPU index", and the NUMA tables on fw_cfg need the A= PIC ID of > + * all CPUs up to max_cpus. > + */ > +uint32_t apic_id_for_cpu(unsigned int cpu_index) Can we rather make this x86_cpu_apic_id(X86CPU *cpu) to account for future changes to topology modelling? Andreas > +{ > + /* right now APIC ID =3D=3D CPU index. this will eventually change= to use > + * the CPU topology configuration properly > + */ > + return cpu_index; > +} > + > static void x86_cpu_initfn(Object *obj) > { > CPUState *cs =3D CPU(obj); > @@ -2228,7 +2243,7 @@ static void x86_cpu_initfn(Object *obj) > x86_cpuid_get_tsc_freq, > x86_cpuid_set_tsc_freq, NULL, NULL, NULL); > =20 > - env->cpuid_apic_id =3D cs->cpu_index; > + env->cpuid_apic_id =3D apic_id_for_cpu(cs->cpu_index); > =20 > /* init various static tables used in TCG mode */ > if (tcg_enabled() && !inited) { > diff --git a/target-i386/cpu.h b/target-i386/cpu.h > index 9d4fcf9..d86c0af 100644 > --- a/target-i386/cpu.h > +++ b/target-i386/cpu.h > @@ -1255,4 +1255,6 @@ void disable_kvm_pv_eoi(void); > /* Return name of 32-bit register, from a R_* constant */ > const char *get_register_name_32(unsigned int reg); > =20 > +uint32_t apic_id_for_cpu(unsigned int cpu_index); > + > #endif /* CPU_I386_H */ --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg