From patchwork Sat Jan 21 14:54:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 46830 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp755465wrn; Sat, 21 Jan 2023 06:59:45 -0800 (PST) X-Google-Smtp-Source: AMrXdXu5vOm1j8ZmyD4JjsKgppLWKyyDK2bwzCXNC5ORu5re0emlqplwpT9v4FuASEMI/DVhqVxF X-Received: by 2002:a05:6402:4d5:b0:49d:a60f:7827 with SMTP id n21-20020a05640204d500b0049da60f7827mr19411604edw.6.1674313185208; Sat, 21 Jan 2023 06:59:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674313185; cv=none; d=google.com; s=arc-20160816; b=qAaD42MYTh72xBXun66rkrsYx69Ige5dCbYZG7LBgAth5lW0RV8GopD+8TiWLHk7lA Zf2nhupmes3Ug1L8ZTw0DCVd2T3vI5tW6ThVr7mmPQBBSu4PnE3IPqPJHP0U5ifETtVJ tGK13IRcf6U3tqYV6BmDp/z+Z3/vMQvVjqJEl0Dp/aai2NYbt5SJgCwlx+PCViyJSUa4 6jYlzJBAqkzo4YNQC9u4l+8McQ2LjiM/kCrL6Vpmcdea61LQQ9+KMW+zdJjUsqlzHVnw GAhjmwmxf4efnpfw1A3KjXy5MqreA728nZrlIOKCUkzgcF3JI8bZOmgXOMv1YD+ngNPF jV0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=tWBKl1UuzhL2R2rSpoOl8gKRWg72KzOBUffsfHCo8OQ=; b=o1ICXDLEpJ+y467bdROtTRmjoRpLnK0mOE67R8bISqo/9mag83YFeiE+pndkhwBOOH 8WBmdNi7dkmwneJDJs32NjP4oiad4Td6EGDN0YInxbX6qHtTvmSzNR3cr899xgZwIfdW UNndw4u0rI5xccqsP9iRAskUDSMpxIdfb4NbYnLFx1EgzmGSLgbR4ABVx68PZFotIM+q 5BqJzbjfUNnHm7410KpvEOy+N2BczEvEb5k6wve6DRDyeQaSNPVTQ4Vr7+hB/0VH79NM nVv/1dkza7c3lLg/f+mnnQMUiazgarlvfxgzpQxOkFODgNZi+iNSlTseZi7jNir1QY2N 2WwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=pRAoVIJR; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ey7-20020a0564022a0700b0049216736fd2si17293834edb.542.2023.01.21.06.59.22; Sat, 21 Jan 2023 06:59:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=pRAoVIJR; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229947AbjAUOyn (ORCPT + 99 others); Sat, 21 Jan 2023 09:54:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229752AbjAUOyc (ORCPT ); Sat, 21 Jan 2023 09:54:32 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8E4B1C33E; Sat, 21 Jan 2023 06:54:30 -0800 (PST) Date: Sat, 21 Jan 2023 14:54:27 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1674312868; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tWBKl1UuzhL2R2rSpoOl8gKRWg72KzOBUffsfHCo8OQ=; b=pRAoVIJRbnaVp0+IjX120L6dNcQTjkKqjkpdllbkxqu47PgRDTNF50OdwzSOTb5gniqWvE JrhpD3bGE3kf0J2QpUqp9jgS3GVTv2Bl/SO+UK0fTS63DvPZNCxSM8Icff53IDvIU4KljK foyaFmlufjNX4oVn9CltpJcLxfrYS1DpoODkKB9FZdDd5wDaCvbbUOBnc4a3UOND3MQHtS pGk3lhWZ860VbU3LrIlm4sM+2D5sRabHGateIWk7kgzKmuwGB4pFrrr0+0djcC/cM8K5yQ FaT7YUllutMMOpfrYeI/7tB592Jgg3YrpvCSEaCs4tsoE/l1LAhKzQhuWyDEeQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1674312868; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tWBKl1UuzhL2R2rSpoOl8gKRWg72KzOBUffsfHCo8OQ=; b=ENc9qjHRPxGXuBPsdzXtfLnj0DtlKGT6Rb6ydPPCYJ9Cx2nDwnlUszRuA9hoqMgkaicBhb FAVWRALWyPDRAqAA== From: "tip-bot2 for Ashok Raj" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/microcode] x86/microcode/intel: Pass the microcode revision to print_ucode_info() directly Cc: Ashok Raj , "Borislav Petkov (AMD)" , Thomas Gleixner , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230120161923.118882-5-ashok.raj@intel.com> References: <20230120161923.118882-5-ashok.raj@intel.com> MIME-Version: 1.0 Message-ID: <167431286787.4906.11043739743543659187.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755644622317786587?= X-GMAIL-MSGID: =?utf-8?q?1755644622317786587?= The following commit has been merged into the x86/microcode branch of tip: Commit-ID: 174f1b909ab0984e5369a634971fb14a618ca797 Gitweb: https://git.kernel.org/tip/174f1b909ab0984e5369a634971fb14a618ca797 Author: Ashok Raj AuthorDate: Mon, 09 Jan 2023 07:35:53 -08:00 Committer: Borislav Petkov (AMD) CommitterDate: Sat, 21 Jan 2023 14:55:20 +01:00 x86/microcode/intel: Pass the microcode revision to print_ucode_info() directly print_ucode_info() takes a struct ucode_cpu_info pointer as parameter. Its sole purpose is to print the microcode revision. The only available ucode_cpu_info always describes the currently loaded microcode revision. After a microcode update is successful, this is the new revision, or on failure it is the original revision. In preparation for future changes, replace the struct ucode_cpu_info pointer parameter with a plain integer which contains the revision number and adjust the call sites accordingly. No functional change. [ bp: - Fix + cleanup commit message. - Revert arbitrary, unrelated change. ] Signed-off-by: Ashok Raj Signed-off-by: Borislav Petkov (AMD) Reviewed-by: Thomas Gleixner Link: https://lore.kernel.org/r/20230120161923.118882-5-ashok.raj@intel.com --- arch/x86/kernel/cpu/microcode/intel.c | 30 +++++++------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c index cac2bdb..9dbd007 100644 --- a/arch/x86/kernel/cpu/microcode/intel.c +++ b/arch/x86/kernel/cpu/microcode/intel.c @@ -308,11 +308,10 @@ 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) +static void print_ucode_info(unsigned int new_rev, unsigned int date) { pr_info_once("microcode updated early to revision 0x%x, date = %04x-%02x-%02x\n", - uci->cpu_sig.rev, + new_rev, date & 0xffff, date >> 24, (date >> 16) & 0xff); @@ -332,7 +331,7 @@ void show_ucode_info_early(void) if (delay_ucode_info) { intel_cpu_collect_info(&uci); - print_ucode_info(&uci, current_mc_date); + print_ucode_info(uci.cpu_sig.rev, current_mc_date); delay_ucode_info = 0; } } @@ -341,33 +340,22 @@ 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(int new_rev, int date) { - struct microcode_intel *mc; int *delay_ucode_info_p; int *current_mc_date_p; - mc = uci->mc; - if (!mc) - return; - delay_ucode_info_p = (int *)__pa_nodebug(&delay_ucode_info); current_mc_date_p = (int *)__pa_nodebug(¤t_mc_date); *delay_ucode_info_p = 1; - *current_mc_date_p = mc->hdr.date; + *current_mc_date_p = date; } #else -static inline void print_ucode(struct ucode_cpu_info *uci) +static inline void print_ucode(int new_rev, int date) { - struct microcode_intel *mc; - - mc = uci->mc; - if (!mc) - return; - - print_ucode_info(uci, mc->hdr.date); + print_ucode_info(new_rev, date); } #endif @@ -407,9 +395,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->cpu_sig.rev, mc->hdr.date); else - print_ucode_info(uci, mc->hdr.date); + print_ucode_info(uci->cpu_sig.rev, mc->hdr.date); return 0; }