From patchwork Tue Aug 11 19:13:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Murali Karicheri X-Patchwork-Id: 6994341 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DE95A9F358 for ; Tue, 11 Aug 2015 19:16:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E529E2060A for ; Tue, 11 Aug 2015 19:16:33 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CFC4A20609 for ; Tue, 11 Aug 2015 19:16:32 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZPEzy-0003dD-Rx; Tue, 11 Aug 2015 19:14:10 +0000 Received: from arroyo.ext.ti.com ([192.94.94.40]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZPEzs-0003al-IQ for linux-arm-kernel@lists.infradead.org; Tue, 11 Aug 2015 19:14:08 +0000 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id t7BJDQdA025556; Tue, 11 Aug 2015 14:13:28 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id t7BJDQV9021510; Tue, 11 Aug 2015 14:13:26 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.224.2; Tue, 11 Aug 2015 14:13:26 -0500 Received: from ula0868495.local (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id t7BJDPWV028532; Tue, 11 Aug 2015 14:13:25 -0500 From: Murali Karicheri To: , , , Subject: [PATCH] ARM: keystone: add a work around to handle asynchronous external abort Date: Tue, 11 Aug 2015 15:13:29 -0400 Message-ID: <1439320409-20084-1-git-send-email-m-karicheri2@ti.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150811_121404_711888_7E6EF941 X-CRM114-Status: GOOD ( 13.02 ) X-Spam-Score: -7.1 (-------) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently on some devices, an asynchronous external abort exception happens during boot up when exception handlers are enabled in kernel before switching to user space. This patch adds a workaround to handle this once during boot. Many customers are already using this with out any issues and is required to workaround the above issue. Signed-off-by: Murali Karicheri --- arch/arm/mach-keystone/keystone.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/arch/arm/mach-keystone/keystone.c b/arch/arm/mach-keystone/keystone.c index e2880105..c1d0fe5 100644 --- a/arch/arm/mach-keystone/keystone.c +++ b/arch/arm/mach-keystone/keystone.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -52,6 +53,24 @@ static struct notifier_block platform_nb = { .notifier_call = keystone_platform_notifier, }; +static bool ignore_first = true; +static int keystone_async_ext_abort_fault(unsigned long addr, unsigned int fsr, + struct pt_regs *regs) +{ + /* + * if first time, ignore this as this is a asynchronous external abort + * happening only some devices that couldn't be root caused and we add + * this work around to handle this first time. + */ + if (ignore_first) { + ignore_first = false; + return 0; + } + + /* Subsequent ones should be handled as fault */ + return 1; +} + static void __init keystone_init(void) { if (PHYS_OFFSET >= KEYSTONE_HIGH_PHYS_START) { @@ -61,6 +80,13 @@ static void __init keystone_init(void) } keystone_pm_runtime_init(); of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); + + /* + * Add a one time exception handler to catch asynchronous external + * abort + */ + hook_fault_code(17, keystone_async_ext_abort_fault, SIGBUS, 0, + "async external abort handler"); } static phys_addr_t keystone_virt_to_idmap(unsigned long x)