Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1274850rdb; Mon, 2 Oct 2023 05:01:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG4H2RqSFeigyEhTw2KbViW1FVt0+t/8RpUJ+beYWvC1ieRpi1n8uS5oI7/CI42Z/f7fKHn X-Received: by 2002:a17:90a:5217:b0:273:ed61:a682 with SMTP id v23-20020a17090a521700b00273ed61a682mr8886031pjh.1.1696248092714; Mon, 02 Oct 2023 05:01:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696248092; cv=none; d=google.com; s=arc-20160816; b=y67Vp1jEqMxogbXat/c1fOoprOHXnqU2/1rRR6pGBELvAGSrEiEv4pxDhdwzs9y2YK W1Nv81jHckKfWF8ne1XBKl52rCdrZQ3I55ZlfWpDkfkL0jSONNPsOCu6ol416/TUkham QxvZuZ9+VFBS6tPA1F/NBGA0NLBrKfl3VHbJLYFqDKWQmExBIreBhHS3VGf43Uj2O/Le qqfkQMlOw22RX93wqnGsLWwgh/WIdrCLZne3+7ejcFq0Rehqfbnb1n+eQ/o7uVESWYP+ Na1Y9I8PgFW834bF2P2M4wdhMycQ7SzR1U+13RJOWQbzpmIK/XRRRpcUWjU7nLNUDdhs ryXA== 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=pr8zJYH4G0eW1EHFuiFLBLiyriNbLiprm8DkW1oBC+k=; fh=Zx4D0zGMBj+9/N7d/Db2W7/hRmbrTS1pGT/B3fLoF6s=; b=JAXFj2Pj+7gfSUNDaqhvfKURR1PPsxMYHanuVFrMqVP/BHQGpGg/ycQwiQTPPmHF5G PEnblT0uiPgnKLptWW0xPmdgw5JPRwqBzORV0Lwyk3aPsfeibbHdWCsfZ0aJjk/+CPYK beQzYUGGjbGPbMvZZUydHivHUrVHJtTvVkrYcObNJ9PMA1h2DfT0lg3H2zoNx6BbqNe3 DzcsoTRqBGFFpnQs1Yvb1PKJGCbYY9xm7voLusujZNC3Q3xWOu/qTBHELQzb3vCJGc5q 1AJ8EuwSOehBraCI0b3YTFzimG5FZhyWTOlvy833lP1WeytlA4MFfshxwODOKAlFfNJS NmeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=UVxX6Z2b; 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 ot2-20020a17090b3b4200b002768ab837bfsi8282403pjb.48.2023.10.02.05.01.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 05:01:32 -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=UVxX6Z2b; 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 295A08023893; Mon, 2 Oct 2023 04:59:36 -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 S236819AbjJBL7P (ORCPT + 99 others); Mon, 2 Oct 2023 07:59:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236697AbjJBL7N (ORCPT ); Mon, 2 Oct 2023 07:59:13 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9D25DC; Mon, 2 Oct 2023 04:59: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=1696247948; x=1727783948; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=Wt4lQ+Vn3ccG4DjT09X9x0/9SxVjB8iFicc1DH/dTOI=; b=UVxX6Z2bbw5ORchyrQTQX/JBwm728TIswzWm/t6Hh8zUQH3c5B9285tL H9i/2uDPtDgAUo5DrOh72xKFcxN5CtQblMnIt+YqJAUmzz66S3mLPbyyI HUiwqR2mTEgm2aTfCnTcdxVWKd4ReJEk0BuWWqL81Bi57X9Bw3FLih3RT qZHSB5Gr6jvOrM6NkE31JsLoFlQKiXqbrDkCtZo31BQUynPK8SBDzKWma 51uyQ5FyDdotIAtephBTkePthM40nZyXAcIfY7g+yeJZQfE66/CmJrR02 FubGk5ZZ9EVQkTZyHCDNaQ+w4Rkb3hSXa772i5iMCVMHFVt7nvmZkNSlx w==; X-IronPort-AV: E=McAfee;i="6600,9927,10850"; a="413538846" X-IronPort-AV: E=Sophos;i="6.03,194,1694761200"; d="scan'208";a="413538846" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Oct 2023 04:59:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10850"; a="816267781" X-IronPort-AV: E=Sophos;i="6.03,194,1694761200"; d="scan'208";a="816267781" Received: from roliveir-mobl1.ger.corp.intel.com ([10.251.222.16]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Oct 2023 04:59:04 -0700 Date: Mon, 2 Oct 2023 14:59:01 +0300 (EEST) From: =?ISO-8859-15?Q?Ilpo_J=E4rvinen?= To: Jithu Joseph cc: Hans de Goede , 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, LKML , platform-driver-x86@vger.kernel.org, patches@lists.linux.dev, ravi.v.shankar@intel.com, pengfei.xu@intel.com Subject: Re: [PATCH v3 9/9] platform/x86/intel/ifs: ARRAY BIST for Sierra Forest In-Reply-To: <20230929202436.2850388-10-jithu.joseph@intel.com> Message-ID: References: <20230922232606.1928026-1-jithu.joseph@intel.com> <20230929202436.2850388-1-jithu.joseph@intel.com> <20230929202436.2850388-10-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]); Mon, 02 Oct 2023 04:59:36 -0700 (PDT) On Fri, 29 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 f0dd849b3400..b183aba3ffdf 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 > @@ -272,6 +274,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; > @@ -283,6 +286,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 0c8927916373..934eaf348f9d 100644 > --- a/drivers/platform/x86/intel/ifs/core.c > +++ b/drivers/platform/x86/intel/ifs/core.c > @@ -11,16 +11,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), Just a suggestion that would IMO make these easier to understand, you could name these array generations with defines so that one does not need to look what's defined in X86_MATCH() to understand the purpose of the second parameter. But it's up to you. -- i. > {} > }; > MODULE_DEVICE_TABLE(x86cpu, ifs_cpu_ids); > @@ -100,6 +100,7 @@ static int __init ifs_init(void) > continue; > ifs_devices[i].rw_data.generation = FIELD_GET(MSR_INTEGRITY_CAPS_SAF_GEN_MASK, > msrval); > + 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 4fe544d79946..a54cd97920c4 100644 > --- a/drivers/platform/x86/intel/ifs/runtest.c > +++ b/drivers/platform/x86/intel/ifs/runtest.c > @@ -329,6 +329,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 > + > +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; > + > + 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 > @@ -356,7 +388,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; >