Received: by 10.192.165.156 with SMTP id m28csp112059imm; Tue, 10 Apr 2018 17:39:05 -0700 (PDT) X-Google-Smtp-Source: AIpwx49GQDBu0YMjEpRKGQZ37nabSuKnC4ANvkWVrFZkP8qJw3kLTFIfbxekSaTI95krnoHLE952 X-Received: by 2002:a17:902:b48c:: with SMTP id y12-v6mr1819071plr.212.1523407145608; Tue, 10 Apr 2018 17:39:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523407145; cv=none; d=google.com; s=arc-20160816; b=PJHIUtY2PNUYmUk9ZIlzcRmfgvVBhAOh4prfes3LO02wKmSIZ1ZPIyfsTwooFkmt4t 3/3xt5TiPaYRWRMX2Q5YEukpoqeley7oTCJjsbDztqE1AmKBZLk3KBhhqlQDxDFnC+5H XcPRj6uvZZC/MdvCqq/xxk133x52q7vJL0p3Jbf1GVDB47DyY1TsNIMjyAsKcidbCk6D 10WYU11d3V186Vtm0Mh8xe9VH9qHGkkIt7xkgqeZbNzmUZ9SS0bkim0UsiWeFZ16lDwZ 9pcJf5vyGxiF6Vnb/33ITkWb5l6RgLVNlYkczUdFZcE7H7z1LZK/VSzOy6gzwnGz5Hrh DwGg== 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=fmB2rC8sX6BiD4Aq8WUwqed+p6K/VXwhoN4ogj9dl9k=; b=MpATiwisKqyNmp5LQR8Dm27p5LpTjIrffHuGfjuTuWo8B+J12WNvswnON2O3ctXYUJ MP+YsW2xol1DoI/FCzN0bvqXCkjEo9Y4MQbKqoTaO9qq8RjU9kAdvYAbT/HMtuw/cXp+ c5OKRnyACYqd6oIDGaCyekRkPro9TTHNMpsd1jYyilbVI4u0f1uzni3HB9cFVZTYWrAi VGV2r/G23Nmy0tj3EWf01WJXc3oHP2IagG83/LUzn0jYrfZI/JCWr5z5cEXOH4X8GGmt TQOH9ByO3jdHQ3yITmfjPR5cTpJ/BgAVCX/WB/wC2ZKUQOe/aU9fBNd6BRU8MU2njVHE gyrQ== 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 33-v6si3662716pll.332.2018.04.10.17.38.29; Tue, 10 Apr 2018 17:39:05 -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 S1754690AbeDJWaw (ORCPT + 99 others); Tue, 10 Apr 2018 18:30:52 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:40154 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752785AbeDJWas (ORCPT ); Tue, 10 Apr 2018 18:30:48 -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 79E5CDE7; Tue, 10 Apr 2018 22:30:47 +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.15 111/168] x86/CPU: Check CPU feature bits after microcode upgrade Date: Wed, 11 Apr 2018 00:24:13 +0200 Message-Id: <20180410212804.995415058@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180410212800.144079021@linuxfoundation.org> References: <20180410212800.144079021@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.15-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 @@ -1757,5 +1757,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"); }