Message ID | 20200421132136.1595-5-shiju.jose@huawei.com (mailing list archive) |
---|---|
State | Changes Requested, archived |
Delegated to: | Bjorn Helgaas |
Headers | show |
Series | ACPI / APEI: Add support to notify non-fatal HW errors | expand |
On Tue, Apr 21, 2020 at 02:21:34PM +0100, Shiju Jose wrote: > static BLOCKING_NOTIFIER_HEAD(ghes_event_notify_list); > @@ -670,12 +692,7 @@ static void ghes_do_proc(struct ghes *ghes, > pr_warn(GHES_PFX "ghes event queue full\n"); > break; > } > - > - if (guid_equal(sec_type, &CPER_SEC_PROC_ARM)) { > - struct cper_sec_proc_arm *err = acpi_hest_get_payload(gdata); > - > - log_arm_hw_error(err); > - } else { > + { > void *err = acpi_hest_get_payload(gdata); This is ugly. Just move the "void *err;" declaration to the top of the function so we can delete this block. > > log_non_standard_event(sec_type, fru_id, fru_text, > -- regards, dan carpenter
Hi Dan, >-----Original Message----- >From: Dan Carpenter [mailto:dan.carpenter@oracle.com] >Sent: 21 April 2020 15:14 >To: Shiju Jose <shiju.jose@huawei.com> >Cc: linux-acpi@vger.kernel.org; linux-pci@vger.kernel.org; linux- >kernel@vger.kernel.org; rjw@rjwysocki.net; bp@alien8.de; >james.morse@arm.com; helgaas@kernel.org; lenb@kernel.org; >tony.luck@intel.com; gregkh@linuxfoundation.org; >zhangliguang@linux.alibaba.com; tglx@linutronix.de; Linuxarm ><linuxarm@huawei.com>; Jonathan Cameron ><jonathan.cameron@huawei.com>; tanxiaofei <tanxiaofei@huawei.com>; >yangyicong <yangyicong@huawei.com> >Subject: Re: [RESEND PATCH v7 4/6] ACPI / APEI: Add callback for ARM HW >errors to the GHES notifier > >On Tue, Apr 21, 2020 at 02:21:34PM +0100, Shiju Jose wrote: >> static BLOCKING_NOTIFIER_HEAD(ghes_event_notify_list); >> @@ -670,12 +692,7 @@ static void ghes_do_proc(struct ghes *ghes, >> pr_warn(GHES_PFX "ghes event queue full\n"); >> break; >> } >> - >> - if (guid_equal(sec_type, &CPER_SEC_PROC_ARM)) { >> - struct cper_sec_proc_arm *err = >acpi_hest_get_payload(gdata); >> - >> - log_arm_hw_error(err); >> - } else { >> + { >> void *err = acpi_hest_get_payload(gdata); > >This is ugly. Just move the "void *err;" declaration to the top of the function >so we can delete this block. Ok. I will change. > >> >> log_non_standard_event(sec_type, fru_id, fru_text, >> -- > >regards, >dan carpenter Thanks, Shiju
diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index 67ef1742fc93..3b89c7621a0d 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c @@ -564,6 +564,20 @@ static int ghes_handle_aer(struct notifier_block *nb, unsigned long event, return NOTIFY_STOP; } +static int ghes_handle_arm_hw_error(struct notifier_block *nb, + unsigned long event, void *data) +{ + struct acpi_hest_generic_data *gdata = data; + struct cper_sec_proc_arm *err = acpi_hest_get_payload(gdata); + + if (!guid_equal((guid_t *)gdata->section_type, &CPER_SEC_PROC_ARM)) + return NOTIFY_DONE; + + log_arm_hw_error(err); + + return NOTIFY_STOP; +} + static struct notifier_block ghes_notifier_mem_error = { .notifier_call = ghes_handle_memory_failure, }; @@ -572,6 +586,10 @@ static struct notifier_block ghes_notifier_aer = { .notifier_call = ghes_handle_aer, }; +static struct notifier_block ghes_notifier_arm_hw_error = { + .notifier_call = ghes_handle_arm_hw_error, +}; + struct ghes_error_handler_list { const char *name; struct notifier_block *nb; @@ -586,6 +604,10 @@ static const struct ghes_error_handler_list ghes_error_handler_list[] = { .name = "ghes_notifier_aer", .nb = &ghes_notifier_aer, }, + { + .name = "ghes_notifier_arm_hw_error", + .nb = &ghes_notifier_arm_hw_error, + }, }; static BLOCKING_NOTIFIER_HEAD(ghes_event_notify_list); @@ -670,12 +692,7 @@ static void ghes_do_proc(struct ghes *ghes, pr_warn(GHES_PFX "ghes event queue full\n"); break; } - - if (guid_equal(sec_type, &CPER_SEC_PROC_ARM)) { - struct cper_sec_proc_arm *err = acpi_hest_get_payload(gdata); - - log_arm_hw_error(err); - } else { + { void *err = acpi_hest_get_payload(gdata); log_non_standard_event(sec_type, fru_id, fru_text,
Add callback function for handling the ARM HW errors to the GHES notifier. Signed-off-by: Shiju Jose <shiju.jose@huawei.com> --- drivers/acpi/apei/ghes.c | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-)