linux-mips
[Top] [All Lists]

[PATCH 1/2] MIPS: asm: asm-eva: Introduce kernel load/store variants

To: <linux-mips@linux-mips.org>
Subject: [PATCH 1/2] MIPS: asm: asm-eva: Introduce kernel load/store variants
From: Markos Chandras <markos.chandras@imgtec.com>
Date: Mon, 23 Feb 2015 08:21:35 +0000
Cc: Markos Chandras <markos.chandras@imgtec.com>, <stable@vger.kernel.org>
In-reply-to: <1424679696-19696-1-git-send-email-markos.chandras@imgtec.com>
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <1424679696-19696-1-git-send-email-markos.chandras@imgtec.com>
Sender: linux-mips-bounce@linux-mips.org
Introduce new macros for kernel load/store variants which will be
used to perform regular kernel space load/store operations in EVA
mode.

Cc: <stable@vger.kernel.org> # v3.15+
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
---
 arch/mips/include/asm/asm-eva.h | 137 +++++++++++++++++++++++++++-------------
 1 file changed, 93 insertions(+), 44 deletions(-)

diff --git a/arch/mips/include/asm/asm-eva.h b/arch/mips/include/asm/asm-eva.h
index e41c56e375b1..1e38f0e1ea3e 100644
--- a/arch/mips/include/asm/asm-eva.h
+++ b/arch/mips/include/asm/asm-eva.h
@@ -11,6 +11,36 @@
 #define __ASM_ASM_EVA_H
 
 #ifndef __ASSEMBLY__
+
+/* Kernel variants */
+
+#define kernel_cache(op, base)         "cache " op ", " base "\n"
+#define kernel_ll(reg, addr)           "ll " reg ", " addr "\n"
+#define kernel_sc(reg, addr)           "sc " reg ", " addr "\n"
+#define kernel_lw(reg, addr)           "lw " reg ", " addr "\n"
+#define kernel_lwl(reg, addr)          "lwl " reg ", " addr "\n"
+#define kernel_lwr(reg, addr)          "lwr " reg ", " addr "\n"
+#define kernel_lh(reg, addr)           "lh " reg ", " addr "\n"
+#define kernel_lb(reg, addr)           "lb " reg ", " addr "\n"
+#define kernel_lbu(reg, addr)          "lbu " reg ", " addr "\n"
+#define kernel_sw(reg, addr)           "sw " reg ", " addr "\n"
+#define kernel_swl(reg, addr)          "swl " reg ", " addr "\n"
+#define kernel_swr(reg, addr)          "swr " reg ", " addr "\n"
+#define kernel_sh(reg, addr)           "sh " reg ", " addr "\n"
+#define kernel_sb(reg, addr)           "sb " reg ", " addr "\n"
+
+#ifdef CONFIG_32BIT
+/*
+ * No 'sd' or 'ld' instructions in 32-bit but the code will
+ * do the correct thing
+ */
+#define kernel_sd(reg, addr)           user_sw(reg, addr)
+#define kernel_ld(reg, addr)           user_lw(reg, addr)
+#else
+#define kernel_sd(reg, addr)           "sd " reg", " addr "\n"
+#define kernel_ld(reg, addr)           "ld " reg", " addr "\n"
+#endif /* CONFIG_32BIT */
+
 #ifdef CONFIG_EVA
 
 #define __BUILD_EVA_INSN(insn, reg, addr)                              \
@@ -41,37 +71,60 @@
 
 #else
 
-#define user_cache(op, base)           "cache " op ", " base "\n"
-#define user_ll(reg, addr)             "ll " reg ", " addr "\n"
-#define user_sc(reg, addr)             "sc " reg ", " addr "\n"
-#define user_lw(reg, addr)             "lw " reg ", " addr "\n"
-#define user_lwl(reg, addr)            "lwl " reg ", " addr "\n"
-#define user_lwr(reg, addr)            "lwr " reg ", " addr "\n"
-#define user_lh(reg, addr)             "lh " reg ", " addr "\n"
-#define user_lb(reg, addr)             "lb " reg ", " addr "\n"
-#define user_lbu(reg, addr)            "lbu " reg ", " addr "\n"
-#define user_sw(reg, addr)             "sw " reg ", " addr "\n"
-#define user_swl(reg, addr)            "swl " reg ", " addr "\n"
-#define user_swr(reg, addr)            "swr " reg ", " addr "\n"
-#define user_sh(reg, addr)             "sh " reg ", " addr "\n"
-#define user_sb(reg, addr)             "sb " reg ", " addr "\n"
+#define user_cache(op, base)           kernel_cache(op, base)
+#define user_ll(reg, addr)             kernel_ll(reg, addr)
+#define user_sc(reg, addr)             kernel_sc(reg, addr)
+#define user_lw(reg, addr)             kernel_lw(reg, addr)
+#define user_lwl(reg, addr)            kernel_lwl(reg, addr)
+#define user_lwr(reg, addr)            kernel_lwr(reg, addr)
+#define user_lh(reg, addr)             kernel_lh(reg, addr)
+#define user_lb(reg, addr)             kernel_lb(reg, addr)
+#define user_lbu(reg, addr)            kernel_lbu(reg, addr)
+#define user_sw(reg, addr)             kernel_sw(reg, addr)
+#define user_swl(reg, addr)            kernel_swl(reg, addr)
+#define user_swr(reg, addr)            kernel_swr(reg, addr)
+#define user_sh(reg, addr)             kernel_sh(reg, addr)
+#define user_sb(reg, addr)             kernel_sb(reg, addr)
 
 #ifdef CONFIG_32BIT
