Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp3586644rwl; Tue, 27 Dec 2022 11:28:36 -0800 (PST) X-Google-Smtp-Source: AMrXdXsOxG5NGBwqXSPztKg69QCS7tHQ6el9b5aOlCmIXNsv83h4qOJbgAuoTSSoJDmZu04joksL X-Received: by 2002:a17:902:d18c:b0:189:66dc:4af5 with SMTP id m12-20020a170902d18c00b0018966dc4af5mr22533466plb.13.1672169316101; Tue, 27 Dec 2022 11:28:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672169316; cv=none; d=google.com; s=arc-20160816; b=ON0blTYYHCaEAF74zaWPL4/wH2aAvU+1HqVcsUiG40JlYykxgeYPNSNDvYW6giKpjs lN/MiJNgnTdMF8tMjlgeT611vMgIumnEK4kCv8LVKgVMwZQHxpghEuOSPbfD4En8ltHY S+kqD17MHpUZjcLDfUxV61PUqRCNXpxOaWUtuTVzE4h4QbLAcQUqbI3tA/ylATR0zea4 NQownYZICQZsXJ4hnWPOvnOTI0bzywmwg5t2nNngAQoUvwWo+x3ylUFWGmhbjZtIdxmT DoHNb9QLl0udCHACIjLDN6vmxDJe2SauJtaeBXUi6xmVA1tL2Dl+uVw7UB4F7q8i6lcH VB0w== 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=Wj9SnnoW3+QUsrElLaCSEx+KtaocMDLeXkG5A6cBpZI=; b=0p4+DMu5QIBXVaC2BXE5Pp1ZXWtce09NP52B5i7axHpQVVxOu14dYeNSSGqf2SuJyD rugiD2w1I+x7pIEfCzAcqBCyqWstMVJ4Mzb1f4rNfkWKHzNwL3ZXJUa+ySFAE4gnypld qvwf/JpEhzNPFnYa3P9vWGva6JQmPoCBgR+Ms+fnhLqovouB/SjjRR3y1cb52UX8f/dO dKGp1HJ1dK0Sfx7U3tK4EqC2ljD/g5JWrLSvQJ2OHQRt5a/Yw9nlZfIs0R0qufayb0eR +OnVb/R45o/mlLSWRB93MlQBH1iC9Zp8w9H61dqceHLzc/RvCIbJYvqiLLv/fZKUDFrL AiUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=VvADsats; 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 e7-20020a17090301c700b00186a4763532si16029098plh.28.2022.12.27.11.28.26; Tue, 27 Dec 2022 11:28:36 -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=VvADsats; 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 S231468AbiL0TY0 (ORCPT + 66 others); Tue, 27 Dec 2022 14:24:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230475AbiL0TX5 (ORCPT ); Tue, 27 Dec 2022 14:23:57 -0500 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CBF5D4C for ; Tue, 27 Dec 2022 11:23:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1672169037; x=1703705037; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lzIse4ZWwsUKwU2q15GNya0zg7eYgzn0naky1H7IqGc=; b=VvADsatsO0DSVDGTQ1c6Ag448IxZWYu+ued11wSh4qteom7PAxpCW9cJ HTlVZyQezER5TOKJ6+kz3DspNLBbpk2syr9AoQA1vfAzywJBRcnxKCiSP uFSxsFzuAGJTBEFNPjyjoBBdqhHr/opDlzLKnmgOJnn1DDRGg4KVMq/wJ YY4FXC/MUNxgRe0zCrOtm5VJna8MnMuVBLZlzucCKhtVw+e8SjP2K8//P sRTnTsQHVKYHFUdRJwxsA/2m/bSFBAaCypU0QIo9MHYhKLn2SZ2Vrm8yG NLW/xKVbf1fXOG9dAvYsNosvNsJ6v11AdSWz7gWl1zh6BfgMqHYDSSbnp w==; X-IronPort-AV: E=McAfee;i="6500,9779,10573"; a="407011180" X-IronPort-AV: E=Sophos;i="5.96,279,1665471600"; d="scan'208";a="407011180" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2022 11:23:55 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10573"; a="777234201" X-IronPort-AV: E=Sophos;i="5.96,279,1665471600"; d="scan'208";a="777234201" Received: from araj-ucode.jf.intel.com ([10.23.0.19]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Dec 2022 11:23:54 -0800 From: Ashok Raj To: Borislav Petkov , Thomas Gleixner Cc: X86-kernel , LKML Mailing List , Ashok Raj , Dave Hansen , Tony Luck , Alison Schofield , Reinette Chatre , Tom Lendacky Subject: [PATCH v2 4/6] x86/microcode/intel: Use a plain revision argument for print_ucode_rev() Date: Tue, 27 Dec 2022 11:23:38 -0800 Message-Id: <20221227192340.8358-5-ashok.raj@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221227192340.8358-1-ashok.raj@intel.com> References: <20221227192340.8358-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 --- Changes since earlier post. 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