From patchwork Wed Aug 4 20:30:27 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Eric W. Biederman" X-Patchwork-Id: 117122 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o74KUlSa025032 for ; Wed, 4 Aug 2010 20:30:47 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934757Ab0HDUak (ORCPT ); Wed, 4 Aug 2010 16:30:40 -0400 Received: from out01.mta.xmission.com ([166.70.13.231]:60762 "EHLO out01.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934605Ab0HDUai (ORCPT ); Wed, 4 Aug 2010 16:30:38 -0400 Received: from in01.mta.xmission.com ([166.70.13.51]) by out01.mta.xmission.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1Ogkbh-0000Mm-6d; Wed, 04 Aug 2010 14:30:33 -0600 Received: from c-67-188-4-80.hsd1.ca.comcast.net ([67.188.4.80] helo=fess.ebiederm.org) by in01.mta.xmission.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1Ogkbg-0000Fb-TG; Wed, 04 Aug 2010 14:30:33 -0600 Received: from fess.ebiederm.org (localhost [127.0.0.1]) by fess.ebiederm.org (8.14.3/8.14.3/Debian-4) with ESMTP id o74KUTIs023410; Wed, 4 Aug 2010 13:30:29 -0700 Received: (from eric@localhost) by fess.ebiederm.org (8.14.3/8.14.3/Submit) id o74KURRP023409; Wed, 4 Aug 2010 13:30:27 -0700 To: Ingo Molnar , Thomas Renninger , "H. Peter Anvin" Cc: Tvrtko Ursulin , Gleb Natapov , Yinghai Lu , Avi Kivity , "linux-kernel\@vger.kernel.org" , KVM list , "Rafael J. Wysocki" , David Hill Subject: [PATCH] x86/apic: Map the local apic when parsing the MP table. References: <201008031028.57263.tvrtko.ursulin@sophos.com> <20100804093623.GE10499@redhat.com> <201008041146.56406.tvrtko.ursulin@sophos.com> From: ebiederm@xmission.com (Eric W. Biederman) Date: Wed, 04 Aug 2010 13:30:27 -0700 In-Reply-To: <201008041146.56406.tvrtko.ursulin@sophos.com> (Tvrtko Ursulin's message of "Wed\, 4 Aug 2010 11\:46\:55 +0100") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) MIME-Version: 1.0 X-XM-SPF: eid=; ; ; mid=; ; ; hst=in01.mta.xmission.com; ; ; ip=67.188.4.80; ; ; frm=ebiederm@xmission.com; ; ; spf=neutral X-SA-Exim-Connect-IP: 67.188.4.80 X-SA-Exim-Mail-From: ebiederm@xmission.com X-SA-Exim-Scanned: No (on in01.mta.xmission.com); SAEximRunCond expanded to false Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 04 Aug 2010 20:30:48 +0000 (UTC) diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index a96489e..c07e513 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c @@ -1606,7 +1606,7 @@ void __init init_apic_mappings(void) * acpi lapic path already maps that address in * acpi_register_lapic_address() */ - if (!acpi_lapic) + if (!acpi_lapic && !smp_found_config) set_fixmap_nocache(FIX_APIC_BASE, apic_phys); apic_printk(APIC_VERBOSE, "mapped APIC to %08lx (%08lx)\n", diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c index d86dbf7..d7b6f7f 100644 --- a/arch/x86/kernel/mpparse.c +++ b/arch/x86/kernel/mpparse.c @@ -274,6 +274,18 @@ static void __init smp_dump_mptable(struct mpc_table *mpc, unsigned char *mpt) void __init default_smp_read_mpc_oem(struct mpc_table *mpc) { } +static void __init smp_register_lapic_address(unsigned long address) +{ + mp_lapic_addr = address; + + set_fixmap_nocache(FIX_APIC_BASE, address); + if (boot_cpu_physical_apicid == -1U) { + boot_cpu_physical_apicid = read_apic_id(); + apic_version[boot_cpu_physical_apicid] = + GET_APIC_VERSION(apic_read(APIC_LVR)); + } +} + static int __init smp_read_mpc(struct mpc_table *mpc, unsigned early) { char str[16]; @@ -295,6 +307,10 @@ static int __init smp_read_mpc(struct mpc_table *mpc, unsigned early) if (early) return 1; + /* Initialize the lapic mapping */ + if (!acpi_lapic) + smp_register_lapic_address(mpc->lapic); + if (mpc->oemptr) x86_init.mpparse.smp_read_mpc_oem(mpc);