platform/x86/intel/ifs: Separate ifs_pkg_auth from ifs_data
In preparation to supporting additional tests, remove ifs_pkg_auth from per-test scope, as it is only applicable for one test type. This will simplify ifs_init() flow when multiple tests are added. 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-2-jithu.joseph@intel.com Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
Родитель
392cacf2aa
Коммит
67f88ffa6d
|
@ -20,6 +20,8 @@ static const struct x86_cpu_id ifs_cpu_ids[] __initconst = {
|
|||
};
|
||||
MODULE_DEVICE_TABLE(x86cpu, ifs_cpu_ids);
|
||||
|
||||
bool *ifs_pkg_auth;
|
||||
|
||||
static struct ifs_device ifs_device = {
|
||||
.data = {
|
||||
.integrity_cap_bit = MSR_INTEGRITY_CAPS_PERIODIC_BIST_BIT,
|
||||
|
@ -56,13 +58,13 @@ static int __init ifs_init(void)
|
|||
if (!(msrval & BIT(ifs_device.data.integrity_cap_bit)))
|
||||
return -ENODEV;
|
||||
|
||||
ifs_device.data.pkg_auth = kmalloc_array(topology_max_packages(), sizeof(bool), GFP_KERNEL);
|
||||
if (!ifs_device.data.pkg_auth)
|
||||
ifs_pkg_auth = kmalloc_array(topology_max_packages(), sizeof(bool), GFP_KERNEL);
|
||||
if (!ifs_pkg_auth)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = misc_register(&ifs_device.misc);
|
||||
if (ret) {
|
||||
kfree(ifs_device.data.pkg_auth);
|
||||
kfree(ifs_pkg_auth);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -72,7 +74,7 @@ static int __init ifs_init(void)
|
|||
static void __exit ifs_exit(void)
|
||||
{
|
||||
misc_deregister(&ifs_device.misc);
|
||||
kfree(ifs_device.data.pkg_auth);
|
||||
kfree(ifs_pkg_auth);
|
||||
}
|
||||
|
||||
module_init(ifs_init);
|
||||
|
|
|
@ -201,7 +201,6 @@ union ifs_status {
|
|||
* struct ifs_data - attributes related to intel IFS driver
|
||||
* @integrity_cap_bit: MSR_INTEGRITY_CAPS bit enumerating this test
|
||||
* @loaded_version: stores the currently loaded ifs image version.
|
||||
* @pkg_auth: array of bool storing per package auth status
|
||||
* @loaded: If a valid test binary has been loaded into the memory
|
||||
* @loading_error: Error occurred on another CPU while loading image
|
||||
* @valid_chunks: number of chunks which could be validated.
|
||||
|
@ -212,7 +211,6 @@ union ifs_status {
|
|||
*/
|
||||
struct ifs_data {
|
||||
int integrity_cap_bit;
|
||||
bool *pkg_auth;
|
||||
int loaded_version;
|
||||
bool loaded;
|
||||
bool loading_error;
|
||||
|
@ -241,6 +239,7 @@ static inline struct ifs_data *ifs_get_data(struct device *dev)
|
|||
return &d->data;
|
||||
}
|
||||
|
||||
extern bool *ifs_pkg_auth;
|
||||
int ifs_load_firmware(struct device *dev);
|
||||
int do_core_test(int cpu, struct device *dev);
|
||||
const struct attribute_group **ifs_get_groups(void);
|
||||
|
|
|
@ -192,7 +192,7 @@ static int scan_chunks_sanity_check(struct device *dev)
|
|||
struct ifs_work local_work;
|
||||
int curr_pkg, cpu, ret;
|
||||
|
||||
memset(ifsd->pkg_auth, 0, (topology_max_packages() * sizeof(bool)));
|
||||
memset(ifs_pkg_auth, 0, (topology_max_packages() * sizeof(bool)));
|
||||
ret = validate_ifs_metadata(dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
@ -204,7 +204,7 @@ static int scan_chunks_sanity_check(struct device *dev)
|
|||
cpus_read_lock();
|
||||
for_each_online_cpu(cpu) {
|
||||
curr_pkg = topology_physical_package_id(cpu);
|
||||
if (ifsd->pkg_auth[curr_pkg])
|
||||
if (ifs_pkg_auth[curr_pkg])
|
||||
continue;
|
||||
reinit_completion(&ifs_done);
|
||||
local_work.dev = dev;
|
||||
|
@ -215,7 +215,7 @@ static int scan_chunks_sanity_check(struct device *dev)
|
|||
ret = -EIO;
|
||||
goto out;
|
||||
}
|
||||
ifsd->pkg_auth[curr_pkg] = 1;
|
||||
ifs_pkg_auth[curr_pkg] = 1;
|
||||
}
|
||||
ret = 0;
|
||||
out:
|
||||
|
|
Загрузка…
Ссылка в новой задаче