From patchwork Fri Mar 24 14:46:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Berger X-Patchwork-Id: 9643015 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 2CC5D60327 for ; Fri, 24 Mar 2017 14:49:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1EF1A205FD for ; Fri, 24 Mar 2017 14:49:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 12FC522376; Fri, 24 Mar 2017 14:49:23 +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 81CEC205FD for ; Fri, 24 Mar 2017 14:49:22 +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=YWCUku1onmG4BgpH/T4aWgsZym LOUx2pa/A23tMULJIcwnuuLjSBaF5b5xUS1nRyNgXkLpdAhGS1ECMTrTgHtddHWWm4kNolklEgv9m N0K5WX2vGUKt8sQNT9Ae77rY0omR4hteW+eWaOqRxXOrQB7NcAi5e/k+FzLw3O2hdcEHvwVUfNBwL uDgoYTZ2liU5A9DSQoqe/5KghdSZGHu0yxJEzKWGD4WXTwBYoEhdgbqCPveOVSOfqZxmFuW6SV4hG R1AQVSHwj21Eow3SvG5fd+SchgRMdsjyclzApX5/DVBkHBlFs2DNFWZ9gNKOx2gARGGFcGslVwQiZ DcFVScvg==; 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 1crQWm-0003Ja-1o; Fri, 24 Mar 2017 14:49:20 +0000 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1crQVr-00029U-A9 for linux-arm-kernel@lists.infradead.org; Fri, 24 Mar 2017 14:48:32 +0000 Received: by mail-wm0-x241.google.com with SMTP id z133so1051962wmb.2 for ; Fri, 24 Mar 2017 07:48:03 -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=nYT+t0cgoGeF/5uVAjbguWrSpc2k6gFY5ojDds1s6bJ3jDlxW6FXQjNAPlWu1zjsa/ xdYgyMGVX0xDlfMCBFCw0rCpYI6SGhb2d/GKiCkFSzN93syzYBBfzv5OMGi8GoKwoxK7 KmDW/tnfQP4iWt2+9lJGWXiAml4V+MQ6gbgv06esipmCXcHuRj34cSdKMPxQelKHF0TJ 17zbTbSihgoU0SR2jM9QjsU3nF1fRjUPoRtPXjGTGzaotrp5toZtPkyjcOIlAp3n5i10 bxPvQrMl93le4krsZWTn9zKo2FfV8ZNLu6LxxeSl+8bRWdI/AhEEUTnvswvXwY0MY2+p Hlxw== 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=Sq8E5F3tV8oa34IeYkN5A88pXCeDo/Fj3/RKlDNVat5AghXP7a8bSP4VDra2ePB7H5 /krUGq9vFNqEtDVE4ftltPbUpixhOvmJpuxG9lU0fohqEM15fE9KSJoDx8ZxhByahBFT 3/db8bNKAEzucVjIN6Wzkf/jT+oo2dLyN5RMaR12nzpSi5TI/3PMZIbwE47RhCFCU/Gi kJqtMlgn7wTjbROWV/cJemai8Vrrp5BqkcKHGYCb72U6t4guaS2OT36lWQ4jj3ImdHIP Pma223AznMabh2j7en9m/w8JsjBxQeSU5dSaha02HQnE0ORzeUtErY/Thidb8Wjt4Nl5 RS7Q== X-Gm-Message-State: AFeK/H2pBzEHLA/alQLTT+3XrBdrmIhI0Ydce5qX+l3VKExlgFqk7P8J7IAiCVwdZx8Peg== X-Received: by 10.28.224.11 with SMTP id x11mr3564795wmg.98.1490366881557; Fri, 24 Mar 2017 07:48:01 -0700 (PDT) Received: from stb-bld-02.irv.broadcom.com ([192.19.255.250]) by smtp.gmail.com with ESMTPSA id k32sm3154947wre.18.2017.03.24.07.47.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Mar 2017 07:48:00 -0700 (PDT) From: Doug Berger To: catalin.marinas@arm.com Subject: [PATCH 5/9] bus: brcmstb_gisb: Correct hooking of ARM aborts Date: Fri, 24 Mar 2017 07:46:28 -0700 Message-Id: <20170324144632.5896-6-opendmb@gmail.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170324144632.5896-1-opendmb@gmail.com> References: <20170324144632.5896-1-opendmb@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170324_074824_262724_575CE7C8 X-CRM114-Status: GOOD ( 12.85 ) 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: mark.rutland@arm.com, wangkefeng.wang@huawei.com, linus.walleij@linaro.org, will.deacon@arm.com, mingo@kernel.org, panand@redhat.com, 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, vladimir.murzin@arm.com, cmetcalf@mellanox.com, suzuki.poulose@arm.com, andre.przywara@arm.com, robh+dt@kernel.org, gregory.0xf0@gmail.com, sandeepa.s.prabhu@gmail.com, horms+renesas@verge.net.au, 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