Received: by 10.213.65.68 with SMTP id h4csp1924040imn; Thu, 5 Apr 2018 06:12:13 -0700 (PDT) X-Google-Smtp-Source: AIpwx48obRVbYFw3Uvtsp++yTGkEPO8kVq93E6qlUFc1qmXjGKHIX+DWR4KSEEUuFzTKe23TXF7J X-Received: by 10.99.100.68 with SMTP id y65mr15048104pgb.257.1522933933851; Thu, 05 Apr 2018 06:12:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522933933; cv=none; d=google.com; s=arc-20160816; b=MiwyR30gwGlCdtPmltdoSZb3bNffOqW2DakfF7zL6e4BdHIiguLauPT+PRKWKAR32o STCmVzA2wvbEfxXzdWCCSPKCipAi/y+Hw3fdXOE/SMSb14ha767951mpVYVp7MsljyC7 k9lxmfn19i7UFD1niZeabz1Wtw94WqRFuyBjCqapHX6a4JiDgFaAYRWskUgfrbv8J3vt EqiUTfr66OYwUtuAwRS52d38X6TpXSUaMFTrbIGm8RFbJM9NJscCYQ6BNXoDyBPX/Qjf Llaaml/7GyK00qJEc7jRfSw9p33JKEVI/ZHZdke350gy8x0v4VwGJNQbIlVdcs54eXgj CeNA== 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=hOY2FRSssRaheREIkcFac1U0g34FlrG4IBNumaF8obQ=; b=hLnB2grbCW1hVV3cGaoNcbDT9ECk1fm6t8yniAOjHU68rsbJPR9udaZ/JZL76DUx8j KbefwJOMxbTKWgMVe2KeyE4r+k5Hq7dnIARKkrruH9gP8vM00qpujFikHpznh8IvlyPV KkotovzL/l1kULaNk0LyiSUjWc4jAkxOa5h/EBDDvNuPrgwEv/X7bbSwRkof2DS3OzJ5 6aCVh4GUPx/5hp2UgyiIVIJ7tsn9s9+MYCyMH7/WMdvcDgPXvcPaB5QKXRYqrIru+sxm N3Mu/4Zhm/O86TQDZm5EOp1Slo0xXDCXBDd23RXKK0H0DuD9PH4lkZLEtyh5V+ykvUR9 PsmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=adqaVYwW; dkim=pass header.i=@codeaurora.org header.s=default header.b=lsl2A3HD; 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 o6si5516994pgf.658.2018.04.05.06.11.59; Thu, 05 Apr 2018 06:12:13 -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=adqaVYwW; dkim=pass header.i=@codeaurora.org header.s=default header.b=lsl2A3HD; 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 S1751445AbeDENJW (ORCPT + 99 others); Thu, 5 Apr 2018 09:09:22 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:38222 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751285AbeDENJT (ORCPT ); Thu, 5 Apr 2018 09:09:19 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 5D9AA60767; Thu, 5 Apr 2018 13:09:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1522933759; bh=XIk5OnfEisZ4v1auFvkiuUG6UvjhrZauoqVwZgmFjGg=; h=From:To:Cc:Subject:Date:From; b=adqaVYwWCcrh7LgfqZaD5qIaqQq5Sj76+mbiz8Vu+VF6BxlINxAyK1sphKsgcCc+o N9H7gLCcRC4VOUL/3yyW3M/UeXZgvsB2XSK0Hd+68gX8vopzbZlo0Md5EjD2DMXU3K +crm2SkysnyvTsdFEXfK4/lvVfBdJI57kribg1nI= 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 E4798602BA; Thu, 5 Apr 2018 13:09:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1522933758; bh=XIk5OnfEisZ4v1auFvkiuUG6UvjhrZauoqVwZgmFjGg=; h=From:To:Cc:Subject:Date:From; b=lsl2A3HDROMxFc7jOu0N9DSJfBEEH0q9Dsp77NpTret9kyU9kXMNQMTXO4fLljveV JdO3JnWG6ZzITkIBHisHrGt1d7lnJhPYb5bghU0UxKruuD+5qhaVXoYvao7RrGWpn3 3Dlg6e/5FqyatFYiuKIgaOPdoqzBjjuVOT2QzZaU= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org E4798602BA 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 v4 1/5] io: define several IO & PIO barrier types for the asm-generic version Date: Thu, 5 Apr 2018 09:09:09 -0400 Message-Id: <1522933753-19589-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 Getting ready to harden readX()/writeX() and inX()/outX() semantics for the generic implementation. Defining two set of macros as __io_br() and __io_ar() to indicate actions to be taken before and after MMIO read. Defining two set of macros as __io_bw() and __io_aw() to indicate actions to be taken before and after MMIO write. Defining two set of macros as __io_pbw() and __io_paw() to indicate actions to be taken before and after Port IO write. Defining two set of macros as __io_pbr() and __io_par() to indicate actions to be taken before and after Port IO read. If rmb() is available for the architecture, prefer rmb() as the default implementation of __io_ar()/__io_par(). If wmb() is available for the architecture, prefer wmb() as the default implementation of __io_bw()/__io_pbw(). Signed-off-by: Sinan Kaya --- include/asm-generic/io.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h index b4531e3..570433b 100644 --- a/include/asm-generic/io.h +++ b/include/asm-generic/io.h @@ -25,6 +25,50 @@ #define mmiowb() do {} while (0) #endif +#ifndef __io_br +#define __io_br() barrier() +#endif + +/* prevent prefetching of coherent DMA data ahead of a dma-complete */ +#ifndef __io_ar +#ifdef rmb +#define __io_ar() rmb() +#else +#define __io_ar() barrier() +#endif +#endif + +/* flush writes to coherent DMA data before possibly triggering a DMA read */ +#ifndef __io_bw +#ifdef wmb +#define __io_bw() wmb() +#else +#define __io_bw() barrier() +#endif +#endif + +/* serialize device access against a spin_unlock, usually handled there. */ +#ifndef __io_aw +#define __io_aw() barrier() +#endif + +#ifndef __io_pbw +#define __io_pbw() __io_bw() +#endif + +#ifndef __io_paw +#define __io_paw() __io_aw() +#endif + +#ifndef __io_pbr +#define __io_pbr() __io_br() +#endif + +#ifndef __io_par +#define __io_par() __io_ar() +#endif + + /* * __raw_{read,write}{b,w,l,q}() access memory in native endianness. * -- 2.7.4