All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@linaro.org>
To: Julien Grall <julien.grall@linaro.org>
Cc: Stefano.Stabellini@eu.citrix.com, ian.campbell@citrix.com,
	patches@linaro.org, xen-devel@lists.xen.org
Subject: Re: [PATCH V4 04/32] xen/arm: Add helpers ioreadl/iowritel
Date: Fri, 10 May 2013 17:24:33 +0100	[thread overview]
Message-ID: <518D1F41.4070902@linaro.org> (raw)
In-Reply-To: <1368198723-24639-5-git-send-email-julien.grall@linaro.org>

Signed-off-by: Julien Grall <julien.grall@linaro.org>

Changes in v5:
    - Use functions from linux code
---
 xen/include/asm-arm/arm32/io.h |   46 ++++++++++++++++++++++++++++++++++++++++
 xen/include/asm-arm/arm64/io.h |   38 +++++++++++++++++++++++++++++++++
 xen/include/asm-arm/mm.h       |    8 +++++++
 3 files changed, 92 insertions(+)
 create mode 100644 xen/include/asm-arm/arm32/io.h
 create mode 100644 xen/include/asm-arm/arm64/io.h

diff --git a/xen/include/asm-arm/arm32/io.h b/xen/include/asm-arm/arm32/io.h
new file mode 100644
index 0000000..0d6da1f
--- /dev/null
+++ b/xen/include/asm-arm/arm32/io.h
@@ -0,0 +1,46 @@
+/*
+ *  Based on linux arch/arm/include/asm/io.h
+ *
+ *  Copyright (C) 1996-2000 Russell King
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Modifications:
+ *  16-Sep-1996        RMK     Inlined the inx/outx functions & optimised for both
+ *                     constant addresses and variable addresses.
+ *  04-Dec-1997        RMK     Moved a lot of this stuff to the new architecture
+ *                     specific IO header files.
+ *  27-Mar-1999        PJB     Second parameter of memcpy_toio is const..
+ *  04-Apr-1999        PJB     Added check_signature.
+ *  12-Dec-1999        RMK     More cleanups
+ *  18-Jun-2000 RMK    Removed virt_to_* and friends definitions
+ *  05-Oct-2004 BJD     Moved memory string functions to use void __iomem
+ */
+#ifndef _ARM_ARM32_IO_H
+#define _ARM_ARM32_IO_H
+
+#include <asm/system.h>
+
+static inline uint32_t ioreadl(const volatile void __iomem *addr)
+{
+    uint32_t val;
+
+    asm volatile("ldr %1, %0"
+                 : "+Qo" (*(volatile uint32_t __force *)addr),
+                   "=r" (val));
+    dsb();
+
+    return val;
+}
+
+static inline void iowritel(const volatile void __iomem *addr, uint32_t val)
+{
+    dsb();
+    asm volatile("str %1, %0"
+                 : "+Qo" (*(volatile uint32_t __force *)addr)
+                 : "r" (val));
+}
+
+#endif /* _ARM_ARM32_IO_H */
diff --git a/xen/include/asm-arm/arm64/io.h b/xen/include/asm-arm/arm64/io.h
new file mode 100644
index 0000000..ec041cd
--- /dev/null
+++ b/xen/include/asm-arm/arm64/io.h
@@ -0,0 +1,38 @@
+/*
+ * Based on linux arch/arm64/include/asm/io.h
+ *
+ * Copyright (C) 1996-2000 Russell King
+ * Copyright (C) 2012 ARM Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef _ARM_ARM64_IO_H
+#define _ARM_ARM64_IO_H
+
+static inline uint32_t ioreadl(const volatile void __iomem *addr)
+{
+    uint32_t val;
+
+    asm volatile("ldr %w0, [%1]" : "=r" (val) : "r" (addr));
+    dsb();
+
+    return val;
+}
+
+static inline void iowritel(const volatile void __iomem *addr, uint32_t val)
+{
+    dsb();
+    asm volatile("str %w0, [%1]" : : "r" (val), "r" (addr));
+}
+
+#endif /* _ARM_ARM64_IO_H */
diff --git a/xen/include/asm-arm/mm.h b/xen/include/asm-arm/mm.h
index 63e1069..5e7c5a3 100644
--- a/xen/include/asm-arm/mm.h
+++ b/xen/include/asm-arm/mm.h
@@ -6,6 +6,14 @@
 #include <asm/page.h>
 #include <public/xen.h>
 
+#if defined(CONFIG_ARM_32)
+# include <asm/arm32/io.h>
+#elif defined(CONFIG_ARM_64)
+# include <asm/arm64/io.h>
+#else
+# error "unknown ARM variant"
+#endif
+
 /* Align Xen to a 2 MiB boundary. */
 #define XEN_PADDR_ALIGN (1 << 21)
 
-- 
1.7.10.4

  parent reply	other threads:[~2013-05-10 16:24 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-10 15:11 [PATCH V4 00/32] Support multiple ARM platform in Xen Julien Grall
2013-05-10 15:11 ` [PATCH V4 01/32] xen/arm: Extend create_xen_entries prototype to take mapping attribute Julien Grall
2013-05-13 11:01   ` Ian Campbell
2013-05-10 15:11 ` [PATCH V4 02/32] xen/mm: Align virtual address on PAGE_SIZE in iounmap Julien Grall
2013-05-10 16:16   ` Julien Grall
2013-05-10 16:22   ` Julien Grall
2013-05-13 11:01   ` Ian Campbell
2013-05-13 11:09     ` Jan Beulich
2013-05-13 11:24       ` Ian Campbell
2013-05-10 15:11 ` [PATCH V4 03/32] xen/arm: Introduce ioremap_attr, ioremap_cache, ioremap_nocache, ioremap_wc Julien Grall
2013-05-10 15:24   ` Ian Campbell
2013-05-10 15:11 ` [PATCH V4 04/32] xen/arm: Add helpers ioreadl/iowritel Julien Grall
2013-05-10 15:38   ` Ian Campbell
2013-05-10 16:24   ` Julien Grall [this message]
2013-05-10 15:11 ` [PATCH V4 05/32] xen/arm: Create a hierarchical device tree Julien Grall
2013-05-10 15:38   ` Ian Campbell
2013-05-10 15:11 ` [PATCH V4 19/32] xen/arm: Add generic UART to get the device in the " Julien Grall
2013-05-10 15:11 ` [PATCH V4 20/32] xen/arm: Use device tree API in pl011 UART driver Julien Grall
2013-05-10 15:12 ` [PATCH V4 22/32] xen/arm: Allow Xen to run on multiple platform without recompilation Julien Grall
2013-05-10 15:12 ` [PATCH V4 24/32] xen/arm: Add versatile express platform Julien Grall
2013-05-10 15:39   ` Ian Campbell
2013-05-10 15:12 ` [PATCH V4 28/32] xen/arm: Add Exynos 4210 UART support Julien Grall
2013-05-10 15:12 ` [PATCH V4 30/32] xen/arm: Add platform specific code for the exynos5 Julien Grall
2013-05-13 11:21 ` [PATCH V4 00/32] Support multiple ARM platform in Xen Ian Campbell
2013-05-13 12:09   ` Julien Grall

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=518D1F41.4070902@linaro.org \
    --to=julien.grall@linaro.org \
    --cc=Stefano.Stabellini@eu.citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=patches@linaro.org \
    --cc=xen-devel@lists.xen.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.