Received: by 10.213.65.68 with SMTP id h4csp2621386imn; Mon, 2 Apr 2018 10:49:39 -0700 (PDT) X-Google-Smtp-Source: AIpwx48LI0QuPtsiXChYfTSgmPvD/wMxKPD2iuUiEDnmQEfkZRaCDHri732rn7fT7i1LbqxYKQ/o X-Received: by 2002:a17:902:d03:: with SMTP id 3-v6mr10794232plu.245.1522691379654; Mon, 02 Apr 2018 10:49:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522691379; cv=none; d=google.com; s=arc-20160816; b=o/H13EngX6bwnTsVXDp7nTvJSzf8sKo4aDVHxmTUYV8fRq1zQKAwDbCjUW50dzx0JE DaeAu0b0NqQj6qNfukKiuE6uDOfOenmXidEiO/fJoRMUWJe6FlAfM0Oo5COfiWfn0MBA q8y8pxVdnULQSiFUdqOfW2phzb8zSFdT+6PvemVzoMTYdjvAQuzSszF+6Y733gl+pFL1 6w8tX7fQ8bvn8Hj8I611dd9PFJXswDpPOtMeWJxzZgSuFLVG68aiFxTjLXe2+gjU/Mii YzkyK+Esux4Tcfcga6jN7frCCa997FO+5ZXHrvHbo0SDk34+sCCC0uneEBy/GRowNj/9 XrVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dmarc-filter:dkim-signature :dkim-signature:arc-authentication-results; bh=34kAcYJzRY/wIrDYMzrZHi3W9plDjqXMRfN8FQl+Whc=; b=vlcX7f6Gyk4AuZgeVBx0Z6Qi/iAO5gnl50snGdF/YprSqRhVG65t6J6W+DX7QcEuLe jPF3USfocfqmv1V7Y+vx+R0VsTj0CDEcm2SxBSe11y1EnSjded2CqIBPaG2YCsx5gTjY QuF+afeslRtc3zdYdKgwgbUL2Wj/MfvrRQFw6EcbQjFLj1rA+Q6DhrDaU0lwmx2ZcDqc TVu6IjWZSHRYHGNoeZ+EJXk4l+VMQ2maKvSNRnikzg+EEH9RaEtQY4uBo2L17LXRuJTi DgiczJuvi+HzWC/PMnF5kPzY+yNj8OPHjnMCbzcThqklysM596xRRZwrvqSmIqCk3DWm YqPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=ONJGzm0U; dkim=pass header.i=@codeaurora.org header.s=default header.b=nVKbJih6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r20si603076pfk.224.2018.04.02.10.49.25; Mon, 02 Apr 2018 10:49:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=ONJGzm0U; dkim=pass header.i=@codeaurora.org header.s=default header.b=nVKbJih6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753226AbeDBRsM (ORCPT + 99 others); Mon, 2 Apr 2018 13:48:12 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:39132 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752900AbeDBRsK (ORCPT ); Mon, 2 Apr 2018 13:48:10 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id B0B956081B; Mon, 2 Apr 2018 17:48:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1522691289; bh=KEbDxTqRnoli8BV6m7pSzTjmw92ch6lmjReUBG3d1hA=; h=From:To:Cc:Subject:Date:From; b=ONJGzm0UcBo5scebpwHms8j3WydpMSR1umW6mmyx5OGW/a+sNxmX7AQXYYMefXBE5 d7bEl9rifxI4wmAMmGXF9ck4pkRX5Orq0ChTnEn/qEMoRE9/VY6GWulx9hlMBTQNaq nZPZ8Zzt9gQSOp5iyM5f/CR/DSC13/U1ZMcsBon0= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 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 5F4E6601D3; Mon, 2 Apr 2018 17:48:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1522691288; bh=KEbDxTqRnoli8BV6m7pSzTjmw92ch6lmjReUBG3d1hA=; h=From:To:Cc:Subject:Date:From; b=nVKbJih6GBFQbqd67q00ys0HLRA1a8S4hE9jJtBJh9yHN3erXBE29J//S2LNA/mK1 pEuRzMoRnW4y6NV3mzn0I+J2XmuFEorC2SMFX0hlG27ixANY/OWV7TMOqx/qmMaFvi JWd4ymVdRGjBd+sprpXC0tD+4gnND3yqazFSvv3I= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 5F4E6601D3 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-alpha@vger.kernel.org, timur@codeaurora.org, sulrich@codeaurora.org Cc: arnd@arndb.de, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Sinan Kaya , Richard Henderson , Ivan Kokshaysky , Matt Turner , Philippe Ombredanne , Greg Kroah-Hartman , Guenter Roeck , Kate Stewart , linux-kernel@vger.kernel.org Subject: [PATCH] alpha: io: reorder barriers to guarantee writeX() and iowriteX() ordering Date: Mon, 2 Apr 2018 13:48:00 -0400 Message-Id: <1522691281-21593-1-git-send-email-okaya@codeaurora.org> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org memory-barriers.txt has been updated with the following requirement. "When using writel(), a prior wmb() is not needed to guarantee that the cache coherent memory writes have completed before writing to the MMIO region." Current writeX() and iowriteX() implementations on alpha are not satisfying this requirement as the barrier is after the register write. Move mb() in writeX() and iowriteX() functions to guarantee that HW observes memory changes before performing register operations. Signed-off-by: Sinan Kaya Reported-by: Arnd Bergmann --- arch/alpha/include/asm/io.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/alpha/include/asm/io.h b/arch/alpha/include/asm/io.h index d123ff9..4c533fc 100644 --- a/arch/alpha/include/asm/io.h +++ b/arch/alpha/include/asm/io.h @@ -341,14 +341,14 @@ extern inline unsigned int ioread16(void __iomem *addr) extern inline void iowrite8(u8 b, void __iomem *addr) { - IO_CONCAT(__IO_PREFIX,iowrite8)(b, addr); mb(); + IO_CONCAT(__IO_PREFIX, iowrite8)(b, addr); } extern inline void iowrite16(u16 b, void __iomem *addr) { - IO_CONCAT(__IO_PREFIX,iowrite16)(b, addr); mb(); + IO_CONCAT(__IO_PREFIX, iowrite16)(b, addr); } extern inline u8 inb(unsigned long port) @@ -382,8 +382,8 @@ extern inline unsigned int ioread32(void __iomem *addr) extern inline void iowrite32(u32 b, void __iomem *addr) { - IO_CONCAT(__IO_PREFIX,iowrite32)(b, addr); mb(); + IO_CONCAT(__IO_PREFIX, iowrite32)(b, addr); } extern inline u32 inl(unsigned long port) @@ -434,14 +434,14 @@ extern inline u16 readw(const volatile void __iomem *addr) extern inline void writeb(u8 b, volatile void __iomem *addr) { - __raw_writeb(b, addr); mb(); + __raw_writeb(b, addr); } extern inline void writew(u16 b, volatile void __iomem *addr) { - __raw_writew(b, addr); mb(); + __raw_writew(b, addr); } #endif @@ -482,14 +482,14 @@ extern inline u64 readq(const volatile void __iomem *addr) extern inline void writel(u32 b, volatile void __iomem *addr) { - __raw_writel(b, addr); mb(); + __raw_writel(b, addr); } extern inline void writeq(u64 b, volatile void __iomem *addr) { - __raw_writeq(b, addr); mb(); + __raw_writeq(b, addr); } #endif -- 2.7.4