mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Yinghai Lu" <yhlu.kernel@gmail.com>
To: "Krzysztof Helt" <krzysztof.h1@wp.pl>
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, tglx@linutronix.de,
	mingo@redhat.com
Subject: Re: [PATCH] x86: better CPU identification without the CPUID
Date: Sat, 13 Sep 2008 22:55:10 -0700	[thread overview]
Message-ID: <86802c440809132255sa518aa8g51136ae21a880e2d@mail.gmail.com> (raw)
In-Reply-To: <86802c440809132143p287edb82i6a73efbc53e6e93f@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 880 bytes --]

On Sat, Sep 13, 2008 at 9:43 PM, Yinghai Lu <yhlu.kernel@gmail.com> wrote:
> On Sat, Sep 13, 2008 at 3:56 AM, Krzysztof Helt <krzysztof.h1@wp.pl> wrote:
>> From: Krzysztof Helt <krzysztof.h1@wp.pl>
>>
>> cpus without the CPUID instruction are identified
>> as general 386 or 486 while some cpus (mostly made
>> by Cyrix) provide c_identify function which identify
>> correctly older cpus using cpu specific registers).
>>
>> Cyrix cpus are even worse as 5x86 and 6x68 have
>> the CPUID instruction disabled. The CPUID is
>> enabled by the c_identify() but the c_identify
>> is only called when the CPUID is available.
>>
>> Fix this by calling the c_identify() for all known
>> cpu families if there is no the CPUID instruction

I updated it to tip/master and call that in early_identify_cpu. it
should solve mtrr detection for Cyrix ...

Please check attached patch.

Thanks

YH

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: identify_cpu_without_cpuid.patch --]
[-- Type: text/x-patch; name=identify_cpu_without_cpuid.patch, Size: 2538 bytes --]

[PATCH] x86: identify_cpu_without_cpuid

need to call c_identify() for cpus without cpuid earlier...

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>

---
 arch/x86/kernel/cpu/common.c |   63 +++++++++++++++++++++++++++----------------
 1 file changed, 40 insertions(+), 23 deletions(-)

Index: linux-2.6/arch/x86/kernel/cpu/common.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/cpu/common.c
+++ linux-2.6/arch/x86/kernel/cpu/common.c
@@ -485,6 +485,33 @@ static void __cpuinit get_cpu_cap(struct
 		c->x86_power = cpuid_edx(0x80000007);
 
 }
+
+static void __cpuinit identify_cpu_without_cpuid(struct cpuinfo_x86 *c)
+{
+#ifdef CONFIG_X86_32
+	int i;
+
+	/*
+	 * First of all, decide if this is a 486 or higher
+	 * It's a 486 if we can modify the AC flag
+	 */
+	if (flag_is_changeable_p(X86_EFLAGS_AC))
+		c->x86 = 4;
+	else
+		c->x86 = 3;
+
+	for (i = 0; i < X86_VENDOR_NUM; i++)
+		if (cpu_devs[i] && cpu_devs[i]->c_identify) {
+			c->x86_vendor_id[0] = 0;
+			cpu_devs[i]->c_identify(c);
+			if (c->x86_vendor_id[0]) {
+				get_cpu_vendor(c);
+				break;
+			}
+		}
+#endif
+}
+
 /*
  * Do minimum CPU detection early.
  * Fields really needed: vendor, cpuid_level, family, model, mask,
@@ -503,18 +530,17 @@ static void __init early_identify_cpu(st
 #endif
 	c->x86_cache_alignment = c->x86_clflush_size;
 
-	if (!have_cpuid_p())
-		return;
-
 	memset(&c->x86_capability, 0, sizeof c->x86_capability);
-
 	c->extended_cpuid_level = 0;
 
-	cpu_detect(c);
-
-	get_cpu_vendor(c);
-
-	get_cpu_cap(c);
+	if (!have_cpuid_p()) {
+		identify_cpu_without_cpuid(c);
+		return;
+	} else {
+		cpu_detect(c);
+		get_cpu_vendor(c);
+		get_cpu_cap(c);
+	}
 
 	if (this_cpu->c_early_init)
 		this_cpu->c_early_init(c);
@@ -583,11 +609,13 @@ static void __cpuinit detect_nopl(struct
 
 static void __cpuinit generic_identify(struct cpuinfo_x86 *c)
 {
-	if (!have_cpuid_p())
-		return;
-
 	c->extended_cpuid_level = 0;
 
+	if (!have_cpuid_p()) {
+		identify_cpu_without_cpuid(c);
+		return;
+	}
+
 	cpu_detect(c);
 
 	get_cpu_vendor(c);
@@ -639,17 +667,6 @@ static void __cpuinit identify_cpu(struc
 	c->x86_cache_alignment = c->x86_clflush_size;
 	memset(&c->x86_capability, 0, sizeof c->x86_capability);
 
-	if (!have_cpuid_p()) {
-		/*
-		 * First of all, decide if this is a 486 or higher
-		 * It's a 486 if we can modify the AC flag
-		 */
-		if (flag_is_changeable_p(X86_EFLAGS_AC))
-			c->x86 = 4;
-		else
-			c->x86 = 3;
-	}
-
 	generic_identify(c);
 
 	if (this_cpu->c_identify)

  reply	other threads:[~2008-09-14  5:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-13 10:56 Krzysztof Helt
2008-09-14  4:43 ` Yinghai Lu
2008-09-14  5:55   ` Yinghai Lu [this message]
2008-09-14  8:30     ` Krzysztof Helt
2008-09-14  9:01       ` Yinghai Lu
2008-09-14  9:16         ` Yinghai Lu

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=86802c440809132255sa518aa8g51136ae21a880e2d@mail.gmail.com \
    --to=yhlu.kernel@gmail.com \
    --cc=hpa@zytor.com \
    --cc=krzysztof.h1@wp.pl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    /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

all inboxes | Powered by JetHome®