Commit c3e6088e authored by Huang Ying's avatar Huang Ying Committed by Len Brown

ACPI, APEI, EINJ Param support is disabled by default

EINJ parameter support is only usable for some specific BIOS.
Originally, it is expected to have no harm for BIOS does not support
it.  But now, we found it will cause issue (memory overwriting) for
some BIOS.  So param support is disabled by default and only enabled
when newly added module parameter named "param_extension" is
explicitly specified.
Signed-off-by: default avatarHuang Ying <ying.huang@intel.com>
Cc: Matthew Garrett <mjg@redhat.com>
Acked-by: default avatarDon Zickus <dzickus@redhat.com>
Acked-by: default avatarTony Luck <tony.luck@intel.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 70cb6e1d
...@@ -48,12 +48,19 @@ directory apei/einj. The following files are provided. ...@@ -48,12 +48,19 @@ directory apei/einj. The following files are provided.
- param1 - param1
This file is used to set the first error parameter value. Effect of This file is used to set the first error parameter value. Effect of
parameter depends on error_type specified. For memory error, this is parameter depends on error_type specified. For memory error, this is
physical memory address. physical memory address. Only available if param_extension module
parameter is specified.
- param2 - param2
This file is used to set the second error parameter value. Effect of This file is used to set the second error parameter value. Effect of
parameter depends on error_type specified. For memory error, this is parameter depends on error_type specified. For memory error, this is
physical memory address mask. physical memory address mask. Only available if param_extension
module parameter is specified.
Injecting parameter support is a BIOS version specific extension, that
is, it only works on some BIOS version. If you want to use it, please
make sure your BIOS version has the proper support and specify
"param_extension=y" in module parameter.
For more information about EINJ, please refer to ACPI specification For more information about EINJ, please refer to ACPI specification
version 4.0, section 17.5. version 4.0, section 17.5.
...@@ -46,7 +46,8 @@ ...@@ -46,7 +46,8 @@
* Some BIOSes allow parameters to the SET_ERROR_TYPE entries in the * Some BIOSes allow parameters to the SET_ERROR_TYPE entries in the
* EINJ table through an unpublished extension. Use with caution as * EINJ table through an unpublished extension. Use with caution as
* most will ignore the parameter and make their own choice of address * most will ignore the parameter and make their own choice of address
* for error injection. * for error injection. This extension is used only if
* param_extension module parameter is specified.
*/ */
struct einj_parameter { struct einj_parameter {
u64 type; u64 type;
...@@ -65,6 +66,9 @@ struct einj_parameter { ...@@ -65,6 +66,9 @@ struct einj_parameter {
((struct acpi_whea_header *)((char *)(tab) + \ ((struct acpi_whea_header *)((char *)(tab) + \
sizeof(struct acpi_table_einj))) sizeof(struct acpi_table_einj)))
static bool param_extension;
module_param(param_extension, bool, 0);
static struct acpi_table_einj *einj_tab; static struct acpi_table_einj *einj_tab;
static struct apei_resources einj_resources; static struct apei_resources einj_resources;
...@@ -489,14 +493,6 @@ static int __init einj_init(void) ...@@ -489,14 +493,6 @@ static int __init einj_init(void)
einj_debug_dir, NULL, &error_type_fops); einj_debug_dir, NULL, &error_type_fops);
if (!fentry) if (!fentry)
goto err_cleanup; goto err_cleanup;
fentry = debugfs_create_x64("param1", S_IRUSR | S_IWUSR,
einj_debug_dir, &error_param1);
if (!fentry)
goto err_cleanup;
fentry = debugfs_create_x64("param2", S_IRUSR | S_IWUSR,
einj_debug_dir, &error_param2);
if (!fentry)
goto err_cleanup;
fentry = debugfs_create_file("error_inject", S_IWUSR, fentry = debugfs_create_file("error_inject", S_IWUSR,
einj_debug_dir, NULL, &error_inject_fops); einj_debug_dir, NULL, &error_inject_fops);
if (!fentry) if (!fentry)
...@@ -513,12 +509,23 @@ static int __init einj_init(void) ...@@ -513,12 +509,23 @@ static int __init einj_init(void)
rc = apei_exec_pre_map_gars(&ctx); rc = apei_exec_pre_map_gars(&ctx);
if (rc) if (rc)
goto err_release; goto err_release;
param_paddr = einj_get_parameter_address(); if (param_extension) {
if (param_paddr) { param_paddr = einj_get_parameter_address();
einj_param = ioremap(param_paddr, sizeof(*einj_param)); if (param_paddr) {
rc = -ENOMEM; einj_param = ioremap(param_paddr, sizeof(*einj_param));
if (!einj_param) rc = -ENOMEM;
goto err_unmap; if (!einj_param)
goto err_unmap;
fentry = debugfs_create_x64("param1", S_IRUSR | S_IWUSR,
einj_debug_dir, &error_param1);
if (!fentry)
goto err_unmap;
fentry = debugfs_create_x64("param2", S_IRUSR | S_IWUSR,
einj_debug_dir, &error_param2);
if (!fentry)
goto err_unmap;
} else
pr_warn(EINJ_PFX "Parameter extension is not supported.\n");
} }
pr_info(EINJ_PFX "Error INJection is initialized.\n"); pr_info(EINJ_PFX "Error INJection is initialized.\n");
...@@ -526,6 +533,8 @@ static int __init einj_init(void) ...@@ -526,6 +533,8 @@ static int __init einj_init(void)
return 0; return 0;
err_unmap: err_unmap:
if (einj_param)
iounmap(einj_param);
apei_exec_post_unmap_gars(&ctx); apei_exec_post_unmap_gars(&ctx);
err_release: err_release:
apei_resources_release(&einj_resources); apei_resources_release(&einj_resources);
......
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