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: 10327387 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 1A92960545 for ; Fri, 6 Apr 2018 18:03:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0B921295DB for ; Fri, 6 Apr 2018 18:03:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0000F295DD; Fri, 6 Apr 2018 18:03:44 +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 67E83295DB for ; Fri, 6 Apr 2018 18:03:44 +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=qtkeXrLZNnr6l7/kfUzmjCyA8zz1+Xv2ghHuQYKDyq8=; b=LEXxYcDfrqTt81 Tz+Suvv7JEOIz4XhknUAw6FAewPn1+gAEO1I6EJJjusgzIYiUO/kGLFFFr5kZiveBbrk4H8AgpQFt Ik2sm1lSYTMjuecH+xSpLiFH33HSy//7b4zziPKzRLT83QLanKNQOmdYnxLeEx5Jlgs/ojZQpUoQ1 WkYVZjyFu+t/xUyB38gihiRn1FZwe4n5jNvo4vdMOR/og7W3VZwiueqN6o0JvB+pjmvhWMd0mCa7T 7F3dm/Gzje/y3xvqAeUBTPrXX9z59smffhAv+AqmxdQCPdfbStjKPg9LlBjYa0Yydk6Mz87czYjA2 SEx272K/D79AS5AAAG/A==; 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 1f4Vi3-0001CP-4M; Fri, 06 Apr 2018 18:03:35 +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-0000rG-B0 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 B876060817; 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180406_110302_460853_7479F983 X-CRM114-Status: GOOD ( 11.84 ) 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 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