From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HTmgH-0000V0-IZ for qemu-devel@nongnu.org; Tue, 20 Mar 2007 18:19:49 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HTmgG-0000Ui-5Z for qemu-devel@nongnu.org; Tue, 20 Mar 2007 18:19:49 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HTmgG-0000Ud-0l for qemu-devel@nongnu.org; Tue, 20 Mar 2007 17:19:48 -0500 Received: from os.inf.tu-dresden.de ([141.76.48.99]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1HTmed-0005zI-JK for qemu-devel@nongnu.org; Tue, 20 Mar 2007 18:18:07 -0400 Received: from silo.inf.tu-dresden.de ([141.76.48.100]) by os.inf.tu-dresden.de with esmtps (TLSv1:AES256-SHA:256) (Exim 4.66) id 1HTmeZ-0007UD-Hv for qemu-devel@nongnu.org; Tue, 20 Mar 2007 23:18:03 +0100 Received: from kauer by silo.inf.tu-dresden.de with local (Exim 4.50) id 1HTmeZ-0007Dx-DX for qemu-devel@nongnu.org; Tue, 20 Mar 2007 23:18:03 +0100 Date: Tue, 20 Mar 2007 23:18:03 +0100 Message-ID: <20070320221803.GF28145@silo.inf.tu-dresden.de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="XF85m9dhOBO43t/C" Content-Disposition: inline From: Bernhard Kauer Subject: [Qemu-devel] [PATCH] i386 return APIC ID with cpuid Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org --XF85m9dhOBO43t/C Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, cpuid(01H) on i386 does not return the initial APIC id. The following patch correct this. Bernhard Kauer --XF85m9dhOBO43t/C Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="qemu2.diff" Index: hw/apic.c =================================================================== RCS file: /sources/qemu/qemu/hw/apic.c,v retrieving revision 1.12 diff -u -r1.12 apic.c --- hw/apic.c 31 Jan 2007 12:22:18 -0000 1.12 +++ hw/apic.c 20 Mar 2007 22:13:09 -0000 @@ -816,6 +816,7 @@ env->apic_state = s; apic_init_ipi(s); s->id = last_apic_id++; + env->cpuid_apic_id = s->id; s->cpu_env = env; s->apicbase = 0xfee00000 | (s->id ? 0 : MSR_IA32_APICBASE_BSP) | MSR_IA32_APICBASE_ENABLE; Index: target-i386/cpu.h =================================================================== RCS file: /sources/qemu/qemu/target-i386/cpu.h,v retrieving revision 1.41 diff -u -r1.41 cpu.h --- target-i386/cpu.h 5 Feb 2007 22:06:27 -0000 1.41 +++ target-i386/cpu.h 20 Mar 2007 22:13:09 -0000 @@ -529,6 +529,7 @@ uint32_t cpuid_xlevel; uint32_t cpuid_model[12]; uint32_t cpuid_ext2_features; + uint32_t cpuid_apic_id; #ifdef USE_KQEMU int kqemu_enabled; Index: target-i386/helper.c =================================================================== RCS file: /sources/qemu/qemu/target-i386/helper.c,v retrieving revision 1.74 diff -u -r1.74 helper.c --- target-i386/helper.c 1 Feb 2007 22:12:19 -0000 1.74 +++ target-i386/helper.c 20 Mar 2007 22:13:10 -0000 @@ -1614,7 +1614,7 @@ break; case 1: EAX = env->cpuid_version; - EBX = 8 << 8; /* CLFLUSH size in quad words, Linux wants it. */ + EBX = (env->cpuid_apic_id << 24) | 8 << 8; /* CLFLUSH size in quad words, Linux wants it. */ ECX = env->cpuid_ext_features; EDX = env->cpuid_features; break; --XF85m9dhOBO43t/C--