Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp3082723rdb; Fri, 22 Sep 2023 18:45:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFZP6eFwr7hbePAExoxUyJ61P6CYvxic0ErdC4o8HHF9gq/UBGREpHQ8GWTepPaWI4h9l2+ X-Received: by 2002:a05:622a:487:b0:418:330:f06a with SMTP id p7-20020a05622a048700b004180330f06amr1440137qtx.3.1695433528913; Fri, 22 Sep 2023 18:45:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695433528; cv=none; d=google.com; s=arc-20160816; b=0jaUV9nxqnj8msE5LCFn60/eask/JjnDbedn2LNso8uY+WMh+unpFbmdMlDkFv6gys nk2qezOxedeXgel9ziz8mwApGdhGfjizH5KuGJ4xISD2nbGxtks4R/QWM+0rFCQPFP/u 7ZsJ2jSyjTzTAJ3A6aA9ftIVAl7XBYHgyq88eagJ5jD9ofIppR1dkYo8G2yCnK4XWtWg AfUUFar3P62ZEK/+Ow5VpawOqy5w+YOKuHwJYiri+GUAlBE9On54zfEX8J8eOkfCjxdQ NUHY+BhJuLCzlp+FSLproz2pQdF2vSpBagufEJHB6+boyE6GX0Ek+wgUr2s4CAysUZHY 6L+A== 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=XJofgqVIs6eyUWqnLyz1eWr1jpQr21AALhgh/yWmiHQ=; fh=DZTEBuCdFfe2DSdaI+6ceTR59ce872SNjmboNXW/0pA=; b=ko+/4HP2SiTS06f1tyEDbTC3D33gUjvFISvcca5FJgA7v7Rle2jt9v0/neEBwtzQL6 V/cBtT+hOADihVwtpXSPpYwS7WmWWO/7SuYuHOL0zCvcBUTs/MUGpxroHkHzAeWhGQ1H GzpdF1VUA1LAgCGC6nn2hPV1FiCJL/ew4ODTbWTbyfgZvSfSOt5G938QyFowpAjkHLWm xSLcIOXkMk7xDpPjrCF0gzCEc8z226eD9ninAZ37/iRfzwMKZwC+vWNl/k5NOHoq82b6 ZhOVy65Ad2U5NLz1BGM99hZBHdmSIzPfdFuSuYOmcR3SOXx3ncmG2IA1Qi9ZFbjuhama O0IA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=CN0OSkx1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id x26-20020a63171a000000b0057cbd803b37si2686321pgl.463.2023.09.22.18.45.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 18:45:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=CN0OSkx1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id A5A3183AE63F; Fri, 22 Sep 2023 16:30:36 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230343AbjIVXaZ (ORCPT + 99 others); Fri, 22 Sep 2023 19:30:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230284AbjIVXaU (ORCPT ); Fri, 22 Sep 2023 19:30:20 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BA9219E; Fri, 22 Sep 2023 16:30:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695425414; x=1726961414; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yqDhufrYUJ2yyLYWzxAUz2+syh0xxHbDT7wJHgZ62Vs=; b=CN0OSkx1eGbq3tQQlYmsOn5Vt+KT0rzNqEZwNW6s6qA8TjSFk8AjykWp bjFAJ9SpJyc5zFiaqV1TRnzHGqxilp1gEWQo9gYIAXkWwoUKFKu7G8g7R GjT8spO7SG2yDudteHmS8TgWWaupROLBb1LLJk9vqqY/AR5AiJMAx3tza O7Kpmkp4beTjyppFzNWfAhmHoC/HnqRhlhEI0+QPCVpUMetqX27QTqIim 2+AXX8bViDIti1yJruihXXtIgsnph41shJDtPd0TnosmYtOaj+eLSpvS/ NQN+JHKp58TN+dVGPDF9L2DFbz3cGHmV5+xW1IncWhamin55AcLZkneTs A==; X-IronPort-AV: E=McAfee;i="6600,9927,10841"; a="411896923" X-IronPort-AV: E=Sophos;i="6.03,169,1694761200"; d="scan'208";a="411896923" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Sep 2023 16:30:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10841"; a="921350826" X-IronPort-AV: E=Sophos;i="6.03,169,1694761200"; d="scan'208";a="921350826" Received: from jithujos.sc.intel.com ([172.25.103.66]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Sep 2023 16:30:11 -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, 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, pengfei.xu@intel.com, ilpo.jarvinen@linux.intel.com Subject: [PATCH v2 1/9] platform/x86/intel/ifs: Store IFS generation number Date: Fri, 22 Sep 2023 16:25:58 -0700 Message-Id: <20230922232606.1928026-2-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230922232606.1928026-1-jithu.joseph@intel.com> References: <20230913183348.1349409-1-jithu.joseph@intel.com> <20230922232606.1928026-1-jithu.joseph@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=2.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Fri, 22 Sep 2023 16:30:36 -0700 (PDT) X-Spam-Level: ** IFS generation number is reported via MSR_INTEGRITY_CAPS. As IFS support gets added to newer CPUs, some differences are expected during IFS image loading and test flows. Define MSR bitmasks to extract and store the generation in driver data, so that driver can modify its MSR interaction appropriately. Signed-off-by: Jithu Joseph Reviewed-by: Tony Luck Tested-by: Pengfei Xu --- arch/x86/include/asm/msr-index.h | 1 + drivers/platform/x86/intel/ifs/ifs.h | 2 ++ drivers/platform/x86/intel/ifs/core.c | 3 +++ 3 files changed, 6 insertions(+) diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h index 1d111350197f..838e5a013a07 100644 --- a/arch/x86/include/asm/msr-index.h +++ b/arch/x86/include/asm/msr-index.h @@ -222,6 +222,7 @@ #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) +#define MSR_INTEGRITY_CAPS_SAF_GEN_MASK GENMASK_ULL(10, 9) #define MSR_LBR_NHM_FROM 0x00000680 #define MSR_LBR_NHM_TO 0x000006c0 diff --git a/drivers/platform/x86/intel/ifs/ifs.h b/drivers/platform/x86/intel/ifs/ifs.h index 93191855890f..d666aeed20fc 100644 --- a/drivers/platform/x86/intel/ifs/ifs.h +++ b/drivers/platform/x86/intel/ifs/ifs.h @@ -229,6 +229,7 @@ struct ifs_test_caps { * @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 + * @generation: IFS test generation enumerated by hardware */ struct ifs_data { int loaded_version; @@ -238,6 +239,7 @@ struct ifs_data { int status; u64 scan_details; u32 cur_batch; + u32 generation; }; struct ifs_work { diff --git a/drivers/platform/x86/intel/ifs/core.c b/drivers/platform/x86/intel/ifs/core.c index 306f886b52d2..4ff2aa4b484b 100644 --- a/drivers/platform/x86/intel/ifs/core.c +++ b/drivers/platform/x86/intel/ifs/core.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* Copyright(c) 2022 Intel Corporation. */ +#include #include #include #include @@ -94,6 +95,8 @@ static int __init ifs_init(void) for (i = 0; i < IFS_NUMTESTS; i++) { if (!(msrval & BIT(ifs_devices[i].test_caps->integrity_cap_bit))) continue; + ifs_devices[i].rw_data.generation = FIELD_GET(MSR_INTEGRITY_CAPS_SAF_GEN_MASK, + msrval); ret = misc_register(&ifs_devices[i].misc); if (ret) goto err_exit; -- 2.25.1