From nobody Fri Dec 19 03:45:00 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43887C001B0 for ; Sun, 13 Aug 2023 17:26:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231453AbjHMR0i (ORCPT ); Sun, 13 Aug 2023 13:26:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230519AbjHMR0c (ORCPT ); Sun, 13 Aug 2023 13:26:32 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F24310DD; Sun, 13 Aug 2023 10:26:34 -0700 (PDT) Date: Sun, 13 Aug 2023 17:26:32 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1691947592; 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=A8LGehJNTJbownToq2PBq86XXUmUG/UNqrjBht0bAvk=; b=lN+KfnS1ECrF2z/N/NTjHmgE4wUI4GuaNFA9xnOOB2c8ofmbvWVPZGtIvcfi5Eik0eD1wN mipQPAd0o7VT1+0OPzJPaaQVsj2cCNyXOltv/sKYZhvgvKtpW0yNy0vQ52Bv5rG+2SGG3d qxueYQvEPReKbTvo4PRekcfOuXiJBQEGikCQ2AM4Zt80ETiU0YkVABN03v2k7XH9LAjOMh rA7380amp0luZQevxSNBD3au9hHiwnRJpPe88cW7p5yv4Bjzqjui1izQvFGkoVfEqK/KuN CPJlcID/LdbGY9AUf5Zoq0RoQ6wWrr3r4CuZf+r13BW0ckbUIr/QN00ce2xMvg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1691947592; 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=A8LGehJNTJbownToq2PBq86XXUmUG/UNqrjBht0bAvk=; b=bx3E2F5KzHyQUzlkZGZDcFtxmyzy2+FPhghaJp0oPN9ndKaIxdr68rITAglGFwRhEzqZYC BUhKu6Hbejnmf/CQ== 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: Rename get_datasize() since its used externally Cc: Boris Petkov , Ashok Raj , Thomas Gleixner , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230812195727.894165745@linutronix.de> References: <20230812195727.894165745@linutronix.de> MIME-Version: 1.0 Message-ID: <169194759234.27769.9182026169292220932.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the x86/microcode branch of tip: Commit-ID: b0e67db12d769cc308a50c1c0ac3721c4f6aead7 Gitweb: https://git.kernel.org/tip/b0e67db12d769cc308a50c1c0ac3721c4= f6aead7 Author: Ashok Raj AuthorDate: Sat, 12 Aug 2023 21:58:45 +02:00 Committer: Borislav Petkov (AMD) CommitterDate: Sun, 13 Aug 2023 18:42:55 +02:00 x86/microcode/intel: Rename get_datasize() since its used externally Rename get_datasize() to intel_microcode_get_datasize() and make it an inli= ne. [ tglx: Make the argument typed and fix up the IFS code ] Suggested-by: Boris Petkov Signed-off-by: Ashok Raj Signed-off-by: Thomas Gleixner Signed-off-by: Borislav Petkov (AMD) Link: https://lore.kernel.org/r/20230812195727.894165745@linutronix.de --- arch/x86/include/asm/microcode_intel.h | 7 ++++--- arch/x86/kernel/cpu/microcode/intel.c | 8 ++++---- drivers/platform/x86/intel/ifs/load.c | 5 +++-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/arch/x86/include/asm/microcode_intel.h b/arch/x86/include/asm/= microcode_intel.h index 9951a4b..7bd4c29 100644 --- a/arch/x86/include/asm/microcode_intel.h +++ b/arch/x86/include/asm/microcode_intel.h @@ -26,9 +26,10 @@ struct microcode_intel { #define MC_HEADER_TYPE_IFS 2 #define DEFAULT_UCODE_DATASIZE (2000) =20 -#define get_datasize(mc) \ - (((struct microcode_intel *)mc)->hdr.datasize ? \ - ((struct microcode_intel *)mc)->hdr.datasize : DEFAULT_UCODE_DATASIZE) +static inline int intel_microcode_get_datasize(struct microcode_header_int= el *hdr) +{ + return hdr->datasize ? : DEFAULT_UCODE_DATASIZE; +} =20 static inline u32 intel_get_microcode_revision(void) { diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/mi= crocode/intel.c index 171d96b..9866672 100644 --- a/arch/x86/kernel/cpu/microcode/intel.c +++ b/arch/x86/kernel/cpu/microcode/intel.c @@ -118,10 +118,10 @@ int intel_find_matching_signature(void *mc, unsigned = int csig, int cpf) return 1; =20 /* Look for ext. headers: */ - if (get_totalsize(mc_hdr) <=3D get_datasize(mc_hdr) + MC_HEADER_SIZE) + if (get_totalsize(mc_hdr) <=3D intel_microcode_get_datasize(mc_hdr) + MC_= HEADER_SIZE) return 0; =20 - ext_hdr =3D mc + get_datasize(mc_hdr) + MC_HEADER_SIZE; + ext_hdr =3D mc + intel_microcode_get_datasize(mc_hdr) + MC_HEADER_SIZE; ext_sig =3D (void *)ext_hdr + EXT_HEADER_SIZE; =20 for (i =3D 0; i < ext_hdr->count; i++) { @@ -156,7 +156,7 @@ int intel_microcode_sanity_check(void *mc, bool print_e= rr, int hdr_type) struct extended_signature *ext_sig; =20 total_size =3D get_totalsize(mc_header); - data_size =3D get_datasize(mc_header); + data_size =3D intel_microcode_get_datasize(mc_header); =20 if (data_size + MC_HEADER_SIZE > total_size) { if (print_err) @@ -438,7 +438,7 @@ static void show_saved_mc(void) date =3D mc_saved_header->date; =20 total_size =3D get_totalsize(mc_saved_header); - data_size =3D get_datasize(mc_saved_header); + data_size =3D intel_microcode_get_datasize(mc_saved_header); =20 pr_debug("mc_saved[%d]: sig=3D0x%x, pf=3D0x%x, rev=3D0x%x, total size=3D= 0x%x, date =3D %04x-%02x-%02x\n", i++, sig, pf, rev, total_size, diff --git a/drivers/platform/x86/intel/ifs/load.c b/drivers/platform/x86/i= ntel/ifs/load.c index 390862a..cefd0d8 100644 --- a/drivers/platform/x86/intel/ifs/load.c +++ b/drivers/platform/x86/intel/ifs/load.c @@ -56,12 +56,13 @@ struct metadata_header { =20 static struct metadata_header *find_meta_data(void *ucode, unsigned int me= ta_type) { + struct microcode_header_intel *hdr =3D &((struct microcode_intel *)ucode)= ->hdr; struct metadata_header *meta_header; unsigned long data_size, total_meta; unsigned long meta_size =3D 0; =20 - data_size =3D get_datasize(ucode); - total_meta =3D ((struct microcode_intel *)ucode)->hdr.metasize; + data_size =3D intel_microcode_get_datasize(hdr); + total_meta =3D hdr->metasize; if (!total_meta) return NULL;