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