Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp413282imm; Sat, 22 Sep 2018 02:59:41 -0700 (PDT) X-Google-Smtp-Source: ACcGV63FFfOnWRWcWjCSpK1lYZ8dqb4au40QPKBCvKuUROfXd04D8SoTc8DIP8mbkPetKLZaw7kD X-Received: by 2002:a63:f751:: with SMTP id f17-v6mr1709880pgk.410.1537610381580; Sat, 22 Sep 2018 02:59:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537610381; cv=none; d=google.com; s=arc-20160816; b=LEZkWh6V2sA88Fzo9O8g2hPjHaarRQLS1LZ3zH3z2SMs3Pvk3KeMGlBxKRjmIRFoHT P3j+bIq3PcTARuvHK68K/awtH0HUQtVzTLKS4J95ODXi0thJA6JkCPI4Cb8HvlZEQFRJ 8I2JpqVFoSf4Z7/YGGaNZkVuJPvewE9jva2I+mA8jK54QPZVkOENp6IlooIWcD7ZEFtQ sBSfxVei5i7iTk2aSHh+qGIlcqHXP0409Q8MSvS82IRJ99viODdRWg+oUcsgbRHkJdTm 7U74hY8to8LkPBSF3RaHrrZQcahPDycQa0x7AcDCJ6B7F6biMWYcr+x5J8TzkC5CMCXU FTOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date; bh=ZUJYVTzloMRLTG1o4LQGC78dY7yoEhKnlL41aeJXbvY=; b=swFVvedQOryFMVcag78SsgnbbnYlEAo3YJhkAMmN9+GG72glYGb3oiJfFMayq1LuI8 /pIbgiaJ0Vja9kw+5aDr9LLcPVI1Q5QcpCzRfBu52jIOnSYLmHiijjjgVZ4WPRUN03z8 ziJB+ZSBQio46ZMmI1YkHvItujjaGCmpKylBVHdXOU4Fk1eLt1gb/+QiWCx3I379PZ9l OcZqmw79UPb8Qx12Srgpu11jNMbrHP4eSErmZS+jIqGYBeofCydEFoepEpcf5jvjMQpC zMCB4jVieihsp/WuOTf8sIttriATVJrVCOehwRIgsWuXiO0M+E5Cn6uA4C+5hMdWSee7 6yUA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l185-v6si845217pgl.270.2018.09.22.02.59.25; Sat, 22 Sep 2018 02:59:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728284AbeIVPvv (ORCPT + 99 others); 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 X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_96_Q autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com 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); }