From patchwork Tue Feb 7 13:19:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Brodkin X-Patchwork-Id: 725104 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vHlM22CTYz9s0m for ; Wed, 8 Feb 2017 00:20:14 +1100 (AEDT) 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 1cb5gq-0007JY-O6; Tue, 07 Feb 2017 13:20:12 +0000 Received: from us01smtprelay-2.synopsys.com ([198.182.60.111] helo=smtprelay.synopsys.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cb5gj-00065B-3u for linux-snps-arc@lists.infradead.org; Tue, 07 Feb 2017 13:20:10 +0000 Received: from mailhost.synopsys.com (mailhost1.synopsys.com [10.12.238.239]) by smtprelay.synopsys.com (Postfix) with ESMTP id 72E8B10C144C; Tue, 7 Feb 2017 05:19:43 -0800 (PST) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id 4E5D4191; Tue, 7 Feb 2017 05:19:43 -0800 (PST) Received: from abrodkin-7440l.internal.synopsys.com (abrodkin-7440l.internal.synopsys.com [10.121.8.94]) by mailhost.synopsys.com (Postfix) with ESMTP id 6FF5E15E; Tue, 7 Feb 2017 05:19:41 -0800 (PST) From: Alexey Brodkin To: linux-snps-arc@lists.infradead.org Subject: [PATCH] ARC: [arcompact] fix handling of unaligned access in delay slot Date: Tue, 7 Feb 2017 16:19:38 +0300 Message-Id: <1486473578-21205-1-git-send-email-abrodkin@synopsys.com> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170207_052005_180627_E8B79376 X-CRM114-Status: UNSURE ( 7.20 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [198.182.60.111 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [198.182.60.111 listed in wl.mailspike.net] -0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Igor Guryanov , Vineet Gupta , Alexey Brodkin , linux-kernel@vger.kernel.org, Felix Fietkau MIME-Version: 1.0 Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Commit 9aed02feae5 ("ARC: [arcompact] handle unaligned access delay slot corner case") was meant to fix one corner-case of unaligned access fixup. But for some reason real implementation has an important spello which prevents kernel to be built with enabled CONFIG_ARC_EMUL_UNALIGNED: --------------------------------->8-------------------------------- arch/arc/kernel/unaligned.c: In function 'misaligned_fixup': arch/arc/kernel/unaligned.c:246:25: error: expected ';' before '~ token regs->ret = regs->bta ~1U; ^ --------------------------------->8-------------------------------- What needs to be done - LSB bit of regs->bta has to be cleared and now we do exactly this with "& ~1U". While at it fix another spello in comments. Signed-off-by: Alexey Brodkin Reported-by: John Crispin Cc: Felix Fietkau Cc: Vineet Gupta Cc: Igor Guryanov --- arch/arc/kernel/unaligned.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arc/kernel/unaligned.c b/arch/arc/kernel/unaligned.c index 91ebe382147f..39ee23d107cc 100644 --- a/arch/arc/kernel/unaligned.c +++ b/arch/arc/kernel/unaligned.c @@ -241,9 +241,9 @@ int misaligned_fixup(unsigned long address, struct pt_regs *regs, if (state.fault) goto fault; - /* clear any remanants of delay slot */ + /* clear any remnants of delay slot */ if (delay_mode(regs)) { - regs->ret = regs->bta ~1U; + regs->ret = regs->bta & ~1U; regs->status32 &= ~STATUS_DE_MASK; } else { regs->ret += state.instr_len;