Received: by 10.192.165.156 with SMTP id m28csp41376imm; Tue, 10 Apr 2018 16:00:21 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+faHwPDXLdDVUOKOewKYYj33OgEopNUhA2j1jC4kQHrGZtJwHqJ5e7VBODjGuch1iG7eWC X-Received: by 10.99.60.79 with SMTP id i15mr1564071pgn.399.1523401221574; Tue, 10 Apr 2018 16:00:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523401221; cv=none; d=google.com; s=arc-20160816; b=KlVe8nV2Y6HFOGTgeM6Eh3VBQrn4za2XCOwgQa+ANuazm58q5gAbyvSDnv3sZQXaA2 CA4rLHrMmxuqNcOqDE7hORlYWcal+y9oxnF5nLHcAgBTdKEP/ZOemzq6KZo9W3LCmImi XCUsCP+upEeAbafn1Fg53NvEDJLtBkoKHwe0LW+9pyx73C+Rmf0kaHSh76W8RpxvUr6w m/OUYIIaEx33L3c2t5jNZcODvv5cT14GhM63qXEQ6B+AdDuE5dr8HWO1GECDYAaifDnc RaS+k1C/DvaXgNxSLrx/zsrCHEnFNIYfz5EfQVdYHd3paAT5230lgv368WZgANpmvlxp IxlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=UFBXjE9ZDhrg8+g1iPKZR1fV2Kfzu6VOXNZmIYD1DZw=; b=M16LyqgFzsj+c+eG6AvSGj9IZHqnSd/8uAcqEFhzkXQk0Q6UEmd5/llLZJ6ngmlf9G q/vjuPjbmGOwyKSZjVk8oKYFz2pxpqYqPmB/3nANj3VLnb+An6nMWxrYyvkq6yldzzcP aHfNiuim0HWGjq7eVXS0IJs88eyYv7xnuXvwXhoW1mm/cHGRvlVARGyykJqdVjLdiykX ias1Wo5yxfTy19LLOlOXF7JBdbvFZFYWFTyIeBUI0bOjl6OV1P66em1GKW8j0rsfGDXu xWH9RtzcNEC6i8FLH8KYOJL18OykUDouMd7VWyi2J4SYxtZnK13LZ0R6n2NyKx2aehsy z9TQ== 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 y62si2838319pfd.309.2018.04.10.15.59.44; Tue, 10 Apr 2018 16:00:21 -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 S1755887AbeDJWh7 (ORCPT + 99 others); Tue, 10 Apr 2018 18:37:59 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:43972 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755045AbeDJWhz (ORCPT ); Tue, 10 Apr 2018 18:37:55 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id BCF5ECC4; Tue, 10 Apr 2018 22:37:54 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ashok Raj , Borislav Petkov , Andy Lutomirski , Arjan van de Ven , Borislav Petkov , Dan Williams , Dave Hansen , David Woodhouse , Josh Poimboeuf , Linus Torvalds , Peter Zijlstra , Thomas Gleixner , Ingo Molnar Subject: [PATCH 4.14 087/138] x86/CPU: Check CPU feature bits after microcode upgrade Date: Wed, 11 Apr 2018 00:24:37 +0200 Message-Id: <20180410212912.289118138@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180410212902.121524696@linuxfoundation.org> References: <20180410212902.121524696@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Borislav Petkov commit 42ca8082e260dcfd8afa2afa6ec1940b9d41724c upstream. With some microcode upgrades, new CPUID features can become visible on the CPU. Check what the kernel has mirrored now and issue a warning hinting at possible things the user/admin can do to make use of the newly visible features. Originally-by: Ashok Raj Tested-by: Ashok Raj Signed-off-by: Borislav Petkov Reviewed-by: Ashok Raj Cc: Andy Lutomirski Cc: Arjan van de Ven Cc: Borislav Petkov Cc: Dan Williams Cc: Dave Hansen Cc: David Woodhouse Cc: Greg Kroah-Hartman Cc: Josh Poimboeuf Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/20180216112640.11554-4-bp@alien8.de Signed-off-by: Ingo Molnar Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/cpu/common.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -1732,5 +1732,25 @@ core_initcall(init_cpu_syscore); */ void microcode_check(void) { + struct cpuinfo_x86 info; + perf_check_microcode(); + + /* Reload CPUID max function as it might've changed. */ + info.cpuid_level = cpuid_eax(0); + + /* + * Copy all capability leafs to pick up the synthetic ones so that + * memcmp() below doesn't fail on that. The ones coming from CPUID will + * get overwritten in get_cpu_cap(). + */ + memcpy(&info.x86_capability, &boot_cpu_data.x86_capability, sizeof(info.x86_capability)); + + get_cpu_cap(&info); + + if (!memcmp(&info.x86_capability, &boot_cpu_data.x86_capability, sizeof(info.x86_capability))) + return; + + pr_warn("x86/CPU: CPU features have changed after loading microcode, but might not take effect.\n"); + pr_warn("x86/CPU: Please consider either early loading through initrd/built-in or a potential BIOS update.\n"); }