From patchwork Tue Mar 28 21:34:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Berger X-Patchwork-Id: 9650579 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 E5768601E9 for ; Tue, 28 Mar 2017 22:05:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DAE7A28425 for ; Tue, 28 Mar 2017 22:05:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CF1022842C; Tue, 28 Mar 2017 22:05:47 +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 8F07028421 for ; Tue, 28 Mar 2017 22:05:47 +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=AnWtcn5wKz49F7aEeq94rvb77ar41N2nXfSaJM4jKW8=; b=DdhBwNLXzzD3gyOtXXM8wWi94P CA80rbv9CVMfZKCTCsl+wNeGPEEEKcSydQmWFfygkF2VWh0mxhdYgOMAwJK6928WG4HKD/up3P+3u N/r8o5sSwdpVeN1olZNIzshwlS590+p1vBUR8EhYt/Pdb/usG42yJNGTtzNqS6jxlVV2UdhVuOTP0 NqlcoL3WOup6fxzw29u3FIaNEZKJX70196Cas59yiPbOIXhmfCLEwYdfW/Hv1ncq7qhwd0yUzlqF3 WD7nhPVHfKXxZ+F4dQKw1Vk/DNkNCf3SDUCt2pmhTO9jFuNv50fvH/A6bUVOXAM76kcfg0U+hdC4b A1yJsMPg==; 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 1cszFK-0001kE-H1; Tue, 28 Mar 2017 22:05:46 +0000 Received: from mail-qt0-x243.google.com ([2607:f8b0:400d:c0d::243]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1csym6-0003n9-7c for linux-arm-kernel@lists.infradead.org; Tue, 28 Mar 2017 21:35:41 +0000 Received: by mail-qt0-x243.google.com with SMTP id x35so13967337qtc.1 for ; Tue, 28 Mar 2017 14:35:15 -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=tj/FJ1ARyHFBLl6lv6Rusf7rlBUpnLk2SlbgaGBpLRw=; b=InXlImugK4/4pk2fCqIf+lJQ8S9XM3VyqrhGBihP0674erP4GZlV4W7erf6FtZhvpD bv/AUfdACYHl+Wqz6t+099iuFkCLkjq9C3H+9By1O1+O1Crwlst/0uw+0sJRps0I4uow wfJtyprckEYfwgZPMMQeti46caC2tUPUKn9rRPbIBA2qNGNWzf70cmLbMV7AEGVxNUQH n6sf9mUP1IOnrE7hVJgzuQ5KeQhX1m5ByHpwptv0m9107kcDY9mM53VMRKQ/P6camEy1 Qbqh2fYySjuMDNpJ8SUvf5BJUHq0lRtiOZKfKleGne3Rm9IuI6Hr44ArP3stBBWWeDcG E5Mg== 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=tj/FJ1ARyHFBLl6lv6Rusf7rlBUpnLk2SlbgaGBpLRw=; b=otlYJLYKduyjKoqDpqC//5H9BK2QwmL5LiPINW8bUEl4RWIbD5qQqLsVIXdCwtWRUy eXp1De3vb4+V5IwiWeOOQN7qXY/aETaaf5GQtrzsO+F62IlCAdohPIjItB7Nv2YSnRgL 8zrpAwSJft1VPUIlAgwfDOMKDZbzOtGw0NB+NGxM5tvK5rVwqc2hvPnaUUF1SzL9C8fk Axb1L00Au2urtIQirhxsHXOgNXrYJJ3an3BnuctOVRz672D8FK4+3NP/55GXRFQgXcJA Cp3EHYKRCnmEgzqSxrFk+80DAEkGvxZN8kjFd0cnWn0YVBd77HwWnfLL0PUKymJt+rpQ us+g== X-Gm-Message-State: AFeK/H27SLB58YVkECwRAP7dSogE+K3fEUjF2autm2aNFArFbAy24tM00Sn2V99mMsJf/Q== X-Received: by 10.237.42.98 with SMTP id k31mr30399170qtf.232.1490736914714; Tue, 28 Mar 2017 14:35:14 -0700 (PDT) Received: from stb-bld-02.irv.broadcom.com ([192.19.255.250]) by smtp.gmail.com with ESMTPSA id a26sm3540762qtb.28.2017.03.28.14.35.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Mar 2017 14:35:13 -0700 (PDT) From: Doug Berger To: mark.rutland@arm.com Subject: [PATCH v2 4/8] bus: brcmstb_gisb: Correct hooking of ARM aborts Date: Tue, 28 Mar 2017 14:34:27 -0700 Message-Id: <20170328213431.10904-5-opendmb@gmail.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170328213431.10904-1-opendmb@gmail.com> References: <20170328213431.10904-1-opendmb@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170328_143534_584192_81F21EEA X-CRM114-Status: GOOD ( 14.07 ) 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: wangkefeng.wang@huawei.com, catalin.marinas@arm.com, linus.walleij@linaro.org, will.deacon@arm.com, mingo@kernel.org, f.fainelli@gmail.com, jonathanh@nvidia.com, bgolaszewski@baylibre.com, bcm-kernel-feedback-list@broadcom.com, shijie.huang@arm.com, opendmb@gmail.com, treding@nvidia.com, devicetree@vger.kernel.org, suzuki.poulose@arm.com, robh+dt@kernel.org, gregory.0xf0@gmail.com, sandeepa.s.prabhu@gmail.com, linux-arm-kernel@lists.infradead.org, mirza.krak@gmail.com, linux-kernel@vger.kernel.org, james.morse@arm.com, olof@lixom.net, computersforpeace@gmail.com 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 The fault status reporting in the FSR registers is different depending on whether the Long Physical Address Extension (LPAE) is being used. This commit corrects the registerring of fault handlers for arm architecture kernels when the LPAE is enabled. It also forces the handler to report that the abort exception was unhandled so that the appropriate signal is sent to the offending user process. Signed-off-by: Doug Berger --- drivers/bus/brcmstb_gisb.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/bus/brcmstb_gisb.c b/drivers/bus/brcmstb_gisb.c index a94598d0945a..9eba0143f1a4 100644 --- a/drivers/bus/brcmstb_gisb.c +++ b/drivers/bus/brcmstb_gisb.c @@ -225,27 +225,29 @@ static int brcmstb_gisb_arb_decode_addr(struct brcmstb_gisb_arb_device *gdev, static int brcmstb_bus_error_handler(unsigned long addr, unsigned int fsr, struct pt_regs *regs) { - int ret = 0; struct brcmstb_gisb_arb_device *gdev; /* iterate over each GISB arb registered handlers */ list_for_each_entry(gdev, &brcmstb_gisb_arb_device_list, next) - ret |= brcmstb_gisb_arb_decode_addr(gdev, "bus error"); + brcmstb_gisb_arb_decode_addr(gdev, "bus error"); + +#if !defined(CONFIG_ARM_LPAE) /* * If it was an imprecise abort, then we need to correct the * return address to be _after_ the instruction. */ if (fsr & (1 << 10)) regs->ARM_pc += 4; +#endif - return ret; + /* Always report unhandled exception */ + return 1; } #endif #ifdef CONFIG_MIPS static int brcmstb_bus_error_handler(struct pt_regs *regs, int is_fixup) { - int ret = 0; struct brcmstb_gisb_arb_device *gdev; u32 cap_status; @@ -258,7 +260,7 @@ static int brcmstb_bus_error_handler(struct pt_regs *regs, int is_fixup) goto out; } - ret |= brcmstb_gisb_arb_decode_addr(gdev, "bus error"); + brcmstb_gisb_arb_decode_addr(gdev, "bus error"); } out: return is_fixup ? MIPS_BE_FIXUP : MIPS_BE_FATAL; @@ -379,9 +381,16 @@ static int __init brcmstb_gisb_arb_probe(struct platform_device *pdev) list_add_tail(&gdev->next, &brcmstb_gisb_arb_device_list); #ifdef CONFIG_ARM +#ifdef CONFIG_ARM_LPAE + hook_fault_code(16, brcmstb_bus_error_handler, SIGBUS, 0, + "synchronous external abort"); + hook_fault_code(17, brcmstb_bus_error_handler, SIGBUS, 0, + "asynchronous external abort"); +#else hook_fault_code(22, brcmstb_bus_error_handler, SIGBUS, 0, "imprecise external abort"); #endif +#endif /* CONFIG_ARM */ #ifdef CONFIG_MIPS board_be_handler = brcmstb_bus_error_handler; #endif