From patchwork Fri Apr 6 18:02:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinan Kaya X-Patchwork-Id: 10327379 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 1B89560545 for ; Fri, 6 Apr 2018 18:03:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 07C20295DC for ; Fri, 6 Apr 2018 18:03:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EFAD4295DE; Fri, 6 Apr 2018 18:03:07 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8462D295DC for ; Fri, 6 Apr 2018 18:03:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751808AbeDFSC4 (ORCPT ); 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= 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 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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