From patchwork Fri May 19 09:39:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Borislav Petkov X-Patchwork-Id: 100183 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp226249qge; Fri, 19 May 2017 02:41:15 -0700 (PDT) X-Received: by 10.84.217.139 with SMTP id p11mr10373482pli.146.1495186875286; Fri, 19 May 2017 02:41:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495186875; cv=none; d=google.com; s=arc-20160816; b=hJcc8Ge2s/ux0pRQjVW/kzjhRtjwZNiUEIEEkA9bDJ9Sh0uG9+PS8k16JdSdk4jeDO MxXgncBNVD6SWhc8UB2R039IgTN1TCFgSRkMckclDM1ms9nKI2ilSo4CfJaDrf4XnrK3 bi6ZscrAqgMNsWkZ6xwYdAYyTDE01hPdsLucsbls6GPuo4wmGfcFSn/4MWp05alATwHR TrfKjNhf73yA8B6uL8wBQRa60mtVw0/H+XiEImTF3dg0GdFWz0m6yKo44EMlAp2FqUit BMP3ouOZiNwM3ikHIExtrLNRr8BO3fd3jyYeF8e3tdT8ULITTDvc71jlXguEd7V+Lp0R rMUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=RAU2HwuI9HB9O0Jkr2VOf2J7XYZI9+ek/5YG3YgUVb8=; b=AUT2cPULBxVl29ctKGyQprqZBpmykz//IwWkCsiFR7CWS7Z4IcpK+Gr4s2WRHv0Npm rh54CtuvqZSZVSpBXB7oreWJT78zzFWtqdr8Qg1aZVolryqQu7s62olyru93Vo9jfA87 /poq/DC/VNNvi5eY9HJxBJW8cfxBg7pSFoNoeRj9DfnqWcT+/FI5C3YvdbCtX7SvjkFb bmGBThMVELSk0W4yyvMIqt0IiVuiA08Cw4AcMJQbUIHW3fypu1NPql/bDUO/GTecvvgV E0/DtaCxfr+pBu/wRtRlJW8BqfB3Q6XyTf2QHYlcuOMfgCPi+vlfEZfotqvEj6DUrkaW 2S8g== 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 s26si8062692pge.221.2017.05.19.02.41.14; Fri, 19 May 2017 02:41:15 -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 S1755546AbdESJlI (ORCPT + 25 others); Fri, 19 May 2017 05:41:08 -0400 Received: from mail.skyhub.de ([5.9.137.197]:40660 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753176AbdESJje (ORCPT ); Fri, 19 May 2017 05:39:34 -0400 X-Virus-Scanned: Nedap ESD1 at mail.skyhub.de Received: from mail.skyhub.de ([127.0.0.1]) by localhost (blast.alien8.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id PSX_aD5ykDCD; Fri, 19 May 2017 11:39:32 +0200 (CEST) Received: from pd.tnic (p2003008C2F262F0081419437A2E6CF4F.dip0.t-ipconnect.de [IPv6:2003:8c:2f26:2f00:8141:9437:a2e6:cf4f]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 792F81EC021E; Fri, 19 May 2017 11:39:32 +0200 (CEST) From: Borislav Petkov To: X86 ML Cc: LKML Subject: [PATCH 3/7] ACPI/APEI: Handle GSIV and GPIO notification types Date: Fri, 19 May 2017 11:39:11 +0200 Message-Id: <20170519093915.15413-4-bp@alien8.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170519093915.15413-1-bp@alien8.de> References: <20170519093915.15413-1-bp@alien8.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Shiju Jose System Controller Interrupts are received by ACPI's error device, which in turn notifies the GHES code. The same is true of APEI's GSIV and GPIO notification types. Add support for GSIV and GPIO sharing the SCI register/unregister/notifier code. Rename the list and notifier to show this is no longer just SCI, but anything from the Hardware Error Device. Signed-off-by: Shiju Jose [ Rewrite commit log. ] Signed-off-by: James Morse Reviewed-by: James Morse Tested-by: Tyler Baicar Cc: "Guohanjun (Hanjun Guo)" Cc: "Rafael J. Wysocki" Cc: "Zhengqiang (turing)" Cc: "fu.wei@linaro.org" Cc: "xuwei (O)" Cc: Gabriele Paoloni Cc: Geliang Tang Cc: John Garry Cc: Len Brown Cc: Prarit Bhargava Cc: Punit Agrawal Cc: linux-acpi@vger.kernel.org Link: http://lkml.kernel.org/r/86258A5CC0A3704780874CF6004BA8A62E695201@FRAEML521-MBX.china.huawei.com [ Some small cleanups ontop. ] Signed-off-by: Borislav Petkov --- drivers/acpi/apei/ghes.c | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) -- 2.11.0 diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index d0855c09f32f..d2c8a9286fa8 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c @@ -89,14 +89,14 @@ bool ghes_disable; module_param_named(disable, ghes_disable, bool, 0); /* - * All error sources notified with SCI shares one notifier function, - * so they need to be linked and checked one by one. This is applied - * to NMI too. + * All error sources notified with HED (Hardware Error Device) share a + * single notifier callback, so they need to be linked and checked one + * by one. This holds true for NMI too. * * RCU is used for these lists, so ghes_list_mutex is only used for * list changing, not for traversing. */ -static LIST_HEAD(ghes_sci); +static LIST_HEAD(ghes_hed); static DEFINE_MUTEX(ghes_list_mutex); /* @@ -702,14 +702,14 @@ static irqreturn_t ghes_irq_func(int irq, void *data) return IRQ_HANDLED; } -static int ghes_notify_sci(struct notifier_block *this, - unsigned long event, void *data) +static int ghes_notify_hed(struct notifier_block *this, unsigned long event, + void *data) { struct ghes *ghes; int ret = NOTIFY_DONE; rcu_read_lock(); - list_for_each_entry_rcu(ghes, &ghes_sci, list) { + list_for_each_entry_rcu(ghes, &ghes_hed, list) { if (!ghes_proc(ghes)) ret = NOTIFY_OK; } @@ -718,8 +718,8 @@ static int ghes_notify_sci(struct notifier_block *this, return ret; } -static struct notifier_block ghes_notifier_sci = { - .notifier_call = ghes_notify_sci, +static struct notifier_block ghes_notifier_hed = { + .notifier_call = ghes_notify_hed, }; #ifdef CONFIG_HAVE_ACPI_APEI_NMI @@ -966,7 +966,10 @@ static int ghes_probe(struct platform_device *ghes_dev) case ACPI_HEST_NOTIFY_POLLED: case ACPI_HEST_NOTIFY_EXTERNAL: case ACPI_HEST_NOTIFY_SCI: + case ACPI_HEST_NOTIFY_GSIV: + case ACPI_HEST_NOTIFY_GPIO: break; + case ACPI_HEST_NOTIFY_NMI: if (!IS_ENABLED(CONFIG_HAVE_ACPI_APEI_NMI)) { pr_warn(GHES_PFX "Generic hardware error source: %d notified via NMI interrupt is not supported!\n", @@ -1024,13 +1027,17 @@ static int ghes_probe(struct platform_device *ghes_dev) goto err_edac_unreg; } break; + case ACPI_HEST_NOTIFY_SCI: + case ACPI_HEST_NOTIFY_GSIV: + case ACPI_HEST_NOTIFY_GPIO: mutex_lock(&ghes_list_mutex); - if (list_empty(&ghes_sci)) - register_acpi_hed_notifier(&ghes_notifier_sci); - list_add_rcu(&ghes->list, &ghes_sci); + if (list_empty(&ghes_hed)) + register_acpi_hed_notifier(&ghes_notifier_hed); + list_add_rcu(&ghes->list, &ghes_hed); mutex_unlock(&ghes_list_mutex); break; + case ACPI_HEST_NOTIFY_NMI: ghes_nmi_add(ghes); break; @@ -1066,14 +1073,18 @@ static int ghes_remove(struct platform_device *ghes_dev) case ACPI_HEST_NOTIFY_EXTERNAL: free_irq(ghes->irq, ghes); break; + case ACPI_HEST_NOTIFY_SCI: + case ACPI_HEST_NOTIFY_GSIV: + case ACPI_HEST_NOTIFY_GPIO: mutex_lock(&ghes_list_mutex); list_del_rcu(&ghes->list); - if (list_empty(&ghes_sci)) - unregister_acpi_hed_notifier(&ghes_notifier_sci); + if (list_empty(&ghes_hed)) + unregister_acpi_hed_notifier(&ghes_notifier_hed); mutex_unlock(&ghes_list_mutex); synchronize_rcu(); break; + case ACPI_HEST_NOTIFY_NMI: ghes_nmi_remove(ghes); break;