Skip to content

Commit

Permalink
ACPI, APEI, Avoid too much error reporting in runtime
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Huang Ying <[email protected]>
Tested-by: Jean Delvare <[email protected]>
Cc: [email protected]
Signed-off-by: Len Brown <[email protected]>
  • Loading branch information
yhuang-intel authored and lenb committed Jun 12, 2012
1 parent cfaf025 commit 34ddeb0
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
17 changes: 15 additions & 2 deletions drivers/acpi/apei/apei-base.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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)
{
Expand Down
9 changes: 9 additions & 0 deletions drivers/acpi/apei/apei-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);

Expand Down
6 changes: 3 additions & 3 deletions drivers/acpi/apei/ghes.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand All @@ -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 {
Expand Down

0 comments on commit 34ddeb0

Please sign in to comment.