Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1390155rdh; Mon, 25 Sep 2023 11:11:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE6qxEk0tPaOnWxbkThyDUKpGUoy8nXdsL+Nr4pePtY+rbQrHocz8O3BilqETwGu9/2xchT X-Received: by 2002:a05:6e02:1a4b:b0:34c:e16d:6793 with SMTP id u11-20020a056e021a4b00b0034ce16d6793mr9831389ilv.14.1695665515990; Mon, 25 Sep 2023 11:11:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695665515; cv=none; d=google.com; s=arc-20160816; b=QQS/xhxjnVUkvKq2SefrNUTM5ZKZ+ybwqwBQDg7NK0bgTSzGY4+h8yDxcFc8FRytv3 nLnuU0+p2KUzT4U2KVHxdBXCjhmy8fJICHcZULF6VIgxS/F/A+jiyXdFuyye+c0S9Ct3 I0tt4Qo7LA0P+mU3qwBCnFMq/PvExEs6+cF3LIqZdeyCJlN5f708nMz61QX7BORPjUY/ PPss192e81qQRJqYfjCUu9IJGSXHw2MZuyfnAQ41dD1g6MXMGAM9Myb29cXNM6dhtoq7 sXitn4wFlO+9IQ3xvd/fr+eIaz79d6i79WtwUz4dJ61+b2KysqXsfyQZRnDwrAuGGhLJ 1JJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=RwZVrX+YKm6Hs+Mot2lZbwnUhw1O1K3T88yPkHesW+8=; fh=Zx4D0zGMBj+9/N7d/Db2W7/hRmbrTS1pGT/B3fLoF6s=; b=OqJV88PcVpTkzqiL7YuXyIdm5/n1H7qZTc8S6r2ie17oEFOYCLBwQ1mLL9MQRU/5yF LpYZ55CNScJsa3tBNFbhPClcSLfcjHwGCeupwQQtZwdaYcnTxQtDmly95gf8wVGQ2kp8 9YN4H9j/ueypDwTSfBZRvNYpoPgrRe9BEDyObegOqP4s9l1StpABoYOK43ZYZBrjdpv3 gbLuTXHnUe5+EYZ4aYavjUwnqoNIsICppsPUi6odnWHFbpxWgKgCPZXTj3P46ziMJZGm OIjZU5Ox98VFe0r1N3cdPBjc4gzJgTiIlahmcedBrDSnY/jlxrr6Gpmxd5v8+n6ukhJM 8vAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=f5terSgm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id g185-20020a636bc2000000b00565eb0b2e66si10334017pgc.864.2023.09.25.11.11.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 11:11:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=f5terSgm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id D0DB0806E1D3; Mon, 25 Sep 2023 08:21:19 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232603AbjIYPVS (ORCPT + 99 others); Mon, 25 Sep 2023 11:21:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231577AbjIYPVQ (ORCPT ); Mon, 25 Sep 2023 11:21:16 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62D6D101; Mon, 25 Sep 2023 08:21:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695655269; x=1727191269; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=+dPD40sRFrtUd5JAcB/1MYn442cJfUxBOmEFl6kxeFU=; b=f5terSgmmJrvKDTFdZtNO5gCBPfDjktcCyVXqIEWDlgEL/bDxeZ2C4or 75e1xNAhm25ihn71Wp1eoKDUxR9jVf0GAkGTQxP9HY/64wfVyMuYx3eiW opOafg1zB/VeuM36Xn8/pvTj6Yekc3q6P17kCyZaWmRA97xWSZF2d3jJj q15Inot26WaBIPuhivDGscbe9eDqZNQ37D8gcdbOtHA+YATWZa63JjA4K jKRXbcdjP2OngjKvfc92fwvQKKYDFNFzYrc2H+6j0y5fRVEJunhr83kcj 8CSbIG7VsErUxE3YpPmJhvrLwpe2kiQhR9EZP5fxmkYsZpdff/PLKRvm5 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10843"; a="371599287" X-IronPort-AV: E=Sophos;i="6.03,175,1694761200"; d="scan'208";a="371599287" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Sep 2023 08:21:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10843"; a="814011272" X-IronPort-AV: E=Sophos;i="6.03,175,1694761200"; d="scan'208";a="814011272" Received: from stamengx-mobl1.ger.corp.intel.com ([10.249.32.149]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Sep 2023 08:20:54 -0700 Date: Mon, 25 Sep 2023 18:20:51 +0300 (EEST) From: =?ISO-8859-15?Q?Ilpo_J=E4rvinen?= To: Jithu Joseph cc: Hans de Goede , markgross@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, rostedt@goodmis.org, ashok.raj@intel.com, tony.luck@intel.com, LKML , platform-driver-x86@vger.kernel.org, patches@lists.linux.dev, ravi.v.shankar@intel.com, pengfei.xu@intel.com Subject: Re: [PATCH v2 2/9] platform/x86/intel/ifs: Refactor image loading code In-Reply-To: <20230922232606.1928026-3-jithu.joseph@intel.com> Message-ID: <61944596-ce90-f883-2f6e-c372a42459c2@linux.intel.com> References: <20230913183348.1349409-1-jithu.joseph@intel.com> <20230922232606.1928026-1-jithu.joseph@intel.com> <20230922232606.1928026-3-jithu.joseph@intel.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-1473190008-1695655259=:2147" X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Mon, 25 Sep 2023 08:21:20 -0700 (PDT) This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-1473190008-1695655259=:2147 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 8BIT On Fri, 22 Sep 2023, Jithu Joseph wrote: > IFS image loading flow is slightly different for newer IFS generations. > > In preparation for adding support for newer IFS generations, refactor > portions of existing image loading code for reuse. > > Signed-off-by: Jithu Joseph > Reviewed-by: Tony Luck > Tested-by: Pengfei Xu > --- > drivers/platform/x86/intel/ifs/load.c | 31 ++++++++++++++++----------- > 1 file changed, 19 insertions(+), 12 deletions(-) > > diff --git a/drivers/platform/x86/intel/ifs/load.c b/drivers/platform/x86/intel/ifs/load.c > index cefd0d886cfd..851c97cc6a6b 100644 > --- a/drivers/platform/x86/intel/ifs/load.c > +++ b/drivers/platform/x86/intel/ifs/load.c > @@ -80,6 +80,23 @@ static struct metadata_header *find_meta_data(void *ucode, unsigned int meta_typ > return NULL; > } > > +static void hashcopy_err_message(struct device *dev, u32 err_code) > +{ > + if (err_code >= ARRAY_SIZE(scan_hash_status)) > + dev_err(dev, "invalid error code 0x%x for hash copy\n", err_code); > + else > + dev_err(dev, "Hash copy error : %s\n", scan_hash_status[err_code]); > +} > + > +static void auth_err_message(struct device *dev, u32 err_code) > +{ > + if (err_code >= ARRAY_SIZE(scan_authentication_status)) > + dev_err(dev, "invalid error code 0x%x for authentication\n", err_code); > + else > + dev_err(dev, "Chunk authentication error : %s\n", > + scan_authentication_status[err_code]); > +} > + > /* > * To copy scan hashes and authenticate test chunks, the initiating cpu must point > * to the EDX:EAX to the test image in linear address. > @@ -109,11 +126,7 @@ static void copy_hashes_authenticate_chunks(struct work_struct *work) > > if (!hashes_status.valid) { > ifsd->loading_error = true; > - if (err_code >= ARRAY_SIZE(scan_hash_status)) { > - dev_err(dev, "invalid error code 0x%x for hash copy\n", err_code); > - goto done; > - } > - dev_err(dev, "Hash copy error : %s", scan_hash_status[err_code]); > + hashcopy_err_message(dev, err_code); > goto done; > } > > @@ -133,13 +146,7 @@ static void copy_hashes_authenticate_chunks(struct work_struct *work) > > if (err_code) { > ifsd->loading_error = true; > - if (err_code >= ARRAY_SIZE(scan_authentication_status)) { > - dev_err(dev, > - "invalid error code 0x%x for authentication\n", err_code); > - goto done; > - } > - dev_err(dev, "Chunk authentication error %s\n", > - scan_authentication_status[err_code]); > + auth_err_message(dev, err_code); > goto done; > } > } > Reviewed-by: Ilpo J?rvinen -- i. --8323329-1473190008-1695655259=:2147--