Skip to content

Commit 5210fb4

Browse files
jithu83jwrdegoede
authored andcommitted
platform/x86/intel/ifs: Sysfs interface for Array BIST
The interface to trigger Array BIST test and obtain its result is similar to the existing scan test. The only notable difference is that, Array BIST doesn't require any test content to be loaded. So binary load related options are not needed for this test. Add sysfs interface for array BIST test, the testing support will be added by subsequent patch. Signed-off-by: Jithu Joseph <jithu.joseph@intel.com> Reviewed-by: Tony Luck <tony.luck@intel.com> Link: https://lore.kernel.org/r/20230322003359.213046-7-jithu.joseph@intel.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
1 parent d31bbdf commit 5210fb4

4 files changed

Lines changed: 24 additions & 6 deletions

File tree

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ static const struct x86_cpu_id ifs_cpu_ids[] __initconst = {
2222
MODULE_DEVICE_TABLE(x86cpu, ifs_cpu_ids);
2323

2424
ATTRIBUTE_GROUPS(plat_ifs);
25+
ATTRIBUTE_GROUPS(plat_ifs_array);
2526

2627
bool *ifs_pkg_auth;
2728

@@ -49,6 +50,7 @@ static struct ifs_device ifs_devices[] = {
4950
.misc = {
5051
.name = "intel_ifs_1",
5152
.minor = MISC_DYNAMIC_MINOR,
53+
.groups = plat_ifs_array_groups,
5254
},
5355
},
5456
};

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,5 +256,6 @@ extern bool *ifs_pkg_auth;
256256
int ifs_load_firmware(struct device *dev);
257257
int do_core_test(int cpu, struct device *dev);
258258
extern struct attribute *plat_ifs_attrs[];
259+
extern struct attribute *plat_ifs_array_attrs[];
259260

260261
#endif

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,8 @@ static void ifs_test_core(int cpu, struct device *dev)
236236
*/
237237
int do_core_test(int cpu, struct device *dev)
238238
{
239+
const struct ifs_test_caps *test = ifs_get_test_caps(dev);
240+
struct ifs_data *ifsd = ifs_get_data(dev);
239241
int ret = 0;
240242

241243
/* Prevent CPUs from being taken offline during the scan test */
@@ -247,7 +249,16 @@ int do_core_test(int cpu, struct device *dev)
247249
goto out;
248250
}
249251

250-
ifs_test_core(cpu, dev);
252+
switch (test->test_num) {
253+
case IFS_TYPE_SAF:
254+
if (!ifsd->loaded)
255+
return -EPERM;
256+
ifs_test_core(cpu, dev);
257+
break;
258+
case IFS_TYPE_ARRAY_BIST:
259+
default:
260+
return -EINVAL;
261+
}
251262
out:
252263
cpus_read_unlock();
253264
return ret;

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ static ssize_t run_test_store(struct device *dev,
6464
struct device_attribute *attr,
6565
const char *buf, size_t count)
6666
{
67-
struct ifs_data *ifsd = ifs_get_data(dev);
6867
unsigned int cpu;
6968
int rc;
7069

@@ -75,10 +74,7 @@ static ssize_t run_test_store(struct device *dev,
7574
if (down_interruptible(&ifs_sem))
7675
return -EINTR;
7776

78-
if (!ifsd->loaded)
79-
rc = -EPERM;
80-
else
81-
rc = do_core_test(cpu, dev);
77+
rc = do_core_test(cpu, dev);
8278

8379
up(&ifs_sem);
8480

@@ -149,3 +145,11 @@ struct attribute *plat_ifs_attrs[] = {
149145
&dev_attr_image_version.attr,
150146
NULL
151147
};
148+
149+
/* global array sysfs attributes */
150+
struct attribute *plat_ifs_array_attrs[] = {
151+
&dev_attr_details.attr,
152+
&dev_attr_status.attr,
153+
&dev_attr_run_test.attr,
154+
NULL
155+
};

0 commit comments

Comments
 (0)