@@ -249,5 +249,6 @@ static inline struct ifs_data *ifs_get_data(struct device *dev)
int ifs_load_firmware(struct device *dev);
int do_core_test(int cpu, struct device *dev);
const struct attribute_group **ifs_get_groups(void);
+extern struct attribute *plat_ifs_array_attrs[];
#endif
@@ -25,6 +25,7 @@ static struct ifs_device ifs_devices[] = {
[IFS_SAF] = {
.data = {
.integrity_cap_bit = MSR_INTEGRITY_CAPS_PERIODIC_BIST_BIT,
+ .pkg_auth = NULL,
.test_num = IFS_SAF,
},
.misc = {
@@ -36,6 +37,7 @@ static struct ifs_device ifs_devices[] = {
[IFS_ARRAY] = {
.data = {
.integrity_cap_bit = MSR_INTEGRITY_CAPS_ARRAY_BIST_BIT,
+ .pkg_auth = NULL,
.test_num = IFS_ARRAY,
},
.misc = {
@@ -48,6 +50,8 @@ static struct ifs_device ifs_devices[] = {
#define IFS_NUMTESTS ARRAY_SIZE(ifs_devices)
+ATTRIBUTE_GROUPS(plat_ifs_array);
+
static int __init ifs_init(void)
{
const struct x86_cpu_id *m;
@@ -72,11 +76,18 @@ static int __init ifs_init(void)
if (!(msrval & BIT(ifs_devices[i].data.integrity_cap_bit)))
continue;
- ifs_devices[i].data.pkg_auth = kmalloc_array(topology_max_packages(),
- sizeof(bool), GFP_KERNEL);
- if (!ifs_devices[i].data.pkg_auth)
- continue;
- ifs_devices[i].misc.groups = ifs_get_groups();
+ switch (ifs_devices[i].data.test_num) {
+ case IFS_SAF:
+ ifs_devices[i].data.pkg_auth = kmalloc_array(topology_max_packages(),
+ sizeof(bool), GFP_KERNEL);
+ if (!ifs_devices[i].data.pkg_auth)
+ continue;
+ ifs_devices[i].misc.groups = ifs_get_groups();
+ break;
+ case IFS_ARRAY:
+ ifs_devices[i].misc.groups = plat_ifs_array_groups;
+ break;
+ }
if (misc_register(&ifs_devices[i].misc))
kfree(ifs_devices[i].data.pkg_auth);
@@ -236,6 +236,7 @@ static void ifs_test_core(int cpu, struct device *dev)
*/
int do_core_test(int cpu, struct device *dev)
{
+ struct ifs_data *ifsd = ifs_get_data(dev);
int ret = 0;
/* Prevent CPUs from being taken offline during the scan test */
@@ -247,7 +248,15 @@ int do_core_test(int cpu, struct device *dev)
goto out;
}
- ifs_test_core(cpu, dev);
+ switch (ifsd->test_num) {
+ case IFS_SAF:
+ ifs_test_core(cpu, dev);
+ break;
+ case IFS_ARRAY:
+ default:
+ return -EINVAL;
+ }
+
out:
cpus_read_unlock();
return ret;
@@ -75,7 +75,7 @@ static ssize_t run_test_store(struct device *dev,
if (down_interruptible(&ifs_sem))
return -EINTR;
- if (!ifsd->loaded)
+ if (ifsd->test_num != IFS_ARRAY && !ifsd->loaded)
rc = -EPERM;
else
rc = do_core_test(cpu, dev);
@@ -156,3 +156,11 @@ const struct attribute_group **ifs_get_groups(void)
{
return plat_ifs_groups;
}
+
+/* global array sysfs attributes */
+struct attribute *plat_ifs_array_attrs[] = {
+ &dev_attr_details.attr,
+ &dev_attr_status.attr,
+ &dev_attr_run_test.attr,
+ NULL
+};