linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Whitehead <tedheadster@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: mingo@kernel.org, tglx@linutronix.de, peterz@infradead.org,
	luto@amacapital.net, bp@alien8.de, hpa@zytor.com,
	Matthew Whitehead <tedheadster@gmail.com>
Subject: [PATCH v2 2/2] x86/cpu: Change query logic so cpuid is enabled before testing
Date: Fri, 21 Sep 2018 17:20:41 -0400	[thread overview]
Message-ID: <20180921212041.13096-3-tedheadster@gmail.com> (raw)
In-Reply-To: <20180921212041.13096-1-tedheadster@gmail.com>

Presently we check for cpuid to be enabled first. If it is not already
enabled, then we next call identify_cpu_without_cpuid() and clear
X86_FEATURE_CPUID.

Unfortunately, identify_cpu_without_cpuid() is the function where cpuid
becomes _enabled_ on Cyrix 6x86/6x86L cpus. So we must reverse the
calling sequence so that cpuid is first enabled, and then check a second
time to see if the feature has now been activated.

Reviewed-by: Andy Lutomirski <luto@amacapital.net>
Signed-off-by: Matthew Whitehead <tedheadster@gmail.com>
---
 arch/x86/kernel/cpu/common.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index eb4cb3efd20e..60c7c5ce7e55 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -1040,6 +1040,9 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)
 	memset(&c->x86_capability, 0, sizeof c->x86_capability);
 	c->extended_cpuid_level = 0;
 
+	if (!have_cpuid_p())
+		identify_cpu_without_cpuid(c);
+	
 	/* cyrix could have cpuid enabled via c_identify()*/
 	if (have_cpuid_p()) {
 		cpu_detect(c);
@@ -1057,7 +1060,6 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)
 		if (this_cpu->c_bsp_init)
 			this_cpu->c_bsp_init(c);
 	} else {
-		identify_cpu_without_cpuid(c);
 		setup_clear_cpu_cap(X86_FEATURE_CPUID);
 	}
 
-- 
2.16.4


  parent reply	other threads:[~2018-09-21 21:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-21 21:20 [PATCH v2 0/2] x86/cpu: Enable cpuid on Cyrix 6x86/6x86L processors Matthew Whitehead
2018-09-21 21:20 ` [PATCH v2 1/2] x86/cpu: Use correct macros for Cyrix calls Matthew Whitehead
2018-09-22  9:57   ` [tip:x86/cpu] x86/CPU: " tip-bot for Matthew Whitehead
2018-09-21 21:20 ` Matthew Whitehead [this message]
2018-09-21 21:54   ` [PATCH v2 2/2] x86/cpu: Change query logic so cpuid is enabled before testing Andy Lutomirski
2018-09-22  9:58   ` [tip:x86/cpu] x86/CPU: Change query logic so CPUID " tip-bot for Matthew Whitehead

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=20180921212041.13096-3-tedheadster@gmail.com \
    --to=tedheadster@gmail.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --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;
as well as URLs for NNTP newsgroup(s).