Commit 5210fb4e authored by Jithu Joseph's avatar Jithu Joseph Committed by Hans de Goede

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: default avatarJithu Joseph <jithu.joseph@intel.com>
Reviewed-by: default avatarTony Luck <tony.luck@intel.com>
Link: https://lore.kernel.org/r/20230322003359.213046-7-jithu.joseph@intel.comReviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
parent d31bbdf4
...@@ -22,6 +22,7 @@ static const struct x86_cpu_id ifs_cpu_ids[] __initconst = { ...@@ -22,6 +22,7 @@ static const struct x86_cpu_id ifs_cpu_ids[] __initconst = {
MODULE_DEVICE_TABLE(x86cpu, ifs_cpu_ids); MODULE_DEVICE_TABLE(x86cpu, ifs_cpu_ids);
ATTRIBUTE_GROUPS(plat_ifs); ATTRIBUTE_GROUPS(plat_ifs);
ATTRIBUTE_GROUPS(plat_ifs_array);
bool *ifs_pkg_auth; bool *ifs_pkg_auth;
...@@ -49,6 +50,7 @@ static struct ifs_device ifs_devices[] = { ...@@ -49,6 +50,7 @@ static struct ifs_device ifs_devices[] = {
.misc = { .misc = {
.name = "intel_ifs_1", .name = "intel_ifs_1",
.minor = MISC_DYNAMIC_MINOR, .minor = MISC_DYNAMIC_MINOR,
.groups = plat_ifs_array_groups,
}, },
}, },
}; };
......
...@@ -256,5 +256,6 @@ extern bool *ifs_pkg_auth; ...@@ -256,5 +256,6 @@ extern bool *ifs_pkg_auth;
int ifs_load_firmware(struct device *dev); int ifs_load_firmware(struct device *dev);
int do_core_test(int cpu, struct device *dev); int do_core_test(int cpu, struct device *dev);
extern struct attribute *plat_ifs_attrs[]; extern struct attribute *plat_ifs_attrs[];
extern struct attribute *plat_ifs_array_attrs[];
#endif #endif
...@@ -236,6 +236,8 @@ static void ifs_test_core(int cpu, struct device *dev) ...@@ -236,6 +236,8 @@ static void ifs_test_core(int cpu, struct device *dev)
*/ */
int do_core_test(int cpu, struct device *dev) int do_core_test(int cpu, struct device *dev)
{ {
const struct ifs_test_caps *test = ifs_get_test_caps(dev);
struct ifs_data *ifsd = ifs_get_data(dev);
int ret = 0; int ret = 0;
/* Prevent CPUs from being taken offline during the scan test */ /* Prevent CPUs from being taken offline during the scan test */
...@@ -247,7 +249,16 @@ int do_core_test(int cpu, struct device *dev) ...@@ -247,7 +249,16 @@ int do_core_test(int cpu, struct device *dev)
goto out; goto out;
} }
switch (test->test_num) {
case IFS_TYPE_SAF:
if (!ifsd->loaded)
return -EPERM;
ifs_test_core(cpu, dev); ifs_test_core(cpu, dev);
break;
case IFS_TYPE_ARRAY_BIST:
default:
return -EINVAL;
}
out: out:
cpus_read_unlock(); cpus_read_unlock();
return ret; return ret;
......
...@@ -64,7 +64,6 @@ static ssize_t run_test_store(struct device *dev, ...@@ -64,7 +64,6 @@ static ssize_t run_test_store(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct ifs_data *ifsd = ifs_get_data(dev);
unsigned int cpu; unsigned int cpu;
int rc; int rc;
...@@ -75,9 +74,6 @@ static ssize_t run_test_store(struct device *dev, ...@@ -75,9 +74,6 @@ static ssize_t run_test_store(struct device *dev,
if (down_interruptible(&ifs_sem)) if (down_interruptible(&ifs_sem))
return -EINTR; return -EINTR;
if (!ifsd->loaded)
rc = -EPERM;
else
rc = do_core_test(cpu, dev); rc = do_core_test(cpu, dev);
up(&ifs_sem); up(&ifs_sem);
...@@ -149,3 +145,11 @@ struct attribute *plat_ifs_attrs[] = { ...@@ -149,3 +145,11 @@ struct attribute *plat_ifs_attrs[] = {
&dev_attr_image_version.attr, &dev_attr_image_version.attr,
NULL NULL
}; };
/* global array sysfs attributes */
struct attribute *plat_ifs_array_attrs[] = {
&dev_attr_details.attr,
&dev_attr_status.attr,
&dev_attr_run_test.attr,
NULL
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment