From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AIpwx4+uk1Ullcbp14XT+Ga5X3QKs8QgF+tGvOLfy755Fb3VvglLZ58axtRH2bFE8+ENVbW1h8ib ARC-Seal: i=1; a=rsa-sha256; t=1523399448; cv=none; d=google.com; s=arc-20160816; b=tB1B26XBDGtqTY6ttGO8rSpCr8E+9yzGGLJh2cOA56FUxVnNyzAfrC73aKHFjzJZw9 4n55oLY9aEvcBM4Ovp8riOGlVVdKz6hMfHIPQntaIVlxtlOWMQ9wFa4aoCCfD9z7juNw j9uCpQaNlAOrRWf3SpGTh+A+H23OFPHADNG5CSoAHYA+cRcbICumKzDYgGSRpwwe1s0j yijcVKUzqpeRIT+f52J1eYlnM0L/aaN5N8yQIgeudRYJQBPJFhE9iEsrDpJeYAl3nyhq 5OS10EE5dRAlyT08ELbhnaU6hOnJSy3ZTgWllTYSrSFY30ttct4BGeKcOkQBTjOkxwAw giew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=fmB2rC8sX6BiD4Aq8WUwqed+p6K/VXwhoN4ogj9dl9k=; b=ook/5Fm5YD9LJoQCP8zKJ2O4SsOv5LAA3gS9Jh6d3bsRVBBpUT0JosQoaraZC180Sg Qomt/0PZAKuSue8C5KnDSFfp98dpCw3mWLGcJ4NinMEzQuUIi3YFDhEP0f4mnRFe33dT l/Tqh7nyA8bkTVHEKLa4gQEjwHhJgjuPeh+seeqbi0wV85PumUz2AzVRbGvo4BHKLvEi F0ytXFJEP/bbkK5SpejEFOGSkNnCHnVrjDKRFmmigwZlVYJa357TGJ7QCuFrNyiWieCK 4SFr7jsO23K1CjARyu7QFUYFlFFqIj4FDSmHxfYhnLxJ1uQZ/Z82X30TIrDAvUSumEkq C1dA== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.61.202 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.61.202 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-LABELS: =?utf-8?b?IlxcU2VudCI=?= X-GMAIL-THRID: =?utf-8?q?1597400099827149153?= X-GMAIL-MSGID: =?utf-8?q?1597400099827149153?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 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"); }