From patchwork Tue Jun 9 09:54:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 482164 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 8A428140338 for ; Tue, 9 Jun 2015 19:57:57 +1000 (AEST) 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 1Z2GFm-0000In-Vd; Tue, 09 Jun 2015 09:55:30 +0000 Received: from galois.linutronix.de ([2001:470:1f0b:db:abcd:42:0:1]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z2GFh-0007RX-3w for linux-arm-kernel@lists.infradead.org; Tue, 09 Jun 2015 09:55:26 +0000 Received: from bigeasy by Galois.linutronix.de with local (Exim 4.80) (envelope-from ) id 1Z2GFG-0000RD-An; Tue, 09 Jun 2015 11:54:58 +0200 Date: Tue, 9 Jun 2015 11:54:58 +0200 From: Sebastian Andrzej Siewior To: Russell King - ARM Linux , Tony Lindgren Subject: Re: Moan: usage of __iormb() and __iowmb() outside of asm/io.h Message-ID: <20150609095458.GA972@linutronix.de> References: <20150608184701.GA7557@n2100.arm.linux.org.uk> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20150608184701.GA7557@n2100.arm.linux.org.uk> X-Key-Id: 2A8CF5D1 X-Key-Fingerprint: 6425 4695 FFF0 AA44 66CC 19E6 7B96 E816 2A8C F5D1 User-Agent: Mutt/1.5.21 (2010-09-15) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150609_025525_345992_8F88359C X-CRM114-Status: GOOD ( 12.62 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [2001:470:1f0b:db:abcd:42:0:1 listed in] [list.dnswl.org] -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain Cc: Ivan Khoronzhuk , Murali Karicheri , Will Deacon , linux-arm-kernel@lists.infradead.org, Catalin Marinas X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org * Russell King - ARM Linux | 2015-06-08 19:47:01 [+0100]: >These are not official kernel barriers - the only reason they exist in >asm/io.h is purely to provide a barrier implementation _for_ creating >the accessors _in_ asm/io.h, which are macros, and therefore these >macros need to stay around for the same scope as those accessors. I'm sorry for that. Are those _relaxed() accessors okay? They don't show up in Documentation/ so I ask here before I do it wrong again… On the other hand if Tony or someone else things that this is not worth it at all I could stick with readl/writel and drop the barries. It is just that musb and releated code used those __raw accessors and I ended up with them, too (I'm not looking for an excuse just saying that I do not have any numbers to show which say that this is good in terms of performance and worth keeping). diff --git a/drivers/dma/cppi41.c b/drivers/dma/cppi41.c --- a/drivers/dma/cppi41.c +++ b/drivers/dma/cppi41.c @@ -257,12 +257,12 @@ static struct cppi41_channel *desc_to_chan(struct cppi41_dd *cdd, u32 desc) static void cppi_writel(u32 val, void *__iomem *mem) { - __raw_writel(val, mem); + writel_relaxed(val, mem); } static u32 cppi_readl(void *__iomem *mem) { - return __raw_readl(mem); + return readl_relaxed(mem); } static u32 pd_trans_len(u32 val) @@ -308,7 +308,7 @@ static irqreturn_t cppi41_irq(int irq, void *data) } if (val) - __iormb(); + rmb(); while (val) { u32 desc, len; @@ -410,14 +410,7 @@ static void cppi41_dma_issue_pending(struct dma_chan *chan) reg |= c->q_comp_num; } - cppi_writel(reg, c->gcr_reg); - - /* - * We don't use writel() but __raw_writel() so we have to make sure - * that the DMA descriptor in coherent memory made to the main memory - * before starting the dma engine. - */ - __iowmb(); + writel(reg, c->gcr_reg); push_desc_queue(c); } @@ -546,7 +539,7 @@ static int cppi41_tear_down_chan(struct cppi41_channel *c) if (!c->td_queued) { cppi41_compute_td_desc(td); - __iowmb(); + wmb(); reg = (sizeof(struct cppi41_desc) - 24) / 4; reg |= td_desc_phys; @@ -577,7 +570,7 @@ static int cppi41_tear_down_chan(struct cppi41_channel *c) } else if (desc_phys == td_desc_phys) { u32 pd0; - __iormb(); + rmb(); pd0 = td->pd0; WARN_ON((pd0 >> DESC_TYPE) != DESC_TYPE_TEARD); WARN_ON(!c->is_tx && !(pd0 & TD_DESC_IS_RX));