Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp135955ybc; Mon, 18 Nov 2019 21:57:50 -0800 (PST) X-Google-Smtp-Source: APXvYqyT/u8s1pLDc1qH1Rp3X60GJD9GxnYC38smPUz6l3CcL1h+W+CYSwHi5tgvwixhTXwAGCf5 X-Received: by 2002:a17:907:1114:: with SMTP id qu20mr33426137ejb.42.1574143070431; Mon, 18 Nov 2019 21:57:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574143070; cv=none; d=google.com; s=arc-20160816; b=Yb9k54poI8CWatL5yuUYTgM5rAeqWZqNf4jyy7qE4FRDCZumgvg3mtomF4qcR9Kl3X pVKLAbtewfYkShxHEz81cH/6PX6ZVTr201TcxYrNPYPaldPsnZACJqiCrIcsfJze1iMK 2EQjWWM8ADLQxmQe3/EjfGySPuCt9sbPNpUeDjDL2pbZvBCZlXf6rSKGIhr/DdrCzcEY u5OMwQeT2k59q6fuGrkYUR3MK9RZpOjGSwrGY1cex2BjVZOuEjJHQZh/Ifp7iBm2tQmC WAQATn3uhKJwufZELD2thPvwRJel4xjxt+AmQRuYULnVeu9UsnW16FlLVhjoYvqGM1Ar 4Ijg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=g9W0bD4IOXKZP7Dv21tg7w8iQSd4/NxdxdlTGkZ+dXQ=; b=A3/P4zL6QpUgJdKt9HfXxfm1RMP0jITeQSF+1ZLs6smSHfUlou1D/tw4tu+SfLhP99 stH9lF2HjLWqh6/CPJYLMbfEA0aL+JRSXzHd1eY8av9p5tjEyfW4a62+GfaH7u6FL/pX CUqoyp4g9ochaKhGS7E66znIzeW4jF5c4LIsDWcalByULvgFRaanxBwyqWjHtDiJThyU /LOlUh3q2xQBw33pDwSdOodCleLN95tQ+o6xtlUbMWnwGki++SMOsrX93KEIKg9wL44S 2vhWkVaVlaBuSemS3qo0/Gfm20e5yXHkc705X1RfQuxSgutx/EHoxvnnjLf+FEiRko/L 8vHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RfcxS6hU; 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 x50si15142513eda.155.2019.11.18.21.57.26; Mon, 18 Nov 2019 21:57:50 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=RfcxS6hU; 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 S1731783AbfKSFx5 (ORCPT + 99 others); Tue, 19 Nov 2019 00:53:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:51944 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732091AbfKSFxz (ORCPT ); Tue, 19 Nov 2019 00:53:55 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 636932084D; Tue, 19 Nov 2019 05:53:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574142834; bh=pLU2em+gidaipwiPpe17mwLmm03YkEkQWrNziFfIf9M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RfcxS6hUaiAN1+1DJ61GbjTmLwMLGQcQf25xKK11P0gLQC5wZwalfJ6XdRMlWtuIv 7PsOMY8R+sLeS2WblnYxY2KmLBrTaEIIK7bAFw4GarxlvM2ovC9WzrIpnc+EveZ9jT b4j2NTH/PaO9zezaAEB27Kupl6pAiLhc4xUqyhbU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Lutomirski , Matthew Whitehead , Borislav Petkov , David Woodhouse , "H. Peter Anvin" , Ingo Molnar , Konrad Rzeszutek Wilk , Peter Zijlstra , Thomas Gleixner , Sasha Levin Subject: [PATCH 4.14 176/239] x86/CPU: Change query logic so CPUID is enabled before testing Date: Tue, 19 Nov 2019 06:19:36 +0100 Message-Id: <20191119051334.309340122@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191119051255.850204959@linuxfoundation.org> References: <20191119051255.850204959@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Matthew Whitehead [ Upstream commit 2893cc8ff892fa74972d8dc0e1d0dc65116daaa3 ] 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 Signed-off-by: Sasha Levin --- 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 c0c9c5a44e82c..3d805e8b37396 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -1066,6 +1066,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); @@ -1082,7 +1085,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.20.1