ACPI, APEI, Avoid too much error reporting in runtime
This patch fixed the following bug. https://bugzilla.kernel.org/show_bug.cgi?id=43282 This is caused by a firmware bug checking (checking generic address register provided by firmware) in runtime. The checking should be done in address mapping time instead of runtime to avoid too much error reporting in runtime. Reported-by: Pawel Sikora <pluto@agmk.net> Signed-off-by: Huang Ying <ying.huang@intel.com> Tested-by: Jean Delvare <khali@linux-fr.org> Cc: stable@vger.kernel.org Signed-off-by: Len Brown <len.brown@intel.com>
This commit is contained in:
parent
cfaf025112
commit
34ddeb035d
3 changed files with 27 additions and 5 deletions
|
@ -243,7 +243,7 @@ static int pre_map_gar_callback(struct apei_exec_context *ctx,
|
|||
u8 ins = entry->instruction;
|
||||
|
||||
if (ctx->ins_table[ins].flags & APEI_EXEC_INS_ACCESS_REGISTER)
|
||||
return acpi_os_map_generic_address(&entry->register_region);
|
||||
return apei_map_generic_address(&entry->register_region);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ static int post_unmap_gar_callback(struct apei_exec_context *ctx,
|
|||
u8 ins = entry->instruction;
|
||||
|
||||
if (ctx->ins_table[ins].flags & APEI_EXEC_INS_ACCESS_REGISTER)
|
||||
acpi_os_unmap_generic_address(&entry->register_region);
|
||||
apei_unmap_generic_address(&entry->register_region);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -606,6 +606,19 @@ static int apei_check_gar(struct acpi_generic_address *reg, u64 *paddr,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int apei_map_generic_address(struct acpi_generic_address *reg)
|
||||
{
|
||||
int rc;
|
||||
u32 access_bit_width;
|
||||
u64 address;
|
||||
|
||||
rc = apei_check_gar(reg, &address, &access_bit_width);
|
||||
if (rc)
|
||||
return rc;
|
||||
return acpi_os_map_generic_address(reg);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(apei_map_generic_address);
|
||||
|
||||
/* read GAR in interrupt (including NMI) or process context */
|
||||
int apei_read(u64 *val, struct acpi_generic_address *reg)
|
||||
{
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
#define APEI_INTERNAL_H
|
||||
|
||||
#include <linux/cper.h>
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/acpi_io.h>
|
||||
|
||||
struct apei_exec_context;
|
||||
|
||||
|
@ -68,6 +70,13 @@ static inline int apei_exec_run_optional(struct apei_exec_context *ctx, u8 actio
|
|||
/* IP has been set in instruction function */
|
||||
#define APEI_EXEC_SET_IP 1
|
||||
|
||||
int apei_map_generic_address(struct acpi_generic_address *reg);
|
||||
|
||||
static inline void apei_unmap_generic_address(struct acpi_generic_address *reg)
|
||||
{
|
||||
acpi_os_unmap_generic_address(reg);
|
||||
}
|
||||
|
||||
int apei_read(u64 *val, struct acpi_generic_address *reg);
|
||||
int apei_write(u64 val, struct acpi_generic_address *reg);
|
||||
|
||||
|
|
|
@ -301,7 +301,7 @@ static struct ghes *ghes_new(struct acpi_hest_generic *generic)
|
|||
if (!ghes)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
ghes->generic = generic;
|
||||
rc = acpi_os_map_generic_address(&generic->error_status_address);
|
||||
rc = apei_map_generic_address(&generic->error_status_address);
|
||||
if (rc)
|
||||
goto err_free;
|
||||
error_block_length = generic->error_block_length;
|
||||
|
@ -321,7 +321,7 @@ static struct ghes *ghes_new(struct acpi_hest_generic *generic)
|
|||
return ghes;
|
||||
|
||||
err_unmap:
|
||||
acpi_os_unmap_generic_address(&generic->error_status_address);
|
||||
apei_unmap_generic_address(&generic->error_status_address);
|
||||
err_free:
|
||||
kfree(ghes);
|
||||
return ERR_PTR(rc);
|
||||
|
@ -330,7 +330,7 @@ static struct ghes *ghes_new(struct acpi_hest_generic *generic)
|
|||
static void ghes_fini(struct ghes *ghes)
|
||||
{
|
||||
kfree(ghes->estatus);
|
||||
acpi_os_unmap_generic_address(&ghes->generic->error_status_address);
|
||||
apei_unmap_generic_address(&ghes->generic->error_status_address);
|
||||
}
|
||||
|
||||
enum {
|
||||
|
|
Loading…
Reference in a new issue