Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4309599ybb; Tue, 7 Apr 2020 05:05:58 -0700 (PDT) X-Google-Smtp-Source: APiQypL4SsHm5VkZNrZDrwznZDs/Wn9gxu2dHuelzEgc2Zffhm8Bs5MTI0kyFQjn0goIEL6t7hPN X-Received: by 2002:aca:ad8f:: with SMTP id w137mr1294372oie.104.1586261158652; Tue, 07 Apr 2020 05:05:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586261158; cv=none; d=google.com; s=arc-20160816; b=ROrngrJ4IjQaDo/2VB1gbUaP0fP5RhMfKiJ8dWFxy/PR0hbveWHSpgPFg1M96ty8Zz 4/mBlf7uUQ0q0BskVp/+FjXYq2lUFPM9jSip8chvssfhX5eNL76XLuITH2ItlA5r7VPI FjUd9i5MrlcsUccfXhNv/YE3HRRZj20Mv54l6M9Gfciyf5EYjHz9OAWXw4ZAqdOPbs/5 4Htg++mJYN1X0cjakOlJQ+9jZDZkh08dOuiuCk4cDb9F9oxS1nxNrCmHRpP+U3LXeCWa sFvep4wlGPeVeifjyI1xkKR6RklZwB9r2i0cuYAWbOgRjV9QEb3TiVSGHxWzvnIyVl6o Bmdg== 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=N9pJaiq4dw5xrYGi1R5cCo4kSYMfkgq9y9k9quud8DRcHY5N42Lbd1uVSzxIenuURu BZRHlmCRS+ZrYJKVZgyz68Nkgs987l07BGDGp/Yh0lKCQINWIVPKUQeeCHNE9/i08so+ wA9OxMJA+EJDAQLiEk7/nOEPSdfgLwEd2K9prK4hKoCAjxIPJKbgCKYr64lqIXu5wL/F 9En0aPdsICVyX16OM0nQQBLjU/oaN8KEB4zBWmIh5ZalHjx8nNDqPoB9HfsSf29RXXOt c6rAtIMlC1Y5SbwqHd7A8zy+BUZTklS/7E8t7Y8taFGClBzBJNKuP9C7kF/hLmteT8la pVgA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x64si1023037oig.34.2020.04.07.05.05.40; Tue, 07 Apr 2020 05:05:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728613AbgDGMCu (ORCPT + 99 others); Tue, 7 Apr 2020 08:02:50 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:38010 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726591AbgDGMCu (ORCPT ); Tue, 7 Apr 2020 08:02:50 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 0E0729E1B38DA7DBF78E; Tue, 7 Apr 2020 20:02:44 +0800 (CST) Received: from DESKTOP-6T4S3DQ.china.huawei.com (10.47.82.134) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.487.0; Tue, 7 Apr 2020 20:02:36 +0800 From: Shiju Jose To: , , , , , , , , , , , , CC: , , , , Shiju Jose Subject: [v7 PATCH 5/6] ACPI / APEI: Add callback for non-standard HW errors to the GHES notifier Date: Tue, 7 Apr 2020 13:00:44 +0100 Message-ID: <20200407120045.958-6-shiju.jose@huawei.com> X-Mailer: git-send-email 2.26.0.windows.1 In-Reply-To: <20200407120045.958-1-shiju.jose@huawei.com> References: <20200407120045.958-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.82.134] 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