public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov@gmail.com>
To: Ingo Molnar <mingo@elte.hu>, "Maciej W. Rozycki" <macro@linux-mips.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Yinghai Lu <yinghai@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: [RFC -tip] x86,apic - set cpu_has_apic for discrete apic
Date: Sun, 12 Jul 2009 01:29:29 +0400	[thread overview]
Message-ID: <20090711212929.GG5325@lenovo> (raw)

In case of discrete apic (due to hardware or firmware reason)
cpuid may not retrieve cpu_has_apic bit. So for SMP
compiled kernels instead of long check we may set "fake"
cpu_has_apic bit and check only the bit in further code
flow.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
---

Please review carefully.

 arch/x86/kernel/apic/apic.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

Index: linux-2.6.git/arch/x86/kernel/apic/apic.c
=====================================================================
--- linux-2.6.git.orig/arch/x86/kernel/apic/apic.c
+++ linux-2.6.git/arch/x86/kernel/apic/apic.c
@@ -1003,6 +1003,20 @@ int __init verify_local_APIC(void)
 	unsigned int reg0, reg1;
 
 	/*
+	 * For discrete APIC case cpu_has_apic bit could not
+	 * be retrieved via cpuid instruction. Same time
+	 * we rely on this bit (mostly for SMP compiled
+	 * kernel) and instead of checking the long condition
+	 * below all the time we do check for plain cpu_has_apic.
+	 *
+	 * At this moment all the checks are passed and we've
+	 * already complained if there was a BIOS bug. This place
+	 * should be safe for such a trick. --cvg
+	 */
+	if (smp_found_config && !cpu_has_apic && !disable_apic)
+		set_cpu_cap(&boot_cpu_data, X86_FEATURE_APIC);
+
+	/*
 	 * The version register is read-only in a real APIC.
 	 */
 	reg0 = apic_read(APIC_LVR);

             reply	other threads:[~2009-07-11 21:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-11 21:29 Cyrill Gorcunov [this message]
2009-07-12  0:41 ` [RFC -tip] x86,apic - set cpu_has_apic for discrete apic Maciej W. Rozycki
2009-07-12  5:52   ` Cyrill Gorcunov
2009-07-12  6:31     ` Maciej W. Rozycki
2009-07-12  6:34       ` Cyrill Gorcunov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090711212929.GG5325@lenovo \
    --to=gorcunov@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=macro@linux-mips.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --cc=yinghai@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox