Received: by 10.223.176.46 with SMTP id f43csp516507wra; Fri, 26 Jan 2018 02:35:35 -0800 (PST) X-Google-Smtp-Source: AH8x2266ObpNoaauaktP2e96xEgUnR7JU0KwD0SVzUaXbUW3YJWQApzPelDJS+4k1f9M3oAx9ENs X-Received: by 2002:a17:902:6a81:: with SMTP id n1-v6mr14211653plk.11.1516962934942; Fri, 26 Jan 2018 02:35:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516962934; cv=none; d=google.com; s=arc-20160816; b=woB8dXh3oES8JWKkEI+JII5Vx1gs0gEYiC2FAHDKR2VIIhyCFmLyAsN+OcLrsFCRox orAtk+o3YE5zEk99QBEccNMOWvW02F38u/7OfEzjCCuax/0j+qDhLqhte4OB9IfafFkk rZKxEv6FhkCzir38LX7ZL6jNbBSPSMTMLYG+57HE7x9jeNjgS/o7XV7jw0FVmURQS3OQ WFynd7GWSKbCPVFffELWU1LW9Bq+aKowEbKb29I6gs6bfQ5xv3Ap2nu0UBJg3cvU1Hkk R83S0nKLLDZOxv0MBR3V8ytnEKAPgtb+uEEVw6ZV2wvn8az78ySIgbhUIbi6JKGEL0FI M6bQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Wkux3kD7DthgVL1cikPTaoRef42dHhN7OKYD5PQAckw=; b=yrVDcBmTbZl42Y/JqgEBKch6Cf+QQa/euVd9prp7JMJk+nlKFIP7ESEzjwLpVW8xFl ibT4c5GRrHhSgOsvDCUsyRRWF2J5ta4ZtosTfzRIRCzGtGTupSNGhdsLmMc7Kn1HkfKW 0WyeuTOpkiF3C0FD3aSg29t6/sPm4BSCYILTO2o/xFi7UxdtWNPi4c4xdliOP3MF9x+5 NSdYYqFhZ5Bfz1spKPGXSbUR6S80JuMalvwjwvDdiy7+pvTxE4lYR3ojCyNHw0SZ0LrS yV6DHFNVJ8oNrV8jyPlLhFSbF01unC/qx5fFb4iu/Dpfs8uYAhh5Mou0FOInHV6uCnE7 49zg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p6si2820375pgd.282.2018.01.26.02.35.20; Fri, 26 Jan 2018 02:35:34 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753134AbeAZKey (ORCPT + 99 others); Fri, 26 Jan 2018 05:34:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38364 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752079AbeAZKex (ORCPT ); Fri, 26 Jan 2018 05:34:53 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 32F5DC065F69; Fri, 26 Jan 2018 10:34:53 +0000 (UTC) Received: from holly.brq.redhat.com (unknown [10.43.2.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id C95FD7FB8F; Fri, 26 Jan 2018 10:34:51 +0000 (UTC) From: Petr Oros To: bp@alien8.de Cc: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] x86/microcode/intel: print previous microcode revision during early update Date: Fri, 26 Jan 2018 11:34:50 +0100 Message-Id: <20180126103451.16863-1-poros@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 26 Jan 2018 10:34:53 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When kernel do early microcode update, code printing only new microcode version. But in this case we no have chance to check which version was in cpu from BIOS vendor. Patch add this info into output message. Signed-off-by: Petr Oros --- arch/x86/kernel/cpu/microcode/intel.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c index d9e460fc7a3b..78330d29cd4c 100644 --- a/arch/x86/kernel/cpu/microcode/intel.c +++ b/arch/x86/kernel/cpu/microcode/intel.c @@ -515,9 +515,11 @@ static bool load_builtin_intel_microcode(struct cpio_data *cp) * Print ucode update info. */ static void -print_ucode_info(struct ucode_cpu_info *uci, unsigned int date) +print_ucode_info(struct ucode_cpu_info *uci, unsigned int date, + unsigned int prev_rev) { - pr_info_once("microcode updated early to revision 0x%x, date = %04x-%02x-%02x\n", + pr_info_once("microcode updated early from revision 0x%x to 0x%x, date = %04x-%02x-%02x\n", + prev_rev, uci->cpu_sig.rev, date & 0xffff, date >> 24, @@ -528,6 +530,7 @@ print_ucode_info(struct ucode_cpu_info *uci, unsigned int date) static int delay_ucode_info; static int current_mc_date; +static int prev_revision; /* * Print early updated ucode info after printk works. This is delayed info dump. @@ -538,7 +541,7 @@ void show_ucode_info_early(void) if (delay_ucode_info) { collect_cpu_info_early(&uci); - print_ucode_info(&uci, current_mc_date); + print_ucode_info(&uci, current_mc_date, prev_revision); delay_ucode_info = 0; } } @@ -547,11 +550,12 @@ void show_ucode_info_early(void) * At this point, we can not call printk() yet. Delay printing microcode info in * show_ucode_info_early() until printk() works. */ -static void print_ucode(struct ucode_cpu_info *uci) +static void print_ucode(struct ucode_cpu_info *uci, unsigned int prev_rev) { struct microcode_intel *mc; int *delay_ucode_info_p; int *current_mc_date_p; + int *prev_revision_p; mc = uci->mc; if (!mc) @@ -559,13 +563,16 @@ static void print_ucode(struct ucode_cpu_info *uci) delay_ucode_info_p = (int *)__pa_nodebug(&delay_ucode_info); current_mc_date_p = (int *)__pa_nodebug(¤t_mc_date); + prev_revision_p = (int *)__pa_nodebug(&prev_revision); *delay_ucode_info_p = 1; *current_mc_date_p = mc->hdr.date; + *prev_revision_p = prev_rev; } #else -static inline void print_ucode(struct ucode_cpu_info *uci) +static inline void print_ucode(struct ucode_cpu_info *uci, + unsigned int prev_rev) { struct microcode_intel *mc; @@ -573,19 +580,21 @@ static inline void print_ucode(struct ucode_cpu_info *uci) if (!mc) return; - print_ucode_info(uci, mc->hdr.date); + print_ucode_info(uci, mc->hdr.date, prev_rev); } #endif static int apply_microcode_early(struct ucode_cpu_info *uci, bool early) { struct microcode_intel *mc; - u32 rev; + u32 rev, prev_rev; mc = uci->mc; if (!mc) return 0; + prev_rev = intel_get_microcode_revision(); + /* write microcode via MSR 0x79 */ native_wrmsrl(MSR_IA32_UCODE_WRITE, (unsigned long)mc->bits); @@ -596,9 +605,9 @@ static int apply_microcode_early(struct ucode_cpu_info *uci, bool early) uci->cpu_sig.rev = rev; if (early) - print_ucode(uci); + print_ucode(uci, prev_rev); else - print_ucode_info(uci, mc->hdr.date); + print_ucode_info(uci, mc->hdr.date, prev_rev); return 0; } -- 2.16.1