From patchwork Fri Oct 21 20:34:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jithu Joseph X-Patchwork-Id: 6971 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp892770wrr; Fri, 21 Oct 2022 13:41:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4MQo4PzhSet2Qn7IBBToTLZUBZx6h1gBFvLGWbMnzyq8SUj3dfpwTs9Uyhij9yR8U0fX20 X-Received: by 2002:a63:2ad8:0:b0:46e:bb8e:b343 with SMTP id q207-20020a632ad8000000b0046ebb8eb343mr3769640pgq.408.1666384881566; Fri, 21 Oct 2022 13:41:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666384881; cv=none; d=google.com; s=arc-20160816; b=dC7AzrR6tmjwPXDIkaS2V84np9b/G20psORv0U2qDuEBan3QWY5mlr2zB2kwGQWrdw MX4BR/l8YFyrEsRrhNSq4k9iYJkVEbjtMDvEKXlh2mRNSAvmqs/xbXXIXYov2r7DRmYX Lip50+0GCPX/dhGHPDeYpoCA8OpNA2WY5G7Xlkxc2LdwowD9MYJY/+BWrL1Qh0EOETb9 iifVJqARAXo76z8edc3pnMThJ+vxXe7/AJEH3lvih2XhYMRF8uDi4AHp0a4wLVy9JMzZ O5fmoNnIdE6DVQRPT6pxV8pVsO1jPnCGk0+cZj0rEFaD6aluMzbGRy9Aq2x6H19rTW9Z b3vA== 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=31uAU7YNjIKG6BnCVQASAUaTB00nfFcytfkmuOHWxhk=; b=wVDV+73x0GFKWj2nr8zqP8TCzf9pCp7mI9k5EDWFEFCdIZ+HbVX6i34Qcx6pyTk0/6 6urK7bqxOy/OaQPnrzcDdgGbf9EwHknt32M3YAg2VtolQQP8YC7C46sxNYpUFLTl4YQm hTIeSkH1Bn+ASRllbuxgFRH9t3fa/wR2szDhcU6nU3+gfGjHVY0xUkGSDLvlTGrVFQto QVOtTCW/6u992B9cTyHEMskcz/UcJB6dvvHcEJcBFUO5w+fM7+JOGx74FdT0nXrkwa1T 6qvYGdm3cOS4QRn9Jy0zEf/0sVa2GiZgFOTNmE8fdSnC33/uiAxYZMhH0z2wq1/INlad jXOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=SXlAiayO; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 5-20020a621605000000b005631f695371si24223575pfw.127.2022.10.21.13.41.09; Fri, 21 Oct 2022 13:41:21 -0700 (PDT) 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=SXlAiayO; 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 S229886AbiJUUkB (ORCPT + 99 others); Fri, 21 Oct 2022 16:40:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229788AbiJUUjx (ORCPT ); Fri, 21 Oct 2022 16:39:53 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8947437E3; Fri, 21 Oct 2022 13:39:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666384792; x=1697920792; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=MHFgE7gyjINPZEVbivHQy+5kAf7Oj4xtRrBdTlwN9uw=; b=SXlAiayOqPcBeD8mNV8jkXe+LVJT2K5T0VEL64NrkvPgIZZ9645Uxtul l+Ao7LrIXCfk2fH6FK8iCUDiaTxPo89wHPBej+ZkD2/QID+Vt6lQRWQvS v3vKeN5sg79+rwicvwCUbG5OGr44Z1TkaANF1IlPB+xEpYvFniCODcXPM dBjiTIv9SlqyeTTschYAUFJyCtCZ54SLQ1hDMTH9FqST6Dh2VQsoSbmGA M8H8Eg2oWPFuLuPu3Sp82s22qhEka+M5plDQ/rpS3PxDL3rBQ6+VfKz+5 0yH7OJoJho2QJi+NGpxxTqz95KI8P+NXHrCdaAloIzs/IP1KpfrQZOuci Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10507"; a="369161170" X-IronPort-AV: E=Sophos;i="5.95,203,1661842800"; d="scan'208";a="369161170" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2022 13:35:33 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10507"; a="735700994" X-IronPort-AV: E=Sophos;i="5.95,203,1661842800"; d="scan'208";a="735700994" Received: from jithujos.sc.intel.com ([172.25.103.66]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2022 13:35:33 -0700 From: Jithu Joseph To: hdegoede@redhat.com, markgross@kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, gregkh@linuxfoundation.org, jithu.joseph@intel.com, ashok.raj@intel.com, tony.luck@intel.com, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, patches@lists.linux.dev, ravi.v.shankar@intel.com, thiago.macieira@intel.com, athenas.jimenez.gonzalez@intel.com Subject: [PATCH 01/14] platform/x86/intel/ifs: Remove unused selection Date: Fri, 21 Oct 2022 13:34:00 -0700 Message-Id: <20221021203413.1220137-2-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221021203413.1220137-1-jithu.joseph@intel.com> References: <20221021203413.1220137-1-jithu.joseph@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.6 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,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?1747331193510061542?= X-GMAIL-MSGID: =?utf-8?q?1747331193510061542?= CONFIG_INTEL_IFS_DEVICE is not used anywhere. The selection in Kconfig is therefore pointless. Delete it. Reviewed-by: Tony Luck Signed-off-by: Jithu Joseph --- drivers/platform/x86/intel/ifs/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/platform/x86/intel/ifs/Kconfig b/drivers/platform/x86/intel/ifs/Kconfig index c341a27cc1a3..89152d46deee 100644 --- a/drivers/platform/x86/intel/ifs/Kconfig +++ b/drivers/platform/x86/intel/ifs/Kconfig @@ -4,7 +4,6 @@ config INTEL_IFS # Discussion on the list has shown that the sysfs API needs a bit # more work, mark this as broken for now depends on BROKEN - select INTEL_IFS_DEVICE help Enable support for the In Field Scan capability in select CPUs. The capability allows for running low level tests via From patchwork Fri Oct 21 20:34:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jithu Joseph X-Patchwork-Id: 6972 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp892869wrr; Fri, 21 Oct 2022 13:41:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4UGCgGTkpf8LXX95jYg7DaFhzaWFCw6DPEwIWOK/2qQJG9K/0C8KIkROsW3l3qK3iw4PXb X-Received: by 2002:a17:903:32d1:b0:183:71f:aff with SMTP id i17-20020a17090332d100b00183071f0affmr21720953plr.136.1666384899169; Fri, 21 Oct 2022 13:41:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666384899; cv=none; d=google.com; s=arc-20160816; b=wPtIo2hMCj+DUeoH4QubiSrNYIe8EM3ZpAXpY9yVY4gFP4quvYQyo7fI2floifpRyp QhE6Hxkc04a108E6MhWaVwbklqDAJZObvvBQME2hDBTMG6ChfDxKHTBnHCDDKltwJWFg s4Q4/+ZLI+mqqx7AxuAAjCffyX2d1j0YUpsU6cfpmpX7E8quiloRBymE5MpX1Wis7/lZ gfCy5otJ3JtOxNcVP8gL2NNOEs8lCyDsX+02oie+ioLUgycKg+qYCIYQKlFtOJ1rijYw TKokGzD5w/tFIusqjkusl5jxviY7e7bzrKf0H9qBIVZ/WzBBGiA2HBroCIEs59Lqj/Qk vJhQ== 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=AIN0CxUN5NT+1wxQdzRKE65ZqTliFoSar2PexdlR49o=; b=p/GNu3QK6vHBivzDei6yzyPLbiMn/Zrk7pdIgKfVyS93HNdEc1YxVgTIiXu4wDCv6l tTsOSVc+mAnnmvX5gLIEHsO39v3/dkDMaBgKFKoZf4CIJFmyrOUVmL+9D+Y9HKPOURBn NiZYsXLBSq+ohr+ioap13KxN2jplbWyRgySCw4M8kYf4nnQLBxoN7Xrtz+tY7hC5mZk1 xsItz+bpLfrR1KvNK67Jw/9YwlIgP0q38UEXNEfkodNTs6wnZq5ixvMyhCwZSgZZoSa8 at6XBRhnZM2239hgzTdAsn86xsu66owQacLw8tpL/AULQFMQ64GVS4jAtnwg6w4joSYo 4QtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=P0qx5tnW; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q8-20020a17090311c800b00179e66b5d2csi29652091plh.398.2022.10.21.13.41.24; Fri, 21 Oct 2022 13:41:39 -0700 (PDT) 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=P0qx5tnW; 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 S229887AbiJUUkE (ORCPT + 99 others); Fri, 21 Oct 2022 16:40:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229793AbiJUUjy (ORCPT ); Fri, 21 Oct 2022 16:39:54 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D698043AE1; Fri, 21 Oct 2022 13:39:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666384792; x=1697920792; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VMx26DNuslaQcj8CoS6d3nA3KToG15PN8FrNUlzWMXs=; b=P0qx5tnW2fk6Dydel4pPoRIavd/iZjaM3emsi8vEzAxCm9rjIEfIqVPh Rd50owHd18Vt2gcQZtUxsmQgBow+fCl3vSUxIit3AUnOTEqxSEZK+zvfx IA3kDzPy8XqZOuah51KpehVq6NMRXtnynzaCsENridAwZi53DtNqTz0hF HqHSecc4M7tfnlFYAL/ww14WtOtdIjO8+uFFO5uhKjtay2ZcozHTlvote kSbNrmQSlDAjcUkGRQO+TkE4JVJTMTGtTRgRnhdiHXqtnupsrCOlj3BsC 1ZSg6epTEI3RZDJ3ruuPCx4lym62MoF7gRoRqvOf7Lv9n3F3voGj39QPi Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10507"; a="369161172" X-IronPort-AV: E=Sophos;i="5.95,203,1661842800"; d="scan'208";a="369161172" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2022 13:35:34 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10507"; a="735700998" X-IronPort-AV: E=Sophos;i="5.95,203,1661842800"; d="scan'208";a="735700998" Received: from jithujos.sc.intel.com ([172.25.103.66]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2022 13:35:33 -0700 From: Jithu Joseph To: hdegoede@redhat.com, markgross@kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, gregkh@linuxfoundation.org, jithu.joseph@intel.com, ashok.raj@intel.com, tony.luck@intel.com, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, patches@lists.linux.dev, ravi.v.shankar@intel.com, thiago.macieira@intel.com, athenas.jimenez.gonzalez@intel.com Subject: [PATCH 02/14] platform/x86/intel/ifs: Propagate load failure error code Date: Fri, 21 Oct 2022 13:34:01 -0700 Message-Id: <20221021203413.1220137-3-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221021203413.1220137-1-jithu.joseph@intel.com> References: <20221021203413.1220137-1-jithu.joseph@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.6 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,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?1747331211992277447?= X-GMAIL-MSGID: =?utf-8?q?1747331211992277447?= Existing implementation was returning fixed error code to user space regardless of the load failure encountered. Modify this to propagate the actual error code to user space. Reviewed-by: Tony Luck Signed-off-by: Jithu Joseph --- drivers/platform/x86/intel/ifs/ifs.h | 2 +- drivers/platform/x86/intel/ifs/load.c | 4 +++- drivers/platform/x86/intel/ifs/sysfs.c | 7 +++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/platform/x86/intel/ifs/ifs.h b/drivers/platform/x86/intel/ifs/ifs.h index 73c8e91cf144..782bcc039ddb 100644 --- a/drivers/platform/x86/intel/ifs/ifs.h +++ b/drivers/platform/x86/intel/ifs/ifs.h @@ -225,7 +225,7 @@ static inline struct ifs_data *ifs_get_data(struct device *dev) return &d->data; } -void ifs_load_firmware(struct device *dev); +int ifs_load_firmware(struct device *dev); int do_core_test(int cpu, struct device *dev); const struct attribute_group **ifs_get_groups(void); diff --git a/drivers/platform/x86/intel/ifs/load.c b/drivers/platform/x86/intel/ifs/load.c index d056617ddc85..ebaa1d6a2b18 100644 --- a/drivers/platform/x86/intel/ifs/load.c +++ b/drivers/platform/x86/intel/ifs/load.c @@ -234,7 +234,7 @@ static bool ifs_image_sanity_check(struct device *dev, const struct microcode_he * Load ifs image. Before loading ifs module, the ifs image must be located * in /lib/firmware/intel/ifs and named as {family/model/stepping}.{testname}. */ -void ifs_load_firmware(struct device *dev) +int ifs_load_firmware(struct device *dev) { struct ifs_data *ifsd = ifs_get_data(dev); const struct firmware *fw; @@ -263,4 +263,6 @@ void ifs_load_firmware(struct device *dev) release_firmware(fw); done: ifsd->loaded = (ret == 0); + + return ret; } diff --git a/drivers/platform/x86/intel/ifs/sysfs.c b/drivers/platform/x86/intel/ifs/sysfs.c index 37d8380d6fa8..4af4e1bea98d 100644 --- a/drivers/platform/x86/intel/ifs/sysfs.c +++ b/drivers/platform/x86/intel/ifs/sysfs.c @@ -94,9 +94,8 @@ static ssize_t reload_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { - struct ifs_data *ifsd = ifs_get_data(dev); bool res; - + int rc; if (kstrtobool(buf, &res)) return -EINVAL; @@ -106,11 +105,11 @@ static ssize_t reload_store(struct device *dev, if (down_interruptible(&ifs_sem)) return -EINTR; - ifs_load_firmware(dev); + rc = ifs_load_firmware(dev); up(&ifs_sem); - return ifsd->loaded ? count : -ENODEV; + return (rc == 0) ? count : rc; } static DEVICE_ATTR_WO(reload); From patchwork Fri Oct 21 20:34:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jithu Joseph X-Patchwork-Id: 6970 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp892654wrr; Fri, 21 Oct 2022 13:41:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5/kY+s0eHqb1R5JE2odTz9nHzwQqETY2/EmHhM7QO6b9ZKuCzTRgWXqIbi06M10Fjvg8hh X-Received: by 2002:a17:90b:1c8b:b0:203:dcf1:128a with SMTP id oo11-20020a17090b1c8b00b00203dcf1128amr57857104pjb.182.1666384867980; Fri, 21 Oct 2022 13:41:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666384867; cv=none; d=google.com; s=arc-20160816; b=zRaCMEPrwQoYpK8Yn8i8JXbxIzERSMt8lgLxVlLuM1BbDKvWlP0AncsWdwmUFfhxsV NSPhhG+G5qTq2VBGaLdRWAnW6m2ZQCCqV8FAyNTS1NB8QLCBcsIYAKCqvfMLstqNFiqc 7g99FwICLtPvMlPXuHnFcT/G3AbPXhNPaSLJbqab7sZKJXVQrb2QlH/78k6GySM6vS5l gKsWDpxUQM3lKpyO7AozOimNIyEFiHI+7JTw3PfYkT83hg7UvVTv/VZRBI4o/v6aRQKC 2SkdMzGgjyyYUjsPQrpJ74YOS27eqmsW7n2xfrtN1HMwk9vpSgBvnzI6KetVknmUCR7O KUNA== 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=NEa65XBpjr4Q4Geb1fAruZFvSzdsLTDtdTl20Sd7ebA=; b=eQpFktVbbkl+ioLuoGNTzqt3qsvuQraKZt/wBSjUzv4GefrIaCqBeEDuHE014hrdCm DjLe8idECE3IKxgxojzinsEN8g8BSHeLVLZZAA6xnYer4nk/3BMHLg+0vEJgvNmwCKVv sfnd5gW/3vs0UF4UsICjPRY2lKoxXcrISVEH4vyJFHjdE5c61ch5eX4/0LyUYC1hhyTG 63dIvB1HFcMi4iRoPdQ2j8eUHnrEI8KL/w64RlfwkYWGQumwNutg+T0r0WadBfvukvjA 4XHFe1ieBYD0hzovYCWFtoO+J9zjVTmH5Ar75xcBRrbIGh4XfrPaOtJ45v6X8L5ss6vi N04g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=DAKBs9rH; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k190-20020a6384c7000000b0045fd1d35d83si25628462pgd.795.2022.10.21.13.40.55; Fri, 21 Oct 2022 13:41:07 -0700 (PDT) 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=DAKBs9rH; 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 S229932AbiJUUkP (ORCPT + 99 others); Fri, 21 Oct 2022 16:40:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229867AbiJUUjz (ORCPT ); Fri, 21 Oct 2022 16:39:55 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04C994454C; Fri, 21 Oct 2022 13:39:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666384794; x=1697920794; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=DYEJTVshqR8fRd94F4Nb8k1S6Du/B4ywdW9auP0/9mk=; b=DAKBs9rH+VWwfyq5r30EwICGxhm0Nr1F/3fWMvLjqVXPAvDmBNU2X4Lt AfYfDsWEQiwMWXh8TmD2YIlYgmARtWUt5lZABQWMSUI8YrO3epqGL6+6z oh2D8iiPqbeT0nNGwXDsotZncEX+OaEUdHFrPSBg7wD1UZhmj782WNXSz uqO7d3k0pd+TzjTWa6QWob/DwLwBht6lnOCccqDkHobSPVBnZYcL8yVGJ DschG8+nOoJxo0iI39QgZZcQwkD4k0kHYRKHBGXBqZ7CeEPebzi8kqcPX rC8MpF67Mz91yuJK1tTMn6/gIiYgbeY+kDxJXLDdNkFyaolqG2gr+W+aT Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10507"; a="369161174" X-IronPort-AV: E=Sophos;i="5.95,203,1661842800"; d="scan'208";a="369161174" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2022 13:35:34 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10507"; a="735701001" X-IronPort-AV: E=Sophos;i="5.95,203,1661842800"; d="scan'208";a="735701001" Received: from jithujos.sc.intel.com ([172.25.103.66]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2022 13:35:34 -0700 From: Jithu Joseph To: hdegoede@redhat.com, markgross@kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, gregkh@linuxfoundation.org, jithu.joseph@intel.com, ashok.raj@intel.com, tony.luck@intel.com, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, patches@lists.linux.dev, ravi.v.shankar@intel.com, thiago.macieira@intel.com, athenas.jimenez.gonzalez@intel.com Subject: [PATCH 03/14] platform/x86/intel/ifs: return a more appropriate Error code Date: Fri, 21 Oct 2022 13:34:02 -0700 Message-Id: <20221021203413.1220137-4-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221021203413.1220137-1-jithu.joseph@intel.com> References: <20221021203413.1220137-1-jithu.joseph@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.6 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,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?1747331179598573725?= X-GMAIL-MSGID: =?utf-8?q?1747331179598573725?= scan_chunks_sanity_check() was returning -ENOMEM if it encounters an error while copying IFS test image from memory to Secure Memory. Return -EIO in this scenario, as it is more appropriate. Reviewed-by: Tony Luck Signed-off-by: Jithu Joseph --- drivers/platform/x86/intel/ifs/load.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/platform/x86/intel/ifs/load.c b/drivers/platform/x86/intel/ifs/load.c index ebaa1d6a2b18..b88db0765311 100644 --- a/drivers/platform/x86/intel/ifs/load.c +++ b/drivers/platform/x86/intel/ifs/load.c @@ -157,8 +157,10 @@ static int scan_chunks_sanity_check(struct device *dev) INIT_WORK(&local_work.w, copy_hashes_authenticate_chunks); schedule_work_on(cpu, &local_work.w); wait_for_completion(&ifs_done); - if (ifsd->loading_error) + if (ifsd->loading_error) { + ret = -EIO; goto out; + } package_authenticated[curr_pkg] = 1; } ret = 0; From patchwork Fri Oct 21 20:34:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jithu Joseph X-Patchwork-Id: 6977 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp892992wrr; Fri, 21 Oct 2022 13:41:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5CK8q1/7mD6Xs3pP4LGsTVQMY+1sE6VchuPAXQqRTAiSWJeyJtMIXQF1rIHK9k7ag6cHZk X-Received: by 2002:a17:903:2450:b0:185:4165:be54 with SMTP id l16-20020a170903245000b001854165be54mr21115268pls.104.1666384918294; Fri, 21 Oct 2022 13:41:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666384918; cv=none; d=google.com; s=arc-20160816; b=j7+XIUR948lBmYo+s/K3Vk4jsGOvF1lzDGz9+J8eNysQEuglIGpHNkz1FsxevlDx0w VLA//pEJohVFntI8NZW+GheiGfJ6rFv45U49GwSflvrKv3O21BJ4Z/qSeYVl2aiBNw5V S/MPzWv/7CCO2YfXP21GecQHNg1jzKg97p5RGGi3i5bZn80dkBchp2ni1gmkp1HyzmDY RxwwkwZ3NSEWCXcV1nBKjVE5a1LS7L4zGo69NhfbmPl7wnxOwECTCefKrudlP6+qijYb fFHTRDKWYX5b5z9RolDMsgB2sztr1woIjthekE1cExIC8j1ou6iQjObWUnuB2QBUaBdX 3nBQ== 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=wBUKOADX07a48N3zlFHB+SSQ+UBrgmEDFGzVItoYEdY=; b=Qmi/3xkN4mHjqrf7K7v4lwCxpS1cUZvf7xMXaAW0M3YEhs5JAAwCzgxYpOO8aB6WHV dM99c2n4uC4scMGYWM1QJbC1lOCD8R2zxFjlS1MlFLf7qA4jybRCeIoTmPPhgft9TPV5 fstw6ru0NgX+2y0J89aRHT0N9A93XAhu7T8xevBy2PUTAGTl6KFiyMOM6scLv+hi85bx UG6VRCJYeiNwFp60OKf3fiKPIcOTSWNtHvCGNvW5egdryy2tmDIfrXhlWFiL9x9bF1jI 62J9OcxveQphMJNoSA4lQGz2RNN7il81g9hr32a8voOBsKG+8zKg6U2pfO/2VSGHif5G Njxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=D87opjzQ; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j13-20020a65430d000000b0046040a85ea6si26739700pgq.120.2022.10.21.13.41.45; Fri, 21 Oct 2022 13:41:58 -0700 (PDT) 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=D87opjzQ; 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 S229976AbiJUUkI (ORCPT + 99 others); Fri, 21 Oct 2022 16:40:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229861AbiJUUjz (ORCPT ); Fri, 21 Oct 2022 16:39:55 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4204145F56; Fri, 21 Oct 2022 13:39:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666384794; x=1697920794; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=0oi6a1r6EcPszIqWC+40MwHJFgZnvwStu7e0P4Y7NfE=; b=D87opjzQ56rckhXfyOOu2iltjphgKhcPa/DSPI4yCEm71iScmDG3peYE /xkiKqoItDIb5Hay5s7H2pUKATrkraasOwp+2N6i38ZQCgeaCN4f0TudT JupBpvc6LCiu4i0Sqx1gZ2W6eiQRBMZarvRfIOqt+Y+bdAmO1KYFItKHj qQ4qHbHQAPlWgXcJ6xc38rxJGMcqrPLr4N4VGMvDXcVRUO5CS8k/whbSw 2juLq3wsSj7hrhxua9Vj7L3wtivhv5cy3S+v5XNC7g+vJjKKL264fliZ+ fNzXxZDXZ1ra1jTvwgRGNzcpOAU0cfk5EwF4jMonkOuqgduebkfa3SXos Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10507"; a="369161176" X-IronPort-AV: E=Sophos;i="5.95,203,1661842800"; d="scan'208";a="369161176" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2022 13:35:34 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10507"; a="735701004" X-IronPort-AV: E=Sophos;i="5.95,203,1661842800"; d="scan'208";a="735701004" Received: from jithujos.sc.intel.com ([172.25.103.66]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2022 13:35:34 -0700 From: Jithu Joseph To: hdegoede@redhat.com, markgross@kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, gregkh@linuxfoundation.org, jithu.joseph@intel.com, ashok.raj@intel.com, tony.luck@intel.com, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, patches@lists.linux.dev, ravi.v.shankar@intel.com, thiago.macieira@intel.com, athenas.jimenez.gonzalez@intel.com Subject: [PATCH 04/14] platform/x86/intel/ifs: Remove image loading during init Date: Fri, 21 Oct 2022 13:34:03 -0700 Message-Id: <20221021203413.1220137-5-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221021203413.1220137-1-jithu.joseph@intel.com> References: <20221021203413.1220137-1-jithu.joseph@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.6 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,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?1747331231909738895?= X-GMAIL-MSGID: =?utf-8?q?1747331231909738895?= Existing implementation loads IFS test image during the driver init flow. Dropping test image loading from the init path improves module load time. Prior to starting IFS tests, the user has to load one of the IFS test images by writing to the current_batch sysfs file. Removing IFS test image loading during init also allows us to make ifs_sem static as it is used only within sysfs.c. Reviewed-by: Tony Luck Suggested-by: Hans de Goede Signed-off-by: Jithu Joseph --- drivers/platform/x86/intel/ifs/ifs.h | 2 -- drivers/platform/x86/intel/ifs/core.c | 6 +----- drivers/platform/x86/intel/ifs/sysfs.c | 2 +- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/platform/x86/intel/ifs/ifs.h b/drivers/platform/x86/intel/ifs/ifs.h index 782bcc039ddb..be37512535f2 100644 --- a/drivers/platform/x86/intel/ifs/ifs.h +++ b/drivers/platform/x86/intel/ifs/ifs.h @@ -229,6 +229,4 @@ int ifs_load_firmware(struct device *dev); int do_core_test(int cpu, struct device *dev); const struct attribute_group **ifs_get_groups(void); -extern struct semaphore ifs_sem; - #endif diff --git a/drivers/platform/x86/intel/ifs/core.c b/drivers/platform/x86/intel/ifs/core.c index 27204e3d674d..5fb7f655c291 100644 --- a/drivers/platform/x86/intel/ifs/core.c +++ b/drivers/platform/x86/intel/ifs/core.c @@ -51,12 +51,8 @@ static int __init ifs_init(void) ifs_device.misc.groups = ifs_get_groups(); if ((msrval & BIT(ifs_device.data.integrity_cap_bit)) && - !misc_register(&ifs_device.misc)) { - down(&ifs_sem); - ifs_load_firmware(ifs_device.misc.this_device); - up(&ifs_sem); + !misc_register(&ifs_device.misc)) return 0; - } return -ENODEV; } diff --git a/drivers/platform/x86/intel/ifs/sysfs.c b/drivers/platform/x86/intel/ifs/sysfs.c index 4af4e1bea98d..766cee651bd6 100644 --- a/drivers/platform/x86/intel/ifs/sysfs.c +++ b/drivers/platform/x86/intel/ifs/sysfs.c @@ -13,7 +13,7 @@ * Protects against simultaneous tests on multiple cores, or * reloading can file while a test is in progress */ -DEFINE_SEMAPHORE(ifs_sem); +static DEFINE_SEMAPHORE(ifs_sem); /* * The sysfs interface to check additional details of last test From patchwork Fri Oct 21 20:34:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jithu Joseph X-Patchwork-Id: 6975 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp892961wrr; Fri, 21 Oct 2022 13:41:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM482y6RKrmV3UXBtZZzA31aRPM3vHeVnBy/39nkWz61sog8lhj2JKO/PAcgTx7h/X1xvJ/J X-Received: by 2002:a05:6a00:1a92:b0:565:d5c0:f627 with SMTP id e18-20020a056a001a9200b00565d5c0f627mr21220467pfv.10.1666384913238; Fri, 21 Oct 2022 13:41:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666384913; cv=none; d=google.com; s=arc-20160816; b=SpthLGtw3vV1mEWyskwhWqjoGE0sUczfAM9pktkn7wiDmeCbmGDmDoFPV8pPbp3CHW AqLyb7HVPcu6ppnFkkpwMOxctGUEVCbFF2y5El6bVFBTYlL7VzZeUFJ/opsY1xUvdtkn VO1iyUr7qYapjR6S+geJcSU+EtCHwSSPJFv0aJCmLItHIyKL4gn5iMAdzYlw8bOLobtC eMm6VH/gf/b7BpkJxigDVv9Gy8cVcvNOTHOWkJdREZYnhPZSAfr3F26zdEeeopzTSkdp aQcXoOuHe11O4MsJRk7kd5ekrEhjS57vhBGZfHnffDKYQRDBct00rS6Avnon42ikfdSe lmVw== 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=SN49VjPSNaJT+NufDTv+szVAVCtKLm+4lSyQlZ5c5sI=; b=CR9XFcBFoji6dR+jJ4xraGQFov539rLHNjCp9xSz1hxMJS/km65DGLau6d/s6fDK7M HqvSgDyWXuqPIjo9xtHEq8nd9oKZgtzyGXoo7dNWQQYiBTnxi5K8wlCXehgVTRXDogGz 9n7S0XlxKh7NRgS9RJ3LYcv5Fe7dFqveSDCn8YJGZnmX82ojtiqTVQh+2F+WdU7+Nj+3 saWpBAEykbP+eNsrVlIJ3zZ8/5UMt9U3IF9qVLJCxRJhqERMxDafsjVVeYewhZsLiSGH dJVYXvDcQTOl+fBMXXRTUo00x3Cw2N/O8qnTrooRl4PnV1sibeq5ltDCPvi3eek+QD0f M4sQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=RV5+3Ypz; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f10-20020a170902ce8a00b00176675b0cf2si30853743plg.381.2022.10.21.13.41.40; Fri, 21 Oct 2022 13:41:53 -0700 (PDT) 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=RV5+3Ypz; 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 S229925AbiJUUkU (ORCPT + 99 others); Fri, 21 Oct 2022 16:40:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229456AbiJUUj4 (ORCPT ); Fri, 21 Oct 2022 16:39:56 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 515614B0E1; Fri, 21 Oct 2022 13:39:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666384795; x=1697920795; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RDEkaaUj9KHHIXsWt/PpifWBMvlEQIpGtFe7sanP2/w=; b=RV5+3YpzSU15kabu9tqArP2OVtik/BHYe8dMvQGLqgyYSLBbT4I2XvbK ZMiDV9hNs371H/NCwuTzS8ptEGhUsUVP1Kc2sCiNweNOaPvFPG1NEHsIu l4dImo6INhas9Df6Pw2SKswRQvDbcCkSWqswIbfCkVZxfVI9vqh3Bg4/v X+RiAmFjG1nnkFEDm31j7cz/yW3HiEByJlcyLBDrv6F8GHxeb5lpSFnuq G4scU6X8IudolnE0hbKc1mWldz3j3+m7hxZFyVyaf/nId56skOMt72Eqw pOhXNe0H1eJvIVKc+6N4YAtTCREwiozhrkxgE1RjrJ7PE1KQpFfTjhfYj Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10507"; a="369161177" X-IronPort-AV: E=Sophos;i="5.95,203,1661842800"; d="scan'208";a="369161177" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2022 13:35:35 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10507"; a="735701008" X-IronPort-AV: E=Sophos;i="5.95,203,1661842800"; d="scan'208";a="735701008" Received: from jithujos.sc.intel.com ([172.25.103.66]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2022 13:35:34 -0700 From: Jithu Joseph To: hdegoede@redhat.com, markgross@kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, gregkh@linuxfoundation.org, jithu.joseph@intel.com, ashok.raj@intel.com, tony.luck@intel.com, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, patches@lists.linux.dev, ravi.v.shankar@intel.com, thiago.macieira@intel.com, athenas.jimenez.gonzalez@intel.com Subject: [PATCH 05/14] x86/microcode/intel: Expose find_matching_signature() for IFS Date: Fri, 21 Oct 2022 13:34:04 -0700 Message-Id: <20221021203413.1220137-6-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221021203413.1220137-1-jithu.joseph@intel.com> References: <20221021203413.1220137-1-jithu.joseph@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.6 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,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?1747331226731154380?= X-GMAIL-MSGID: =?utf-8?q?1747331226731154380?= IFS uses 'scan test images' provided by Intel that can be regarded as firmware. IFS test image carries microcode header with extended signature table. Expose find_matching_signature() for verifying if the test image header or the extended signature table indicate whether an IFS test image is fit to run on a system. Add microcode_intel_ prefix to the function name. No functional change Reviewed-by: Tony Luck Reviewed-by: Ashok Raj Signed-off-by: Jithu Joseph --- arch/x86/include/asm/microcode_intel.h | 3 +++ arch/x86/kernel/cpu/microcode/intel.c | 19 ++++++++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/arch/x86/include/asm/microcode_intel.h b/arch/x86/include/asm/microcode_intel.h index 4c92cea7e4b5..33db2a62ed34 100644 --- a/arch/x86/include/asm/microcode_intel.h +++ b/arch/x86/include/asm/microcode_intel.h @@ -74,12 +74,15 @@ extern void load_ucode_intel_ap(void); extern void show_ucode_info_early(void); extern int __init save_microcode_in_initrd_intel(void); void reload_ucode_intel(void); +int microcode_intel_find_matching_signature(void *mc, unsigned int csig, int cpf); #else static inline __init void load_ucode_intel_bsp(void) {} static inline void load_ucode_intel_ap(void) {} static inline void show_ucode_info_early(void) {} static inline int __init save_microcode_in_initrd_intel(void) { return -EINVAL; } static inline void reload_ucode_intel(void) {} +static inline int microcode_intel_find_matching_signature(void *mc, unsigned int csig, int cpf) + { return 0; } #endif #endif /* _ASM_X86_MICROCODE_INTEL_H */ diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c index 025c8f0cd948..f0cc60d92dfc 100644 --- a/arch/x86/kernel/cpu/microcode/intel.c +++ b/arch/x86/kernel/cpu/microcode/intel.c @@ -48,7 +48,7 @@ static int llc_size_per_core; /* * Returns 1 if update has been found, 0 otherwise. */ -static int find_matching_signature(void *mc, unsigned int csig, int cpf) +int microcode_intel_find_matching_signature(void *mc, unsigned int csig, int cpf) { struct microcode_header_intel *mc_hdr = mc; struct extended_sigtable *ext_hdr; @@ -72,6 +72,7 @@ static int find_matching_signature(void *mc, unsigned int csig, int cpf) } return 0; } +EXPORT_SYMBOL_GPL(microcode_intel_find_matching_signature); /* * Returns 1 if update has been found, 0 otherwise. @@ -83,7 +84,7 @@ static int has_newer_microcode(void *mc, unsigned int csig, int cpf, int new_rev if (mc_hdr->rev <= new_rev) return 0; - return find_matching_signature(mc, csig, cpf); + return microcode_intel_find_matching_signature(mc, csig, cpf); } static struct ucode_patch *memdup_patch(void *data, unsigned int size) @@ -117,7 +118,7 @@ static void save_microcode_patch(struct ucode_cpu_info *uci, void *data, unsigne sig = mc_saved_hdr->sig; pf = mc_saved_hdr->pf; - if (find_matching_signature(data, sig, pf)) { + if (microcode_intel_find_matching_signature(data, sig, pf)) { prev_found = true; if (mc_hdr->rev <= mc_saved_hdr->rev) @@ -149,7 +150,7 @@ static void save_microcode_patch(struct ucode_cpu_info *uci, void *data, unsigne if (!p) return; - if (!find_matching_signature(p->data, uci->cpu_sig.sig, uci->cpu_sig.pf)) + if (!microcode_intel_find_matching_signature(p->data, uci->cpu_sig.sig, uci->cpu_sig.pf)) return; /* @@ -286,8 +287,8 @@ scan_microcode(void *data, size_t size, struct ucode_cpu_info *uci, bool save) size -= mc_size; - if (!find_matching_signature(data, uci->cpu_sig.sig, - uci->cpu_sig.pf)) { + if (!microcode_intel_find_matching_signature(data, uci->cpu_sig.sig, + uci->cpu_sig.pf)) { data += mc_size; continue; } @@ -652,9 +653,9 @@ static struct microcode_intel *find_patch(struct ucode_cpu_info *uci) if (phdr->rev <= uci->cpu_sig.rev) continue; - if (!find_matching_signature(phdr, - uci->cpu_sig.sig, - uci->cpu_sig.pf)) + if (!microcode_intel_find_matching_signature(phdr, + uci->cpu_sig.sig, + uci->cpu_sig.pf)) continue; return iter->data; From patchwork Fri Oct 21 20:34:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jithu Joseph X-Patchwork-Id: 6976 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp892965wrr; Fri, 21 Oct 2022 13:41:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7WHrkJjgHB4ebFQ1J/7MYu/rIq2uhnlOtV9CHeXyck7fxFvUoiwhP3fz9tY4A9W8HoWiHL X-Received: by 2002:a65:6bcb:0:b0:44c:3e11:a7ac with SMTP id e11-20020a656bcb000000b0044c3e11a7acmr18108743pgw.274.1666384913635; Fri, 21 Oct 2022 13:41:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666384913; cv=none; d=google.com; s=arc-20160816; b=kzEVj/OzaJU5RAmGeG/YjcKHHMF2iVxn0K6XEkeV9+zey7cA9zRU0RhptHpt068zg/ q8xXOdIRugBG0vf06l/XbtEOhgHhl6+Ant/V1cXTOJMhiHzgYGbzRONOQYYAE5B6fNWI 43jy3jWORJ8Ff7Wypq8gCEZqVZ+OmS2APMTvuX5pO/F4pDKT82gBcdj7+lhKU4dL5gr5 W2nfDXVRiTk8uylRbC6MkutgBGNhBfEikfDlhNzp4k8MHW3vxF2S9b7X3sCEvoVkjrP+ eHlUcSLJHOJjaqn6RIxy5YVo+TXOBloFXXEgpWFIAAQlbgSr1RGyD7PRdh53MGroHFNU G1cw== 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=3A1X4x+UXKSeG6i3A5shG2MFzV6IICux0TxujzAbfQg=; b=iZ1defmEyaUzYLshKajl373JgnVMLzIUsLLRqogy9zVeUKsw7kb97PZ0P8QclEwUbw 4S3P9JE2HpHZLE+mU2PbzjUr+rBEaes2wDYo2JMTmXzbyEChsQNpADqPF8gkIPWTDBlt WuQk3jRAuOFvtFCUqEKs20gICsZ9JxkyNRvK0D+eG+EfZ53mwdwtHUk/JEtPgcUrj4lj Oo5uZVugh9dw3HqNVzjcuyxs+Ps/s5FqLJ/4dxe+U3Elcs51fEy/GsAAlLCbW3k0zzyQ ok5wocz9TcsdL9zaM7fdDm9QZ1IR0swzWZv2EikL/7NrtEprxcmq0xgUV99IwzGaL/4f hP7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hmHuL0p0; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b5-20020a63cf45000000b0043c1067ea80si24266322pgj.210.2022.10.21.13.41.40; Fri, 21 Oct 2022 13:41:53 -0700 (PDT) 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=hmHuL0p0; 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 S230098AbiJUUkZ (ORCPT + 99 others); Fri, 21 Oct 2022 16:40:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229875AbiJUUj4 (ORCPT ); Fri, 21 Oct 2022 16:39:56 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 526304B4A0; Fri, 21 Oct 2022 13:39:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666384795; x=1697920795; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jYLjCtMe0oKlNW4X9hQ8u/gqYqo3txjMxVWcMyx5Mts=; b=hmHuL0p0PItkjcY0317FAIeReGiLShImli/kkzMlwuGORcaNuUk3Tz5c 4WqHGGo42TFRU3OG15bnXJ/Rs01/igV85qqDBk4p8PyH/8aBl3jsvHQqc g2WBS5dIZzv0cdw7IMzNCtVMRJlTno7+TdbSXPihCD6gJVTROIR1KnSnD zTe7XDHbO26lXQBDbMbamUyfrDP0od/7IbwNeBUnydqS6nJElnOhcswWd y7Or3LEttEt7Uj6ObTd2krwkt4satONyRHN1Xei0mihXIcT/UUHsPPRJA cr9eVaGSH3VW5X1hBJa0m1AD305M2JrnYDK7SXs64jOrrPMOreZMggHWf w==; X-IronPort-AV: E=McAfee;i="6500,9779,10507"; a="369161179" X-IronPort-AV: E=Sophos;i="5.95,203,1661842800"; d="scan'208";a="369161179" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2022 13:35:35 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10507"; a="735701014" X-IronPort-AV: E=Sophos;i="5.95,203,1661842800"; d="scan'208";a="735701014" Received: from jithujos.sc.intel.com ([172.25.103.66]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2022 13:35:34 -0700 From: Jithu Joseph To: hdegoede@redhat.com, markgross@kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, gregkh@linuxfoundation.org, jithu.joseph@intel.com, ashok.raj@intel.com, tony.luck@intel.com, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, patches@lists.linux.dev, ravi.v.shankar@intel.com, thiago.macieira@intel.com, athenas.jimenez.gonzalez@intel.com Subject: [PATCH 06/14] x86/microcode/intel: Use appropriate type in microcode_sanity_check() Date: Fri, 21 Oct 2022 13:34:05 -0700 Message-Id: <20221021203413.1220137-7-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221021203413.1220137-1-jithu.joseph@intel.com> References: <20221021203413.1220137-1-jithu.joseph@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.6 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,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?1747331227274266058?= X-GMAIL-MSGID: =?utf-8?q?1747331227274266058?= The data type of print_err parameter used by microcode_sanity_check() is int. In prepration for exporting this function, to be used by the IFS driver, Convert it to a more appropriate bool type for readability. No functional change intended. Reviewed-by: Tony Luck Reviewed-by: Ashok Raj Signed-off-by: Jithu Joseph --- arch/x86/kernel/cpu/microcode/intel.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c index f0cc60d92dfc..5473b094baee 100644 --- a/arch/x86/kernel/cpu/microcode/intel.c +++ b/arch/x86/kernel/cpu/microcode/intel.c @@ -164,7 +164,7 @@ static void save_microcode_patch(struct ucode_cpu_info *uci, void *data, unsigne intel_ucode_patch = p->data; } -static int microcode_sanity_check(void *mc, int print_err) +static int microcode_sanity_check(void *mc, bool print_err) { unsigned long total_size, data_size, ext_table_size; struct microcode_header_intel *mc_header = mc; @@ -282,7 +282,7 @@ scan_microcode(void *data, size_t size, struct ucode_cpu_info *uci, bool save) mc_size = get_totalsize(mc_header); if (!mc_size || mc_size > size || - microcode_sanity_check(data, 0) < 0) + microcode_sanity_check(data, false) < 0) break; size -= mc_size; @@ -821,7 +821,7 @@ static enum ucode_state generic_load_microcode(int cpu, struct iov_iter *iter) memcpy(mc, &mc_header, sizeof(mc_header)); data = mc + sizeof(mc_header); if (!copy_from_iter_full(data, data_size, iter) || - microcode_sanity_check(mc, 1) < 0) { + microcode_sanity_check(mc, true) < 0) { break; } From patchwork Fri Oct 21 20:34:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jithu Joseph X-Patchwork-Id: 6979 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp893237wrr; Fri, 21 Oct 2022 13:42:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5o0MdezGjNekVBbIruvwz0n+PBXhM11jJg80rDBRR8Vizdw2sOUAUoDVBHmMkSRxvR3cx4 X-Received: by 2002:a05:6a00:e09:b0:563:69ac:5633 with SMTP id bq9-20020a056a000e0900b0056369ac5633mr20990294pfb.54.1666384957266; Fri, 21 Oct 2022 13:42:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666384957; cv=none; d=google.com; s=arc-20160816; b=ED6yg0X3TC0kHzEXYHRd4g8r7AZ9V3JtpqRM6LjBJC9MnK5dz0X5rgHkRO/Bp0UOcm acRoreGPfS/j1f/AyT8hmMLVPHtpdL4z1RXaByQoXm2iGsMfnuUGkSJUIYaLzyNdGETQ kpnYwJ0CXdhuxkacUGsy9/7i+lpkpUhREp2z7HbjS/pCHKPY9faas/3nkarKDu8I7kpN TOHvDaXw04FZDS1AeQx5DzMtufvFJ1nGryA8kyCwI6L+BDirpMthx/DWkYP5uA/EzjlD MUUrWJy0+FKm9ttagr8jaIpBzbdtUS9MLFy3xS/AIqfQqgp/4nBbthHmQlfKHNljzenA BfEw== 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=cGNTbe440aL52QwPk3Iz/6ZiJdH3wUanA+/tZif8pgA=; b=GIajLBYnudXRzWX33p4bJ387ScwsrMzMZ5hvjSCl/DpYVhWEvPjThlqXe/+mMU4kzd 06VZdpxy6eCBVJiqQqaEn/+86mBaa/E9HgLtVm7svTtqCMFPHOs6wdIpDx2XbAuKsQRY lQhr3uavx+zWpKNL4mtkq2DfX1IwTlVXLeBXzGPXfdoTW9enA7pPx+/XW9D/pu0Z6A8o vmZG3l2jlTDKcgt7eE1dKg+irOFwR4dAGRSd+cVurmSd2I002dnz5u3A/gjjXKJCZvn+ XrNgLv5gC0r0aI8ReR3wnNhJgnhSpHYaGaZzPI+c+Kbkb45KrsVXeflMXEZLxHrzBX7W v3TQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=g3tjWPgF; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nn15-20020a17090b38cf00b0020fadac08a2si8383520pjb.108.2022.10.21.13.42.24; Fri, 21 Oct 2022 13:42:37 -0700 (PDT) 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=g3tjWPgF; 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 S229796AbiJUUke (ORCPT + 99 others); Fri, 21 Oct 2022 16:40:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229894AbiJUUj5 (ORCPT ); Fri, 21 Oct 2022 16:39:57 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10CB54B4AA; Fri, 21 Oct 2022 13:39:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666384796; x=1697920796; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=QxRC+gbPUdUp3j7hZeJ/DbMqthGvlXHYc4JmKqG4KW8=; b=g3tjWPgFJxeEwtg7fFAHFp3hPgiTVRVYQ6JRHK6hdLFtk4ooJ4IHJk0C hsOTcX1pV/nYXwTvauNYBlr1Zh/f+btTqc5jS4YpzipkWogCCWDWEd7TX 0K0RdY0g6jgR+isiwvr+tYj1C8C5KdwkSilIKih2M1cRh7rAf/5bz/DmJ Lw2YJEX1QorMkEkfrMra/8qmsoUK16v4sD3OcmNH/GSKWe/tZBpKFkBpx w/oars13ZcOXnqyNp1Z7vaMaEl67foG93S65uzQ7nla5x7TDtUkJSyvqy 0qcYmzFjK8aLgDBYlaQZoqSBBX5Asm67GOIU9Z7Tublssy6LEB0BeHtO6 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10507"; a="369161181" X-IronPort-AV: E=Sophos;i="5.95,203,1661842800"; d="scan'208";a="369161181" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2022 13:35:35 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10507"; a="735701017" X-IronPort-AV: E=Sophos;i="5.95,203,1661842800"; d="scan'208";a="735701017" Received: from jithujos.sc.intel.com ([172.25.103.66]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2022 13:35:35 -0700 From: Jithu Joseph To: hdegoede@redhat.com, markgross@kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, gregkh@linuxfoundation.org, jithu.joseph@intel.com, ashok.raj@intel.com, tony.luck@intel.com, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, patches@lists.linux.dev, ravi.v.shankar@intel.com, thiago.macieira@intel.com, athenas.jimenez.gonzalez@intel.com Subject: [PATCH 07/14] x86/microcode/intel: Expose microcode_sanity_check() Date: Fri, 21 Oct 2022 13:34:06 -0700 Message-Id: <20221021203413.1220137-8-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221021203413.1220137-1-jithu.joseph@intel.com> References: <20221021203413.1220137-1-jithu.joseph@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.6 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,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?1747331272733662935?= X-GMAIL-MSGID: =?utf-8?q?1747331272733662935?= IFS test image carries the same microcode header as regular Intel microcode blobs. Microcode blobs use header version of 1, whereas IFS test images will use header version of 2. microcode_sanity_check() can be used by IFS driver to perform sanity check of the IFS test images too. Refactor header version as a parameter and expose this function. Qualify the function name with intel. No functional change intended. Reviewed-by: Tony Luck Reviewed-by: Ashok Raj Signed-off-by: Jithu Joseph --- arch/x86/include/asm/microcode_intel.h | 3 +++ arch/x86/kernel/cpu/microcode/intel.c | 14 +++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/arch/x86/include/asm/microcode_intel.h b/arch/x86/include/asm/microcode_intel.h index 33db2a62ed34..27eba991c6b6 100644 --- a/arch/x86/include/asm/microcode_intel.h +++ b/arch/x86/include/asm/microcode_intel.h @@ -75,6 +75,7 @@ extern void show_ucode_info_early(void); extern int __init save_microcode_in_initrd_intel(void); void reload_ucode_intel(void); int microcode_intel_find_matching_signature(void *mc, unsigned int csig, int cpf); +int microcode_intel_sanity_check(void *mc, bool print_err, int hdr_ver); #else static inline __init void load_ucode_intel_bsp(void) {} static inline void load_ucode_intel_ap(void) {} @@ -83,6 +84,8 @@ static inline int __init save_microcode_in_initrd_intel(void) { return -EINVAL; static inline void reload_ucode_intel(void) {} static inline int microcode_intel_find_matching_signature(void *mc, unsigned int csig, int cpf) { return 0; } +static inline int microcode_intel_sanity_check(void *mc, bool print_err, int hdr_ver) + { return -EINVAL; } #endif #endif /* _ASM_X86_MICROCODE_INTEL_H */ diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c index 5473b094baee..bc3f33a25d7a 100644 --- a/arch/x86/kernel/cpu/microcode/intel.c +++ b/arch/x86/kernel/cpu/microcode/intel.c @@ -37,6 +37,8 @@ #include #include +#define MICROCODE_HEADER_VER 1 + static const char ucode_path[] = "kernel/x86/microcode/GenuineIntel.bin"; /* Current microcode patch used in early patching on the APs. */ @@ -164,7 +166,7 @@ static void save_microcode_patch(struct ucode_cpu_info *uci, void *data, unsigne intel_ucode_patch = p->data; } -static int microcode_sanity_check(void *mc, bool print_err) +int microcode_intel_sanity_check(void *mc, bool print_err, int hdr_ver) { unsigned long total_size, data_size, ext_table_size; struct microcode_header_intel *mc_header = mc; @@ -181,9 +183,10 @@ static int microcode_sanity_check(void *mc, bool print_err) return -EINVAL; } - if (mc_header->ldrver != 1 || mc_header->hdrver != 1) { + if (mc_header->ldrver != 1 || mc_header->hdrver != hdr_ver) { if (print_err) - pr_err("Error: invalid/unknown microcode update format.\n"); + pr_err("Error: invalid/unknown microcode update format. Header version %d\n", + mc_header->hdrver); return -EINVAL; } @@ -261,6 +264,7 @@ static int microcode_sanity_check(void *mc, bool print_err) } return 0; } +EXPORT_SYMBOL_GPL(microcode_intel_sanity_check); /* * Get microcode matching with BSP's model. Only CPUs with the same model as @@ -282,7 +286,7 @@ scan_microcode(void *data, size_t size, struct ucode_cpu_info *uci, bool save) mc_size = get_totalsize(mc_header); if (!mc_size || mc_size > size || - microcode_sanity_check(data, false) < 0) + microcode_intel_sanity_check(data, false, MICROCODE_HEADER_VER) < 0) break; size -= mc_size; @@ -821,7 +825,7 @@ static enum ucode_state generic_load_microcode(int cpu, struct iov_iter *iter) memcpy(mc, &mc_header, sizeof(mc_header)); data = mc + sizeof(mc_header); if (!copy_from_iter_full(data, data_size, iter) || - microcode_sanity_check(mc, true) < 0) { + microcode_intel_sanity_check(mc, true, MICROCODE_HEADER_VER) < 0) { break; } From patchwork Fri Oct 21 20:34:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jithu Joseph X-Patchwork-Id: 6973 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp892894wrr; Fri, 21 Oct 2022 13:41:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM582294GYbckMQVAe3eADUFUsf9osYIQDK8zQQ8B4JUeaTymOmfBA1jOrwYLds4Yieawio3 X-Received: by 2002:a65:5801:0:b0:45d:bbd8:e872 with SMTP id g1-20020a655801000000b0045dbbd8e872mr17053361pgr.343.1666384902765; Fri, 21 Oct 2022 13:41:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666384902; cv=none; d=google.com; s=arc-20160816; b=FDF33uTK1wbUpztDVrbcxJMLOiy5i/k9D6yda+4Ob0ieNcdpOgQDR4z4yV5uxBrvNR Wf4GAix424twil4KvKBheQt3iaQCrdOJVypWKHy9upzy3Bs9DOn5LIEajHpz+76LeVCu bZ9to1FbMkg9Yfyg+ivMARyCmZ09Ilk3TVkI3j3H+r0sED4mcD5CMuWeg76642Vy+cQT bvPx4g3pjNtOuwinHidnga9zJt8Se83wlogptFxEMrxozAKiqVVsdS8olxnGHWCY7J6r +/M7OeYLF0VZTEe+HOCDagS/HAEFgaGZPKucN1a5SZNicxIRGZhimVDYJRvp45p0N0cz 4qGQ== 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=Q0E0mZEO0LMtj83SoJs/712Utz1/+KSVBwCUZqrUbnY=; b=tgf5rN1BFTlIglLhr6oK7vmxJTNMH70iNsAotQT13n+kOomhJ5OFNu3z1iQ0ve/523 0dmws7YUsxg9cfeATFkVt30tYyGodX35QeUTWHEP1V76JZJ/dleH03T9s73B5UTpoLon 7h+037L5wzNk/CG0tgRQwIw/YHaNT4E3ZGt9l9zxSW3OXc76qUGFeFU9jGpInMq9pdkS S1lQMlDgqcQ2kEMqDSvPKuKmcvQgakPaPSrPMVSmg2N9L3gUcyFDX6Ng6V4YhV98R+M/ mfZe/HkrroPfDGOIFYnaJWMSRs+zoAh2tPsS+dSNv36nSWpsxInPWYHRLJ0G/vbUGNIl UuTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=kkKjzu4o; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 38-20020a631466000000b0045af77fa685si27645488pgu.235.2022.10.21.13.41.28; Fri, 21 Oct 2022 13:41:42 -0700 (PDT) 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=kkKjzu4o; 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 S229853AbiJUUkp (ORCPT + 99 others); Fri, 21 Oct 2022 16:40:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229908AbiJUUj7 (ORCPT ); Fri, 21 Oct 2022 16:39:59 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 861CB4DB7D; Fri, 21 Oct 2022 13:39:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666384797; x=1697920797; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yo+BuHHe+5788jOOlbf8kqFseScnYm+6V1Kpa1hItDA=; b=kkKjzu4o5iF3Gf1II2UC143sPFj9ilChA2jtp6Hy3D0YErAtNCmdl0/A R5pSd4XQ8o5II01aT9gQEAJBrdhintoI/2LOz/ihrc+pDtpomgQmNuD/Q 00C7W2bDS+x+IkF6NA/Nysn/WyIi1p5BfgEO4hRcYbP//bZNO8rrVeVrS Kh/DYqVT0TBy2qhbBO/XSCjxaQUNmWytI9/ekdiHJB/I6oJmKcPpZvvYb hpwpFlPVrLvKz60zySPQCGUftGoBle9VKcaAVkxDpcE7+5w7m3G0ywOr2 hGIOYZE2y1OP6XMk/Mg4h3RidS0DIPFfLV8R97B4JLv1miWlVHmH6ZC7J g==; X-IronPort-AV: E=McAfee;i="6500,9779,10507"; a="369161182" X-IronPort-AV: E=Sophos;i="5.95,203,1661842800"; d="scan'208";a="369161182" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2022 13:35:36 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10507"; a="735701022" X-IronPort-AV: E=Sophos;i="5.95,203,1661842800"; d="scan'208";a="735701022" Received: from jithujos.sc.intel.com ([172.25.103.66]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2022 13:35:35 -0700 From: Jithu Joseph To: hdegoede@redhat.com, markgross@kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, gregkh@linuxfoundation.org, jithu.joseph@intel.com, ashok.raj@intel.com, tony.luck@intel.com, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, patches@lists.linux.dev, ravi.v.shankar@intel.com, thiago.macieira@intel.com, athenas.jimenez.gonzalez@intel.com Subject: [PATCH 08/14] x86/microcode/intel: Meta-data support in microcode file Date: Fri, 21 Oct 2022 13:34:07 -0700 Message-Id: <20221021203413.1220137-9-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221021203413.1220137-1-jithu.joseph@intel.com> References: <20221021203413.1220137-1-jithu.joseph@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.6 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,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?1747331215769605264?= X-GMAIL-MSGID: =?utf-8?q?1747331215769605264?= From: Ashok Raj Intel has made extensions to the microcode file format so that it can also be used for In Field Scan. One of the existing reserved fields has been allocated to indicate the size of the region in the file allocated for metadata structures. Microcode Format +----------------------+ Base |Header Version | +----------------------+ |Update revision | +----------------------+ |Date DDMMYYYY | +----------------------+ |Sig | +----------------------+ |Checksum | +----------------------+ |Loader Version | +----------------------+ |Processor Flags | +----------------------+ |Data Size | +----------------------+ |Total Size | +----------------------+ |Meta Size | +----------------------+ |Reserved | +----------------------+ |Reserved | +----------------------+ Base+48 | | | | | | | | | Microcode | | | | Data | | | | | +----------------------+ Base+48+data_size- | | meta_size | Meta Data | | | +----------------------+ Base+48+data_size | Extended Signature | | Table | | | | | | | | | | | +----------------------+ Base+total_size In subsequent patches IFS test image file (which reuse microcode header format) will make use of metadata section. Though IFS is the first consumer of this metadata within microcode file, it is expected that this will be used for supporting upcoming microcode update related enhancements. Also add an accessor function which will return a pointer to the start of a specific meta_type being queried. Reviewed-by: Tony Luck Signed-off-by: Ashok Raj Signed-off-by: Jithu Joseph --- arch/x86/include/asm/microcode_intel.h | 19 +++++++++- arch/x86/kernel/cpu/microcode/intel.c | 48 ++++++++++++++++++++++++-- 2 files changed, 64 insertions(+), 3 deletions(-) diff --git a/arch/x86/include/asm/microcode_intel.h b/arch/x86/include/asm/microcode_intel.h index 27eba991c6b6..dcbc377f67d1 100644 --- a/arch/x86/include/asm/microcode_intel.h +++ b/arch/x86/include/asm/microcode_intel.h @@ -14,7 +14,8 @@ struct microcode_header_intel { unsigned int pf; unsigned int datasize; unsigned int totalsize; - unsigned int reserved[3]; + unsigned int metasize; + unsigned int reserved[2]; }; struct microcode_intel { @@ -36,6 +37,18 @@ struct extended_sigtable { struct extended_signature sigs[]; }; +#define META_TYPE_END (0) + +struct metadata_header { + unsigned int meta_type; + unsigned int meta_blk_size; +}; + +struct metadata_intel { + struct metadata_header meta_hdr; + unsigned int meta_bits[]; +}; + #define DEFAULT_UCODE_DATASIZE (2000) #define MC_HEADER_SIZE (sizeof(struct microcode_header_intel)) #define DEFAULT_UCODE_TOTALSIZE (DEFAULT_UCODE_DATASIZE + MC_HEADER_SIZE) @@ -76,6 +89,7 @@ extern int __init save_microcode_in_initrd_intel(void); void reload_ucode_intel(void); int microcode_intel_find_matching_signature(void *mc, unsigned int csig, int cpf); int microcode_intel_sanity_check(void *mc, bool print_err, int hdr_ver); +struct metadata_header *microcode_intel_find_meta_data(void *ucode, unsigned int meta_type); #else static inline __init void load_ucode_intel_bsp(void) {} static inline void load_ucode_intel_ap(void) {} @@ -86,6 +100,9 @@ static inline int microcode_intel_find_matching_signature(void *mc, unsigned int { return 0; } static inline int microcode_intel_sanity_check(void *mc, bool print_err, int hdr_ver) { return -EINVAL; } +static inline struct metadata_header *microcode_intel_find_meta_data(void *ucode, + unsigned int meta_type) + { return NULL; } #endif #endif /* _ASM_X86_MICROCODE_INTEL_H */ diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c index bc3f33a25d7a..179ca345bc06 100644 --- a/arch/x86/kernel/cpu/microcode/intel.c +++ b/arch/x86/kernel/cpu/microcode/intel.c @@ -168,14 +168,17 @@ static void save_microcode_patch(struct ucode_cpu_info *uci, void *data, unsigne int microcode_intel_sanity_check(void *mc, bool print_err, int hdr_ver) { - unsigned long total_size, data_size, ext_table_size; + unsigned long total_size, data_size, ext_table_size, total_meta; struct microcode_header_intel *mc_header = mc; struct extended_sigtable *ext_header = NULL; u32 sum, orig_sum, ext_sigcount = 0, i; struct extended_signature *ext_sig; + struct metadata_header *meta_header; + unsigned long meta_size = 0; total_size = get_totalsize(mc_header); data_size = get_datasize(mc_header); + total_meta = mc_header->metasize; if (data_size + MC_HEADER_SIZE > total_size) { if (print_err) @@ -245,7 +248,7 @@ int microcode_intel_sanity_check(void *mc, bool print_err, int hdr_ver) } if (!ext_table_size) - return 0; + goto check_meta; /* * Check extended signature checksum: 0 => valid. @@ -262,6 +265,22 @@ int microcode_intel_sanity_check(void *mc, bool print_err, int hdr_ver) return -EINVAL; } } + +check_meta: + if (!total_meta) + return 0; + + meta_header = (mc + MC_HEADER_SIZE + data_size) - total_meta; + while (meta_header->meta_type != META_TYPE_END) { + meta_size += meta_header->meta_blk_size; + if (!meta_header->meta_blk_size || meta_size > total_meta) { + if (print_err) { + pr_err("Bad value for metadata size, aborting.\n"); + return -EINVAL; + } + } + meta_header = (void *)meta_header + meta_header->meta_blk_size; + } return 0; } EXPORT_SYMBOL_GPL(microcode_intel_sanity_check); @@ -967,3 +986,28 @@ struct microcode_ops * __init init_intel_microcode(void) return µcode_intel_ops; } + +struct metadata_header *microcode_intel_find_meta_data(void *ucode, unsigned int meta_type) +{ + struct metadata_header *meta_header; + unsigned long data_size, total_meta; + unsigned long meta_size = 0; + + data_size = get_datasize(ucode); + total_meta = ((struct microcode_intel *)ucode)->hdr.metasize; + + if (!total_meta) + return NULL; + + meta_header = (ucode + MC_HEADER_SIZE + data_size) - total_meta; + + while ((meta_header->meta_type != META_TYPE_END) && meta_size < total_meta) { + meta_size += meta_header->meta_blk_size; + if (meta_header->meta_type == meta_type) + return meta_header; + + meta_header = (void *)meta_header + meta_header->meta_blk_size; + } + return NULL; +} +EXPORT_SYMBOL_GPL(microcode_intel_find_meta_data); From patchwork Fri Oct 21 20:34:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jithu Joseph X-Patchwork-Id: 6982 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp893343wrr; Fri, 21 Oct 2022 13:42:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4pFBOjZbAjcrsnXVwbtuA10tB5H0aHSSBLYgh+U/HmW8dLgbXPRtrp2IxCL5v4cfsxVNsM X-Received: by 2002:a17:903:32cf:b0:185:c53f:7459 with SMTP id i15-20020a17090332cf00b00185c53f7459mr20044062plr.82.1666384964306; Fri, 21 Oct 2022 13:42:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666384964; cv=none; d=google.com; s=arc-20160816; b=Dx5PwbnUkb5lRcuU3KJihI95VugsJBX3CnsflUxutR/+//AzE8Q6DM1As4BnffYM5Y EcTBKsIq3g/zKoUjbYlKUWQCMemRw+1DmxaAlCD0uycgm5lU2d8IBwQShoCRFNfe3bUt ludAHV9ASsauVkev9xT+oNYchNdoYNxdRxomKlJCwTuFeyceFc7IFRta7Kp07jr0i9aK 2DdBBY2LkMHOJ8FrM2ACZt8j51o/wN3jZHZaCAwBSUEyGc2WItx6AnyHYzuoBtlmlnps 63l08b4lArtzkRg8fcHD4JXsk5aQTsWg/0QCYJOsm2rt8OZ2Wc0tlLdY7d/6yWvzPm5L yBXg== 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=T3u3FTdJwWm2X4P6KOMIC9u4gIObIm0g2i/z6BfZ6zo=; b=qKuNUmw9iGArnWhxptqdqCKJV8Go8gN/uti2CwR0MGb6OeZZTja1A6poJs2IhW5JPD +CnaDLFHVL8Iw3JKDJcbbI9ghVD2rC6Kfy60ZpHEuoxGhXKRP5Am3azXyLTKIPeVN0b+ VuDLtt5Da5acKNqvJoU7hoydieQt0GC4lgMcBAMST/iEie24qfTBGY0D8hlfpgNeNk2s +ZBVBOmWQUvNf2HiFQUFRnvzx9VYw5ZPci315+xFSaq8eiT27CcUcTjKXpTGw9QZL0to /q0x8SJYeK/frFroMiaTkStkXxteCTYlqfTmXdMZHaESvfHRJtwyJG3kUbF0IiGMdUEI b6Wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=cp4UL0wo; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a10-20020a63d20a000000b00461bf5f86fdsi26216017pgg.403.2022.10.21.13.42.31; Fri, 21 Oct 2022 13:42:44 -0700 (PDT) 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=cp4UL0wo; 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 S230131AbiJUUk5 (ORCPT + 99 others); Fri, 21 Oct 2022 16:40:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229928AbiJUUkA (ORCPT ); Fri, 21 Oct 2022 16:40:00 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB75458E8F; Fri, 21 Oct 2022 13:39:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666384798; x=1697920798; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KwUTiUljjWI+BCYf4fGdJwTrdeBzp7WcJvxyFXiS2vo=; b=cp4UL0woWU6nXX+mzfrvBhTNegmAXVZ8USV+3mNcigxadOqGRDWAJ5Gb /J/vRiFFMrAdTRqv/PwmSG7ES0yQ18t4Gt+S7jKsBb3z9uJwi68ELjh2S B66NvBJ1HtK9Kdz0Onp7j0AkjIlrGDCGpV4by5muAtVic+6nx86vPYwBE mkQ/lTrVRmh9xmRmYQxD0pftb/P4fHNkdrmJNNOSml0r4Y5ecKDXgB89S hXiVF2y+PJOjjOGGUKsoMBo9l6Yn3kaDzysowaN9GWYr3YokHdp/4HnsE IQEBijAMvNa6iW96B3buxJpk1Fo9v10VxZCqWtUpeqs/N270jzKGQaM2B w==; X-IronPort-AV: E=McAfee;i="6500,9779,10507"; a="369161183" X-IronPort-AV: E=Sophos;i="5.95,203,1661842800"; d="scan'208";a="369161183" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2022 13:35:36 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10507"; a="735701025" X-IronPort-AV: E=Sophos;i="5.95,203,1661842800"; d="scan'208";a="735701025" Received: from jithujos.sc.intel.com ([172.25.103.66]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2022 13:35:35 -0700 From: Jithu Joseph To: hdegoede@redhat.com, markgross@kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, gregkh@linuxfoundation.org, jithu.joseph@intel.com, ashok.raj@intel.com, tony.luck@intel.com, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, patches@lists.linux.dev, ravi.v.shankar@intel.com, thiago.macieira@intel.com, athenas.jimenez.gonzalez@intel.com Subject: [PATCH 09/14] platform/x86/intel/ifs: Use generic microcode headers and functions Date: Fri, 21 Oct 2022 13:34:08 -0700 Message-Id: <20221021203413.1220137-10-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221021203413.1220137-1-jithu.joseph@intel.com> References: <20221021203413.1220137-1-jithu.joseph@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.6 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,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?1747331280254736478?= X-GMAIL-MSGID: =?utf-8?q?1747331280254736478?= Existing implementation (broken) of IFS used a header format (for IFS test images) which was very similar to microcode format, but didn’t accommodate extended signatures. This meant same IFS test image had to be duplicated for different steppings and the validation code in the driver was only looking at the primary header parameters. Going forward IFS test image headers has been tweaked to become fully compatible with microcode format. Newer IFS test image headers will use microcode_header_intel->hdrver = 2, so as to distinguish it from microcode images and older IFS test images. In light of the above, use struct microcode_header_intel directly in IFS driver instead of duplicating into a separate ifs_header structure. Further use existing microcode_sanity_check() and find_matching_signature() directly instead of implementing separate ones within the driver. More IFS specific checks will be added subsequently. Reviewed-by: Tony Luck Signed-off-by: Jithu Joseph --- drivers/platform/x86/intel/ifs/load.c | 102 +++++--------------------- 1 file changed, 19 insertions(+), 83 deletions(-) diff --git a/drivers/platform/x86/intel/ifs/load.c b/drivers/platform/x86/intel/ifs/load.c index b88db0765311..3cb13a7aa74b 100644 --- a/drivers/platform/x86/intel/ifs/load.c +++ b/drivers/platform/x86/intel/ifs/load.c @@ -8,22 +8,9 @@ #include "ifs.h" -struct ifs_header { - u32 header_ver; - u32 blob_revision; - u32 date; - u32 processor_sig; - u32 check_sum; - u32 loader_rev; - u32 processor_flags; - u32 metadata_size; - u32 total_size; - u32 fusa_info; - u64 reserved; -}; - -#define IFS_HEADER_SIZE (sizeof(struct ifs_header)) -static struct ifs_header *ifs_header_ptr; /* pointer to the ifs image header */ +#define IFS_HEADER_SIZE (sizeof(struct microcode_header_intel)) +#define IFS_HEADER_VER 2 +static struct microcode_header_intel *ifs_header_ptr; /* pointer to the ifs image header */ static u64 ifs_hash_ptr; /* Address of ifs metadata (hash) */ static u64 ifs_test_image_ptr; /* 256B aligned address of test pattern */ static DECLARE_COMPLETION(ifs_done); @@ -118,33 +105,18 @@ static void copy_hashes_authenticate_chunks(struct work_struct *work) */ static int scan_chunks_sanity_check(struct device *dev) { - int metadata_size, curr_pkg, cpu, ret = -ENOMEM; struct ifs_data *ifsd = ifs_get_data(dev); + int curr_pkg, cpu, ret = -ENOMEM; bool *package_authenticated; struct ifs_work local_work; - char *test_ptr; package_authenticated = kcalloc(topology_max_packages(), sizeof(bool), GFP_KERNEL); if (!package_authenticated) return ret; - metadata_size = ifs_header_ptr->metadata_size; - /* Spec says that if the Meta Data Size = 0 then it should be treated as 2000 */ - if (metadata_size == 0) - metadata_size = 2000; - - /* Scan chunk start must be 256 byte aligned */ - if ((metadata_size + IFS_HEADER_SIZE) % 256) { - dev_err(dev, "Scan pattern offset within the binary is not 256 byte aligned\n"); - return -EINVAL; - } - - test_ptr = (char *)ifs_header_ptr + IFS_HEADER_SIZE + metadata_size; ifsd->loading_error = false; - - ifs_test_image_ptr = (u64)test_ptr; - ifsd->loaded_version = ifs_header_ptr->blob_revision; + ifsd->loaded_version = ifs_header_ptr->rev; /* copy the scan hash and authenticate per package */ cpus_read_lock(); @@ -171,67 +143,32 @@ static int scan_chunks_sanity_check(struct device *dev) return ret; } -static int ifs_sanity_check(struct device *dev, - const struct microcode_header_intel *mc_header) +static int ifs_image_sanity_check(struct device *dev, const struct microcode_header_intel *data) { - unsigned long total_size, data_size; - u32 sum, *mc; - - total_size = get_totalsize(mc_header); - data_size = get_datasize(mc_header); + struct ucode_cpu_info uci; - if ((data_size + MC_HEADER_SIZE > total_size) || (total_size % sizeof(u32))) { - dev_err(dev, "bad ifs data file size.\n"); + if (data->hdrver != IFS_HEADER_VER) { + dev_err(dev, "Header version %d not supported\n", data->hdrver); return -EINVAL; } - if (mc_header->ldrver != 1 || mc_header->hdrver != 1) { - dev_err(dev, "invalid/unknown ifs update format.\n"); + if (microcode_intel_sanity_check((void *)data, true, IFS_HEADER_VER)) { + dev_err(dev, "sanity check failed\n"); return -EINVAL; } - mc = (u32 *)mc_header; - sum = 0; - for (int i = 0; i < total_size / sizeof(u32); i++) - sum += mc[i]; + intel_cpu_collect_info(&uci); - if (sum) { - dev_err(dev, "bad ifs data checksum, aborting.\n"); + if (!microcode_intel_find_matching_signature((void *)data, + uci.cpu_sig.sig, + uci.cpu_sig.pf)) { + dev_err(dev, "cpu signature, pf not matching\n"); return -EINVAL; } return 0; } -static bool find_ifs_matching_signature(struct device *dev, struct ucode_cpu_info *uci, - const struct microcode_header_intel *shdr) -{ - unsigned int mc_size; - - mc_size = get_totalsize(shdr); - - if (!mc_size || ifs_sanity_check(dev, shdr) < 0) { - dev_err(dev, "ifs sanity check failure\n"); - return false; - } - - if (!intel_cpu_signatures_match(uci->cpu_sig.sig, uci->cpu_sig.pf, shdr->sig, shdr->pf)) { - dev_err(dev, "ifs signature, pf not matching\n"); - return false; - } - - return true; -} - -static bool ifs_image_sanity_check(struct device *dev, const struct microcode_header_intel *data) -{ - struct ucode_cpu_info uci; - - intel_cpu_collect_info(&uci); - - return find_ifs_matching_signature(dev, &uci, data); -} - /* * Load ifs image. Before loading ifs module, the ifs image must be located * in /lib/firmware/intel/ifs and named as {family/model/stepping}.{testname}. @@ -252,12 +189,11 @@ int ifs_load_firmware(struct device *dev) goto done; } - if (!ifs_image_sanity_check(dev, (struct microcode_header_intel *)fw->data)) { - dev_err(dev, "ifs header sanity check failed\n"); + ret = ifs_image_sanity_check(dev, (struct microcode_header_intel *)fw->data); + if (ret) goto release; - } - ifs_header_ptr = (struct ifs_header *)fw->data; + ifs_header_ptr = (struct microcode_header_intel *)fw->data; ifs_hash_ptr = (u64)(ifs_header_ptr + 1); ret = scan_chunks_sanity_check(dev); From patchwork Fri Oct 21 20:34:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jithu Joseph X-Patchwork-Id: 6974 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp892898wrr; Fri, 21 Oct 2022 13:41:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7ZMpLOtbAo79jystp9P9mtYBckTVxwSa35rydYNZfGT7JoPARKOVhHSLxv75ZvgXmWTjOX X-Received: by 2002:a05:6a00:1145:b0:52b:78c:fa26 with SMTP id b5-20020a056a00114500b0052b078cfa26mr20926706pfm.27.1666384902990; Fri, 21 Oct 2022 13:41:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666384902; cv=none; d=google.com; s=arc-20160816; b=ddY20ORbICjh9LxYHX/ONXhu3TW2hztCuiSL1z9t42aGGJclMsJpbSwtBFNVWmaW1m F+ZzDU8K687lE6hAhclGLC1x3GgvOGJnC0d5udcR7IS9kWx8oGrP+1D3kYZJ9a9aC5ig 6z2Yq53AdcjgqBISDYMBQi4MF6+TkStOWKw+vzLtceokvFzYBrZLjbcvg/irkSzJqkEv LlkaAkopaKP3DchzVi1tpvFksdBkitY8sd0cacD7XuKoqJSd0iMLIpJMMPhBZUN5HGQD 9/hPDhBpb6q1f7qB2166Fk0qb9CNAzIE922+7eqDwyG5Es90kC+wzfOZ+02nZiwqpOd0 EbBg== 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=Z+yZHNThK7iJ2p3T0IsRbGRcZYPTRbFRyuBjvodZPUE=; b=jEBzbRrsu+oX8BScUnNJPGjgj86b/FWIizbSaQPh23nxhN8AYbmFoTEoIhFz4zZqla Br0VrEfX9xH9borNoNkxcNmIo1vx9nf09Rq7LquQl/R6vwXcHEvALhixpe0YhDge8haP EZwgoJVnoBMSRHzKO5yUM5RXR1gotZU5jh5+GBHw/Et95COYmu04cWFLGroM/azNAO3q vfF7fVYt+puC/ePPTjR9OtAtZ7de4aJ7xMZLYyKlGtFwueYRcgDEZHlZBnSi+t+bbB5g GNgov7XMYWyl8SXFceI9BO074pctH23JFehZnRzUTIBqt4ISawtjIaqhhZq/iuHaEgn/ 9P3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=F5YEumW1; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b1-20020a170902b60100b0017ebdf9ca1bsi23485521pls.464.2022.10.21.13.41.28; Fri, 21 Oct 2022 13:41:42 -0700 (PDT) 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=F5YEumW1; 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 S230041AbiJUUkv (ORCPT + 99 others); Fri, 21 Oct 2022 16:40:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229920AbiJUUkA (ORCPT ); Fri, 21 Oct 2022 16:40:00 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB64258E8B; Fri, 21 Oct 2022 13:39:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666384798; x=1697920798; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=4GA/zUmUAfO1cKUlriGt7rRQ7snnRf1VH62DtYVeQqU=; b=F5YEumW103h9PwFevZ8bDQVi2jMiBxPuk74jCeq0YBGAYJQ5bTsRiYGq O9cgXw+RnLuIvC2jfB28g9mZ5x0rW1xWUekjAYjjjiPn3UWXOJ5kn+KN4 cXjevD4wfTKug4ZepdFcTsM8+a5GXg+ZmyeVA0zjlbVaBXzOVpZ8yCw6g R5awvpSaHl6gsM2M752pFJ3MpgQqi0k2Ji9Wjns+PQj09nf6Wjy7x5UuN UuHfntvcJzhq2HWCCPKsUDMbqsRkNLZa27VreBtPUnH7lXHZdxqmr6Anj SETlw0b2M5A/0mJtBzXGps5+prjdLJMBsyutSVHdtOvx0sTdqeIU1lN+b A==; X-IronPort-AV: E=McAfee;i="6500,9779,10507"; a="369161184" X-IronPort-AV: E=Sophos;i="5.95,203,1661842800"; d="scan'208";a="369161184" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2022 13:35:36 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10507"; a="735701029" X-IronPort-AV: E=Sophos;i="5.95,203,1661842800"; d="scan'208";a="735701029" Received: from jithujos.sc.intel.com ([172.25.103.66]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2022 13:35:36 -0700 From: Jithu Joseph To: hdegoede@redhat.com, markgross@kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, gregkh@linuxfoundation.org, jithu.joseph@intel.com, ashok.raj@intel.com, tony.luck@intel.com, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, patches@lists.linux.dev, ravi.v.shankar@intel.com, thiago.macieira@intel.com, athenas.jimenez.gonzalez@intel.com Subject: [PATCH 10/14] platform/x86/intel/ifs: Add metadata validation Date: Fri, 21 Oct 2022 13:34:09 -0700 Message-Id: <20221021203413.1220137-11-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221021203413.1220137-1-jithu.joseph@intel.com> References: <20221021203413.1220137-1-jithu.joseph@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.6 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,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?1747331215878125259?= X-GMAIL-MSGID: =?utf-8?q?1747331215878125259?= The data portion of IFS test image file contains a meta-data structure in addition to test data and hashes. Introduce the layout of this meta_data structure and validate the sanity of certain fields of the new-image before loading. Tweak references to IFS test image chunks to reflect the updated layout of the test image. Reviewed-by: Tony Luck Signed-off-by: Jithu Joseph --- drivers/platform/x86/intel/ifs/ifs.h | 2 + drivers/platform/x86/intel/ifs/load.c | 54 +++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/drivers/platform/x86/intel/ifs/ifs.h b/drivers/platform/x86/intel/ifs/ifs.h index be37512535f2..bb43fd65d2d2 100644 --- a/drivers/platform/x86/intel/ifs/ifs.h +++ b/drivers/platform/x86/intel/ifs/ifs.h @@ -196,6 +196,7 @@ union ifs_status { * @valid_chunks: number of chunks which could be validated. * @status: it holds simple status pass/fail/untested * @scan_details: opaque scan status code from h/w + * @cur_batch: suffix indicating the currently loaded test file */ struct ifs_data { int integrity_cap_bit; @@ -205,6 +206,7 @@ struct ifs_data { int valid_chunks; int status; u64 scan_details; + int cur_batch; }; struct ifs_work { diff --git a/drivers/platform/x86/intel/ifs/load.c b/drivers/platform/x86/intel/ifs/load.c index 3cb13a7aa74b..d300cf3ce5bd 100644 --- a/drivers/platform/x86/intel/ifs/load.c +++ b/drivers/platform/x86/intel/ifs/load.c @@ -8,8 +8,24 @@ #include "ifs.h" +struct meta_data { + unsigned int meta_type; // metadata type + unsigned int meta_size; // size of this entire struct including hdrs. + unsigned int test_type; // IFS test type + unsigned int fusa_info; // Fusa info + unsigned int total_images; // Total number of images + unsigned int current_image; // Current Image # + unsigned int total_chunks; // Total number of chunks in this image + unsigned int starting_chunk; // Starting chunk number in this image + unsigned int size_per_chunk; // size of each chunk + unsigned int chunks_per_stride; // number of chunks in a stride + unsigned int reserved[54]; // Align to 256 bytes for chunk alignment. +}; + #define IFS_HEADER_SIZE (sizeof(struct microcode_header_intel)) #define IFS_HEADER_VER 2 +#define META_TYPE_IFS 1 +#define IFS_CHUNK_ALIGNMENT 256 static struct microcode_header_intel *ifs_header_ptr; /* pointer to the ifs image header */ static u64 ifs_hash_ptr; /* Address of ifs metadata (hash) */ static u64 ifs_test_image_ptr; /* 256B aligned address of test pattern */ @@ -98,6 +114,41 @@ static void copy_hashes_authenticate_chunks(struct work_struct *work) complete(&ifs_done); } +static int validate_ifs_metadata(struct device *dev) +{ + struct ifs_data *ifsd = ifs_get_data(dev); + struct meta_data *ifs_meta; + char test_file[64]; + int ret = -EINVAL; + + snprintf(test_file, sizeof(test_file), "%02x-%02x-%02x-%02x.scan", + boot_cpu_data.x86, boot_cpu_data.x86_model, + boot_cpu_data.x86_stepping, ifsd->cur_batch); + + ifs_meta = (struct meta_data *)microcode_intel_find_meta_data(ifs_header_ptr, + META_TYPE_IFS); + if (!ifs_meta) { + dev_err(dev, "IFS Metadata missing in file %s\n", test_file); + return ret; + } + + ifs_test_image_ptr = (u64)ifs_meta + sizeof(struct meta_data); + + /* Scan chunk start must be 256 byte aligned */ + if (!IS_ALIGNED(ifs_test_image_ptr, IFS_CHUNK_ALIGNMENT)) { + dev_err(dev, "Scan pattern offset is not 256 byte aligned in %s\n", test_file); + return ret; + } + + if (ifs_meta->current_image != ifsd->cur_batch) { + dev_warn(dev, "Suffix metadata is not matching with filename %s(0x%02x)\n", + test_file, ifs_meta->current_image); + return ret; + } + + return 0; +} + /* * IFS requires scan chunks authenticated per each socket in the platform. * Once the test chunk is authenticated, it is automatically copied to secured memory @@ -114,6 +165,9 @@ static int scan_chunks_sanity_check(struct device *dev) if (!package_authenticated) return ret; + ret = validate_ifs_metadata(dev); + if (ret) + return ret; ifsd->loading_error = false; ifsd->loaded_version = ifs_header_ptr->rev; From patchwork Fri Oct 21 20:34:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jithu Joseph X-Patchwork-Id: 6981 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp893297wrr; Fri, 21 Oct 2022 13:42:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6H6V79/PDQYYQrm7IuF/5uYG0v1KrgGkkaF2sMxK11/SZ/ewNCrGbY3vMVdFnXG9YSZnUq X-Received: by 2002:a17:90b:1a88:b0:20d:8df0:ac63 with SMTP id ng8-20020a17090b1a8800b0020d8df0ac63mr55681111pjb.206.1666384956552; Fri, 21 Oct 2022 13:42:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666384956; cv=none; d=google.com; s=arc-20160816; b=IzEW57l8mCq7+BX7VLpe09F5zo0KkFDYxVs0GSJx1NnMXDn3YSp1/ZLzVG8dh3s9nl FdD6ltN2rXfbkmkZP/qdso94tl6ylMFBzm4DMbDDoTFX2+u29+E8CVfPrbS6Nrry+NYe DIrRrPYjyM93LLORdURJXi0tzNDyVjPSr3/oARrHt/ONrEKrVehAeGWIpzVrbR/YuET7 Bz4iZy+HPZRjYqYg+e0GnlCALgu28XzNuTITXkUJ0GUJN+5GumEkw2Y+v5UuoyRJ5j7W U1Gj0dtWfT6eOJJpFtDz7bhajnusykCJ4m5zQYntmUcBZGidrwS+rWOA/8yu5WW5TYeF /3ug== 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=ewcANpLHOWqlDYSel/X2IrgKl24tQyH2UwtYKbMQSnY=; b=i10Cuy7T08s6HqB63Y0VcmTfjODLgGYov99XNUnSJEOTWB9jORFz4TMLQIsSnNR8Eo E8Ajj97Xy+oYBiWdqH5rCfCjwSl/ivjGx0jlabf0vPkFq4v8XCil4NcXLblgmINdaP05 KSa2ML6cy43vvpy+0kXJWJRSQuNubWQBIX/b5OmOefSWuJqH2LXWoiZPhgR68c/mT9n4 sM1h066g8I95WLSj0F4fqHvl2N1zbd9DgWSySxUojIU/o7PZcffOyGOYMildBrswHKvs SmUsMbgmrEebLo3y5/rSIPARqrYtcqA5cagWrKmRXSAXasTlO0pRjSLflBmpzOqMzozg dxcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Bmbxgweg; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k15-20020a170902d58f00b00176806795b7si25675015plh.351.2022.10.21.13.42.23; Fri, 21 Oct 2022 13:42:36 -0700 (PDT) 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=Bmbxgweg; 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 S229670AbiJUUlR (ORCPT + 99 others); Fri, 21 Oct 2022 16:41:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229861AbiJUUkL (ORCPT ); Fri, 21 Oct 2022 16:40:11 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 301CD98370; Fri, 21 Oct 2022 13:40:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666384800; x=1697920800; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=sr0b38xXZ200FAk2bInFJdfJNKcjZ4q1uNqY7iCbQH8=; b=Bmbxgweg1QwBJ/TXvIdRzNgRDoW8TApnKfSu8zRPVCt56UdqD9bIbFtB +27uxEGzAJpjsYyZfnEGEUt07VKnwe2g9+y36NHH5auNCWdT7NYXvuS1e 2dJe1+k2ZizI8QpwL5sfH8l83VYfiJQk7VqIbtHjZgoLiomVikaBUfJIB +jDYtPZECo/JIgL8/DcGeeeoKPU2qk+seXE6PHpXUXuhp2WtPxeHAtoxa 9ye1Nuz3gU3NXYsluvwKmNf3KtKAVR2RW15/eKEE3zwNd9Qe45nteZSy+ XB3j7pnmHH6C4Y6V8DD7xzSh1xATmGmG8banrwISfTBpi+uuKdEUswKLs A==; X-IronPort-AV: E=McAfee;i="6500,9779,10507"; a="369161187" X-IronPort-AV: E=Sophos;i="5.95,203,1661842800"; d="scan'208";a="369161187" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2022 13:35:36 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10507"; a="735701033" X-IronPort-AV: E=Sophos;i="5.95,203,1661842800"; d="scan'208";a="735701033" Received: from jithujos.sc.intel.com ([172.25.103.66]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2022 13:35:36 -0700 From: Jithu Joseph To: hdegoede@redhat.com, markgross@kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, gregkh@linuxfoundation.org, jithu.joseph@intel.com, ashok.raj@intel.com, tony.luck@intel.com, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, patches@lists.linux.dev, ravi.v.shankar@intel.com, thiago.macieira@intel.com, athenas.jimenez.gonzalez@intel.com Subject: [PATCH 11/14] platform/x86/intel/ifs: Remove reload sysfs entry Date: Fri, 21 Oct 2022 13:34:10 -0700 Message-Id: <20221021203413.1220137-12-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221021203413.1220137-1-jithu.joseph@intel.com> References: <20221021203413.1220137-1-jithu.joseph@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.6 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,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?1747331272330861188?= X-GMAIL-MSGID: =?utf-8?q?1747331272330861188?= Reload sysfs entry is replaced by current_batch, drop it. Reviewed-by: Tony Luck Signed-off-by: Jithu Joseph --- drivers/platform/x86/intel/ifs/sysfs.c | 28 -------------------------- 1 file changed, 28 deletions(-) diff --git a/drivers/platform/x86/intel/ifs/sysfs.c b/drivers/platform/x86/intel/ifs/sysfs.c index 766cee651bd6..e077910c5d28 100644 --- a/drivers/platform/x86/intel/ifs/sysfs.c +++ b/drivers/platform/x86/intel/ifs/sysfs.c @@ -87,33 +87,6 @@ static ssize_t run_test_store(struct device *dev, static DEVICE_ATTR_WO(run_test); -/* - * Reload the IFS image. When user wants to install new IFS image - */ -static ssize_t reload_store(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) -{ - bool res; - int rc; - - if (kstrtobool(buf, &res)) - return -EINVAL; - if (!res) - return count; - - if (down_interruptible(&ifs_sem)) - return -EINTR; - - rc = ifs_load_firmware(dev); - - up(&ifs_sem); - - return (rc == 0) ? count : rc; -} - -static DEVICE_ATTR_WO(reload); - /* * Display currently loaded IFS image version. */ @@ -135,7 +108,6 @@ static struct attribute *plat_ifs_attrs[] = { &dev_attr_details.attr, &dev_attr_status.attr, &dev_attr_run_test.attr, - &dev_attr_reload.attr, &dev_attr_image_version.attr, NULL }; From patchwork Fri Oct 21 20:34:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jithu Joseph X-Patchwork-Id: 6980 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp893285wrr; Fri, 21 Oct 2022 13:42:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6YgE53KFLd1fhDzZpNl91TnDnh3NsJD86s+dNSB8e46W2FQn9y+kDRhaoBJek+yI6hYcek X-Received: by 2002:a65:42c7:0:b0:462:7158:c863 with SMTP id l7-20020a6542c7000000b004627158c863mr18057717pgp.590.1666384963899; Fri, 21 Oct 2022 13:42:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666384963; cv=none; d=google.com; s=arc-20160816; b=cB2G8eTNGsnoIYWiIXhwCCszaKWTdW7B0iR3f/Jg5ij/5SK9XxDG1RQxJbUp89445V Zt1Y6rjoG6pGRbwUv0gwVjWeZwwTwyUPuYQ6LKuyVQ4K/T3ePcHGy57Kp2z6EiBHhQ9E bCYCqBb9X74v82iACiZY25Dm0vHP36JVA81u6NoMskm1iXwItTZmDmjv2KwpKKM6y5R/ 4nDwUHBxPxUx98owQpSCC9E8vpVFgwtlVZvRdWR7/CB1+ZdmqctJda+jBqPTuqwDaKQf d4YAYIlUpegiehukw50w8KKMan4k+oHVPu/nFMDpARy26lKnNgh0MxKBOiBVcU2Bb0fJ faRA== 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=pl3+eiwUbTjxsDQGe6JiraF8j9uzN1ZJUlR9J/7GeDY=; b=Zzn5d2frdNB6/APTZhN9BJ19LZRyeP+tV6buqj8+giyqs2Mq7un+hD+B+zuGdz4k/m Be/qfsUJ6GcYnJCbVLN/6YySdiyrZfxytLz+ogJbBa+CGInqn/LLWVr7PMHG9xqvgKqb nxxsw2tZw3LEBQS8lv8M9/T1OyrFbh/yk1Q5jtfQ4yhPokKC9lzS/ucLuYrcIbFWMAZK 7vL0wzx5NaZKEtsluXz0/z3LOCr+Cvr5txxWKAXqoHJDtDb8OxEuMUwzDQX7Vdq2GFOA J2MGxD3Vn23N8Q+XLpJvKsHnR62jphr38ycBJDsQL7l8k3YrXSQ4LTKE4Xj4C6EZuMZe iUUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hpp2nuRW; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q13-20020a17090311cd00b00172f8a4b3e1si29130011plh.81.2022.10.21.13.42.31; Fri, 21 Oct 2022 13:42:43 -0700 (PDT) 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=hpp2nuRW; 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 S229510AbiJUUlY (ORCPT + 99 others); Fri, 21 Oct 2022 16:41:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229846AbiJUUkL (ORCPT ); Fri, 21 Oct 2022 16:40:11 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 305C798C8E; Fri, 21 Oct 2022 13:40:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666384800; x=1697920800; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=SAhT/BSzRTox0MsInHG55JZ6ufYQDkhSIvOxY17CTAQ=; b=hpp2nuRWqPfO+WDqoXZMfatzB+jg6gpICs4KwPwW7mv6hqgmSjz4UHNR t18TpUOPJwjb4vsO+PqW3/S/4DbyXHztZpFRXnH29QQxPyuiunepBwjfg /yuyuWZlMj3b9HX2hkT9rovH1GGfyu8xBqxaSTufNGXmTy5+LO3Ph86C7 JVZ6DAa5rHguESsDFOaIIG9aTkflw5y0GCj2IgM/TDd5q14pAR+p9ltxJ Dmf1QkMFVv8iRNs+oEjMnUKYy/o9k+RDsvnZijbHlAvYQsiUaJ0pXm2gI y6JCcUkBXJIrB37jhEDl74dnE8PCwi82fpYveWEhDWAkCMxF0TZtWqtKL A==; X-IronPort-AV: E=McAfee;i="6500,9779,10507"; a="369161191" X-IronPort-AV: E=Sophos;i="5.95,203,1661842800"; d="scan'208";a="369161191" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2022 13:35:37 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10507"; a="735701040" X-IronPort-AV: E=Sophos;i="5.95,203,1661842800"; d="scan'208";a="735701040" Received: from jithujos.sc.intel.com ([172.25.103.66]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2022 13:35:36 -0700 From: Jithu Joseph To: hdegoede@redhat.com, markgross@kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, gregkh@linuxfoundation.org, jithu.joseph@intel.com, ashok.raj@intel.com, tony.luck@intel.com, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, patches@lists.linux.dev, ravi.v.shankar@intel.com, thiago.macieira@intel.com, athenas.jimenez.gonzalez@intel.com Subject: [PATCH 12/14] platform/x86/intel/ifs: Add current_batch sysfs entry Date: Fri, 21 Oct 2022 13:34:11 -0700 Message-Id: <20221021203413.1220137-13-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221021203413.1220137-1-jithu.joseph@intel.com> References: <20221021203413.1220137-1-jithu.joseph@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.6 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,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?1747331279893101578?= X-GMAIL-MSGID: =?utf-8?q?1747331279893101578?= Initial implementation assumed a single IFS test image file with a fixed name ff-mm-ss.scan. (where ff, mm, ss refers to family, model and stepping of the core) Subsequently, it became evident that supporting more than one test image file is needed to provide more comprehensive test coverage. (Test coverage in this scenario refers to testing more transistors in the core to identify faults) The other alternative of increasing the size of a single scan test image file would not work as the upper bound is limited by the size of memory area reserved by BIOS for loading IFS test image. Introduce "current_batch" file which accepts a number. Writing a number to the current_batch file would load the test image file by name ff-mm-ss-.scan, where is the number written to the "current_batch" file in hex. Range check of the input is done to verify it not greater than 0xff. For e.g if the scan test image comprises of 6 files, they would be named as show below: 06-8f-06-01.scan 06-8f-06-02.scan 06-8f-06-03.scan 06-8f-06-04.scan 06-8f-06-05.scan 06-8f-06-06.scan And writing 3 to current_batch would result in loading 06-8f-06-03.scan in the above e.g. The file can also be read to know the currently loaded file. And testing a system looks like: for each scan file do load the IFS test image file (write to the batch file) for each core do test the core with this set of tests done done Qualify few error messages with the test image file suffix to provide better context. Reviewed-by: Tony Luck Signed-off-by: Jithu Joseph --- drivers/platform/x86/intel/ifs/ifs.h | 21 +++++++++---- drivers/platform/x86/intel/ifs/core.c | 1 + drivers/platform/x86/intel/ifs/load.c | 14 +++++---- drivers/platform/x86/intel/ifs/runtest.c | 10 ++++--- drivers/platform/x86/intel/ifs/sysfs.c | 38 ++++++++++++++++++++++++ 5 files changed, 70 insertions(+), 14 deletions(-) diff --git a/drivers/platform/x86/intel/ifs/ifs.h b/drivers/platform/x86/intel/ifs/ifs.h index bb43fd65d2d2..7651558c218e 100644 --- a/drivers/platform/x86/intel/ifs/ifs.h +++ b/drivers/platform/x86/intel/ifs/ifs.h @@ -33,13 +33,23 @@ * The driver loads the tests into memory reserved BIOS local to each CPU * socket in a two step process using writes to MSRs to first load the * SHA hashes for the test. Then the tests themselves. Status MSRs provide - * feedback on the success/failure of these steps. When a new test file - * is installed it can be loaded by writing to the driver reload file:: + * feedback on the success/failure of these steps. * - * # echo 1 > /sys/devices/virtual/misc/intel_ifs_0/reload + * The test files are kept in a fixed location: /lib/firmware/intel/ifs_0/ + * For e.g if there are 3 test files, they would be named in the following + * fashion: + * ff-mm-ss-01.scan + * ff-mm-ss-02.scan + * ff-mm-ss-03.scan + * (where ff refers to family, mm indicates model and ss indicates stepping) * - * Similar to microcode, the current version of the scan tests is stored - * in a fixed location: /lib/firmware/intel/ifs.0/family-model-stepping.scan + * A different testfile can be loaded by writing the numerical portion + * (e.g 1, 2 or 3 in the above scenario) into the curent_batch file. + * To load ff-mm-ss-02.scan, the following command can be used:: + * + * # echo 2 > /sys/devices/virtual/misc/intel_ifs_0/current_batch + * + * The above file can also be read to know the currently loaded image. * * Running tests * ------------- @@ -207,6 +217,7 @@ struct ifs_data { int status; u64 scan_details; int cur_batch; + int test_num; }; struct ifs_work { diff --git a/drivers/platform/x86/intel/ifs/core.c b/drivers/platform/x86/intel/ifs/core.c index 5fb7f655c291..1f040837e8eb 100644 --- a/drivers/platform/x86/intel/ifs/core.c +++ b/drivers/platform/x86/intel/ifs/core.c @@ -22,6 +22,7 @@ MODULE_DEVICE_TABLE(x86cpu, ifs_cpu_ids); static struct ifs_device ifs_device = { .data = { .integrity_cap_bit = MSR_INTEGRITY_CAPS_PERIODIC_BIST_BIT, + .test_num = 0, }, .misc = { .name = "intel_ifs_0", diff --git a/drivers/platform/x86/intel/ifs/load.c b/drivers/platform/x86/intel/ifs/load.c index d300cf3ce5bd..abc217da3e55 100644 --- a/drivers/platform/x86/intel/ifs/load.c +++ b/drivers/platform/x86/intel/ifs/load.c @@ -225,17 +225,18 @@ static int ifs_image_sanity_check(struct device *dev, const struct microcode_hea /* * Load ifs image. Before loading ifs module, the ifs image must be located - * in /lib/firmware/intel/ifs and named as {family/model/stepping}.{testname}. + * in /lib/firmware/intel/ifs_x/ and named as family-model-stepping-02x.{testname}. */ int ifs_load_firmware(struct device *dev) { struct ifs_data *ifsd = ifs_get_data(dev); const struct firmware *fw; - char scan_path[32]; - int ret; + char scan_path[64]; + int ret = -EINVAL; - snprintf(scan_path, sizeof(scan_path), "intel/ifs/%02x-%02x-%02x.scan", - boot_cpu_data.x86, boot_cpu_data.x86_model, boot_cpu_data.x86_stepping); + snprintf(scan_path, sizeof(scan_path), "intel/ifs_%d/%02x-%02x-%02x-%02x.scan", + ifsd->test_num, boot_cpu_data.x86, boot_cpu_data.x86_model, + boot_cpu_data.x86_stepping, ifsd->cur_batch); ret = request_firmware_direct(&fw, scan_path, dev); if (ret) { @@ -251,6 +252,9 @@ int ifs_load_firmware(struct device *dev) ifs_hash_ptr = (u64)(ifs_header_ptr + 1); ret = scan_chunks_sanity_check(dev); + if (ret) + dev_err(dev, "Load failure for batch: %02x\n", ifsd->cur_batch); + release: release_firmware(fw); done: diff --git a/drivers/platform/x86/intel/ifs/runtest.c b/drivers/platform/x86/intel/ifs/runtest.c index b2ca2bb4501f..0bfd8fcdd7e8 100644 --- a/drivers/platform/x86/intel/ifs/runtest.c +++ b/drivers/platform/x86/intel/ifs/runtest.c @@ -78,14 +78,16 @@ static void message_not_tested(struct device *dev, int cpu, union ifs_status sta static void message_fail(struct device *dev, int cpu, union ifs_status status) { + struct ifs_data *ifsd = ifs_get_data(dev); + /* * control_error is set when the microcode runs into a problem * loading the image from the reserved BIOS memory, or it has * been corrupted. Reloading the image may fix this issue. */ if (status.control_error) { - dev_err(dev, "CPU(s) %*pbl: could not execute from loaded scan image\n", - cpumask_pr_args(cpu_smt_mask(cpu))); + dev_err(dev, "CPU(s) %*pbl: could not execute from loaded scan image. Batch: %02x version: 0x%x\n", + cpumask_pr_args(cpu_smt_mask(cpu)), ifsd->cur_batch, ifsd->loaded_version); } /* @@ -96,8 +98,8 @@ static void message_fail(struct device *dev, int cpu, union ifs_status status) * the core being tested. */ if (status.signature_error) { - dev_err(dev, "CPU(s) %*pbl: test signature incorrect.\n", - cpumask_pr_args(cpu_smt_mask(cpu))); + dev_err(dev, "CPU(s) %*pbl: test signature incorrect. Batch: %02x version: 0x%x\n", + cpumask_pr_args(cpu_smt_mask(cpu)), ifsd->cur_batch, ifsd->loaded_version); } } diff --git a/drivers/platform/x86/intel/ifs/sysfs.c b/drivers/platform/x86/intel/ifs/sysfs.c index e077910c5d28..e6e5fb2b7fc0 100644 --- a/drivers/platform/x86/intel/ifs/sysfs.c +++ b/drivers/platform/x86/intel/ifs/sysfs.c @@ -87,6 +87,43 @@ static ssize_t run_test_store(struct device *dev, static DEVICE_ATTR_WO(run_test); +static ssize_t current_batch_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct ifs_data *ifsd = ifs_get_data(dev); + int cur_batch; + int rc; + + rc = kstrtouint(buf, 0, &cur_batch); + if (rc < 0 || cur_batch > 0xff) + return -EINVAL; + + if (down_interruptible(&ifs_sem)) + return -EINTR; + + ifsd->cur_batch = cur_batch; + + rc = ifs_load_firmware(dev); + + up(&ifs_sem); + + return (rc == 0) ? count : rc; +} + +static ssize_t current_batch_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct ifs_data *ifsd = ifs_get_data(dev); + + if (!ifsd->loaded) + return sysfs_emit(buf, "%s\n", "none"); + else + return sysfs_emit(buf, "0x%02x\n", ifsd->cur_batch); +} + +static DEVICE_ATTR_RW(current_batch); + /* * Display currently loaded IFS image version. */ @@ -108,6 +145,7 @@ static struct attribute *plat_ifs_attrs[] = { &dev_attr_details.attr, &dev_attr_status.attr, &dev_attr_run_test.attr, + &dev_attr_current_batch.attr, &dev_attr_image_version.attr, NULL }; From patchwork Fri Oct 21 20:34:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jithu Joseph X-Patchwork-Id: 6983 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp893474wrr; Fri, 21 Oct 2022 13:43:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7I1+fZOYfBJFFFkq/2af/bsPAz5cupe2ZLktoy4oXfur4goaQ0Ai49KeSSggu83Mdpcvou X-Received: by 2002:a17:90b:4d8b:b0:20a:e256:fdd8 with SMTP id oj11-20020a17090b4d8b00b0020ae256fdd8mr59418598pjb.4.1666385003501; Fri, 21 Oct 2022 13:43:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666385003; cv=none; d=google.com; s=arc-20160816; b=jtqVi+EhTRJ8WPGAYAxXbj1ipPjWa98AmYPLPCFs3MwyS172u/hWf/xMUWkohtT1zs z3gK94MwKgdz0RuXLTL1n/uIIhgCXlDUMqMPERlG9ixevIZEwyY+88yfKl2kMPfZLB3d y0xnZ2DbGjfh8mRj7D10yrObsosbmqJ/2Pi6/UDgDNGrEW/9u/sq607AZtRv7v70tLpS 1aD4+WWXDyJMKoqiE336Vq5rC4DlwMH4YrDR6fVfUJVnlwEPswWug/DEuobVmXKst+Ka H8ZhbGEKiSzHTZIUEGi7nU6EctB9b2IhoyJSeMo5JTkzGFCPKYndKUbbmg4b8rkpNpXg 2suA== 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=5vzy3W/AXxWZWcRGhk5sbJ6IZY0ZaMmw6BJOrnDNCts=; b=aSiYB6wNcwT2LMafnDjDqK60o/bSMCPwqu4doK2qjXr23jBT0jNWOdgJSwB4la3jHq YIRHHKmhX92YgPtak28B3lFuvScdvOKwHXAd43UG3JlU0k/5XERsX2ZCZuBFRButOUCZ n2+yXx/7vvOPGvjD61gevHdhqeVKre5sRyXM4yeGBqt2TTz4bxrGmp1+Z7NmI8FJaEcc x/r3gYG3AmNNxRTbhSY3i7jJGzZ6KF6ILwiOHqsfU025oUqOOIW9G9XyK/rq0lBuTCM9 HIW7Q+HnqxC5yeaF044fRdwP6vbPVC3e9c9K42bi4SKuuJWcbbPd4qk5SIOnzEFR6Iot aoJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=CMbYtpih; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u5-20020a637905000000b00434c2c0a834si26559783pgc.734.2022.10.21.13.43.10; Fri, 21 Oct 2022 13:43:23 -0700 (PDT) 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=CMbYtpih; 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 S230316AbiJUUlK (ORCPT + 99 others); Fri, 21 Oct 2022 16:41:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229904AbiJUUkL (ORCPT ); Fri, 21 Oct 2022 16:40:11 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 306EA9A9D0; Fri, 21 Oct 2022 13:40:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666384800; x=1697920800; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ieAw6DOi25+M/PVVeqIKsG7UFRjhjw4Kz3UXCTTfxEQ=; b=CMbYtpihPhC9398J+dEVDSR1aQ+Nm/lV9atyaFHFHOQVe9o/mhMpTWRc UBjHu+eSOdBXTcdu9HzuuZ5NQ7ZAdJthRRGZ2nloUxJEfQAsRSFSQZ2xR UwoNciOKr3vdnwmqHfWeI7D2fhTrSJ/mpuDklgpF9W5dWdDu8H1rMxHjO +fRQzSfCUrj9qfHsvl4LaJoXWca4kvhiaPdJr6bN+NrZDGFqEC0wHkJlN a9e716SSEROyNcF7TVDlzObBJq10XJwK1MEbqG2n/a35CJDrsa5/zAPa5 vw2DgEM9POXESHvbaAN5wbU5N3qt4b7xdjs6bW++tPRihGkkJ+PntxaTL w==; X-IronPort-AV: E=McAfee;i="6500,9779,10507"; a="369161192" X-IronPort-AV: E=Sophos;i="5.95,203,1661842800"; d="scan'208";a="369161192" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2022 13:35:37 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10507"; a="735701044" X-IronPort-AV: E=Sophos;i="5.95,203,1661842800"; d="scan'208";a="735701044" Received: from jithujos.sc.intel.com ([172.25.103.66]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2022 13:35:36 -0700 From: Jithu Joseph To: hdegoede@redhat.com, markgross@kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, gregkh@linuxfoundation.org, jithu.joseph@intel.com, ashok.raj@intel.com, tony.luck@intel.com, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, patches@lists.linux.dev, ravi.v.shankar@intel.com, thiago.macieira@intel.com, athenas.jimenez.gonzalez@intel.com Subject: [PATCH 13/14] Documentation/ABI: Update IFS ABI doc Date: Fri, 21 Oct 2022 13:34:12 -0700 Message-Id: <20221021203413.1220137-14-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221021203413.1220137-1-jithu.joseph@intel.com> References: <20221021203413.1220137-1-jithu.joseph@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.6 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,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?1747331321314782951?= X-GMAIL-MSGID: =?utf-8?q?1747331321314782951?= Remove reload documentation and add current_batch documentation. Update the kernel version and date for all the entries. Reviewed-by: Tony Luck Signed-off-by: Jithu Joseph --- .../ABI/testing/sysfs-platform-intel-ifs | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-platform-intel-ifs b/Documentation/ABI/testing/sysfs-platform-intel-ifs index 486d6d2ff8a0..f74df3abee57 100644 --- a/Documentation/ABI/testing/sysfs-platform-intel-ifs +++ b/Documentation/ABI/testing/sysfs-platform-intel-ifs @@ -1,39 +1,41 @@ What: /sys/devices/virtual/misc/intel_ifs_/run_test -Date: April 21 2022 -KernelVersion: 5.19 +Date: Sept 30 2022 +KernelVersion: 6.2 Contact: "Jithu Joseph" Description: Write to trigger IFS test for one online core. Note that the test is per core. The cpu# can be for any thread on the core. Running on one thread completes the test for the core containing that thread. Example: to test the core containing cpu5: echo 5 > - /sys/devices/platform/intel_ifs./run_test + /sys/devices/virtual/misc/intel_ifs_/run_test What: /sys/devices/virtual/misc/intel_ifs_/status -Date: April 21 2022 -KernelVersion: 5.19 +Date: Sept 30 2022 +KernelVersion: 6.2 Contact: "Jithu Joseph" Description: The status of the last test. It can be one of "pass", "fail" or "untested". What: /sys/devices/virtual/misc/intel_ifs_/details -Date: April 21 2022 -KernelVersion: 5.19 +Date: Sept 30 2022 +KernelVersion: 6.2 Contact: "Jithu Joseph" Description: Additional information regarding the last test. The details file reports the hex value of the SCAN_STATUS MSR. Note that the error_code field may contain driver defined software code not defined in the Intel SDM. What: /sys/devices/virtual/misc/intel_ifs_/image_version -Date: April 21 2022 -KernelVersion: 5.19 +Date: Sept 30 2022 +KernelVersion: 6.2 Contact: "Jithu Joseph" Description: Version (hexadecimal) of loaded IFS binary image. If no scan image is loaded reports "none". -What: /sys/devices/virtual/misc/intel_ifs_/reload -Date: April 21 2022 -KernelVersion: 5.19 +What: /sys/devices/virtual/misc/intel_ifs_/current_batch +Date: Sept 30 2022 +KernelVersion: 6.2 Contact: "Jithu Joseph" -Description: Write "1" (or "y" or "Y") to reload the IFS image from - /lib/firmware/intel/ifs/ff-mm-ss.scan. +Description: Write a number less than or equal to 0xff to load an IFS test image. + The number written treated as the 2 digit suffix in the following file name: + /lib/firmware/intel/ifs_/ff-mm-ss-02x.scan + Reading the file will provide the suffix of the currently loaded IFS test image. From patchwork Fri Oct 21 20:34:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jithu Joseph X-Patchwork-Id: 6985 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp893479wrr; Fri, 21 Oct 2022 13:43:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM62jsBfOrsMT4KqLgBmWWjIxu4wUcO7nWE2asJC6OOQpE6fAQONF9ybmbM/vMsJZq3D6Hqd X-Received: by 2002:a17:90a:aa8f:b0:210:bec0:bde with SMTP id l15-20020a17090aaa8f00b00210bec00bdemr15016838pjq.109.1666384993278; Fri, 21 Oct 2022 13:43:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666384993; cv=none; d=google.com; s=arc-20160816; b=qX7KhkrB+W37rGYhhaKM+uLE1MIdoL9qfEYGHX3Mv8WZC2OwHpbHpRB7s54erQlKh0 f4EpYfxvGME0ZrI5/XUeMV+lUg0J3OD7M4zjsY+kJU4zsZZRdyc1A4xX3p7PmDOT6Wtd ccoXnejf3RkUnXHme/+awblpzJgNCE0TKSssilp3aLfgfcT6ZVUehTqkvI3fUmZjxeRw D3rL2vb7JPSv+Lr+URA+iUKlQJOEbYfdP1MTXH6SlgQbFuJMLaoAmqHZoRLkWiJduZqD ecLM7AZowBoAi9n5M3EbzNH9R8OWFsyfK7FFUxP97VPPgfir2Yyh+HR0FUf6HN8lMhPG r2kQ== 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=nWqzhDkq3Ke2HiAI93PvLqGpeaf3XxZni0fi5297azU=; b=z6os7kDZmTKz1DVJVVu95xF2w/Biz1AYD2nQcmX4sq31Kl3Z/Hvwu2VpW3BbKZ5Gax ugBDUWiIqrPipTDEXw/0eHkTwEelglXkuRc4Ha8ufCDEK1l3a5ht/Z+LYVEgpP2tgz19 BIHLCXWjOK83LWXyaK9Vo4DX8B/kMzzgSFw1jvcuyCdAM9on3LW/AHh5whYAW9A///HA gcvzfEYCgo0qOqG2Ln9SW+am7Zy5aoB/IiPRm2d3DklGMKjSYL599Zq6SljzKZqTgFus ecsHAGz1V9B6crtNIvxjFeoRmR8eBSGH18cBi1Dso4FSf/E3fruKVGs/6bH7J5NxkvaR Zbtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=OV1x9cnG; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x14-20020a63484e000000b0046ebb90ea5fsi3211257pgk.359.2022.10.21.13.43.00; Fri, 21 Oct 2022 13:43:13 -0700 (PDT) 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=OV1x9cnG; 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 S230178AbiJUUl3 (ORCPT + 99 others); Fri, 21 Oct 2022 16:41:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229484AbiJUUkQ (ORCPT ); Fri, 21 Oct 2022 16:40:16 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C78846202; Fri, 21 Oct 2022 13:40:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666384805; x=1697920805; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=DyrS883OR7AFX4gN5EeEXTzT5dUJ/TdR0BLm14KTOTM=; b=OV1x9cnGuoy4TAKKkfdW8ht+2nXop3GUIXELd20HW4NKv153gdZtbaLY dqpgU6qxPBL4C8ZKxvLVUiwSonRaOV/Lask/QZHWM1zo/XU9Je9JUU4Jp VkScV0blhn6lRmvZeZOoOffylE0b+MSp9omHtFKDohuqOLDiZy80eSsLD t3toA5MPw1D/o4V0u4UvPm2/bDXm1otV66X5RxxyRN9JOUAR0ClfPTTfR YJ5OHMssuZQ8ltLgEGO56JJ+2yWTtaAa+Pf+m7nr88l5oUXM5pR0w4ZBu fidLYpDRVnW/NnoDUf6ObKXRkQBN7zg1JNKL1K6qNQBGDAwT01YAG76Rf w==; X-IronPort-AV: E=McAfee;i="6500,9779,10507"; a="369161193" X-IronPort-AV: E=Sophos;i="5.95,203,1661842800"; d="scan'208";a="369161193" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2022 13:35:37 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10507"; a="735701050" X-IronPort-AV: E=Sophos;i="5.95,203,1661842800"; d="scan'208";a="735701050" Received: from jithujos.sc.intel.com ([172.25.103.66]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2022 13:35:37 -0700 From: Jithu Joseph To: hdegoede@redhat.com, markgross@kernel.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, gregkh@linuxfoundation.org, jithu.joseph@intel.com, ashok.raj@intel.com, tony.luck@intel.com, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org, patches@lists.linux.dev, ravi.v.shankar@intel.com, thiago.macieira@intel.com, athenas.jimenez.gonzalez@intel.com Subject: [PATCH 14/14] Revert "platform/x86/intel/ifs: Mark as BROKEN" Date: Fri, 21 Oct 2022 13:34:13 -0700 Message-Id: <20221021203413.1220137-15-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221021203413.1220137-1-jithu.joseph@intel.com> References: <20221021203413.1220137-1-jithu.joseph@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.6 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,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?1747331310244036093?= X-GMAIL-MSGID: =?utf-8?q?1747331310244036093?= Issues with user interface [1] to load scan test images has been addressed, so the following can be reverted. commit c483e7ea10fa ("platform/x86/intel/ifs: Mark as BROKEN") Link: https://lore.kernel.org/lkml/26102aca-a730-ddf8-d024-2e7367696757@redhat.com/ [1] Reviewed-by: Tony Luck Signed-off-by: Jithu Joseph --- drivers/platform/x86/intel/ifs/Kconfig | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/platform/x86/intel/ifs/Kconfig b/drivers/platform/x86/intel/ifs/Kconfig index 89152d46deee..3eded966757e 100644 --- a/drivers/platform/x86/intel/ifs/Kconfig +++ b/drivers/platform/x86/intel/ifs/Kconfig @@ -1,9 +1,6 @@ config INTEL_IFS tristate "Intel In Field Scan" depends on X86 && CPU_SUP_INTEL && 64BIT && SMP - # Discussion on the list has shown that the sysfs API needs a bit - # more work, mark this as broken for now - depends on BROKEN help Enable support for the In Field Scan capability in select CPUs. The capability allows for running low level tests via