From patchwork Fri Apr 6 18:02:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinan Kaya X-Patchwork-Id: 10327385 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 6767460541 for ; Fri, 6 Apr 2018 18:03:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 55C9E295DB for ; Fri, 6 Apr 2018 18:03:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 49DF7295DD; Fri, 6 Apr 2018 18:03:17 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI 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 C2722295DB for ; Fri, 6 Apr 2018 18:03:16 +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:References:In-Reply-To: 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: List-Owner; bh=1pUmdxi8wmeMxgC1hPUkPRBOBi9mOS32bdWDdkvhyl4=; b=Q4HgghNNemH5DJ JCiBO28iF8L1Elgfg90qWAydtJqor2oGqz6EtmJ67kQhhA/FfPFASi17l1bPbjxH5ZBGWH2n0ROLp I/nksqcGJ7ekCd2DeTjDtnqbjspQfQJfFlmeRnO11jqmpSBo9hQauVVtkMkLdvwQubgAZ8P9/dNCL uZP6rRFVI6U+m1WgkLMZG8xVQYKpbGT6Q0pITduIVcJATzAl7Kamh661jupLWzRmJ31ORYzT/fF3s qd4HzGmKHxu6FPblFVr3AavMrjQNbsxEA16r5rJGd/LAU/rqa0ZYs3K84nGtSh8SWshlUv58bsd7m XrjcyI0em4qtfytYH/1g==; 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 1f4Vha-0000ty-CN; Fri, 06 Apr 2018 18:03:06 +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 1f4VhW-0000rM-Az for linux-arm-kernel@lists.infradead.org; Fri, 06 Apr 2018 18:03:03 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 891DC60C65; Fri, 6 Apr 2018 18:02:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1523037773; bh=jOwHyrGjXSLW2VVElUV8XoZGyXfhim/LzT/oa/lqdW8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AajZJukBVOf1+tkEPh8idwo4KdW0Mxpg4aXWbfHKvhIY7Ff7pVDsKZHnRB+SrPz1C RJp/9jeq9swDcScXyyz3jiBb8yqcCZCBoF1AyhQ6xPNn869Jeq6cF55UhgeLBZU+Ho 3yfK4Au+e8vIFct9tuYwsKOpbj62ecl9Z0BciWCQ= 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 13861601C4; Fri, 6 Apr 2018 18:02:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1523037772; bh=jOwHyrGjXSLW2VVElUV8XoZGyXfhim/LzT/oa/lqdW8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C6c5cua0JMlLrWtHiujwE3Op6DrvUe4PDWB5exCsHeJPviZz1XxLQEaFpmVsEq2u2 eAomOKWLTvASjB9Gj+JJfW84MbnOHp7Asx/aAGdzY17D1y6k9yTzuhX7rGYelth+VK wn5eQxPKMSBYP/Azqe7rpxT5QTilbOoQzrsyfDg8= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 13861601C4 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: arnd@arndb.de, timur@codeaurora.org, sulrich@codeaurora.org Subject: [PATCH 2/2] io: change writeX_relaxed() to remove barriers Date: Fri, 6 Apr 2018 14:02:46 -0400 Message-Id: <1523037766-14518-2-git-send-email-okaya@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1523037766-14518-1-git-send-email-okaya@codeaurora.org> References: <1523037766-14518-1-git-send-email-okaya@codeaurora.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180406_110302_427413_009AD064 X-CRM114-Status: GOOD ( 12.15 ) 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: Sinan Kaya , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.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 Now that we hardened writeX() API in asm-generic version, writeX_relaxed() API is violating the rules when writeX_relaxed() == writeX() in the default implementation. The relaxed API shouldn't have any barriers in it and it doesn't provide any ordering with respect to the memory transactions. The only requirement is for writes to be ordered with respect to each other. This is achieved by the volatile in the __raw_writeX() API. Open code the relaxed API and remove any barriers in it. Signed-off-by: Sinan Kaya --- include/asm-generic/io.h | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h index fa0975d..f4a1494 100644 --- a/include/asm-generic/io.h +++ b/include/asm-generic/io.h @@ -284,19 +284,35 @@ static inline u64 readq_relaxed(const volatile void __iomem *addr) #endif #ifndef writeb_relaxed -#define writeb_relaxed writeb +#define writeb_relaxed writeb_relaxed +static inline void writeb_relaxed(u8 value, volatile void __iomem *addr) +{ + __raw_writeb(value, addr); +} #endif #ifndef writew_relaxed -#define writew_relaxed writew +#define writew_relaxed writew_relaxed +static inline void writew_relaxed(u16 value, volatile void __iomem *addr) +{ + __raw_writew(cpu_to_le16(value), addr); +} #endif #ifndef writel_relaxed -#define writel_relaxed writel +#define writel_relaxed writel_relaxed +static inline void writel_relaxed(u32 value, volatile void __iomem *addr) +{ + __raw_writel(__cpu_to_le32(value), addr); +} #endif #if defined(writeq) && !defined(writeq_relaxed) -#define writeq_relaxed writeq +#define writeq_relaxed writeq_relaxed +static inline void writeq_relaxed(u64 value, volatile void __iomem *addr) +{ + __raw_writeq(__cpu_to_le64(value), addr); +} #endif /*