Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp145408ybz; Tue, 21 Apr 2020 06:26:25 -0700 (PDT) X-Google-Smtp-Source: APiQypKwck2fuzTcxSkf79HCRykQuYAkWVXhmzyAKozieRB9G1tJK/6Wd08ZHwsyeMK8C4B/C45a X-Received: by 2002:aa7:cd7c:: with SMTP id ca28mr12174562edb.181.1587475584865; Tue, 21 Apr 2020 06:26:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587475584; cv=none; d=google.com; s=arc-20160816; b=Kjhnm0H0g864NcI3tN6GcMkx8GQwbVuD6g1nbBYNmmRJK2IKCgm7i7yGGUTFaYoi9z G8aui+GRRVNSXOWBVgHuG8wHjzAk2xvGN2l8f0X+9wJJso/v9P3fdgHgKWmrYHw+ajq3 +wPvuAegpCi/oP94COAoN3piiWEIXJmWJ15BVpUhKExdnREVGjG+CKawdcZjwWr+I/ux ME5HPJMveFVfCu7YKK2DwlkXvk/saStVGWXJvcjyfM0BCEad/T9oZLzaziB2usBSVM+2 1lD74+kkL8IXFodta+05zmoz6soPGNCEXA4kdTk0KzXkNDsQ04WNjFJ6PL7VgE3p4+pf vxMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=89oK0RRq82VPtNTwAnfEMr7pLyGMGkkD1e88NZEZMC4=; b=G29Erxt1avu0ogr133rZUCTFDDVIq485heUFCK9V2HvFG1k92TW/+Au+XU3JGXLI8K w0Hbc4rv16GrVXSOW0Yzj8FCPg7SSzFVkoepx1zWrRWsGJBg6FfjZu4BXO4UqcE07Xjh Xy6ZObpFNkQX6L+1qLQSTbcIBwkDuh2YbnbbnCRPsIbIzyQ2XZXK/6Z2BV0MiJbTWaTl Eq7tSwTUoY1XUqsChPRaI+JqFIx3Xud0fHpWFXxUYbIJJMlmCvEeaEGcX0X9PIiszPYz kHOZqtIBQ498eFafg2qWUpMBJ9sQyIUu/+VSwttZLGLx9veHri017R3GNmBuEbELXwYB IiPw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bo7si1500967edb.80.2020.04.21.06.25.59; Tue, 21 Apr 2020 06:26:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729105AbgDUNYF (ORCPT + 99 others); Tue, 21 Apr 2020 09:24:05 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:2825 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728864AbgDUNYE (ORCPT ); Tue, 21 Apr 2020 09:24:04 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 6CF5271FE9D8EE5F270D; Tue, 21 Apr 2020 21:24:01 +0800 (CST) Received: from DESKTOP-6T4S3DQ.china.huawei.com (10.47.83.77) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.487.0; Tue, 21 Apr 2020 21:23:51 +0800 From: Shiju Jose To: , , , , , , , , , , , , CC: , , , , Shiju Jose Subject: [RESEND PATCH v7 5/6] ACPI / APEI: Add callback for non-standard HW errors to the GHES notifier Date: Tue, 21 Apr 2020 14:21:35 +0100 Message-ID: <20200421132136.1595-6-shiju.jose@huawei.com> X-Mailer: git-send-email 2.26.0.windows.1 In-Reply-To: <20200421132136.1595-1-shiju.jose@huawei.com> References: <20200421132136.1595-1-shiju.jose@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.47.83.77] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add callback function for the non-standard HW errors to the GHES notifier. Signed-off-by: Shiju Jose --- drivers/acpi/apei/ghes.c | 56 ++++++++++++++++++++++++++-------------- 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index 3b89c7621a0d..0c27ea8ea943 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c @@ -578,6 +578,34 @@ static int ghes_handle_arm_hw_error(struct notifier_block *nb, return NOTIFY_STOP; } +static int ghes_handle_non_standard_event(struct notifier_block *nb, + unsigned long event, void *data) +{ + struct acpi_hest_generic_data *gdata = data; + void *err = acpi_hest_get_payload(gdata); + int sec_sev; + guid_t *sec_type; + const guid_t *fru_id = &guid_null; + char *fru_text = ""; + + if (guid_equal((guid_t *)gdata->section_type, &CPER_SEC_PLATFORM_MEM) || + guid_equal((guid_t *)gdata->section_type, &CPER_SEC_PCIE) || + guid_equal((guid_t *)gdata->section_type, &CPER_SEC_PROC_ARM)) + return NOTIFY_DONE; + + sec_type = (guid_t *)gdata->section_type; + sec_sev = ghes_severity(gdata->error_severity); + if (gdata->validation_bits & CPER_SEC_VALID_FRU_ID) + fru_id = (guid_t *)gdata->fru_id; + + if (gdata->validation_bits & CPER_SEC_VALID_FRU_TEXT) + fru_text = gdata->fru_text; + + log_non_standard_event(sec_type, fru_id, fru_text, sec_sev, + err, gdata->error_data_length); + return NOTIFY_OK; +} + static struct notifier_block ghes_notifier_mem_error = { .notifier_call = ghes_handle_memory_failure, }; @@ -590,6 +618,10 @@ static struct notifier_block ghes_notifier_arm_hw_error = { .notifier_call = ghes_handle_arm_hw_error, }; +static struct notifier_block ghes_notifier_non_standard_event = { + .notifier_call = ghes_handle_non_standard_event, +}; + struct ghes_error_handler_list { const char *name; struct notifier_block *nb; @@ -608,6 +640,10 @@ static const struct ghes_error_handler_list ghes_error_handler_list[] = { .name = "ghes_notifier_arm_hw_error", .nb = &ghes_notifier_arm_hw_error, }, + { + .name = "ghes_notifier_non_standard_event", + .nb = &ghes_notifier_non_standard_event, + }, }; static BLOCKING_NOTIFIER_HEAD(ghes_event_notify_list); @@ -656,24 +692,13 @@ static DECLARE_WORK(ghes_event_work, ghes_event_work_func); static void ghes_do_proc(struct ghes *ghes, const struct acpi_hest_generic_status *estatus) { - int sev, sec_sev; + int sev; struct acpi_hest_generic_data *gdata; - guid_t *sec_type; - const guid_t *fru_id = &guid_null; - char *fru_text = ""; struct ghes_event_entry event_entry; u32 len; sev = ghes_severity(estatus->error_severity); apei_estatus_for_each_section(estatus, gdata) { - sec_type = (guid_t *)gdata->section_type; - sec_sev = ghes_severity(gdata->error_severity); - if (gdata->validation_bits & CPER_SEC_VALID_FRU_ID) - fru_id = (guid_t *)gdata->fru_id; - - if (gdata->validation_bits & CPER_SEC_VALID_FRU_TEXT) - fru_text = gdata->fru_text; - len = acpi_hest_get_record_size(gdata); event_entry.gdata = (void *)gen_pool_alloc(ghes_gdata_pool, len); @@ -692,13 +717,6 @@ static void ghes_do_proc(struct ghes *ghes, pr_warn(GHES_PFX "ghes event queue full\n"); break; } - { - void *err = acpi_hest_get_payload(gdata); - - log_non_standard_event(sec_type, fru_id, fru_text, - sec_sev, err, - gdata->error_data_length); - } } } -- 2.17.1