Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp645463pxm; Wed, 2 Mar 2022 05:53:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJzbcEOuos88Zn/bo01U4mCEeSxMVXmM+UvgA7LKZ/ZbTSP8vproL0Kwu9X+sQ5oIZg/kYQr X-Received: by 2002:a17:906:7706:b0:6d6:e521:5471 with SMTP id q6-20020a170906770600b006d6e5215471mr6292923ejm.387.1646229186009; Wed, 02 Mar 2022 05:53:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646229186; cv=none; d=google.com; s=arc-20160816; b=bLXI1IQUwtwzn1eutHxRuDqiGDKN/c+osVh1boI90GClSHnKj3nalVl48klFUFjjGZ daA0D0vwGpRPVA1hKmrvun+OUg4nvO/XzBxN6KVb/TCKSTYILJTEDR1ayDINMarppnPz I40fUKHhRob09zdPGCIEW8LrrNlAp0nHJAB8zKS20FSrTfIvRGgG51D73zEcGoSG0RgS kF3bax5WeGsGQ1E2yuiHk69PYiF6SAhZOXoNLYo9D3bG4NhoHVQ6qttKacLkleAaG8/g q/eGVxzn2h62lpWNJDD7qvrUWMyIONzw/4FZQ/yfaQXAPxXgcs5V1s/KDHQJzFi+0CN1 vWHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=f+NIKMXcWEsGx7MMAIO28YF/6+4YvOTGaa5eUR87Dz4=; b=A5/b5bl4W9q0jzckc/uCVRDTtCmVqmFno2zotjji0A1gQlnqAZtDY9AOEtAdOXrK3z F7tMohoKt4b6wTuXvtyIsN/1Qk7N2uMAU6tPXg2e0EtfOET7jG4SvNqt51GzUOULc/+w zCKJvAQOzR+LyVaQdas5BMwLBhDvdIuOmbnVIAWj5tnRQU/+mG5d+T49SMLJVw1AzZtc AXH1FDUkYWL1PZPdKLHXVc6l13S7Tfa6bvhqyGJjFX3W7KlOxAOCS1SVy/D8z1XJ4w5X nGwKFI3A9f66S7V2jNqr8MLSfJorWEWj0NwpvyVDrkD4o9LZGWDJujW9Ja6D+KDxgfbb I1sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=XiOTmf2u; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c19-20020a170906171300b006cf6b54b376si9844828eje.455.2022.03.02.05.52.43; Wed, 02 Mar 2022 05:53:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=XiOTmf2u; 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 S237325AbiCAT4s (ORCPT + 99 others); Tue, 1 Mar 2022 14:56:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234210AbiCAT4g (ORCPT ); Tue, 1 Mar 2022 14:56:36 -0500 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A01DD6CA6F; Tue, 1 Mar 2022 11:55:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646164554; x=1677700554; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=IX9RbOmrBoZoGdoaea4eD/8Uj1Ve7FBJwYQ9q6QGXdw=; b=XiOTmf2upM7Pw3Yu/YhYxVt1aaL3Y8nT/jDE9Vl314hloHI+89oFoNkd BvFi0WkGb/4XmguXmOo2zO2r0LOuVN2bqHPRSOVQRTaffO4Krdar+Tzvx 4XU0sFPoK8t+DstfSKixi05tei7LXEhBI+ft1L27/0ep4j8TPQEgmCaQ7 F5O0VlPoLadKl5KpGK9uDI8n7XTJS6kbsO3vaaNL4WrM9tbBBayN5LQlG T7fuK1D0aHPqcjObJfsSW7IpU6gZoEfdMa2Y6oDXszcN6pSRhyhLofOV4 siQybq429pVRpLoDjs7eJZLHzPbqelXoESGklOofh7ZKdebinNNUsldie Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10273"; a="233194892" X-IronPort-AV: E=Sophos;i="5.90,146,1643702400"; d="scan'208";a="233194892" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Mar 2022 11:55:53 -0800 X-IronPort-AV: E=Sophos;i="5.90,146,1643702400"; d="scan'208";a="630133161" Received: from coffy.sc.intel.com ([10.3.79.166]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Mar 2022 11:55:53 -0800 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, corbet@lwn.net, gregkh@linuxfoundation.org, andriy.shevchenko@linux.intel.com, jithu.joseph@intel.com, ashok.raj@intel.com, tony.luck@intel.com, rostedt@goodmis.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, platform-driver-x86@vger.kernel.org, patches@lists.linux.dev, ravi.v.shankar@intel.com Subject: [RFC 03/10] platform/x86/intel/ifs: Add driver for In-Field Scan Date: Tue, 1 Mar 2022 11:54:50 -0800 Message-Id: <20220301195457.21152-4-jithu.joseph@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220301195457.21152-1-jithu.joseph@intel.com> References: <20220301195457.21152-1-jithu.joseph@intel.com> X-Spam-Status: No, score=-4.8 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_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 In-Field Scan (IFS) provides hardware hooks to perform core tests and report failures for portions of silicon that lack error detection capabilities, which will be available in some server SKUs starting with Sapphire Rapids. It offers infrastructure to specific users such as cloud providers or OEMs to schedule tests and find in-field failures due to aging in silicon that might not necessarily be reported with normal machine checks. Add basic parts of the IFS module (initialization and check IFS capability support in a processor). MSR IA32_CORE_CAPABILITY is a feature-enumerating MSR, bit 2 of which reports MSR_INTEGRITY_CAPABILITIES. Processor that supports IFS should reports the MSR_INTEGRITY_CAPABILITIES enabled. Please check the latest Intel 64 and IA-32 Architectures Software Developer's Manual for more detailed information on the MSR and the MSR_INTEGRITY_CAPABILITIES. Originally-by: Kyung Min Park Signed-off-by: Jithu Joseph Reviewed-by: Ashok Raj Reviewed-by: Tony Luck --- MAINTAINERS | 7 ++++ drivers/platform/x86/intel/Kconfig | 1 + drivers/platform/x86/intel/Makefile | 1 + drivers/platform/x86/intel/ifs/Kconfig | 9 +++++ drivers/platform/x86/intel/ifs/Makefile | 7 ++++ drivers/platform/x86/intel/ifs/core.c | 49 +++++++++++++++++++++++++ drivers/platform/x86/intel/ifs/ifs.h | 14 +++++++ 7 files changed, 88 insertions(+) create mode 100644 drivers/platform/x86/intel/ifs/Kconfig create mode 100644 drivers/platform/x86/intel/ifs/Makefile create mode 100644 drivers/platform/x86/intel/ifs/core.c create mode 100644 drivers/platform/x86/intel/ifs/ifs.h diff --git a/MAINTAINERS b/MAINTAINERS index 777cd6fa2b3d..4c9912c0d725 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -9685,6 +9685,13 @@ B: https://bugzilla.kernel.org T: git git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux.git F: drivers/idle/intel_idle.c +INTEL IN FIELD SCAN (IFS) DRIVER +M: Jithu Joseph +R: Ashok Raj +R: Tony Luck +S: Maintained +F: drivers/platform/x86/intel/ifs + INTEL INTEGRATED SENSOR HUB DRIVER M: Srinivas Pandruvada M: Jiri Kosina diff --git a/drivers/platform/x86/intel/Kconfig b/drivers/platform/x86/intel/Kconfig index 8e65086bb6c8..7339e7daf0a1 100644 --- a/drivers/platform/x86/intel/Kconfig +++ b/drivers/platform/x86/intel/Kconfig @@ -4,6 +4,7 @@ # source "drivers/platform/x86/intel/atomisp2/Kconfig" +source "drivers/platform/x86/intel/ifs/Kconfig" source "drivers/platform/x86/intel/int1092/Kconfig" source "drivers/platform/x86/intel/int33fe/Kconfig" source "drivers/platform/x86/intel/int3472/Kconfig" diff --git a/drivers/platform/x86/intel/Makefile b/drivers/platform/x86/intel/Makefile index 35f2066578b2..bd7f2ef5e767 100644 --- a/drivers/platform/x86/intel/Makefile +++ b/drivers/platform/x86/intel/Makefile @@ -5,6 +5,7 @@ # obj-$(CONFIG_INTEL_ATOMISP2_PDX86) += atomisp2/ +obj-$(CONFIG_INTEL_IFS) += ifs/ obj-$(CONFIG_INTEL_SAR_INT1092) += int1092/ obj-$(CONFIG_INTEL_CHT_INT33FE) += int33fe/ obj-$(CONFIG_INTEL_SKL_INT3472) += int3472/ diff --git a/drivers/platform/x86/intel/ifs/Kconfig b/drivers/platform/x86/intel/ifs/Kconfig new file mode 100644 index 000000000000..88e3d4fa1759 --- /dev/null +++ b/drivers/platform/x86/intel/ifs/Kconfig @@ -0,0 +1,9 @@ +config INTEL_IFS + tristate "Intel In Field Scan" + depends on X86 && 64BIT && SMP + help + Enable support for In Field Scan in Intel CPU to perform core + logic test in the field. To compile this driver as a module, choose + M here. The module will be called intel_ifs. + + If unsure, say N. diff --git a/drivers/platform/x86/intel/ifs/Makefile b/drivers/platform/x86/intel/ifs/Makefile new file mode 100644 index 000000000000..05b4925402b4 --- /dev/null +++ b/drivers/platform/x86/intel/ifs/Makefile @@ -0,0 +1,7 @@ +# +# Makefile for the In-Field Scan driver +# + +obj-$(CONFIG_INTEL_IFS) += intel_ifs.o + +intel_ifs-objs := core.o diff --git a/drivers/platform/x86/intel/ifs/core.c b/drivers/platform/x86/intel/ifs/core.c new file mode 100644 index 000000000000..fb3c864d3085 --- /dev/null +++ b/drivers/platform/x86/intel/ifs/core.c @@ -0,0 +1,49 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* Copyright(c) 2021 Intel Corporation. + * + * Author: Jithu Joseph + */ + +#include +#include + +#include "ifs.h" + +#define X86_MATCH(model) \ + X86_MATCH_VENDOR_FAM_MODEL_FEATURE(INTEL, 6, \ + INTEL_FAM6_##model, X86_FEATURE_CORE_CAPABILITIES, NULL) + +static const struct x86_cpu_id ifs_cpu_ids[] __initconst = { + X86_MATCH(SAPPHIRERAPIDS_X), + {} +}; + +MODULE_DEVICE_TABLE(x86cpu, ifs_cpu_ids); + +static int __init ifs_init(void) +{ + const struct x86_cpu_id *m; + u64 ia32_core_caps; + + /* ifs capability check */ + m = x86_match_cpu(ifs_cpu_ids); + if (!m) + return -ENODEV; + if (rdmsrl_safe(MSR_IA32_CORE_CAPS, &ia32_core_caps)) + return -ENODEV; + if (!(ia32_core_caps & MSR_IA32_CORE_CAPS_INTEGRITY)) + return -ENODEV; + + return 0; +} + +static void __exit ifs_exit(void) +{ + pr_info("unloaded 'In-Field Scan' module\n"); +} + +MODULE_LICENSE("GPL"); +MODULE_INFO(name, "ifs"); +MODULE_DESCRIPTION("ifs"); +module_init(ifs_init); +module_exit(ifs_exit); diff --git a/drivers/platform/x86/intel/ifs/ifs.h b/drivers/platform/x86/intel/ifs/ifs.h new file mode 100644 index 000000000000..f3f924fced06 --- /dev/null +++ b/drivers/platform/x86/intel/ifs/ifs.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* Copyright(c) 2021 Intel Corporation. + * + * Author: Jithu Joseph + */ + +#ifndef _IFS_H_ +#define _IFS_H_ + +/* These bits are in the IA32_CORE_CAPABILITIES MSR */ +#define MSR_IA32_CORE_CAPS_INTEGRITY_BIT 2 +#define MSR_IA32_CORE_CAPS_INTEGRITY BIT(MSR_IA32_CORE_CAPS_INTEGRITY_BIT) + +#endif -- 2.17.1