From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76720C433F4 for ; Sat, 22 Sep 2018 09:58:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 32D2221532 for ; Sat, 22 Sep 2018 09:58:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 32D2221532 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=zytor.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728316AbeIVPvv (ORCPT ); Sat, 22 Sep 2018 11:51:51 -0400 Received: from terminus.zytor.com ([198.137.202.136]:44209 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727324AbeIVPvv (ORCPT ); Sat, 22 Sep 2018 11:51:51 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id w8M9wRKl2281108 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 22 Sep 2018 02:58:28 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w8M9wR0i2281105; Sat, 22 Sep 2018 02:58:27 -0700 Date: Sat, 22 Sep 2018 02:58:27 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Matthew Whitehead Message-ID: Cc: konrad.wilk@oracle.com, hpa@zytor.com, tedheadster@gmail.com, bp@suse.de, linux-kernel@vger.kernel.org, mingo@kernel.org, luto@amacapital.net, dwmw@amazon.co.uk, peterz@infradead.org, tglx@linutronix.de Reply-To: luto@amacapital.net, tglx@linutronix.de, peterz@infradead.org, dwmw@amazon.co.uk, linux-kernel@vger.kernel.org, mingo@kernel.org, bp@suse.de, konrad.wilk@oracle.com, hpa@zytor.com, tedheadster@gmail.com In-Reply-To: <20180921212041.13096-3-tedheadster@gmail.com> References: <20180921212041.13096-3-tedheadster@gmail.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/cpu] x86/CPU: Change query logic so CPUID is enabled before testing Git-Commit-ID: 2893cc8ff892fa74972d8dc0e1d0dc65116daaa3 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 2893cc8ff892fa74972d8dc0e1d0dc65116daaa3 Gitweb: https://git.kernel.org/tip/2893cc8ff892fa74972d8dc0e1d0dc65116daaa3 Author: Matthew Whitehead AuthorDate: Fri, 21 Sep 2018 17:20:41 -0400 Committer: Borislav Petkov CommitDate: Sat, 22 Sep 2018 11:47:39 +0200 x86/CPU: Change query logic so CPUID is enabled before testing Presently we check first if CPUID is enabled. 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. 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. [ bp: Massage commit message and remove trailing whitespace. ] Suggested-by: Andy Lutomirski Signed-off-by: Matthew Whitehead Signed-off-by: Borislav Petkov Reviewed-by: Andy Lutomirski Cc: David Woodhouse Cc: H. Peter Anvin Cc: Ingo Molnar Cc: Konrad Rzeszutek Wilk Cc: Peter Zijlstra Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/20180921212041.13096-3-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 44c4ef3d989b..658c85d16a9b 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -1076,6 +1076,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); @@ -1093,7 +1096,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); }