--- v3
+++ v5
@@ -6,24 +6,27 @@
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
---
+Changelog[v4]
+ - Export symbols
Changelog[v3]
- Map raw CR value from paste instruction into an error code.
---
- arch/powerpc/include/asm/vas.h | 13 ++++++++
- drivers/misc/vas/copy-paste.h | 74 +++++++++++++++++++++++++++++++++++++++++
- drivers/misc/vas/vas-internal.h | 14 ++++++++
- drivers/misc/vas/vas-window.c | 50 ++++++++++++++++++++++++++++
- 4 files changed, 151 insertions(+)
- create mode 100644 drivers/misc/vas/copy-paste.h
+ arch/powerpc/include/asm/vas.h | 13 +++++
+ arch/powerpc/platforms/powernv/copy-paste.h | 74 +++++++++++++++++++++++++++++
+ arch/powerpc/platforms/powernv/vas-window.c | 52 ++++++++++++++++++++
+ arch/powerpc/platforms/powernv/vas.h | 14 ++++++
+ 4 files changed, 153 insertions(+)
+ create mode 100644 arch/powerpc/platforms/powernv/copy-paste.h
diff --git a/arch/powerpc/include/asm/vas.h b/arch/powerpc/include/asm/vas.h
-index ff8da98..1ef81ed 100644
+index 944bb4b..4e5a470 100644
--- a/arch/powerpc/include/asm/vas.h
+++ b/arch/powerpc/include/asm/vas.h
-@@ -132,6 +132,19 @@ struct vas_window *vas_tx_win_open(int vasid, enum vas_cop_type cop,
+@@ -125,4 +125,17 @@ struct vas_window *vas_tx_win_open(int vasid, enum vas_cop_type cop,
+ */
int vas_win_close(struct vas_window *win);
- /*
++/*
+ * Copy the co-processor request block (CRB) @crb into the local L2 cache.
+ * For now, @offset must be 0 and @first must be true.
+ */
@@ -36,15 +39,12 @@
+ */
+extern int vas_paste_crb(struct vas_window *win, int off, bool last, bool re);
+
-+/*
- * Get/Set bit fields
- */
- #define GET_FIELD(m, v) (((v) & (m)) >> MASK_LSH(m))
-diff --git a/drivers/misc/vas/copy-paste.h b/drivers/misc/vas/copy-paste.h
+ #endif /* _MISC_VAS_H */
+diff --git a/arch/powerpc/platforms/powernv/copy-paste.h b/arch/powerpc/platforms/powernv/copy-paste.h
new file mode 100644
index 0000000..7783bb8
--- /dev/null
-+++ b/drivers/misc/vas/copy-paste.h
++++ b/arch/powerpc/platforms/powernv/copy-paste.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2016 IBM Corp.
@@ -120,52 +120,30 @@
+
+ return cr;
+}
-diff --git a/drivers/misc/vas/vas-internal.h b/drivers/misc/vas/vas-internal.h
-index 1e5c94b..54e2a31 100644
---- a/drivers/misc/vas/vas-internal.h
-+++ b/drivers/misc/vas/vas-internal.h
-@@ -456,4 +456,18 @@ static inline uint64_t read_hvwc_reg(struct vas_window *win,
- return in_be64(win->hvwc_map+reg);
+diff --git a/arch/powerpc/platforms/powernv/vas-window.c b/arch/powerpc/platforms/powernv/vas-window.c
+index 4a4fd68..06e9c39 100644
+--- a/arch/powerpc/platforms/powernv/vas-window.c
++++ b/arch/powerpc/platforms/powernv/vas-window.c
+@@ -14,6 +14,7 @@
+ #include <linux/log2.h>
+
+ #include "vas.h"
++#include "copy-paste.h"
+
+ static int fault_winid;
+
+@@ -901,6 +902,57 @@ struct vas_window *vas_tx_win_open(int vasid, enum vas_cop_type cop,
}
-
-+#ifdef vas_debug
-+
-+static void print_fifo_msg_count(struct vas_window *txwin)
-+{
-+ uint64_t read_hvwc_reg(struct vas_window *w, char *n, uint64_t o);
-+ pr_devel("Winid %d, Msg count %llu\n", txwin->winid,
-+ (uint64_t)read_hvwc_reg(txwin, VREG(LRFIFO_PUSH)));
-+}
-+#else /* vas_debug */
-+
-+#define print_fifo_msg_count(window)
-+
-+#endif /* vas_debug */
-+
- #endif
-diff --git a/drivers/misc/vas/vas-window.c b/drivers/misc/vas/vas-window.c
-index 9caf10b..fa2dd72 100644
---- a/drivers/misc/vas/vas-window.c
-+++ b/drivers/misc/vas/vas-window.c
-@@ -13,6 +13,7 @@
- #include <linux/io.h>
- #include <asm/vas.h>
- #include "vas-internal.h"
-+#include "copy-paste.h"
-
- static int fault_winid;
-
-@@ -913,6 +914,55 @@ struct vas_window *vas_tx_win_open(int vasid, enum vas_cop_type cop,
-
- }
+ EXPORT_SYMBOL_GPL(vas_tx_win_open);
+int vas_copy_crb(void *crb, int offset, bool first)
+{
-+ if (!vas_initialized)
++ if (!vas_initialized())
+ return -1;
+
+ return vas_copy(crb, offset, first);
+}
++EXPORT_SYMBOL_GPL(vas_copy_crb);
+
+#define RMA_LSMP_REPORT_ENABLE PPC_BIT(53)
+int vas_paste_crb(struct vas_window *txwin, int offset, bool last, bool re)
@@ -174,7 +152,7 @@
+ uint64_t val;
+ void *addr;
+
-+ if (!vas_initialized)
++ if (!vas_initialized())
+ return -1;
+ /*
+ * Only NX windows are supported for now and hardware assumes
@@ -207,9 +185,33 @@
+
+ return rc;
+}
++EXPORT_SYMBOL_GPL(vas_paste_crb);
+
static void poll_window_busy_state(struct vas_window *window)
{
int busy;
+diff --git a/arch/powerpc/platforms/powernv/vas.h b/arch/powerpc/platforms/powernv/vas.h
+index 291a08e..bcede85 100644
+--- a/arch/powerpc/platforms/powernv/vas.h
++++ b/arch/powerpc/platforms/powernv/vas.h
+@@ -448,4 +448,18 @@ static inline uint64_t read_hvwc_reg(struct vas_window *win,
+ return in_be64(win->hvwc_map+reg);
+ }
+
++#ifdef vas_debug
++
++static void print_fifo_msg_count(struct vas_window *txwin)
++{
++ uint64_t read_hvwc_reg(struct vas_window *w, char *n, uint64_t o);
++ pr_devel("Winid %d, Msg count %llu\n", txwin->winid,
++ (uint64_t)read_hvwc_reg(txwin, VREG(LRFIFO_PUSH)));
++}
++#else /* vas_debug */
++
++#define print_fifo_msg_count(window)
++
++#endif /* vas_debug */
++
+ #endif /* _VAS_H */
--
2.7.4