Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp6388911rwl; Mon, 9 Jan 2023 07:47:02 -0800 (PST) X-Google-Smtp-Source: AMrXdXs/haSjckX3B7wq5vxiXJoy6vXWvzTDRhS+G2eTHWlrb7UNfLY7TP1lT/FeEsdbDk13j12I X-Received: by 2002:a05:6a20:2d0d:b0:a3:f233:c35 with SMTP id g13-20020a056a202d0d00b000a3f2330c35mr83542001pzl.52.1673279222692; Mon, 09 Jan 2023 07:47:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673279222; cv=none; d=google.com; s=arc-20160816; b=aJMUsUQQF4tHsAUK6O4xeLxeedbEnhsOx+L4WJsS3g6PtM/4LTE4PkTYF+H3DuVPeb H/G08v/ljZCeJvwH3iAwqk1ZB2PYxLBfeE1IG/db/b2MbjZCxhy8Rs7jMt0qoFZ0HHHE iLjv6ooS7a2+E6hPxhue21GQd73nw6SqyRwCcRG+nNXft8iLhnmcQDDp1XXHG8TuaFMc qgsUX9JswwudrjkotDN0HKxszvDXPyboNSyhOi8BPesXVmgP217W/81k68hmLKGiXJqL 97r36BB/wyq3Y7hQpJ/Y7nZHCGhHjlwACkGWJsd3zhSbpIvS4vh0RvFakxV/tFEHXhUd Tf6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Ra0ZaVmG0Wyj0ekifRhvCmyW/jBQvzdl1nEyulH6RAU=; b=bcE4j4hzGlvhYmhy+Lea1EHTnP19GW7cnkIxZdYJaSYaJexwBGYZA4FgDxTHsix8P7 KeFDacRjS5PCVFxGZ82ZcGvnymaLPn0w3T5m+H3cR3/lGXayfvGVGeAaeuGlyRZubAj5 8He18b22zdh47QY7xtOIMRjdzo89aAatyrLu6QZT6y6oAe3AFkEZTkei6vlE9AgPdBnR 5IcJYFjrhedBzynX955Ox5rooNFKrJQsWjlS7q6R5kOD09y/jJhXZvOE/w1wJaetaZl5 uBBjZFzlGmIDPpaOD5F0uhDmKP4OjfKpn3SKJto/WagnSrmyWygIOTrVpj3MisYXicjR VGjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=UklwSdFW; 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=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j72-20020a638b4b000000b004b2f01f4c46si4127066pge.27.2023.01.09.07.46.56; Mon, 09 Jan 2023 07:47:02 -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=@intel.com header.s=Intel header.b=UklwSdFW; 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=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235031AbjAIPlF (ORCPT + 53 others); Mon, 9 Jan 2023 10:41:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237273AbjAIPkS (ORCPT ); Mon, 9 Jan 2023 10:40:18 -0500 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCF0C40C18 for ; Mon, 9 Jan 2023 07:36:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673278578; x=1704814578; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=oyjz6XJwnWS6TtsCd6s9DEyvm+PHR2WDUT1F7iZ6FqM=; b=UklwSdFWE8e8lGt6XHSRo/YZ6RGdRgVP8qLKeqzDv7hkfP+eIeDdUNSe 1dHe04NLldtZIaqfs8VPpxlaPx9xzSX9ZcDi+21dRCZVm0ck3SuXLTy69 kKr5bidWpgN4ZrVNJWobHHUOEmuPy3I89lHEGLMV58D+bjvmj/5lpZ5Yx PTivUlxuWhhF8/ojcSgeQCNwcsrxhxpXNoZCyYIpjADPwEpKxC96pS2U+ h2T88zv/UEZ6l+jjDlcD09xhvVKaa+RVqxFVHRuWMPgbZQqxWyrRX9rT/ +rEyUx4epiC9grBQUawj5g8YfYAM3Olu1lw/Y7ScwkCtkYr6RKvtZuvgv A==; X-IronPort-AV: E=McAfee;i="6500,9779,10585"; a="385203578" X-IronPort-AV: E=Sophos;i="5.96,311,1665471600"; d="scan'208";a="385203578" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jan 2023 07:36:13 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10585"; a="902023890" X-IronPort-AV: E=Sophos;i="5.96,311,1665471600"; d="scan'208";a="902023890" Received: from araj-ucode.jf.intel.com ([10.23.0.19]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jan 2023 07:36:12 -0800 From: Ashok Raj To: Borislav Petkov , Thomas Gleixner Cc: X86-kernel , LKML Mailing List , Ashok Raj , Dave Hansen , Tony Luck , Ingo Molnar , alison.schofield@intel.com, reinette.chatre@intel.com, Tom Lendacky Subject: [PATCH v4 4/6] x86/microcode/intel: Use a plain revision argument for print_ucode_rev() Date: Mon, 9 Jan 2023 07:35:53 -0800 Message-Id: <20230109153555.4986-5-ashok.raj@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230109153555.4986-1-ashok.raj@intel.com> References: <20230109153555.4986-1-ashok.raj@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE 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 print_ucode_rev() takes a struct ucode_cpu_info argument. The sole purpose of it 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. Subsequent changes need to print both the original and new revision, but the original version will be cached in a plain integer, which makes the code inconsistent. Replace the struct ucode_cpu_info argument with a plain integer which contains the revision number and adjust the call sites accordingly. No functional change. Signed-off-by: Ashok Raj Reviewed-by: Thomas Gleixner Cc: LKML Cc: x86 Cc: Tony Luck Cc: Dave Hansen Cc: Alison Schofield Cc: Reinette Chatre Cc: Thomas Gleixner Cc: Tom Lendacky Cc: Ingo Molnar --- Changes since V1: Thomas: - Updated commit log as suggested - Remove the line break after static void before print_ucode_info --- arch/x86/kernel/cpu/microcode/intel.c | 31 ++++++++------------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c index 6bebc46ad8b1..1d709b72cfd0 100644 --- a/arch/x86/kernel/cpu/microcode/intel.c +++ b/arch/x86/kernel/cpu/microcode/intel.c @@ -310,13 +310,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, - date & 0xffff, - date >> 24, + new_rev, date & 0xffff, date >> 24, (date >> 16) & 0xff); } @@ -334,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; } } @@ -343,33 +340,23 @@ 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 @@ -409,9 +396,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; } -- 2.34.1