From patchwork Fri Apr 7 20:08:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Brodkin X-Patchwork-Id: 748451 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 3w09dM1sH2z9s7F for ; Sat, 8 Apr 2017 06:08:55 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="kPrA38tK"; dkim-atps=neutral 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: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:In-Reply-To: References:List-Owner; bh=1CjpVftYAP5n6cxBFe7N+AUz0SyjwystVPJ2MA9WK1w=; b=kPr A38tKEVlG67iAdZj57R3hfZOUCgB3jBFxcWe1N38yMVkcJp3/xirue1hoURYVVPikhitpOYPy/kMq lQH9mwSjeFSYS2QjmbAeEINCAg332F5uDbFPdKYsV59UaYmZI8s/jLNRTfp6bFH7ndv6G9gvi2jc/ /tFqr7h7UlimSINYkctt7M9rQlPZO8WyvnH2+d3hF9rMz6xItfZQHX0LPxPyMgKzHYuOHfNCENcwQ qLVT9PDQzWEy5IUB816sAJ/gwRaeGOc1rBJYR2fw0soZJW/W1rSeVZUXobhfQZDBDQmrm8XPFqCU4 3nkzBG8CpkiM99/pz2K+rIq3lXzbL5g==; 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 1cwaBh-0004mW-Pu; Fri, 07 Apr 2017 20:08:53 +0000 Received: from smtprelay2.synopsys.com ([198.182.60.111] helo=smtprelay.synopsys.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cwaBe-0004jO-KG for linux-snps-arc@lists.infradead.org; Fri, 07 Apr 2017 20:08:52 +0000 Received: from mailhost.synopsys.com (mailhost1.synopsys.com [10.12.238.239]) by smtprelay.synopsys.com (Postfix) with ESMTP id 3C68910C165F; Fri, 7 Apr 2017 13:08:28 -0700 (PDT) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id A75769FE; Fri, 7 Apr 2017 13:08:28 -0700 (PDT) Received: from abrodkin-7440l.internal.synopsys.com (unknown [10.225.15.124]) by mailhost.synopsys.com (Postfix) with ESMTP id 560CC9CB; Fri, 7 Apr 2017 13:08:26 -0700 (PDT) From: Alexey Brodkin To: u-boot@lists.denx.de Subject: [PATCH] ARCv2: SLC: Make sure busy bit is set properly on SLC flushing Date: Fri, 7 Apr 2017 23:08:04 +0300 Message-Id: <1491595684-23700-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-20170407_130850_672366_B7728C39 X-CRM114-Status: UNSURE ( 7.36 ) 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 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -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] -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: linux-snps-arc@lists.infradead.org, Alexey Brodkin MIME-Version: 1.0 Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org As reported in STAR 9001165532, an SLC control reg read (for checking busy state) right after SLC invalidate command may incorrectly return NOT busy causing software to NOT spin-wait while operation is underway. (and for some reason this only happens if L1 cache is also disabled - as required by IOC programming model) Suggested workaround is to do an additional Control Reg read, which ensures the 2nd read gets the right status. Same fix made in Linux kernel: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c70c473396cbdec1168a6eff60e13029c0916854 Signed-off-by: Alexey Brodkin --- arch/arc/lib/cache.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/arc/lib/cache.c b/arch/arc/lib/cache.c index b6ec83112cd8..f1436bf19992 100644 --- a/arch/arc/lib/cache.c +++ b/arch/arc/lib/cache.c @@ -59,10 +59,16 @@ static unsigned int __before_slc_op(const int op) static void __after_slc_op(const int op, unsigned int reg) { - if (op & OP_FLUSH) /* flush / flush-n-inv both wait */ + if (op & OP_FLUSH) { /* flush / flush-n-inv both wait */ + /* + * Make sure "busy" bit reports correct status, + * see STAR 9001165532 + */ + read_aux_reg(ARC_AUX_SLC_CTRL); while (read_aux_reg(ARC_AUX_SLC_CTRL) & DC_CTRL_FLUSH_STATUS) ; + } /* Switch back to default Invalidate mode */ if (op == OP_INV)