From patchwork Thu Mar 30 00:29:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Berger X-Patchwork-Id: 9652791 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 47D3B6034B for ; Thu, 30 Mar 2017 00:30:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 375AB28552 for ; Thu, 30 Mar 2017 00:30:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2A06D28564; Thu, 30 Mar 2017 00:30:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D2F4C28552 for ; Thu, 30 Mar 2017 00:30:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=rI06qrVAwSXPpK3g4+vOct7T3FShXXAnHWNZNQNVr8M=; b=Far3NN1t2IdpOSu8f4rmOD56y0 +okGov6+6JAmyGcA5Jrx94G9LTzgjLZmSPiSXxJG/ywoZ9/i2MACGYlqd9c8ps+W8XSFRnlrAvZ/j 9jw9KyAuClwM2Bkds7uNZgFKEfVjKtnkiXJndQ3H/H8ByvypQBE9D5pCtqJ4qRU9hlWBviY+inGlb ODR5/mSptg4m6zE3cWBBRdXrcx7/xq5rHxpbiNN/4mETpBXA0IcywKuP0ISzNnrID9K6kFk+WlXJ5 2yFSxWnBG1GvA7SUx9Qjic6w09yTR9b/K3O2f7HuYuz7l47pevdSus/ds6mWqmIWv0vN23+7ivNYV ez8P2FJQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1ctNzJ-0003k8-FP; Thu, 30 Mar 2017 00:30:53 +0000 Received: from mail-qk0-x242.google.com ([2607:f8b0:400d:c09::242]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1ctNyW-0001tr-Hz for linux-arm-kernel@lists.infradead.org; Thu, 30 Mar 2017 00:30:07 +0000 Received: by mail-qk0-x242.google.com with SMTP id r142so4342972qke.3 for ; Wed, 29 Mar 2017 17:29:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7wiCnArlYJCXGXyti6AF8O0yYOMpq2P+qFAitZA8wPk=; b=fR3V+Pd3ne0Thv27OVZQXuqScrryOgGsnrIhqfz5l0PAPyY9YRgd80LEKsCXxWJXuT xD7WcUAOqlGZGuyd18vQ+8i68Ht6cAhM2Kq6j47ueBbWuOLxoJbPSujfjjWAugDSDHly wqSSKDvSqcLGS0lZrCvmPrGe+Hod3A64grdCkKv0VuFO85lKflEXfVnQHgsrS9lelqi2 cVWyEnQfdcGgEgVPPs7JmrILSZAeCjtqLjmGtq8px0l+bKhRwBPVcP2pRvuR01EtePUx 5yQxKh3EE6pi5PFgnC112cR12pQk1Bj83e1kRYuJvLHb/K9Bl/lOwPDnVIB0LodizDuJ nzgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=7wiCnArlYJCXGXyti6AF8O0yYOMpq2P+qFAitZA8wPk=; b=Xi7fAC+93NGhDvPsVRMosGb9YrOxaqhnANCvBdsEFdrLia0AM/gvSI9k5sDeos3EMP 5oO4ta0bq/eiEoOSTiMFi2SJ4Ed7UPXLzB+Rnm9oJnI7BGB2IRdvEZ1FtYiAqMwQmQd1 eZQwXWK13PZ5b5XMCrKnEdcCoStXswy6lZybgRux/5jgEs52roL0qPsaQPxiRgiQTza5 txt3vr8CwspqsdG1dwaXGu+/Siff7vp3WwIWW8IHhgyZPsO7oAkgD+G4wrjFFjnjTwp0 OBv5rFAnJcYoXUqbXhyeBgemSiwzowCfazyb3Iky1uS6EBl80QJwFoBm/lEOfcN9xSN2 txJg== X-Gm-Message-State: AFeK/H1/QIMe4ikK0z4abBiqP2AI9EyDxspGIKThuC9amIHSAMRe3ZlKiZGuto6risKslg== X-Received: by 10.55.33.139 with SMTP id f11mr3525462qki.5.1490833786613; Wed, 29 Mar 2017 17:29:46 -0700 (PDT) Received: from stb-bld-02.irv.broadcom.com ([192.19.255.250]) by smtp.gmail.com with ESMTPSA id t47sm368450qte.45.2017.03.29.17.29.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 Mar 2017 17:29:45 -0700 (PDT) From: Doug Berger To: mark.rutland@arm.com Subject: [PATCH v3 3/6] bus: brcmstb_gisb: add notifier handling Date: Wed, 29 Mar 2017 17:29:11 -0700 Message-Id: <20170330002914.7371-4-opendmb@gmail.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170330002914.7371-1-opendmb@gmail.com> References: <20170330002914.7371-1-opendmb@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170329_173004_859569_00377CBB X-CRM114-Status: GOOD ( 12.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: treding@nvidia.com, f.fainelli@gmail.com, mirza.krak@gmail.com, catalin.marinas@arm.com, linus.walleij@linaro.org, suzuki.poulose@arm.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, jonathanh@nvidia.com, bgolaszewski@baylibre.com, devicetree@vger.kernel.org, robh+dt@kernel.org, bcm-kernel-feedback-list@broadcom.com, gregory.0xf0@gmail.com, olof@lixom.net, Doug Berger , computersforpeace@gmail.com, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Check for GISB arbitration errors through a chained notifier when a process dies or a kernel panic occurs. This allows a meaningful GISB diagnostic message to occur along with other diagnostic information from the event. Signed-off-by: Doug Berger --- drivers/bus/brcmstb_gisb.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/drivers/bus/brcmstb_gisb.c b/drivers/bus/brcmstb_gisb.c index 017c37b9c7c1..a2e1c5c25a3a 100644 --- a/drivers/bus/brcmstb_gisb.c +++ b/drivers/bus/brcmstb_gisb.c @@ -24,6 +24,9 @@ #include #include #include +#include +#include +#include #ifdef CONFIG_ARM #include @@ -283,6 +286,36 @@ static irqreturn_t brcmstb_gisb_tea_handler(int irq, void *dev_id) return IRQ_HANDLED; } +/* + * Dump out gisb errors on die or panic. + */ +static int dump_gisb_error(struct notifier_block *self, unsigned long v, + void *p); + +static struct notifier_block gisb_die_notifier = { + .notifier_call = dump_gisb_error, +}; + +static struct notifier_block gisb_panic_notifier = { + .notifier_call = dump_gisb_error, +}; + +static int dump_gisb_error(struct notifier_block *self, unsigned long v, + void *p) +{ + struct brcmstb_gisb_arb_device *gdev; + const char *reason = "panic"; + + if (self == &gisb_die_notifier) + reason = "die"; + + /* iterate over each GISB arb registered handlers */ + list_for_each_entry(gdev, &brcmstb_gisb_arb_device_list, next) + brcmstb_gisb_arb_decode_addr(gdev, reason); + + return NOTIFY_DONE; +} + static DEVICE_ATTR(gisb_arb_timeout, S_IWUSR | S_IRUGO, gisb_arb_get_timeout, gisb_arb_set_timeout); @@ -390,6 +423,12 @@ static int __init brcmstb_gisb_arb_probe(struct platform_device *pdev) board_be_handler = brcmstb_bus_error_handler; #endif + if (list_is_singular(&brcmstb_gisb_arb_device_list)) { + register_die_notifier(&gisb_die_notifier); + atomic_notifier_chain_register(&panic_notifier_list, + &gisb_panic_notifier); + } + dev_info(&pdev->dev, "registered mem: %p, irqs: %d, %d\n", gdev->base, timeout_irq, tea_irq);