linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sai Prakash Ranjan <quic_saipraka@quicinc.com>
To: <arnd@arndb.de>, <catalin.marinas@arm.com>, <rostedt@goodmis.org>
Cc: <gregkh@linuxfoundation.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-arm-msm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<maz@kernel.org>, <quic_psodagud@quicinc.com>,
	<quic_tsoni@quicinc.com>, <will@kernel.org>,
	Sai Prakash Ranjan <quic_saipraka@quicinc.com>
Subject: [PATCHv14 1/9] arm64: io: Use asm-generic high level MMIO accessors
Date: Wed, 4 May 2022 16:58:20 +0530	[thread overview]
Message-ID: <fb38e469c238428d1a3ff554d6bf8edfe6ff7ecf.1651663123.git.quic_saipraka@quicinc.com> (raw)
In-Reply-To: <cover.1651663123.git.quic_saipraka@quicinc.com>

Remove custom arm64 MMIO accessors read{b,w,l,q} and their relaxed
versions in support to use asm-generic defined accessors. Also define
one set of IO barriers (ar/bw version) used by asm-generic code to
override the arm64 specific variants.

Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Sai Prakash Ranjan <quic_saipraka@quicinc.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm64/include/asm/io.h | 41 ++++++++-----------------------------
 1 file changed, 8 insertions(+), 33 deletions(-)

diff --git a/arch/arm64/include/asm/io.h b/arch/arm64/include/asm/io.h
index 7fd836bea7eb..1b436810d779 100644
--- a/arch/arm64/include/asm/io.h
+++ b/arch/arm64/include/asm/io.h
@@ -91,7 +91,7 @@ static inline u64 __raw_readq(const volatile void __iomem *addr)
 }
 
 /* IO barriers */
-#define __iormb(v)							\
+#define __io_ar(v)							\
 ({									\
 	unsigned long tmp;						\
 									\
@@ -108,39 +108,14 @@ static inline u64 __raw_readq(const volatile void __iomem *addr)
 		     : "memory");					\
 })
 
-#define __io_par(v)		__iormb(v)
-#define __iowmb()		dma_wmb()
-#define __iomb()		dma_mb()
-
-/*
- * Relaxed I/O memory access primitives. These follow the Device memory
- * ordering rules but do not guarantee any ordering relative to Normal memory
- * accesses.
- */
-#define readb_relaxed(c)	({ u8  __r = __raw_readb(c); __r; })
-#define readw_relaxed(c)	({ u16 __r = le16_to_cpu((__force __le16)__raw_readw(c)); __r; })
-#define readl_relaxed(c)	({ u32 __r = le32_to_cpu((__force __le32)__raw_readl(c)); __r; })
-#define readq_relaxed(c)	({ u64 __r = le64_to_cpu((__force __le64)__raw_readq(c)); __r; })
+#define __io_bw()		dma_wmb()
+#define __io_br(v)
+#define __io_aw(v)
 
-#define writeb_relaxed(v,c)	((void)__raw_writeb((v),(c)))
-#define writew_relaxed(v,c)	((void)__raw_writew((__force u16)cpu_to_le16(v),(c)))
-#define writel_relaxed(v,c)	((void)__raw_writel((__force u32)cpu_to_le32(v),(c)))
-#define writeq_relaxed(v,c)	((void)__raw_writeq((__force u64)cpu_to_le64(v),(c)))
-
-/*
- * I/O memory access primitives. Reads are ordered relative to any
- * following Normal memory access. Writes are ordered relative to any prior
- * Normal memory access.
- */
-#define readb(c)		({ u8  __v = readb_relaxed(c); __iormb(__v); __v; })
-#define readw(c)		({ u16 __v = readw_relaxed(c); __iormb(__v); __v; })
-#define readl(c)		({ u32 __v = readl_relaxed(c); __iormb(__v); __v; })
-#define readq(c)		({ u64 __v = readq_relaxed(c); __iormb(__v); __v; })
-
-#define writeb(v,c)		({ __iowmb(); writeb_relaxed((v),(c)); })
-#define writew(v,c)		({ __iowmb(); writew_relaxed((v),(c)); })
-#define writel(v,c)		({ __iowmb(); writel_relaxed((v),(c)); })
-#define writeq(v,c)		({ __iowmb(); writeq_relaxed((v),(c)); })
+/* arm64-specific, don't use in portable drivers */
+#define __iormb(v)		__io_ar(v)
+#define __iowmb()		__io_bw()
+#define __iomb()		dma_mb()
 
 /*
  *  I/O port access primitives.
-- 
2.33.1


  reply	other threads:[~2022-05-04 11:29 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-04 11:28 [PATCHv14 0/9] lib/rwmmio/arm64: Add support to trace register reads/writes Sai Prakash Ranjan
2022-05-04 11:28 ` Sai Prakash Ranjan [this message]
2022-05-04 11:28 ` [PATCHv14 2/9] coresight: etm4x: Use asm-generic IO memory barriers Sai Prakash Ranjan
2022-05-05 23:44   ` Suzuki K Poulose
2022-05-06  3:02     ` Sai Prakash Ranjan
2022-05-06  9:21       ` Suzuki K Poulose
2022-05-06 13:22         ` Sai Prakash Ranjan
2022-05-04 11:28 ` [PATCHv14 3/9] irqchip/tegra: Fix overflow implicit truncation warnings Sai Prakash Ranjan
2022-05-04 11:28 ` [PATCHv14 4/9] drm/meson: " Sai Prakash Ranjan
2022-05-04 11:28 ` [PATCHv14 5/9] lib: Add register read/write tracing support Sai Prakash Ranjan
2022-05-11  3:51   ` Sai Prakash Ranjan
2022-05-17  6:41     ` Sai Prakash Ranjan
2022-05-18 14:07   ` Steven Rostedt
2022-05-18 15:18     ` Sai Prakash Ranjan
2022-05-18 16:45       ` Sai Prakash Ranjan
2022-05-04 11:28 ` [PATCHv14 6/9] KVM: arm64: Add a flag to disable MMIO trace for nVHE KVM Sai Prakash Ranjan
2022-05-04 11:28 ` [PATCHv14 7/9] asm-generic/io: Add logging support for MMIO accessors Sai Prakash Ranjan
2022-05-04 11:28 ` [PATCHv14 8/9] serial: qcom_geni_serial: Disable MMIO tracing for geni serial Sai Prakash Ranjan
2022-05-04 11:28 ` [PATCHv14 9/9] soc: qcom: geni: Disable MMIO tracing for GENI SE Sai Prakash Ranjan
2022-05-04 11:32 ` [PATCHv14 0/9] lib/rwmmio/arm64: Add support to trace register reads/writes Sai Prakash Ranjan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fb38e469c238428d1a3ff554d6bf8edfe6ff7ecf.1651663123.git.quic_saipraka@quicinc.com \
    --to=quic_saipraka@quicinc.com \
    --cc=arnd@arndb.de \
    --cc=catalin.marinas@arm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=quic_psodagud@quicinc.com \
    --cc=quic_tsoni@quicinc.com \
    --cc=rostedt@goodmis.org \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).