Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3780019rdb; Thu, 14 Sep 2023 02:17:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFRt4yvEgIv+y0R3pfiOJXLxDFXsEbgTnBkpbcfN+xj+UbA9tiGlaTkfgknqciATCTpF5ir X-Received: by 2002:a17:902:e742:b0:1c3:94a4:34bf with SMTP id p2-20020a170902e74200b001c394a434bfmr5721756plf.66.1694683047914; Thu, 14 Sep 2023 02:17:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694683047; cv=none; d=google.com; s=arc-20160816; b=sDvkdSB2/40JiPnansNDWb9qVsNdMJFXVGISErKRd+RsKtD7nPQjVh8NI7jcbo1Xyb g1mqS3ZFAejiyZVkNosijrObtynPimuYjU0pzL9FU5z5cwJfUBBM5gOS0PfxGUQmSofd 9bH6dLY2dEm2uhb/Von99OsDRZq2S4EbZ8EVM3bWuWkZB/rusk1aWpalvIj03ghyMO3M nee7Xt5Eq/su3UcG7J134GmhZRDuCPMMZiYFMDzzbQdr/tWTRV1LpDkjFg766SHZa98F SuQL/8dOnBQsuNC0BKyW1v2BRliRSU4sEHepxofwnJRUh5eQMkVQD0PA17ILaSnvn20g ceMw== 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=mHabYtRN1t0xWYb49oCu8HtJOPNCBVGe90dv/65PDy8=; fh=8xS9zNNEexx7KHEczBpq5wXIDtxA/g5mXnxETx6X+p0=; b=nF+C6eCPnFcxFODiinCORYLWqlcokO9BVCctaj/cGjnGsvwC8lv8nObV04OBXQaacM Z3gPTVYhW3iEijs1ySPNvyPG2I2blLTTQ0PoleSLpCgmWQLHRynZJd7GLCI277GaiMhr 02LP/lGFgUjaky7PuCuNvToLoZKdK0iZMHTjSub8cVzxABhGFVSB1HfI+qLMIurJGXra 9b0n8r04OHhAkjk0QrmzMitBHsfO8JPDrvfYLPg6AXGRYzl5I6oRhsg2lt//2g1MOQaG BwN64GqpFHdHnNSom/f4gDqeERD39l4fEl1mxxWMdio8aXzAaXdH9D2ONeO8dICs9SMT xVCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=c22BAhIA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id j20-20020a170902f25400b001b89b63b877si1204278plc.446.2023.09.14.02.17.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 02:17:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=c22BAhIA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 12351801BFDC; Wed, 13 Sep 2023 11:38:02 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231925AbjIMSiC (ORCPT + 99 others); Wed, 13 Sep 2023 14:38:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229552AbjIMSh6 (ORCPT ); Wed, 13 Sep 2023 14:37:58 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3EBC1BC6; Wed, 13 Sep 2023 11:37: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=1694630274; x=1726166274; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zYniCTlI2hRtCCmtPBhkZpW2hr3gRwPR25GRONFDmyM=; b=c22BAhIA5kRI5fagxc0Bfmd7/LS3xBFH51O2r5dj88HqIYaDgLjmj5va SCrgxnuHVc76+w+egJBIzThWDQ4LxvXl+fc3HxhTUwH2ppxvkp3VkCxD2 iaUb5WVvg60SRm5+rVUaxeYuLVm0ED4MGcPvhEk1AOI37UeXAGo8OsSeu i8kVCYejyO6E4F1cLcJ3fQrC4v2v9t870DnvkVTrygDrq9FrlOwZO3Gij MgujrYqlp0nQXflxVsY2DRx2+eVmcuzdygoS4OoTvpHEgza9ETmztV9cp VzyFPtZkbf8jhaH/DofGw/hqnGSTgi3DoVw1UYRWpO3/0dE3xkQdrJlE8 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10832"; a="369019114" X-IronPort-AV: E=Sophos;i="6.02,143,1688454000"; d="scan'208";a="369019114" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Sep 2023 11:37:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10832"; a="744238575" X-IronPort-AV: E=Sophos;i="6.02,143,1688454000"; d="scan'208";a="744238575" Received: from jithujos.sc.intel.com ([172.25.103.66]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Sep 2023 11:37:53 -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 Subject: [PATCH 01/10] platform/x86/intel/ifs: Store IFS generation number Date: Wed, 13 Sep 2023 11:33:39 -0700 Message-Id: <20230913183348.1349409-2-jithu.joseph@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230913183348.1349409-1-jithu.joseph@intel.com> References: <20230913183348.1349409-1-jithu.joseph@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 (snail.vger.email [0.0.0.0]); Wed, 13 Sep 2023 11:38:02 -0700 (PDT) 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 | 2 ++ drivers/platform/x86/intel/ifs/ifs.h | 2 ++ drivers/platform/x86/intel/ifs/core.c | 2 ++ 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..a71a86a01488 100644 --- a/arch/x86/include/asm/msr-index.h +++ b/arch/x86/include/asm/msr-index.h @@ -222,6 +222,8 @@ #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_REV_SHIFT 9 +#define MSR_INTEGRITY_CAPS_SAF_GEN_REV_MASK (0x3ull << MSR_INTEGRITY_CAPS_SAF_GEN_REV_SHIFT) #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..88d84aad9334 100644 --- a/drivers/platform/x86/intel/ifs/core.c +++ b/drivers/platform/x86/intel/ifs/core.c @@ -94,6 +94,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 = (msrval & MSR_INTEGRITY_CAPS_SAF_GEN_REV_MASK) + >> MSR_INTEGRITY_CAPS_SAF_GEN_REV_SHIFT; ret = misc_register(&ifs_devices[i].misc); if (ret) goto err_exit; -- 2.25.1