Received: by 10.213.65.68 with SMTP id h4csp916505imn; Fri, 6 Apr 2018 11:06:38 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+eVtjUHBD6Wtxau0MR2wzXJKQbn0ZIwtkjAhYpkRno9LOI9LSnyojjxaYspxu11F1Bx3+q X-Received: by 2002:a17:902:b101:: with SMTP id q1-v6mr27961222plr.3.1523037998435; Fri, 06 Apr 2018 11:06:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523037998; cv=none; d=google.com; s=arc-20160816; b=qpE2wLZBf/i0FTNdtrB23Zj4QO/tPzkb2cKHFZ7zd5EHeHCWBZe2pPkwyEXF/trSa8 JwlZEYBDzOQa3zEGAXT9MvDwku57ZVZUyTO9Lldh5Tl0A/uHwf1fbIa49vyQGcVtpB52 pWxp20gjWOwfc7EF2suVK99w+hbF1JkYagKz+oFrosYMO0CdEaZQcrPntP21j4D9N2CD uscsmljnC2d47IUbQuqqnPBXprp+1Hc6jYhihNB3qmykdLlws7OwSFGFfQgR86E57bgn 34uJA8gWWotBO4FeazZy3gtuI1xcryrQIn24yYlg8GKm/TtYg8aNsRLJOkN9BfVtfjtE Rdsw== 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=H75PEj82744lYTXavaNC2NeWuIYu5Q17MtMrZfOTbBc=; b=r3RbveE9aC1XEYqrlJrI3XePp1N4TK4Jg6sVWi3hNug3celLiz+xgaNhrInFafa2XZ WsAgDbgML7CLxsTuq9UYQQsKmLni9J6amW+kjVMRoPRK15z0YbL5AyvpJWG/8PWt17Lk hE0p+UVxk5Kwy/HzFw508zvLbygQA9KbqcZTnazj0EhL1ZqmS5dTK25LzSq+5rTeimDS dW8shzAWCGjxk4BEyfaoEJqHhY4QIGpVgE3ZS0vtBgFiNGg99CxIDKarCUkJ3Jt3efEF m8eVxuteLG9q3yWfS6XcWGRPs2QwEo5UejK+kPmb1QUMfHOU450OwyGPhP/REv49Hj6Z impg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=M3tpPz+G; dkim=pass header.i=@codeaurora.org header.s=default header.b=M3tpPz+G; 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 a23si8474271pfa.95.2018.04.06.11.06.01; Fri, 06 Apr 2018 11:06:38 -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=M3tpPz+G; dkim=pass header.i=@codeaurora.org header.s=default header.b=M3tpPz+G; 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 S1751874AbeDFSC4 (ORCPT + 99 others); Fri, 6 Apr 2018 14:02:56 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:50722 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751773AbeDFSCw (ORCPT ); Fri, 6 Apr 2018 14:02:52 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id EC81360316; 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=1523037771; bh=1gcDpEo6hZd1B/wXSdiqT+rT+PtDJaUyJrqUFGkI56M=; h=From:To:Cc:Subject:Date:From; b=M3tpPz+GRe/M/d4MGprPhkFLYCbfp88YhXyXtoabMEIvQELGPIJhuuEFCA3GHKk2u YwKkrKUA17lGwi/D4xNB6JCcPnXk2o8+3UoMeRAm2wPeHXpNKuK/aKY7XnlG5YbCUr +3hV358ZUl1Ma/LlNJpvjAmR9zUKJB1jQk0/uJGM= 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 745AA601C4; Fri, 6 Apr 2018 18:02:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1523037771; bh=1gcDpEo6hZd1B/wXSdiqT+rT+PtDJaUyJrqUFGkI56M=; h=From:To:Cc:Subject:Date:From; b=M3tpPz+GRe/M/d4MGprPhkFLYCbfp88YhXyXtoabMEIvQELGPIJhuuEFCA3GHKk2u YwKkrKUA17lGwi/D4xNB6JCcPnXk2o8+3UoMeRAm2wPeHXpNKuK/aKY7XnlG5YbCUr +3hV358ZUl1Ma/LlNJpvjAmR9zUKJB1jQk0/uJGM= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 745AA601C4 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 Cc: linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Sinan Kaya , linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] io: change readX_relaxed() to remove barriers Date: Fri, 6 Apr 2018 14:02:45 -0400 Message-Id: <1523037766-14518-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 Now that we hardened readX() API in asm-generic version, readX_relaxed() API is violating the rules when readX_relaxed() == readX() 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 reads to be ordered with respect to each other. This is achieved by the volatile in the __raw_readX() 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 578b688..fa0975d 100644 --- a/include/asm-generic/io.h +++ b/include/asm-generic/io.h @@ -252,19 +252,35 @@ static inline void writeq(u64 value, volatile void __iomem *addr) * accesses. */ #ifndef readb_relaxed -#define readb_relaxed readb +#define readb_relaxed readb_relaxed +static inline u8 readb_relaxed(const volatile void __iomem *addr) +{ + return __raw_readb(addr); +} #endif #ifndef readw_relaxed -#define readw_relaxed readw +#define readw_relaxed readw_relaxed +static inline u16 readw_relaxed(const volatile void __iomem *addr) +{ + return __le16_to_cpu(__raw_readw(addr)); +} #endif #ifndef readl_relaxed -#define readl_relaxed readl +#define readl_relaxed readl_relaxed +static inline u32 readl_relaxed(const volatile void __iomem *addr) +{ + return __le32_to_cpu(__raw_readl(addr)); +} #endif #if defined(readq) && !defined(readq_relaxed) -#define readq_relaxed readq +#define readq_relaxed readq_relaxed +static inline u64 readq_relaxed(const volatile void __iomem *addr) +{ + return __le64_to_cpu(__raw_readq(addr)); +} #endif #ifndef writeb_relaxed -- 2.7.4