From patchwork Tue Apr 3 12:55:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinan Kaya X-Patchwork-Id: 10321035 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 273CE60116 for ; Tue, 3 Apr 2018 12:55:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 11A9F2883B for ; Tue, 3 Apr 2018 12:55:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 058A528B3E; Tue, 3 Apr 2018 12:55:36 +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_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 854D72883B for ; Tue, 3 Apr 2018 12:55:35 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=16owIi/Cl+cdqbaiCnwEgqMzJZGpPyRniieD1skO1pw=; b=QBH6AuKq+BMKuB La7eU/w8GW0A5+ZrJpiPgFjQ2MIsVvy8nD0uzF0QgyegUQwYHwTo9q8Z+k67eibEmxapZHlqCcrsG ops58f5zhIyXpun7tcf1fqdthl+vw4WDmD6Kdrys73sRUB+07hIZ6tCCKmAnIVn5eMrkPcAp4C7GW cMG3lwQNCsoWllXk5v6+Orv1zk1wpRDk4jB5t9detjQwI002U0VUFiBY1WQnohDlp90I6YO2CwSLS QzjPW0RsiFJb41cid1iZa5CU1aqEnbMJvRX6De3oQl0nBrQ03v4SHjQ732V1o/A8Lm+gODwjDpY73 BjqzUgOMGFlFYNtwIkJg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1f3LTI-0005z0-5O; Tue, 03 Apr 2018 12:55:32 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f3LTC-0005wM-DS for linux-arm-kernel@lists.infradead.org; Tue, 03 Apr 2018 12:55:29 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id CB5F7605FF; Tue, 3 Apr 2018 12:55:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1522760115; bh=gt/baHg+YOtYxbcPB+ga2CKKrno8z+c2HwxNKeRapjE=; h=From:To:Cc:Subject:Date:From; b=b7ZW3g/wGByB4VDiDqkVE1WPQCCCGdBrWhDVh/IS+AJN53eHPc6Z9f5djFl3lqosT KX1XWbhpWexb5uMwFJxywVeZlxUWn+qQYd0xs72vf8FDylEABPfhtaYqWsxNdvmQx2 TqqwKGTXgWc+bqVCwpTGdd5beqweIYhFDJdjDhdw= Received: from drakthul.qualcomm.com (global_nat1_iad_fw.qualcomm.com [129.46.232.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: okaya@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id EA1B1605FF; Tue, 3 Apr 2018 12:55:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1522760115; bh=gt/baHg+YOtYxbcPB+ga2CKKrno8z+c2HwxNKeRapjE=; h=From:To:Cc:Subject:Date:From; b=b7ZW3g/wGByB4VDiDqkVE1WPQCCCGdBrWhDVh/IS+AJN53eHPc6Z9f5djFl3lqosT KX1XWbhpWexb5uMwFJxywVeZlxUWn+qQYd0xs72vf8FDylEABPfhtaYqWsxNdvmQx2 TqqwKGTXgWc+bqVCwpTGdd5beqweIYhFDJdjDhdw= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org EA1B1605FF Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=okaya@codeaurora.org From: Sinan Kaya To: linux-mips@linux-mips.org, arnd@arndb.de, timur@codeaurora.org, sulrich@codeaurora.org Subject: [PATCH v3 1/2] MIPS: io: prevent compiler reordering on the default writeX() implementation Date: Tue, 3 Apr 2018 08:55:03 -0400 Message-Id: <1522760109-16497-1-git-send-email-okaya@codeaurora.org> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180403_055526_484363_2ACE6C66 X-CRM114-Status: GOOD ( 12.13 ) 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: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Ralf Baechle , Sinan Kaya , Paul Burton , James Hogan , linux-arm-kernel@lists.infradead.org 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 writeX() has a strong ordering semantics with respect to memory updates. In the abscence of a write barrier or a compiler barrier, commpiler can reorder register and memory update instructions. This breaks the writeX() API. Signed-off-by: Sinan Kaya --- arch/mips/include/asm/io.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h index 0cbf3af..fd00ddaf 100644 --- a/arch/mips/include/asm/io.h +++ b/arch/mips/include/asm/io.h @@ -307,7 +307,7 @@ static inline void iounmap(const volatile void __iomem *addr) #if defined(CONFIG_CPU_CAVIUM_OCTEON) || defined(CONFIG_LOONGSON3_ENHANCEMENT) #define war_io_reorder_wmb() wmb() #else -#define war_io_reorder_wmb() do { } while (0) +#define war_io_reorder_wmb() barrier() #endif #define __BUILD_MEMORY_SINGLE(pfx, bwlq, type, irq) \