From patchwork Thu Apr 5 13:09:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinan Kaya X-Patchwork-Id: 10324567 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 450966053F for ; Thu, 5 Apr 2018 13:11:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 32F1C291CB for ; Thu, 5 Apr 2018 13:11:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 317E2291E1; Thu, 5 Apr 2018 13:11:56 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable 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 56DA0291E6 for ; Thu, 5 Apr 2018 13:11:49 +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=MCkV6FqbL4arkL/cyzbTyoUUeKmsxMVGVbV+YPi93ww=; b=tXNqYIHm4mUQSS vcRQLkGpKw1DCo8HjPt+Pi/sVOn/C0rielDmuAq2+FzctPa/4dHgS9VsB7Q7qGGt8EUGkB5wyB8xs hnURvWsi+p724zfI2uUaY6ujDMPmv6MsAVrLGR4MDZPAxRMCuUKGfcf8IXsCoZKJx8tkx7dCT0fXr l75kNZ0rAEmj9zXsah/VCe2w3yZTCa4qAQDNZPelLcu5fLo/VQqjdWEVGQqCEfiK8dergXdPrZhNf rS+CKGZr/rS1GsfmWTWpQh8IVKNNaCAbKBPJ6eMARSgobusb1smyiT2GW05YSBxHM3eHvB60yOEkU vBK4nXik5tn2lPUPnLSQ==; 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 1f44g2-0000w0-B0; Thu, 05 Apr 2018 13:11:42 +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 1f44dt-0006ex-MH for linux-arm-kernel@lists.infradead.org; Thu, 05 Apr 2018 13:09:36 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 125476081A; 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= 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180405_060929_784781_1C3D539B X-CRM114-Status: UNSURE ( 9.78 ) X-CRM114-Notice: Please train this message. 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 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. *