From patchwork Wed Mar 22 00:33:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Joseph, Jithu" X-Patchwork-Id: 13183412 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09CA3C761A6 for ; Wed, 22 Mar 2023 00:38:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229487AbjCVAiG (ORCPT ); Tue, 21 Mar 2023 20:38:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229783AbjCVAiF (ORCPT ); Tue, 21 Mar 2023 20:38:05 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 956B45261; Tue, 21 Mar 2023 17:38: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=1679445483; x=1710981483; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KQ8B+/SmB6Ps2PdDC2JGIJkpyzpOfVhnUhlP4BJLxJY=; b=ewoJ5mwPuOpNSeHzXqVQcq5Lh6qT+fRPqymVgq6EvET0DvTctEP2/MUh KlPd88o+YKu0pBIxFb1vHaLnu/VdTKlpE/x2j6SnDWpwQH7LnC7J2Ho7J l0YsQqopT/iNL6HM4PaUUtpwF86JZD6/KBHP4rbvpetN1aagEXZAUHzlR 1ezUxJHrD+EimeZ+ZYBnjXekTo5cDanQf5V4/gv143dBl10SB51fQ1rN4 cjg91gMFxJvFoKQe1k7RWKZ5XErCitb6e16Q1oNyLrZShFVOdAIIFWF0t NnVsTCrF2W8BRcjXaJUBv1lLS+GWwQoJhqGXcX/CDWVYumkQYMlDhf+Sr g==; X-IronPort-AV: E=McAfee;i="6600,9927,10656"; a="322934890" X-IronPort-AV: E=Sophos;i="5.98,280,1673942400"; d="scan'208";a="322934890" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2023 17:38:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10656"; a="675076027" X-IronPort-AV: E=Sophos;i="5.98,280,1673942400"; d="scan'208";a="675076027" Received: from jithujos.sc.intel.com ([172.25.103.66]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2023 17:38:01 -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, rostedt@goodmis.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, sohil.mehta@intel.com Subject: [PATCH v4 1/9] platform/x86/intel/ifs: Separate ifs_pkg_auth from ifs_data Date: Tue, 21 Mar 2023 17:33:51 -0700 Message-Id: <20230322003359.213046-2-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230322003359.213046-1-jithu.joseph@intel.com> References: <20230301015942.462799-1-jithu.joseph@intel.com> <20230322003359.213046-1-jithu.joseph@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org In preparation to supporting additional tests, remove ifs_pkg_auth from per-test scope, as it is only applicable for one test type. This will simplify ifs_init() flow when multiple tests are added. Signed-off-by: Jithu Joseph Reviewed-by: Tony Luck --- drivers/platform/x86/intel/ifs/ifs.h | 3 +-- drivers/platform/x86/intel/ifs/core.c | 10 ++++++---- drivers/platform/x86/intel/ifs/load.c | 6 +++--- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/platform/x86/intel/ifs/ifs.h b/drivers/platform/x86/intel/ifs/ifs.h index 046e39304fd5..221413b79281 100644 --- a/drivers/platform/x86/intel/ifs/ifs.h +++ b/drivers/platform/x86/intel/ifs/ifs.h @@ -201,7 +201,6 @@ union ifs_status { * struct ifs_data - attributes related to intel IFS driver * @integrity_cap_bit: MSR_INTEGRITY_CAPS bit enumerating this test * @loaded_version: stores the currently loaded ifs image version. - * @pkg_auth: array of bool storing per package auth status * @loaded: If a valid test binary has been loaded into the memory * @loading_error: Error occurred on another CPU while loading image * @valid_chunks: number of chunks which could be validated. @@ -212,7 +211,6 @@ union ifs_status { */ struct ifs_data { int integrity_cap_bit; - bool *pkg_auth; int loaded_version; bool loaded; bool loading_error; @@ -241,6 +239,7 @@ static inline struct ifs_data *ifs_get_data(struct device *dev) return &d->data; } +extern bool *ifs_pkg_auth; 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/core.c b/drivers/platform/x86/intel/ifs/core.c index 206a617c2e02..3176d94b1fe5 100644 --- a/drivers/platform/x86/intel/ifs/core.c +++ b/drivers/platform/x86/intel/ifs/core.c @@ -20,6 +20,8 @@ static const struct x86_cpu_id ifs_cpu_ids[] __initconst = { }; MODULE_DEVICE_TABLE(x86cpu, ifs_cpu_ids); +bool *ifs_pkg_auth; + static struct ifs_device ifs_device = { .data = { .integrity_cap_bit = MSR_INTEGRITY_CAPS_PERIODIC_BIST_BIT, @@ -56,13 +58,13 @@ static int __init ifs_init(void) if (!(msrval & BIT(ifs_device.data.integrity_cap_bit))) return -ENODEV; - ifs_device.data.pkg_auth = kmalloc_array(topology_max_packages(), sizeof(bool), GFP_KERNEL); - if (!ifs_device.data.pkg_auth) + ifs_pkg_auth = kmalloc_array(topology_max_packages(), sizeof(bool), GFP_KERNEL); + if (!ifs_pkg_auth) return -ENOMEM; ret = misc_register(&ifs_device.misc); if (ret) { - kfree(ifs_device.data.pkg_auth); + kfree(ifs_pkg_auth); return ret; } @@ -72,7 +74,7 @@ static int __init ifs_init(void) static void __exit ifs_exit(void) { misc_deregister(&ifs_device.misc); - kfree(ifs_device.data.pkg_auth); + kfree(ifs_pkg_auth); } module_init(ifs_init); diff --git a/drivers/platform/x86/intel/ifs/load.c b/drivers/platform/x86/intel/ifs/load.c index c5c24e6fdc43..74a50e99cacd 100644 --- a/drivers/platform/x86/intel/ifs/load.c +++ b/drivers/platform/x86/intel/ifs/load.c @@ -192,7 +192,7 @@ static int scan_chunks_sanity_check(struct device *dev) struct ifs_work local_work; int curr_pkg, cpu, ret; - memset(ifsd->pkg_auth, 0, (topology_max_packages() * sizeof(bool))); + memset(ifs_pkg_auth, 0, (topology_max_packages() * sizeof(bool))); ret = validate_ifs_metadata(dev); if (ret) return ret; @@ -204,7 +204,7 @@ static int scan_chunks_sanity_check(struct device *dev) cpus_read_lock(); for_each_online_cpu(cpu) { curr_pkg = topology_physical_package_id(cpu); - if (ifsd->pkg_auth[curr_pkg]) + if (ifs_pkg_auth[curr_pkg]) continue; reinit_completion(&ifs_done); local_work.dev = dev; @@ -215,7 +215,7 @@ static int scan_chunks_sanity_check(struct device *dev) ret = -EIO; goto out; } - ifsd->pkg_auth[curr_pkg] = 1; + ifs_pkg_auth[curr_pkg] = 1; } ret = 0; out: From patchwork Wed Mar 22 00:33:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Joseph, Jithu" X-Patchwork-Id: 13183414 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 378A7C6FD1D for ; Wed, 22 Mar 2023 00:38:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229810AbjCVAiH (ORCPT ); Tue, 21 Mar 2023 20:38:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229778AbjCVAiF (ORCPT ); Tue, 21 Mar 2023 20:38:05 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF32B5585; Tue, 21 Mar 2023 17:38: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=1679445483; x=1710981483; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=BgdHjJC4QL7BVfBsochJmfeDk+Hnz+14Q2sFFqrIJxw=; b=BErds0mOGysVdCV5rYM3MqkY8KGMlWub6NphXX5T3KVJXCv/p+sapkNF YDXpLGpjvd1CSZ05YNhlSZA3QW+9ZxVcz1djgsmozZKRmgRbQdthiY3T5 /fsgGop24Q27HQsqq7Z8132iApj7nAOOQTSznccNkvBEnwjCtxvGX8/ez U2vrDLFwPq/ZD3mQ8vfBEQhn0iWS/Qnhf4hzeZoLJMGxM23y36rCPBQAK MMlaU+mXJLgPTMaqdm8yUXDnqCYQZtp1gmDMj3tAKYP3rUvugrh33da4Y 1basDvgP3alToHKK24awBoQXG9kLGRpNEE5SMssyZmi1bZv80ec3BLRs1 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10656"; a="322934899" X-IronPort-AV: E=Sophos;i="5.98,280,1673942400"; d="scan'208";a="322934899" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2023 17:38:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10656"; a="675076031" X-IronPort-AV: E=Sophos;i="5.98,280,1673942400"; d="scan'208";a="675076031" Received: from jithujos.sc.intel.com ([172.25.103.66]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2023 17:38:02 -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, rostedt@goodmis.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, sohil.mehta@intel.com Subject: [PATCH v4 2/9] platform/x86/intel/ifs: Reorganize driver data Date: Tue, 21 Mar 2023 17:33:52 -0700 Message-Id: <20230322003359.213046-3-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230322003359.213046-1-jithu.joseph@intel.com> References: <20230301015942.462799-1-jithu.joseph@intel.com> <20230322003359.213046-1-jithu.joseph@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org The struct holding device driver data contained both read only(ro) and read write(rw) fields. Separating ro fields from rw fields was recommended as a preferable design pattern during review[1]. Group ro fields into a separate const struct. Associate it to the miscdevice being registered by keeping its pointer in the same container struct as the miscdevice. Link: https://lore.kernel.org/lkml/Y+9H9otxLYPqMkUh@kroah.com/ [1] Signed-off-by: Jithu Joseph Reviewed-by: Tony Luck --- drivers/platform/x86/intel/ifs/ifs.h | 22 ++++++++++++++++------ drivers/platform/x86/intel/ifs/core.c | 12 +++++++----- drivers/platform/x86/intel/ifs/load.c | 3 ++- 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/drivers/platform/x86/intel/ifs/ifs.h b/drivers/platform/x86/intel/ifs/ifs.h index 221413b79281..d9c1a1f3e31d 100644 --- a/drivers/platform/x86/intel/ifs/ifs.h +++ b/drivers/platform/x86/intel/ifs/ifs.h @@ -197,9 +197,13 @@ union ifs_status { #define IFS_SW_TIMEOUT 0xFD #define IFS_SW_PARTIAL_COMPLETION 0xFE +struct ifs_test_caps { + int integrity_cap_bit; + int test_num; +}; + /** * struct ifs_data - attributes related to intel IFS driver - * @integrity_cap_bit: MSR_INTEGRITY_CAPS bit enumerating this test * @loaded_version: stores the currently loaded ifs image version. * @loaded: If a valid test binary has been loaded into the memory * @loading_error: Error occurred on another CPU while loading image @@ -207,10 +211,8 @@ union ifs_status { * @status: it holds simple status pass/fail/untested * @scan_details: opaque scan status code from h/w * @cur_batch: number indicating the currently loaded test file - * @test_num: number indicating the test type */ struct ifs_data { - int integrity_cap_bit; int loaded_version; bool loaded; bool loading_error; @@ -218,7 +220,6 @@ struct ifs_data { int status; u64 scan_details; u32 cur_batch; - int test_num; }; struct ifs_work { @@ -227,7 +228,8 @@ struct ifs_work { }; struct ifs_device { - struct ifs_data data; + const struct ifs_test_caps *test_caps; + struct ifs_data rw_data; struct miscdevice misc; }; @@ -236,7 +238,15 @@ static inline struct ifs_data *ifs_get_data(struct device *dev) struct miscdevice *m = dev_get_drvdata(dev); struct ifs_device *d = container_of(m, struct ifs_device, misc); - return &d->data; + return &d->rw_data; +} + +static inline const struct ifs_test_caps *ifs_get_test_caps(struct device *dev) +{ + struct miscdevice *m = dev_get_drvdata(dev); + struct ifs_device *d = container_of(m, struct ifs_device, misc); + + return d->test_caps; } extern bool *ifs_pkg_auth; diff --git a/drivers/platform/x86/intel/ifs/core.c b/drivers/platform/x86/intel/ifs/core.c index 3176d94b1fe5..e2bf728eefdf 100644 --- a/drivers/platform/x86/intel/ifs/core.c +++ b/drivers/platform/x86/intel/ifs/core.c @@ -22,11 +22,13 @@ MODULE_DEVICE_TABLE(x86cpu, ifs_cpu_ids); bool *ifs_pkg_auth; +static const struct ifs_test_caps scan_test = { + .integrity_cap_bit = MSR_INTEGRITY_CAPS_PERIODIC_BIST_BIT, + .test_num = 0, +}; + static struct ifs_device ifs_device = { - .data = { - .integrity_cap_bit = MSR_INTEGRITY_CAPS_PERIODIC_BIST_BIT, - .test_num = 0, - }, + .test_caps = &scan_test, .misc = { .name = "intel_ifs_0", .nodename = "intel_ifs/0", @@ -55,7 +57,7 @@ static int __init ifs_init(void) ifs_device.misc.groups = ifs_get_groups(); - if (!(msrval & BIT(ifs_device.data.integrity_cap_bit))) + if (!(msrval & BIT(ifs_device.test_caps->integrity_cap_bit))) return -ENODEV; ifs_pkg_auth = kmalloc_array(topology_max_packages(), sizeof(bool), GFP_KERNEL); diff --git a/drivers/platform/x86/intel/ifs/load.c b/drivers/platform/x86/intel/ifs/load.c index 74a50e99cacd..61dffb4c8a1d 100644 --- a/drivers/platform/x86/intel/ifs/load.c +++ b/drivers/platform/x86/intel/ifs/load.c @@ -257,13 +257,14 @@ static int image_sanity_check(struct device *dev, const struct microcode_header_ */ int ifs_load_firmware(struct device *dev) { + const struct ifs_test_caps *test = ifs_get_test_caps(dev); struct ifs_data *ifsd = ifs_get_data(dev); const struct firmware *fw; char scan_path[64]; int ret = -EINVAL; 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, + test->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); From patchwork Wed Mar 22 00:33:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Joseph, Jithu" X-Patchwork-Id: 13183413 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77418C76195 for ; Wed, 22 Mar 2023 00:38:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229783AbjCVAiI (ORCPT ); Tue, 21 Mar 2023 20:38:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229731AbjCVAiG (ORCPT ); Tue, 21 Mar 2023 20:38:06 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F3CF5B8D; Tue, 21 Mar 2023 17:38:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679445485; x=1710981485; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tR8Yd0RAdqIs10hjw9+2qyYnDXiukGHnJw3oTb13eQc=; b=bmzjGiEmHtHEnjH4cR6p2eqin9eY7YCMP67Y259N4ms11xQ6kG6P8cEs floL70OAyxmY4vnHdWewBdIKO/0U6KzBQedyBZJj+BJa6Mkqht9YeLchD 9hD39MZp6lqIi7/BTr/L5gVi1PiWbpi1bspb3wZz2wYHAc5FgNxHFW5s/ C0KMpjKNvK3y1NYRLke+5xxxoL13aCCJpXVEPI4e/7/AIe8tNIWz6hAra 1DvYfQ4HhZ+wj6x+B/TsNnkoeTDolT5hn+7ST4x8hu7wU8h1tfjy6gyas x2q0dXOOrv4oaecJTI87mklHl9x1v9+iihp3yHbRaOacpkxNsXxaEBlWm g==; X-IronPort-AV: E=McAfee;i="6600,9927,10656"; a="322934908" X-IronPort-AV: E=Sophos;i="5.98,280,1673942400"; d="scan'208";a="322934908" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2023 17:38:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10656"; a="675076035" X-IronPort-AV: E=Sophos;i="5.98,280,1673942400"; d="scan'208";a="675076035" Received: from jithujos.sc.intel.com ([172.25.103.66]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2023 17:38:03 -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, rostedt@goodmis.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, sohil.mehta@intel.com Subject: [PATCH v4 3/9] platform/x86/intel/ifs: IFS cleanup Date: Tue, 21 Mar 2023 17:33:53 -0700 Message-Id: <20230322003359.213046-4-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230322003359.213046-1-jithu.joseph@intel.com> References: <20230301015942.462799-1-jithu.joseph@intel.com> <20230322003359.213046-1-jithu.joseph@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org Cleanup incorporating misc review comments - Remove the subdirectory intel_ifs/0 for devicenode [1] - Make plat_ifs_groups non static and use it directly without using a function [2] Link: https://lore.kernel.org/lkml/Y+4kQOtrHt5pdsSO@kroah.com/ [1] Link: https://lore.kernel.org/lkml/Y9nyxNesVHCUXAcH@kroah.com/ [2] Signed-off-by: Jithu Joseph Reviewed-by: Tony Luck Reviewed-by: Hans de Goede --- drivers/platform/x86/intel/ifs/ifs.h | 2 +- drivers/platform/x86/intel/ifs/core.c | 6 +++--- drivers/platform/x86/intel/ifs/sysfs.c | 9 +-------- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/drivers/platform/x86/intel/ifs/ifs.h b/drivers/platform/x86/intel/ifs/ifs.h index d9c1a1f3e31d..55bcc70c2966 100644 --- a/drivers/platform/x86/intel/ifs/ifs.h +++ b/drivers/platform/x86/intel/ifs/ifs.h @@ -252,6 +252,6 @@ static inline const struct ifs_test_caps *ifs_get_test_caps(struct device *dev) extern bool *ifs_pkg_auth; 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 attribute *plat_ifs_attrs[]; #endif diff --git a/drivers/platform/x86/intel/ifs/core.c b/drivers/platform/x86/intel/ifs/core.c index e2bf728eefdf..f272644617a3 100644 --- a/drivers/platform/x86/intel/ifs/core.c +++ b/drivers/platform/x86/intel/ifs/core.c @@ -20,6 +20,8 @@ static const struct x86_cpu_id ifs_cpu_ids[] __initconst = { }; MODULE_DEVICE_TABLE(x86cpu, ifs_cpu_ids); +ATTRIBUTE_GROUPS(plat_ifs); + bool *ifs_pkg_auth; static const struct ifs_test_caps scan_test = { @@ -31,8 +33,8 @@ static struct ifs_device ifs_device = { .test_caps = &scan_test, .misc = { .name = "intel_ifs_0", - .nodename = "intel_ifs/0", .minor = MISC_DYNAMIC_MINOR, + .groups = plat_ifs_groups, }, }; @@ -55,8 +57,6 @@ static int __init ifs_init(void) if (rdmsrl_safe(MSR_INTEGRITY_CAPS, &msrval)) return -ENODEV; - ifs_device.misc.groups = ifs_get_groups(); - if (!(msrval & BIT(ifs_device.test_caps->integrity_cap_bit))) return -ENODEV; diff --git a/drivers/platform/x86/intel/ifs/sysfs.c b/drivers/platform/x86/intel/ifs/sysfs.c index ee636a76b083..2007d8054f04 100644 --- a/drivers/platform/x86/intel/ifs/sysfs.c +++ b/drivers/platform/x86/intel/ifs/sysfs.c @@ -141,7 +141,7 @@ static ssize_t image_version_show(struct device *dev, static DEVICE_ATTR_RO(image_version); /* global scan sysfs attributes */ -static struct attribute *plat_ifs_attrs[] = { +struct attribute *plat_ifs_attrs[] = { &dev_attr_details.attr, &dev_attr_status.attr, &dev_attr_run_test.attr, @@ -149,10 +149,3 @@ static struct attribute *plat_ifs_attrs[] = { &dev_attr_image_version.attr, NULL }; - -ATTRIBUTE_GROUPS(plat_ifs); - -const struct attribute_group **ifs_get_groups(void) -{ - return plat_ifs_groups; -} From patchwork Wed Mar 22 00:33:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Joseph, Jithu" X-Patchwork-Id: 13183415 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8A5C0C6FD20 for ; Wed, 22 Mar 2023 00:38:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229832AbjCVAiI (ORCPT ); Tue, 21 Mar 2023 20:38:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229784AbjCVAiG (ORCPT ); Tue, 21 Mar 2023 20:38:06 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22CBA5BB0; Tue, 21 Mar 2023 17:38:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679445485; x=1710981485; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=iC/ejTfRQ+T7oTkSU6HDeauMoGFLZcP67w8IIlZp0OY=; b=cY+YdrCNg86mee2FmPOE2AiRC/XOa1NEjmWtmlO9DOmnsqemm5oa9sor naudb5n3S5CrbCekzFxJbE+nSTfND9kDGsUrWTe8qfOc0YjVlSKfHsCFD voORdzZ2S+2crPvxLg/cNcCbWVXoSFdlaxehFKwUH6PKPFM0jNszXTAuB fFSYs6j8MH2rebDsC3a+u4ZOT6mNPkiFgqv76G3ru60oIHxadRPuxcJee u5VmgjPvvtDo5rQuB9RVKReu5tQdiijmaMy3bXhkU/edT0tWVLSnKcBvm dhnMuOt1owX2Qj2h6/OGQpcAmyJwr348YylVab4VQ+B5V33d5mZojir2X Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10656"; a="322934918" X-IronPort-AV: E=Sophos;i="5.98,280,1673942400"; d="scan'208";a="322934918" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2023 17:38:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10656"; a="675076039" X-IronPort-AV: E=Sophos;i="5.98,280,1673942400"; d="scan'208";a="675076039" Received: from jithujos.sc.intel.com ([172.25.103.66]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2023 17:38:03 -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, rostedt@goodmis.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, sohil.mehta@intel.com Subject: [PATCH v4 4/9] x86/include/asm/msr-index.h: Add IFS Array test bits Date: Tue, 21 Mar 2023 17:33:54 -0700 Message-Id: <20230322003359.213046-5-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230322003359.213046-1-jithu.joseph@intel.com> References: <20230301015942.462799-1-jithu.joseph@intel.com> <20230322003359.213046-1-jithu.joseph@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org Define MSR bitfields for enumerating support for Array BIST test. Signed-off-by: Jithu Joseph Reviewed-by: Tony Luck Reviewed-by: Hans de Goede --- arch/x86/include/asm/msr-index.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h index ad35355ee43e..3aedae61af4f 100644 --- a/arch/x86/include/asm/msr-index.h +++ b/arch/x86/include/asm/msr-index.h @@ -206,6 +206,8 @@ /* Abbreviated from Intel SDM name IA32_INTEGRITY_CAPABILITIES */ #define MSR_INTEGRITY_CAPS 0x000002d9 +#define MSR_INTEGRITY_CAPS_ARRAY_BIST_BIT 2 +#define MSR_INTEGRITY_CAPS_ARRAY_BIST BIT(MSR_INTEGRITY_CAPS_ARRAY_BIST_BIT) #define MSR_INTEGRITY_CAPS_PERIODIC_BIST_BIT 4 #define MSR_INTEGRITY_CAPS_PERIODIC_BIST BIT(MSR_INTEGRITY_CAPS_PERIODIC_BIST_BIT) From patchwork Wed Mar 22 00:33:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Joseph, Jithu" X-Patchwork-Id: 13183416 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EFAD8C77B60 for ; Wed, 22 Mar 2023 00:38:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229844AbjCVAiJ (ORCPT ); Tue, 21 Mar 2023 20:38:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229797AbjCVAiG (ORCPT ); Tue, 21 Mar 2023 20:38:06 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C94A565BE; Tue, 21 Mar 2023 17:38:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679445485; x=1710981485; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5aYESLOoWjLS/ePaQj9XJXoxw/ffemCQIpasdHuVrYQ=; b=L9o7c1GGoWNb534DLGhZtXAUz9OU5PYByDx4mDn8yjEBjm/Te4szXiOU w1iJoHiKN9gyt/oFbUUtd+fqbL4Trkb7q7Dvn/GUW1erCgwPSRQg+BwFL NRW2nyMKxTzbUETsr2Pchek20wOjn74k0w08RnVE439QdnqC4oMiUSc5V F8L+lSRKXdo8yeyUnsZiUX67msFZ5XfAjNqTaAJ1oZv/Mm6G67C2rtSrV ASW1Effa3XXeXLp9Xb1Uzr5OleJBHaoo1r9gQGhY5yTNPYp0DakMcTBIw OYQJO5zDsl5L2R76RtAyLWEckwZ8hGcbLLiT+LH19c1RcRWBpfAULcHXF w==; X-IronPort-AV: E=McAfee;i="6600,9927,10656"; a="322934927" X-IronPort-AV: E=Sophos;i="5.98,280,1673942400"; d="scan'208";a="322934927" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2023 17:38:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10656"; a="675076049" X-IronPort-AV: E=Sophos;i="5.98,280,1673942400"; d="scan'208";a="675076049" Received: from jithujos.sc.intel.com ([172.25.103.66]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2023 17:38:04 -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, rostedt@goodmis.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, sohil.mehta@intel.com Subject: [PATCH v4 5/9] platform/x86/intel/ifs: Introduce Array Scan test to IFS Date: Tue, 21 Mar 2023 17:33:55 -0700 Message-Id: <20230322003359.213046-6-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230322003359.213046-1-jithu.joseph@intel.com> References: <20230301015942.462799-1-jithu.joseph@intel.com> <20230322003359.213046-1-jithu.joseph@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org Array BIST is a new type of core test introduced under the Intel Infield Scan (IFS) suite of tests. Emerald Rapids (EMR) is the first CPU to support Array BIST. Array BIST performs tests on some portions of the core logic such as caches and register files. These are different portions of the silicon compared to the parts tested by the first test type i.e Scan at Field (SAF). Make changes in the device driver init flow to register this new test type with the device driver framework. Each test will have its own sysfs directory (intel_ifs_0 , intel_ifs_1) under misc hierarchy to accommodate for the differences in test type and how they are initiated. Upcoming patches will add actual support. Signed-off-by: Jithu Joseph Reviewed-by: Tony Luck --- drivers/platform/x86/intel/ifs/ifs.h | 3 ++ drivers/platform/x86/intel/ifs/core.c | 65 +++++++++++++++++++-------- 2 files changed, 50 insertions(+), 18 deletions(-) diff --git a/drivers/platform/x86/intel/ifs/ifs.h b/drivers/platform/x86/intel/ifs/ifs.h index 55bcc70c2966..14789b156299 100644 --- a/drivers/platform/x86/intel/ifs/ifs.h +++ b/drivers/platform/x86/intel/ifs/ifs.h @@ -137,6 +137,9 @@ #define SCAN_TEST_PASS 1 #define SCAN_TEST_FAIL 2 +#define IFS_TYPE_SAF 0 +#define IFS_TYPE_ARRAY_BIST 1 + /* MSR_SCAN_HASHES_STATUS bit fields */ union ifs_scan_hashes_status { u64 data; diff --git a/drivers/platform/x86/intel/ifs/core.c b/drivers/platform/x86/intel/ifs/core.c index f272644617a3..0067eee25f3c 100644 --- a/drivers/platform/x86/intel/ifs/core.c +++ b/drivers/platform/x86/intel/ifs/core.c @@ -16,6 +16,7 @@ static const struct x86_cpu_id ifs_cpu_ids[] __initconst = { X86_MATCH(SAPPHIRERAPIDS_X), + X86_MATCH(EMERALDRAPIDS_X), {} }; MODULE_DEVICE_TABLE(x86cpu, ifs_cpu_ids); @@ -26,23 +27,50 @@ bool *ifs_pkg_auth; static const struct ifs_test_caps scan_test = { .integrity_cap_bit = MSR_INTEGRITY_CAPS_PERIODIC_BIST_BIT, - .test_num = 0, + .test_num = IFS_TYPE_SAF, }; -static struct ifs_device ifs_device = { - .test_caps = &scan_test, - .misc = { - .name = "intel_ifs_0", - .minor = MISC_DYNAMIC_MINOR, - .groups = plat_ifs_groups, +static const struct ifs_test_caps array_test = { + .integrity_cap_bit = MSR_INTEGRITY_CAPS_ARRAY_BIST_BIT, + .test_num = IFS_TYPE_ARRAY_BIST, +}; + +static struct ifs_device ifs_devices[] = { + [IFS_TYPE_SAF] = { + .test_caps = &scan_test, + .misc = { + .name = "intel_ifs_0", + .minor = MISC_DYNAMIC_MINOR, + .groups = plat_ifs_groups, + }, + }, + [IFS_TYPE_ARRAY_BIST] = { + .test_caps = &array_test, + .misc = { + .name = "intel_ifs_1", + .minor = MISC_DYNAMIC_MINOR, + }, }, }; +#define IFS_NUMTESTS ARRAY_SIZE(ifs_devices) + +static void ifs_cleanup(void) +{ + int i; + + for (i = 0; i < IFS_NUMTESTS; i++) { + if (ifs_devices[i].misc.this_device) + misc_deregister(&ifs_devices[i].misc); + } + kfree(ifs_pkg_auth); +} + static int __init ifs_init(void) { const struct x86_cpu_id *m; u64 msrval; - int ret; + int i, ret; m = x86_match_cpu(ifs_cpu_ids); if (!m) @@ -57,26 +85,27 @@ static int __init ifs_init(void) if (rdmsrl_safe(MSR_INTEGRITY_CAPS, &msrval)) return -ENODEV; - if (!(msrval & BIT(ifs_device.test_caps->integrity_cap_bit))) - return -ENODEV; - ifs_pkg_auth = kmalloc_array(topology_max_packages(), sizeof(bool), GFP_KERNEL); if (!ifs_pkg_auth) return -ENOMEM; - ret = misc_register(&ifs_device.misc); - if (ret) { - kfree(ifs_pkg_auth); - return ret; + for (i = 0; i < IFS_NUMTESTS; i++) { + if (!(msrval & BIT(ifs_devices[i].test_caps->integrity_cap_bit))) + continue; + ret = misc_register(&ifs_devices[i].misc); + if (ret) + goto err_exit; } - return 0; + +err_exit: + ifs_cleanup(); + return ret; } static void __exit ifs_exit(void) { - misc_deregister(&ifs_device.misc); - kfree(ifs_pkg_auth); + ifs_cleanup(); } module_init(ifs_init); From patchwork Wed Mar 22 00:33:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Joseph, Jithu" X-Patchwork-Id: 13183417 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9302AC77B62 for ; Wed, 22 Mar 2023 00:38:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229876AbjCVAiM (ORCPT ); Tue, 21 Mar 2023 20:38:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229833AbjCVAiI (ORCPT ); Tue, 21 Mar 2023 20:38:08 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAADB5B8D; Tue, 21 Mar 2023 17:38:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679445486; x=1710981486; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nqUH8s/50nhlaqxdRML8go3KMYy8jHe6DCaPoKvFnrM=; b=iBEpCGTD0ogyg9vI0yuniQJunph1vGeT5pHIOgXeHaZLvCkuziAUWwB5 aet/hbBR7k5MoO0pMlz5uEfW5kZs7QSs8P/ZZGbbBYlGeo57F6PLLhSVZ ItztvdW3QC3slF4/y17AJQ5kzbvkS+4ITvt7J8ETwj4Z0+waNLz9f1Me/ H01wTOZnYZKBmfQMtaE1OunMU1MB7x+/5QLufZxbchRZn6Ts+qwEuOs1w PcTLnU1pMirxD/sHdMZHAwvV1ZV/PtlZMiIyAKTDLB61T5/dO8xYaU76l x0giK6cdHk12f76gaE2i1/5uzWXA/Ajq2In2/Xx8hL4CfKTHnurBMsVOU w==; X-IronPort-AV: E=McAfee;i="6600,9927,10656"; a="322934937" X-IronPort-AV: E=Sophos;i="5.98,280,1673942400"; d="scan'208";a="322934937" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2023 17:38:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10656"; a="675076054" X-IronPort-AV: E=Sophos;i="5.98,280,1673942400"; d="scan'208";a="675076054" Received: from jithujos.sc.intel.com ([172.25.103.66]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2023 17:38:05 -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, rostedt@goodmis.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, sohil.mehta@intel.com Subject: [PATCH v4 6/9] platform/x86/intel/ifs: Sysfs interface for Array BIST Date: Tue, 21 Mar 2023 17:33:56 -0700 Message-Id: <20230322003359.213046-7-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230322003359.213046-1-jithu.joseph@intel.com> References: <20230301015942.462799-1-jithu.joseph@intel.com> <20230322003359.213046-1-jithu.joseph@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org The interface to trigger Array BIST test and obtain its result is similar to the existing scan test. The only notable difference is that, Array BIST doesn't require any test content to be loaded. So binary load related options are not needed for this test. Add sysfs interface for array BIST test, the testing support will be added by subsequent patch. Signed-off-by: Jithu Joseph Reviewed-by: Tony Luck --- drivers/platform/x86/intel/ifs/ifs.h | 1 + drivers/platform/x86/intel/ifs/core.c | 2 ++ drivers/platform/x86/intel/ifs/runtest.c | 13 ++++++++++++- drivers/platform/x86/intel/ifs/sysfs.c | 14 +++++++++----- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/drivers/platform/x86/intel/ifs/ifs.h b/drivers/platform/x86/intel/ifs/ifs.h index 14789b156299..a7d87fb4c412 100644 --- a/drivers/platform/x86/intel/ifs/ifs.h +++ b/drivers/platform/x86/intel/ifs/ifs.h @@ -256,5 +256,6 @@ extern bool *ifs_pkg_auth; int ifs_load_firmware(struct device *dev); int do_core_test(int cpu, struct device *dev); extern struct attribute *plat_ifs_attrs[]; +extern struct attribute *plat_ifs_array_attrs[]; #endif diff --git a/drivers/platform/x86/intel/ifs/core.c b/drivers/platform/x86/intel/ifs/core.c index 0067eee25f3c..306f886b52d2 100644 --- a/drivers/platform/x86/intel/ifs/core.c +++ b/drivers/platform/x86/intel/ifs/core.c @@ -22,6 +22,7 @@ static const struct x86_cpu_id ifs_cpu_ids[] __initconst = { MODULE_DEVICE_TABLE(x86cpu, ifs_cpu_ids); ATTRIBUTE_GROUPS(plat_ifs); +ATTRIBUTE_GROUPS(plat_ifs_array); bool *ifs_pkg_auth; @@ -49,6 +50,7 @@ static struct ifs_device ifs_devices[] = { .misc = { .name = "intel_ifs_1", .minor = MISC_DYNAMIC_MINOR, + .groups = plat_ifs_array_groups, }, }, }; diff --git a/drivers/platform/x86/intel/ifs/runtest.c b/drivers/platform/x86/intel/ifs/runtest.c index 0bfd8fcdd7e8..323752fe5034 100644 --- a/drivers/platform/x86/intel/ifs/runtest.c +++ b/drivers/platform/x86/intel/ifs/runtest.c @@ -236,6 +236,8 @@ static void ifs_test_core(int cpu, struct device *dev) */ int do_core_test(int cpu, struct device *dev) { + const struct ifs_test_caps *test = ifs_get_test_caps(dev); + struct ifs_data *ifsd = ifs_get_data(dev); int ret = 0; /* Prevent CPUs from being taken offline during the scan test */ @@ -247,7 +249,16 @@ int do_core_test(int cpu, struct device *dev) goto out; } - ifs_test_core(cpu, dev); + switch (test->test_num) { + case IFS_TYPE_SAF: + if (!ifsd->loaded) + return -EPERM; + ifs_test_core(cpu, dev); + break; + case IFS_TYPE_ARRAY_BIST: + default: + return -EINVAL; + } out: cpus_read_unlock(); return ret; diff --git a/drivers/platform/x86/intel/ifs/sysfs.c b/drivers/platform/x86/intel/ifs/sysfs.c index 2007d8054f04..d856d6b8fc03 100644 --- a/drivers/platform/x86/intel/ifs/sysfs.c +++ b/drivers/platform/x86/intel/ifs/sysfs.c @@ -64,7 +64,6 @@ static ssize_t run_test_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { - struct ifs_data *ifsd = ifs_get_data(dev); unsigned int cpu; int rc; @@ -75,10 +74,7 @@ static ssize_t run_test_store(struct device *dev, if (down_interruptible(&ifs_sem)) return -EINTR; - if (!ifsd->loaded) - rc = -EPERM; - else - rc = do_core_test(cpu, dev); + rc = do_core_test(cpu, dev); up(&ifs_sem); @@ -149,3 +145,11 @@ struct attribute *plat_ifs_attrs[] = { &dev_attr_image_version.attr, NULL }; + +/* global array sysfs attributes */ +struct attribute *plat_ifs_array_attrs[] = { + &dev_attr_details.attr, + &dev_attr_status.attr, + &dev_attr_run_test.attr, + NULL +}; From patchwork Wed Mar 22 00:33:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Joseph, Jithu" X-Patchwork-Id: 13183418 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7FD27C76195 for ; Wed, 22 Mar 2023 00:38:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229872AbjCVAiN (ORCPT ); Tue, 21 Mar 2023 20:38:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229841AbjCVAiJ (ORCPT ); Tue, 21 Mar 2023 20:38:09 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 753AD903B; Tue, 21 Mar 2023 17:38:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679445487; x=1710981487; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Jo23zFkwsDwbXcptMJ4++GJBxyXgWzFG3F/uuQmQl5Q=; b=gaLcHnpAAbed5hukxpasQuKmRIoCiTSLhsJJl1vFpYT5XPJVPirAr6Mu Qz/Ze/s31kSAFnUji9aNwhzFCWHS5zY5Vo1SCiJumLhpECMs7xkyHYEuK TwUloyyc2gC7mmDCcKbNJpCzTALweISut7II7+ULgrAM6Uh2HdFMvuAIF wGI6rt/XEpUAkXb3EqL5K4n3gZWWasKMDXz3FdikUyTJzCGUEoUBJEpSO UvNysFw5mVTGN2YQE7D64HJ+ZgueaTe7idjlC7h56xwbhZhzYUAmUDqlO 5Hsl1smBfPMO4w9pl5y438AIr354gaEnEyJJaxH+ysdy3wzxTiLR1JFCo Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10656"; a="322934949" X-IronPort-AV: E=Sophos;i="5.98,280,1673942400"; d="scan'208";a="322934949" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2023 17:38:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10656"; a="675076061" X-IronPort-AV: E=Sophos;i="5.98,280,1673942400"; d="scan'208";a="675076061" Received: from jithujos.sc.intel.com ([172.25.103.66]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2023 17:38:06 -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, rostedt@goodmis.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, sohil.mehta@intel.com Subject: [PATCH v4 7/9] platform/x86/intel/ifs: Implement Array BIST test Date: Tue, 21 Mar 2023 17:33:57 -0700 Message-Id: <20230322003359.213046-8-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230322003359.213046-1-jithu.joseph@intel.com> References: <20230301015942.462799-1-jithu.joseph@intel.com> <20230322003359.213046-1-jithu.joseph@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org Array BIST test (for a particular core) is triggered by writing to MSR_ARRAY_BIST from one sibling of the core. This will initiate a test for all supported arrays on that CPU. Array BIST test may be aborted before completing all the arrays in the event of an interrupt or other reasons. In this case, kernel will restart the test from that point onwards. Array test will also be aborted when the test fails, in which case the test is stopped immediately without further retry. Signed-off-by: Jithu Joseph Reviewed-by: Tony Luck --- drivers/platform/x86/intel/ifs/ifs.h | 12 ++++ drivers/platform/x86/intel/ifs/runtest.c | 81 ++++++++++++++++++++++++ 2 files changed, 93 insertions(+) diff --git a/drivers/platform/x86/intel/ifs/ifs.h b/drivers/platform/x86/intel/ifs/ifs.h index a7d87fb4c412..048131df13bc 100644 --- a/drivers/platform/x86/intel/ifs/ifs.h +++ b/drivers/platform/x86/intel/ifs/ifs.h @@ -127,6 +127,7 @@ #include #include +#define MSR_ARRAY_BIST 0x00000105 #define MSR_COPY_SCAN_HASHES 0x000002c2 #define MSR_SCAN_HASHES_STATUS 0x000002c3 #define MSR_AUTHENTICATE_AND_COPY_CHUNK 0x000002c4 @@ -192,6 +193,17 @@ union ifs_status { }; }; +/* MSR_ARRAY_BIST bit fields */ +union ifs_array { + u64 data; + struct { + u32 array_bitmask; + u16 array_bank; + u16 rsvd :15; + u16 ctrl_result :1; + }; +}; + /* * Driver populated error-codes * 0xFD: Test timed out before completing all the chunks. diff --git a/drivers/platform/x86/intel/ifs/runtest.c b/drivers/platform/x86/intel/ifs/runtest.c index 323752fe5034..1061eb7ec399 100644 --- a/drivers/platform/x86/intel/ifs/runtest.c +++ b/drivers/platform/x86/intel/ifs/runtest.c @@ -229,6 +229,85 @@ static void ifs_test_core(int cpu, struct device *dev) } } +#define SPINUNIT 100 /* 100 nsec */ +static atomic_t array_cpus_out; + +/* + * Simplified cpu sibling rendezvous loop based on microcode loader __wait_for_cpus() + */ +static void wait_for_sibling_cpu(atomic_t *t, long long timeout) +{ + int cpu = smp_processor_id(); + const struct cpumask *smt_mask = cpu_smt_mask(cpu); + int all_cpus = cpumask_weight(smt_mask); + + atomic_inc(t); + while (atomic_read(t) < all_cpus) { + if (timeout < SPINUNIT) + return; + ndelay(SPINUNIT); + timeout -= SPINUNIT; + touch_nmi_watchdog(); + } +} + +static int do_array_test(void *data) +{ + union ifs_array *command = data; + int cpu = smp_processor_id(); + int first; + + /* + * Only one logical CPU on a core needs to trigger the Array test via MSR write. + */ + first = cpumask_first(cpu_smt_mask(cpu)); + + if (cpu == first) { + wrmsrl(MSR_ARRAY_BIST, command->data); + /* Pass back the result of the test */ + rdmsrl(MSR_ARRAY_BIST, command->data); + } + + /* Tests complete faster if the sibling is spinning here */ + wait_for_sibling_cpu(&array_cpus_out, NSEC_PER_SEC); + + return 0; +} + +static void ifs_array_test_core(int cpu, struct device *dev) +{ + union ifs_array command = {}; + bool timed_out = false; + struct ifs_data *ifsd; + unsigned long timeout; + + ifsd = ifs_get_data(dev); + + command.array_bitmask = ~0U; + timeout = jiffies + HZ / 2; + + do { + if (time_after(jiffies, timeout)) { + timed_out = true; + break; + } + atomic_set(&array_cpus_out, 0); + stop_core_cpuslocked(cpu, do_array_test, &command); + + if (command.ctrl_result) + break; + } while (command.array_bitmask); + + ifsd->scan_details = command.data; + + if (command.ctrl_result) + ifsd->status = SCAN_TEST_FAIL; + else if (timed_out || command.array_bitmask) + ifsd->status = SCAN_NOT_TESTED; + else + ifsd->status = SCAN_TEST_PASS; +} + /* * Initiate per core test. It wakes up work queue threads on the target cpu and * its sibling cpu. Once all sibling threads wake up, the scan test gets executed and @@ -256,6 +335,8 @@ int do_core_test(int cpu, struct device *dev) ifs_test_core(cpu, dev); break; case IFS_TYPE_ARRAY_BIST: + ifs_array_test_core(cpu, dev); + break; default: return -EINVAL; } From patchwork Wed Mar 22 00:33:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Joseph, Jithu" X-Patchwork-Id: 13183420 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C268FC6FD1D for ; Wed, 22 Mar 2023 00:38:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229794AbjCVAiO (ORCPT ); Tue, 21 Mar 2023 20:38:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229847AbjCVAiK (ORCPT ); Tue, 21 Mar 2023 20:38:10 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34F5F9758; Tue, 21 Mar 2023 17:38:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679445488; x=1710981488; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=b2HqjCdXLmojgBEJmKt1Gb9Votzjmjl0kKbTWnmZybc=; b=m0UzKxP7CCJJ11a7JtyrBh3KlAk9kKmI0BLA2uWn8XW1RAQH+1wt21Lx 339SPJSX/nZMW09LVZGe+JxL8pALbE7sDx2dlMtt1pu1dpunMU40U9BSw PhFOZidbHEALJIaJ2efBj++Nu/vQLqylKlbfYkayqyZ6uxO2t99C0hOz+ PSJV/PyP/Iiz3Md8m4BeZDEH6b6IrxAyFkLcSh8td48NApnGOqGHI6Eu9 d4p03fK/MG6wIDSNPdQO6JPdyr+p82vO2jYdDDHEe+Dv0yNJREemg1M/1 i0ddSEd2ym4nYOTDp2b1DCBXah8tKw08DTuVae9YgBBuKJKmKdBwOOlgA g==; X-IronPort-AV: E=McAfee;i="6600,9927,10656"; a="322934958" X-IronPort-AV: E=Sophos;i="5.98,280,1673942400"; d="scan'208";a="322934958" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2023 17:38:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10656"; a="675076068" X-IronPort-AV: E=Sophos;i="5.98,280,1673942400"; d="scan'208";a="675076068" Received: from jithujos.sc.intel.com ([172.25.103.66]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2023 17:38:07 -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, rostedt@goodmis.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, sohil.mehta@intel.com Subject: [PATCH v4 8/9] platform/x86/intel/ifs: Update IFS doc Date: Tue, 21 Mar 2023 17:33:58 -0700 Message-Id: <20230322003359.213046-9-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230322003359.213046-1-jithu.joseph@intel.com> References: <20230301015942.462799-1-jithu.joseph@intel.com> <20230322003359.213046-1-jithu.joseph@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org Array BIST is the second test supported by IFS. Modify IFS doc entry to be more general. Signed-off-by: Jithu Joseph Reviewed-by: Tony Luck --- drivers/platform/x86/intel/ifs/ifs.h | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/drivers/platform/x86/intel/ifs/ifs.h b/drivers/platform/x86/intel/ifs/ifs.h index 048131df13bc..93191855890f 100644 --- a/drivers/platform/x86/intel/ifs/ifs.h +++ b/drivers/platform/x86/intel/ifs/ifs.h @@ -17,7 +17,7 @@ * In Field Scan (IFS) is a hardware feature to run circuit level tests on * a CPU core to detect problems that are not caught by parity or ECC checks. * Future CPUs will support more than one type of test which will show up - * with a new platform-device instance-id, for now only .0 is exposed. + * with a new platform-device instance-id. * * * IFS Image @@ -25,7 +25,10 @@ * * Intel provides a firmware file containing the scan tests via * github [#f1]_. Similar to microcode there is a separate file for each - * family-model-stepping. + * family-model-stepping. IFS Images are not applicable for some test types. + * Wherever applicable the sysfs directory would provide a "current_batch" file + * (see below) for loading the image. + * * * IFS Image Loading * ----------------- @@ -35,7 +38,7 @@ * SHA hashes for the test. Then the tests themselves. Status MSRs provide * feedback on the success/failure of these steps. * - * The test files are kept in a fixed location: /lib/firmware/intel/ifs_0/ + * The test files are kept in a fixed location: /lib/firmware/intel/ifs_/ * For e.g if there are 3 test files, they would be named in the following * fashion: * ff-mm-ss-01.scan @@ -47,7 +50,7 @@ * (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 + * # echo 2 > /sys/devices/virtual/misc/intel_ifs_/current_batch * * The above file can also be read to know the currently loaded image. * @@ -69,16 +72,16 @@ * to migrate those applications to other cores before running a core test. * It may also be necessary to redirect interrupts to other CPUs. * - * In all cases reading the SCAN_STATUS MSR provides details on what + * In all cases reading the corresponding test's STATUS MSR provides details on what * happened. The driver makes the value of this MSR visible to applications * via the "details" file (see below). Interrupted tests may be restarted. * - * The IFS driver provides sysfs interfaces via /sys/devices/virtual/misc/intel_ifs_0/ + * The IFS driver provides sysfs interfaces via /sys/devices/virtual/misc/intel_ifs_/ * to control execution: * * Test a specific core:: * - * # echo > /sys/devices/virtual/misc/intel_ifs_0/run_test + * # echo > /sys/devices/virtual/misc/intel_ifs_/run_test * * when HT is enabled any of the sibling cpu# can be specified to test * its corresponding physical core. Since the tests are per physical core, @@ -87,21 +90,21 @@ * * For e.g. to test core corresponding to cpu5 * - * # echo 5 > /sys/devices/virtual/misc/intel_ifs_0/run_test + * # echo 5 > /sys/devices/virtual/misc/intel_ifs_/run_test * * Results of the last test is provided in /sys:: * - * $ cat /sys/devices/virtual/misc/intel_ifs_0/status + * $ cat /sys/devices/virtual/misc/intel_ifs_/status * pass * * Status can be one of pass, fail, untested * * Additional details of the last test is provided by the details file:: * - * $ cat /sys/devices/virtual/misc/intel_ifs_0/details + * $ cat /sys/devices/virtual/misc/intel_ifs_/details * 0x8081 * - * The details file reports the hex value of the SCAN_STATUS MSR. + * The details file reports the hex value of the test specific status MSR. * Hardware defined error codes are documented in volume 4 of the Intel * Software Developer's Manual but the error_code field may contain one of * the following driver defined software codes: From patchwork Wed Mar 22 00:33:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Joseph, Jithu" X-Patchwork-Id: 13183419 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF694C6FD20 for ; Wed, 22 Mar 2023 00:38:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229885AbjCVAiP (ORCPT ); Tue, 21 Mar 2023 20:38:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229871AbjCVAiL (ORCPT ); Tue, 21 Mar 2023 20:38:11 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38086E184; Tue, 21 Mar 2023 17:38:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679445489; x=1710981489; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nohiqToOsP6y6cJNQuVw0xtw2VknYjmA95yg6FTsWC8=; b=mTg++/nj4JlBxKrZ6LHm8z7U9Qg8MZTYW4nfrAZgFwP+SKK1YtG8fDg/ 6eb8rIhRYActqveiR5XcKY3vnVQ+CZWy1dk/+1X2WDbqcOOFeMTlW5w+H NQZo+o8DlWTmWFwx5umPHSQvtvaXjtMvU+0c5emgmE3plFEaTWGwskOaq GPC+tOM0Vvs6UVRs8tLiJmXn4nm+AIlLYPom6pfOUcHYsfhBpMFgPtReH wpGo1WsTem0FiMDPozzgipPs6opqyP7Euv1wDp1tBf7BldtvEpz+o00nB f1Dp0tdZZdt/hwxl7Ne9Q+e3Avts7nERtFnMl9HLzIyyXOxep5lk1jXKa A==; X-IronPort-AV: E=McAfee;i="6600,9927,10656"; a="322934967" X-IronPort-AV: E=Sophos;i="5.98,280,1673942400"; d="scan'208";a="322934967" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2023 17:38:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10656"; a="675076077" X-IronPort-AV: E=Sophos;i="5.98,280,1673942400"; d="scan'208";a="675076077" Received: from jithujos.sc.intel.com ([172.25.103.66]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2023 17:38:07 -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, rostedt@goodmis.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, sohil.mehta@intel.com Subject: [PATCH v4 9/9] Documentation/ABI: Update IFS ABI doc Date: Tue, 21 Mar 2023 17:33:59 -0700 Message-Id: <20230322003359.213046-10-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230322003359.213046-1-jithu.joseph@intel.com> References: <20230301015942.462799-1-jithu.joseph@intel.com> <20230322003359.213046-1-jithu.joseph@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org Array BIST test doesn't need an IFS test image to operate unlike the SCAN test. Consequently current_batch and image_version files are not applicable for Array BIST IFS device instance, clarify this in the ABI doc. Also given that multiple tests are supported, take the opportunity to generalize descriptions wherever applicable. Signed-off-by: Jithu Joseph Reviewed-by: Tony Luck --- .../ABI/testing/sysfs-platform-intel-ifs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-platform-intel-ifs b/Documentation/ABI/testing/sysfs-platform-intel-ifs index 55991983d0d0..41b4d5b1e21c 100644 --- a/Documentation/ABI/testing/sysfs-platform-intel-ifs +++ b/Documentation/ABI/testing/sysfs-platform-intel-ifs @@ -1,3 +1,7 @@ +Device instance to test mapping +intel_ifs_0 -> Scan Test +intel_ifs_1 -> Array BIST test + What: /sys/devices/virtual/misc/intel_ifs_/run_test Date: Nov 16 2022 KernelVersion: 6.2 @@ -8,6 +12,7 @@ Description: Write to trigger IFS test for one online core. completes the test for the core containing that thread. Example: to test the core containing cpu5: echo 5 > /sys/devices/virtual/misc/intel_ifs_/run_test +Devices: all What: /sys/devices/virtual/misc/intel_ifs_/status Date: Nov 16 2022 @@ -15,21 +20,25 @@ KernelVersion: 6.2 Contact: "Jithu Joseph" Description: The status of the last test. It can be one of "pass", "fail" or "untested". +Devices: all What: /sys/devices/virtual/misc/intel_ifs_/details Date: Nov 16 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 + the hex value of the STATUS MSR for this test. Note that the error_code field may contain driver defined software code not defined in the Intel SDM. +Devices: all What: /sys/devices/virtual/misc/intel_ifs_/image_version Date: Nov 16 2022 KernelVersion: 6.2 Contact: "Jithu Joseph" -Description: Version (hexadecimal) of loaded IFS binary image. If no scan image - is loaded reports "none". +Description: Version (hexadecimal) of loaded IFS test image. If no test image + is loaded reports "none". Only present for device instances where a test image + is applicable. +Devices: intel_ifs_0 What: /sys/devices/virtual/misc/intel_ifs_/current_batch Date: Nov 16 2022 @@ -39,3 +48,5 @@ 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. + This file is present only for device instances where a test image is applicable. +Devices: intel_ifs_0