Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4941218rdb; Fri, 15 Sep 2023 18:20:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHo0G+KY7NgnmVWV5ApM5jGIfLGUK54XzZBrNtj82WbDSQzH4J5jX8IoiXEB5DCNjZhJWFg X-Received: by 2002:a05:6808:3d2:b0:3ab:84f0:b49d with SMTP id o18-20020a05680803d200b003ab84f0b49dmr3582765oie.3.1694827213285; Fri, 15 Sep 2023 18:20:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694827213; cv=none; d=google.com; s=arc-20160816; b=HGHX4UcRLCGBaC+KkVmUI3tRmYxlXe9QnKR4slq3Enw7SNHsgAnFIt+J43dNw/2rqQ o4SEwyDkuxrZbRB1sRqbowaCQOCWbKVmB+qlJEZxH5TMFajnSxbwqthc8nnoYVv9I/YH LiXU3U3eUJD0eqkfeDj+dGi1uj3vVwnfB01/4IHkpdCGmmXT7B2kk3HLR7cZ5H6US3Oy u5VfJyHfCvxNX19ICowZCzY+KPQk/u2aS3RFlNdf1M/EzvVdKoEGex5EfZbUmGHQKXYT UmR4//jJdZrKy72yihLry2jAvIEp+fxSCsSLNJR/tPrH/Jk4IzEQwjncixMieLUpwesC KuGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=no41j4/xpANW+3Sqa48NkcvmfJRvP+xn9XB665u+3Ek=; fh=K2GM5v+nVwO6ZuN/Z8kiBzkmUG39Q9bUAXLt7esKjHI=; b=ohwui/wWzs8ryFolM1X6eGVCfBdwgTY0uHMRPjqD2VJArWSOvxvbMJwQVxy6s1kwBC Jnyoc2s1icexJSUt5UeGqTIyLCLlek7PI5L9R6nqwPP/AZ8jc7BqR80MHQiRjotH0xXI X3bCZoHjcLPpOEVkB4rgh/gcGt8U3nCZK/kbOwBQR/C9INCUfFbOvkljU038oH36suBT UC+ho1vm2u9W/HsswVpN42J3V4Y9y+WVivrV5sWownCLVxmre9OyoPLJwNs0fd0PLfkN asvzXoDZsyGrznGTHXtNoiDAYWJRvcN33ZWEIzwXCKb+8SZhoOdyZeHe9hdIIYymJTN1 6VHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=NKSO3qyI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id fa38-20020a056a002d2600b0069019bef4e4si4130980pfb.79.2023.09.15.18.20.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 18:20:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=NKSO3qyI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (Postfix) with ESMTP id 1AE34804AD9B; Fri, 15 Sep 2023 10:06:33 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235184AbjIORFm (ORCPT + 99 others); Fri, 15 Sep 2023 13:05:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235499AbjIORFW (ORCPT ); Fri, 15 Sep 2023 13:05:22 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56DE72724; Fri, 15 Sep 2023 10:04: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=1694797494; x=1726333494; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=aysai3SOeuDv7ALo+1RgOm9eYqO3zsn50ZmfVEljzUI=; b=NKSO3qyIygezQpJlG2PXbOO0emrhvk3IMGKXDpbVUL4apwpmR5Hu7+Ts JAKk2ge85Rq/ehieMuq5BRnJWdgNqjQWQPOkyjgG0Bsdv2bd6lHC6ir15 sqAJo6JVmApGyCdckVnq+TJZBj1Th4r/2MQ2JUfBw5qsO+JlEqS7KIt7i AM5UdAuJeTRRY91I8NeNoP112Nic5IcEMP4vyIqGeON8M61R36wdf+86D OFjJhu2qKVmUUs5PD+UtdpFLNALw4n2IcF8wNJN1zU7YAw7fBzwB+jTyK y06WeP29E8YK7QpN888czRJORCgsjx2c5XVjq+Pjdl2NSrAw8AHTlll8F w==; X-IronPort-AV: E=McAfee;i="6600,9927,10834"; a="379218163" X-IronPort-AV: E=Sophos;i="6.02,149,1688454000"; d="scan'208";a="379218163" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Sep 2023 10:04:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10834"; a="1075855824" X-IronPort-AV: E=Sophos;i="6.02,149,1688454000"; d="scan'208";a="1075855824" Received: from srdoo-mobl1.ger.corp.intel.com ([10.252.38.99]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Sep 2023 10:04:12 -0700 Date: Fri, 15 Sep 2023 20:04:09 +0300 (EEST) From: =?ISO-8859-15?Q?Ilpo_J=E4rvinen?= To: Jithu Joseph cc: hdegoede@redhat.com, markgross@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, rostedt@goodmis.org, 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: Re: [PATCH 10/10] platform/x86/intel/ifs: ARRAY BIST for Sierra Forest In-Reply-To: <20230913183348.1349409-11-jithu.joseph@intel.com> Message-ID: References: <20230913183348.1349409-1-jithu.joseph@intel.com> <20230913183348.1349409-11-jithu.joseph@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.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 (pete.vger.email [0.0.0.0]); Fri, 15 Sep 2023 10:06:33 -0700 (PDT) On Wed, 13 Sep 2023, Jithu Joseph wrote: > Array BIST MSR addresses, bit definition and semantics > are different for Sierra Forest. Branch into a separate > Array BIST flow on Sierra Forest when user invokes Array Test. > > Signed-off-by: Jithu Joseph > Reviewed-by: Tony Luck > Tested-by: Pengfei Xu > --- > drivers/platform/x86/intel/ifs/ifs.h | 4 +++ > drivers/platform/x86/intel/ifs/core.c | 15 +++++----- > drivers/platform/x86/intel/ifs/runtest.c | 37 +++++++++++++++++++++++- > 3 files changed, 48 insertions(+), 8 deletions(-) > > diff --git a/drivers/platform/x86/intel/ifs/ifs.h b/drivers/platform/x86/intel/ifs/ifs.h > index 3265a6d8a6f3..2f20588a71f1 100644 > --- a/drivers/platform/x86/intel/ifs/ifs.h > +++ b/drivers/platform/x86/intel/ifs/ifs.h > @@ -137,6 +137,8 @@ > #define MSR_CHUNKS_AUTHENTICATION_STATUS 0x000002c5 > #define MSR_ACTIVATE_SCAN 0x000002c6 > #define MSR_SCAN_STATUS 0x000002c7 > +#define MSR_ARRAY_TRIGGER 0x000002d6 > +#define MSR_ARRAY_STATUS 0x000002d7 > #define MSR_SAF_CTRL 0x000004f0 > > #define SCAN_NOT_TESTED 0 > @@ -270,6 +272,7 @@ struct ifs_test_caps { > * @cur_batch: number indicating the currently loaded test file > * @generation: IFS test generation enumerated by hardware > * @chunk_size: size of a test chunk > + * @array_gen: test generation of array test > */ > struct ifs_data { > int loaded_version; > @@ -281,6 +284,7 @@ struct ifs_data { > u32 cur_batch; > u32 generation; > u32 chunk_size; > + u32 array_gen; > }; > > struct ifs_work { > diff --git a/drivers/platform/x86/intel/ifs/core.c b/drivers/platform/x86/intel/ifs/core.c > index 0938bfbd9086..e8b570930c16 100644 > --- a/drivers/platform/x86/intel/ifs/core.c > +++ b/drivers/platform/x86/intel/ifs/core.c > @@ -10,16 +10,16 @@ > > #include "ifs.h" > > -#define X86_MATCH(model) \ > +#define X86_MATCH(model, array_gen) \ > X86_MATCH_VENDOR_FAM_MODEL_FEATURE(INTEL, 6, \ > - INTEL_FAM6_##model, X86_FEATURE_CORE_CAPABILITIES, NULL) > + INTEL_FAM6_##model, X86_FEATURE_CORE_CAPABILITIES, array_gen) > > static const struct x86_cpu_id ifs_cpu_ids[] __initconst = { > - X86_MATCH(SAPPHIRERAPIDS_X), > - X86_MATCH(EMERALDRAPIDS_X), > - X86_MATCH(GRANITERAPIDS_X), > - X86_MATCH(GRANITERAPIDS_D), > - X86_MATCH(ATOM_CRESTMONT_X), > + X86_MATCH(SAPPHIRERAPIDS_X, 0), > + X86_MATCH(EMERALDRAPIDS_X, 0), > + X86_MATCH(GRANITERAPIDS_X, 0), > + X86_MATCH(GRANITERAPIDS_D, 0), > + X86_MATCH(ATOM_CRESTMONT_X, 1), > {} > }; > MODULE_DEVICE_TABLE(x86cpu, ifs_cpu_ids); > @@ -99,6 +99,7 @@ static int __init ifs_init(void) > continue; > ifs_devices[i].rw_data.generation = (msrval & MSR_INTEGRITY_CAPS_SAF_GEN_REV_MASK) > >> MSR_INTEGRITY_CAPS_SAF_GEN_REV_SHIFT; > + ifs_devices[i].rw_data.array_gen = (u32)m->driver_data; > ret = misc_register(&ifs_devices[i].misc); > if (ret) > goto err_exit; > diff --git a/drivers/platform/x86/intel/ifs/runtest.c b/drivers/platform/x86/intel/ifs/runtest.c > index 997d2f07aa0c..9cfd5c015cb2 100644 > --- a/drivers/platform/x86/intel/ifs/runtest.c > +++ b/drivers/platform/x86/intel/ifs/runtest.c > @@ -327,6 +327,38 @@ static void ifs_array_test_core(int cpu, struct device *dev) > ifsd->status = SCAN_TEST_PASS; > } > > +#define ARRAY_GEN1_TEST_ALL_ARRAYS (0x0ULL) > +#define ARRAY_GEN1_STATUS_FAIL (0x1ULL) Unnecessary parenthesis > +static int do_array_test_gen1(void *status) > +{ > + int cpu = smp_processor_id(); > + int first; > + > + first = cpumask_first(cpu_smt_mask(cpu)); > + > + if (cpu == first) { > + wrmsrl(MSR_ARRAY_TRIGGER, ARRAY_GEN1_TEST_ALL_ARRAYS); > + rdmsrl(MSR_ARRAY_STATUS, *((u64 *)status)); > + } > + > + return 0; > +} > + > +static void ifs_array_test_gen1(int cpu, struct device *dev) > +{ > + struct ifs_data *ifsd = ifs_get_data(dev); > + u64 status = 0; Just use space instead of tab. > + > + stop_core_cpuslocked(cpu, do_array_test_gen1, &status); > + ifsd->scan_details = status; > + > + if (status & ARRAY_GEN1_STATUS_FAIL) > + ifsd->status = SCAN_TEST_FAIL; > + 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 > @@ -354,7 +386,10 @@ 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); > + if (ifsd->array_gen == 0) > + ifs_array_test_core(cpu, dev); > + else > + ifs_array_test_gen1(cpu, dev); > break; > default: > return -EINVAL; > -- i.