Received: by 10.213.65.68 with SMTP id h4csp920679imn; Fri, 6 Apr 2018 11:11:08 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+XSYhE8ICzjm3wvDD1A95JF2aHjoqs7BeFgXEvC2XneOGfp5WK+dO0b16PXAqi0/zrzXC7 X-Received: by 2002:a17:902:722:: with SMTP id 31-v6mr27953549pli.38.1523038268726; Fri, 06 Apr 2018 11:11:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523038268; cv=none; d=google.com; s=arc-20160816; b=OJVHyEuUFRTiSqEyKJnuwkxGmVwao3+MxWR25Y6gc0dFcNmy/hN89O9CORWxVesbB3 jaUNC3nUDMVGOERzCvOHdLZ5Y0mgQS3LkVnWCg3ktfuE50NWLccgBHw7z5IOqg5q4QKS iFhWmUaZvDjIAgPQfvutsV0146rIIcrfwPao27xK7aW8fuonQVyT3lNoKgKSEYZCwuV4 0iOlYf5K0FEXoL/6pevcsMeQax4Yyze8TFkHIucVI3t9LzYyeSpF9cwyulIgUTc2Q0LB p/06qMnUGXOy63Vd+BwwZzX04if7Qp8tP+1Nwh4ADBYfo0o5MN75NObHqAy2+fHMDqXc 95Mg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dmarc-filter:dkim-signature:dkim-signature :arc-authentication-results; bh=QE0j8WZcZAGOV8eIPSgUOMNKZtzXlf+dWzTHRnX1DwU=; b=C4Nzf86MsjDbqd5uHuARyFBmKM/wTns0zkxoqVE1oCKBGL5hzvBmdiNQmhg9aMqmxV M0fuEAB5HCQrLbo/fNdHimueFp2vdmTOXZKJsBqlg1C3FPH9FYMmR23oavo8kcV2QH07 SngbQeosIO05YN1i4ZlVe3TL7HsHeoMwcEV3HrJfbj5y92z6WtbD0xAnyVM6vepLCpxA I4nrNKpWNLTY9JAFKlu4YQvfO8magX1DosZtZb8FCm10zOsMw6UcBWX+8k9Glll12qYK v08pRwbiAyEr2OTADxJv9sVb7kTGa/75fjNDD9zxdrcvMd19G5iP9AQX/WXvnaXRaUf6 3j3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=AajZJukB; dkim=pass header.i=@codeaurora.org header.s=default header.b=C6c5cua0; 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 i132si532083pgc.509.2018.04.06.11.10.30; Fri, 06 Apr 2018 11:11:08 -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=AajZJukB; dkim=pass header.i=@codeaurora.org header.s=default header.b=C6c5cua0; 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 S1751941AbeDFSDL (ORCPT + 99 others); Fri, 6 Apr 2018 14:03:11 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:50748 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751779AbeDFSCx (ORCPT ); Fri, 6 Apr 2018 14:02:53 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 3623E60850; 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= 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 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 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 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 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 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 /* -- 2.7.4