-/*
- * No 'sd' or 'ld' instructions in 32-bit but the code will
- * do the correct thing
- */
-#define user_sd(reg, addr)             user_sw(reg, addr)
-#define user_ld(reg, addr)             user_lw(reg, addr)
+#define user_sd(reg, addr)             kernel_sw(reg, addr)
+#define user_ld(reg, addr)             kernel_lw(reg, addr)
 #else
-#define user_sd(reg, addr)             "sd " reg", " addr "\n"
-#define user_ld(reg, addr)             "ld " reg", " addr "\n"
+#define user_sd(reg, addr)             kernel_sd(reg, addr)
+#define user_ld(reg, addr)             kernel_ld(reg, addr)
 #endif /* CONFIG_32BIT */
 
 #endif /* CONFIG_EVA */
 
 #else /* __ASSEMBLY__ */
 
+#define kernel_cache(op, base)         cache op, base
+#define kernel_ll(reg, addr)           ll reg, addr
+#define kernel_sc(reg, addr)           sc reg, addr
+#define kernel_lw(reg, addr)           lw reg, addr
+#define kernel_lwl(reg, addr)          lwl reg, addr
+#define kernel_lwr(reg, addr)          lwr reg, addr
+#define kernel_lh(reg, addr)           lh reg, addr
+#define kernel_lb(reg, addr)           lb reg, addr
+#define kernel_lbu(reg, addr)          lbu reg, addr
+#define kernel_sw(reg, addr)           sw reg, addr
+#define kernel_swl(reg, addr)          swl reg, addr
+#define kernel_swr(reg, addr)          swr reg, addr
+#define kernel_sh(reg, addr)           sh reg, addr
+#define kernel_sb(reg, addr)           sb reg, addr
+
+#ifdef CONFIG_32BIT
+/*
+ * No 'sd' or 'ld' instructions in 32-bit but the code will
+ * do the correct thing
+ */
+#define kernel_sd(reg, addr)           user_sw(reg, addr)
+#define kernel_ld(reg, addr)           user_lw(reg, addr)
+#else
+#define kernel_sd(reg, addr)           sd reg, addr
+#define kernel_ld(reg, addr)           ld reg, addr
+#endif /* CONFIG_32BIT */
+
 #ifdef CONFIG_EVA
 
 #define __BUILD_EVA_INSN(insn, reg, addr)                      \
@@ -101,31 +154,27 @@
 #define user_sd(reg, addr)             user_sw(reg, addr)
 #else
 
-#define user_cache(op, base)           cache op, base
-#define user_ll(reg, addr)             ll reg, addr
-#define user_sc(reg, addr)             sc reg, addr
-#define user_lw(reg, addr)             lw reg, addr
-#define user_lwl(reg, addr)            lwl reg, addr
-#define user_lwr(reg, addr)            lwr reg, addr
-#define user_lh(reg, addr)             lh reg, addr
-#define user_lb(reg, addr)             lb reg, addr
-#define user_lbu(reg, addr)            lbu reg, addr
-#define user_sw(reg, addr)             sw reg, addr
-#define user_swl(reg, addr)            swl reg, addr
-#define user_swr(reg, addr)            swr reg, addr
-#define user_sh(reg, addr)             sh reg, addr
-#define user_sb(reg, addr)             sb reg, addr
+#define user_cache(op, base)           kernel_cache(op, base)
+#define user_ll(reg, addr)             kernel_ll(reg, addr)
+#define user_sc(reg, addr)             kernel_sc(reg, addr)
+#define user_lw(reg, addr)             kernel_lw(reg, addr)
+#define user_lwl(reg, addr)            kernel_lwl(reg, addr)
+#define user_lwr(reg, addr)            kernel_lwr(reg, addr)
+#define user_lh(reg, addr)             kernel_lh(reg, addr)
+#define user_lb(reg, addr)             kernel_lb(reg, addr)
+#define user_lbu(reg, addr)            kernel_lbu(reg, addr)
+#define user_sw(reg, addr)             kernel_sw(reg, addr)
+#define user_swl(reg, addr)            kernel_swl(reg, addr)
+#define user_swr(reg, addr)            kernel_swr(reg, addr)
+#define user_sh(reg, addr)             kernel_sh(reg, addr)
+#define user_sb(reg, addr)             kernel_sb(reg, addr)
 
 #ifdef CONFIG_32BIT
-/*
- * No 'sd' or 'ld' instructions in 32-bit but the code will
- * do the correct thing
- */
-#define user_sd(reg, addr)             user_sw(reg, addr)
-#define user_ld(reg, addr)             user_lw(reg, addr)
+#define user_sd(reg, addr)             kernel_sw(reg, addr)
+#define user_ld(reg, addr)             kernel_lw(reg, addr)
 #else
-#define user_sd(reg, addr)             sd reg, addr
-#define user_ld(reg, addr)             ld reg, addr
+#define user_sd(reg, addr)             kernel_sd(reg, addr)
+#define user_ld(reg, addr)             kernel_sd(reg, addr)
 #endif /* CONFIG_32BIT */
 
 #endif /* CONFIG_EVA */
-- 
2.3.0


<Prev in Thread] Current Thread [Next in Thread>