Skip to content

Commit 06d65b2

Browse files
jithu83ij-intel
authored andcommitted
platform/x86/intel/ifs: ARRAY BIST for Sierra Forest
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 <jithu.joseph@intel.com> Reviewed-by: Tony Luck <tony.luck@intel.com> Tested-by: Pengfei Xu <pengfei.xu@intel.com> Link: https://lore.kernel.org/r/20231005195137.3117166-10-jithu.joseph@intel.com [ij: ARRAY_GEN_* -> ARRAY_GEN* for consistency] Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
1 parent b9aa9e4 commit 06d65b2

File tree

3 files changed

+51
-8
lines changed

3 files changed

+51
-8
lines changed

drivers/platform/x86/intel/ifs/core.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111

1212
#include "ifs.h"
1313

14-
#define X86_MATCH(model) \
14+
#define X86_MATCH(model, array_gen) \
1515
X86_MATCH_VENDOR_FAM_MODEL_FEATURE(INTEL, 6, \
16-
INTEL_FAM6_##model, X86_FEATURE_CORE_CAPABILITIES, NULL)
16+
INTEL_FAM6_##model, X86_FEATURE_CORE_CAPABILITIES, array_gen)
1717

1818
static const struct x86_cpu_id ifs_cpu_ids[] __initconst = {
19-
X86_MATCH(SAPPHIRERAPIDS_X),
20-
X86_MATCH(EMERALDRAPIDS_X),
21-
X86_MATCH(GRANITERAPIDS_X),
22-
X86_MATCH(GRANITERAPIDS_D),
23-
X86_MATCH(ATOM_CRESTMONT_X),
19+
X86_MATCH(SAPPHIRERAPIDS_X, ARRAY_GEN0),
20+
X86_MATCH(EMERALDRAPIDS_X, ARRAY_GEN0),
21+
X86_MATCH(GRANITERAPIDS_X, ARRAY_GEN0),
22+
X86_MATCH(GRANITERAPIDS_D, ARRAY_GEN0),
23+
X86_MATCH(ATOM_CRESTMONT_X, ARRAY_GEN1),
2424
{}
2525
};
2626
MODULE_DEVICE_TABLE(x86cpu, ifs_cpu_ids);
@@ -100,6 +100,7 @@ static int __init ifs_init(void)
100100
continue;
101101
ifs_devices[i].rw_data.generation = FIELD_GET(MSR_INTEGRITY_CAPS_SAF_GEN_MASK,
102102
msrval);
103+
ifs_devices[i].rw_data.array_gen = (u32)m->driver_data;
103104
ret = misc_register(&ifs_devices[i].misc);
104105
if (ret)
105106
goto err_exit;

drivers/platform/x86/intel/ifs/ifs.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@
137137
#define MSR_CHUNKS_AUTHENTICATION_STATUS 0x000002c5
138138
#define MSR_ACTIVATE_SCAN 0x000002c6
139139
#define MSR_SCAN_STATUS 0x000002c7
140+
#define MSR_ARRAY_TRIGGER 0x000002d6
141+
#define MSR_ARRAY_STATUS 0x000002d7
140142
#define MSR_SAF_CTRL 0x000004f0
141143

142144
#define SCAN_NOT_TESTED 0
@@ -146,6 +148,9 @@
146148
#define IFS_TYPE_SAF 0
147149
#define IFS_TYPE_ARRAY_BIST 1
148150

151+
#define ARRAY_GEN0 0
152+
#define ARRAY_GEN1 1
153+
149154
/* MSR_SCAN_HASHES_STATUS bit fields */
150155
union ifs_scan_hashes_status {
151156
u64 data;
@@ -272,6 +277,7 @@ struct ifs_test_caps {
272277
* @cur_batch: number indicating the currently loaded test file
273278
* @generation: IFS test generation enumerated by hardware
274279
* @chunk_size: size of a test chunk
280+
* @array_gen: test generation of array test
275281
*/
276282
struct ifs_data {
277283
int loaded_version;
@@ -283,6 +289,7 @@ struct ifs_data {
283289
u32 cur_batch;
284290
u32 generation;
285291
u32 chunk_size;
292+
u32 array_gen;
286293
};
287294

288295
struct ifs_work {

drivers/platform/x86/intel/ifs/runtest.c

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,38 @@ static void ifs_array_test_core(int cpu, struct device *dev)
329329
ifsd->status = SCAN_TEST_PASS;
330330
}
331331

332+
#define ARRAY_GEN1_TEST_ALL_ARRAYS 0x0ULL
333+
#define ARRAY_GEN1_STATUS_FAIL 0x1ULL
334+
335+
static int do_array_test_gen1(void *status)
336+
{
337+
int cpu = smp_processor_id();
338+
int first;
339+
340+
first = cpumask_first(cpu_smt_mask(cpu));
341+
342+
if (cpu == first) {
343+
wrmsrl(MSR_ARRAY_TRIGGER, ARRAY_GEN1_TEST_ALL_ARRAYS);
344+
rdmsrl(MSR_ARRAY_STATUS, *((u64 *)status));
345+
}
346+
347+
return 0;
348+
}
349+
350+
static void ifs_array_test_gen1(int cpu, struct device *dev)
351+
{
352+
struct ifs_data *ifsd = ifs_get_data(dev);
353+
u64 status = 0;
354+
355+
stop_core_cpuslocked(cpu, do_array_test_gen1, &status);
356+
ifsd->scan_details = status;
357+
358+
if (status & ARRAY_GEN1_STATUS_FAIL)
359+
ifsd->status = SCAN_TEST_FAIL;
360+
else
361+
ifsd->status = SCAN_TEST_PASS;
362+
}
363+
332364
/*
333365
* Initiate per core test. It wakes up work queue threads on the target cpu and
334366
* 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)
356388
ifs_test_core(cpu, dev);
357389
break;
358390
case IFS_TYPE_ARRAY_BIST:
359-
ifs_array_test_core(cpu, dev);
391+
if (ifsd->array_gen == ARRAY_GEN0)
392+
ifs_array_test_core(cpu, dev);
393+
else
394+
ifs_array_test_gen1(cpu, dev);
360395
break;
361396
default:
362397
return -EINVAL;

0 commit comments

Comments
 (0)