--- v8
+++ v7
@@ -5,9 +5,6 @@
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
---
-Changelog [v8]:
- Minor cleanup of error/debug messages
-
Changelog [v6]:
- Minor reorg to make setup/cleanup functions more symmetric
@@ -24,19 +21,15 @@
- Get HVWC, UWC and paste addresses from window->vinst (i.e DT)
rather than kernel macros.
---
- arch/powerpc/platforms/powernv/vas-window.c | 174 ++++++++++++++++++++++++++++
- 1 file changed, 174 insertions(+)
+ arch/powerpc/platforms/powernv/vas-window.c | 173 ++++++++++++++++++++++++++++
+ 1 file changed, 173 insertions(+)
diff --git a/arch/powerpc/platforms/powernv/vas-window.c b/arch/powerpc/platforms/powernv/vas-window.c
-index de21acb..642814a2 100644
+index 6156fbe..a3a705a 100644
--- a/arch/powerpc/platforms/powernv/vas-window.c
+++ b/arch/powerpc/platforms/powernv/vas-window.c
-@@ -7,11 +7,185 @@
- * 2 of the License, or (at your option) any later version.
- */
+@@ -9,9 +9,182 @@
-+#define pr_fmt(fmt) "vas: " fmt
-+
#include <linux/types.h>
#include <linux/mutex.h>
+#include <linux/slab.h>
@@ -48,10 +41,10 @@
+ * Compute the paste address region for the window @window using the
+ * ->paste_base_addr and ->paste_win_id_shift we got from device tree.
+ */
-+static void compute_paste_address(struct vas_window *window, u64 *addr, int *len)
-+{
++void compute_paste_address(struct vas_window *window, uint64_t *addr, int *len)
++{
++ uint64_t base, shift;
+ int winid;
-+ u64 base, shift;
+
+ base = window->vinst->paste_base_addr;
+ shift = window->vinst->paste_win_id_shift;
@@ -65,9 +58,9 @@
+}
+
+static inline void get_hvwc_mmio_bar(struct vas_window *window,
-+ u64 *start, int *len)
-+{
-+ u64 pbaddr;
++ uint64_t *start, int *len)
++{
++ uint64_t pbaddr;
+
+ pbaddr = window->vinst->hvwc_bar_start;
+ *start = pbaddr + window->winid * VAS_HVWC_SIZE;
@@ -75,9 +68,9 @@
+}
+
+static inline void get_uwc_mmio_bar(struct vas_window *window,
-+ u64 *start, int *len)
-+{
-+ u64 pbaddr;
++ uint64_t *start, int *len)
++{
++ uint64_t pbaddr;
+
+ pbaddr = window->vinst->uwc_bar_start;
+ *start = pbaddr + window->winid * VAS_UWC_SIZE;
@@ -91,15 +84,16 @@
+ */
+void *map_paste_region(struct vas_window *txwin)
+{
-+ int len;
++ int rc, len;
+ void *map;
+ char *name;
-+ u64 start;
-+
++ uint64_t start;
++
++ rc = -ENOMEM;
+ name = kasprintf(GFP_KERNEL, "window-v%d-w%d", txwin->vinst->vas_id,
+ txwin->winid);
+ if (!name)
-+ goto free_name;
++ return ERR_PTR(rc);
+
+ txwin->paste_addr_name = name;
+ compute_paste_address(txwin, &start, &len);
@@ -117,16 +111,16 @@
+ goto free_name;
+ }
+
-+ pr_devel("Mapped paste addr 0x%llx to kaddr 0x%p\n", start, map);
++ pr_devel("VAS: mapped paste addr 0x%llx to kaddr 0x%p\n", start, map);
+ return map;
+
+free_name:
+ kfree(name);
-+ return ERR_PTR(-ENOMEM);
-+}
-+
-+
-+static void *map_mmio_region(char *name, u64 start, int len)
++ return ERR_PTR(rc);
++}
++
++
++static void *map_mmio_region(char *name, uint64_t start, int len)
+{
+ void *map;
+
@@ -146,7 +140,7 @@
+ return map;
+}
+
-+static void unmap_region(void *addr, u64 start, int len)
++static void unmap_region(void *addr, uint64_t start, int len)
+{
+ iounmap(addr);
+ release_mem_region((phys_addr_t)start, len);
@@ -158,7 +152,7 @@
+void unmap_paste_region(struct vas_window *window)
+{
+ int len;
-+ u64 busaddr_start;
++ uint64_t busaddr_start;
+
+ if (window->paste_kaddr) {
+ compute_paste_address(window, &busaddr_start, &len);
@@ -175,7 +169,7 @@
+static void unmap_winctx_mmio_bars(struct vas_window *window)
+{
+ int len;
-+ u64 busaddr_start;
++ uint64_t busaddr_start;
+
+ if (window->hvwc_map) {
+ get_hvwc_mmio_bar(window, &busaddr_start, &len);
@@ -198,7 +192,7 @@
+int map_winctx_mmio_bars(struct vas_window *window)
+{
+ int len;
-+ u64 start;
++ uint64_t start;
+
+ get_hvwc_mmio_bar(window, &start, &len);
+ window->hvwc_map = map_mmio_region("HVWCM_Window", start, len);