--- v2
+++ v3
@@ -3,23 +3,32 @@
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
---
+Changelog[v3]
+ - Rename winctx->pid to winctx->pidr to reflect that its a value
+ from the PID register (SPRN_PID), not the linux process id.
+ - Make it easier to split header into kernel/user parts
+ - To keep user interface simple, use macros rather than enum for
+ the threshold-control modes.
+ - Add a pid field to struct vas_window - needed for user space
+ send windows.
+
Changelog[v2]
- Add an overview of VAS in vas-internal.h
- Get window context parameters from device tree and drop
unnecessary macros.
---
MAINTAINERS | 6 +
- arch/powerpc/include/asm/vas.h | 40 +++++
- drivers/misc/vas/vas-internal.h | 383 ++++++++++++++++++++++++++++++++++++++++
- 3 files changed, 429 insertions(+)
+ arch/powerpc/include/asm/vas.h | 43 +++++
+ drivers/misc/vas/vas-internal.h | 392 ++++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 441 insertions(+)
create mode 100644 arch/powerpc/include/asm/vas.h
create mode 100644 drivers/misc/vas/vas-internal.h
diff --git a/MAINTAINERS b/MAINTAINERS
-index 63cefa6..54f015c 100644
+index c265a5f..2a910c9 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
-@@ -12739,6 +12739,12 @@ S: Maintained
+@@ -13213,6 +13213,12 @@ S: Maintained
F: Documentation/fb/uvesafb.txt
F: drivers/video/fbdev/uvesafb.*
@@ -34,10 +43,10 @@
L: linux-mtd@lists.infradead.org
diff --git a/arch/powerpc/include/asm/vas.h b/arch/powerpc/include/asm/vas.h
new file mode 100644
-index 0000000..1c10437
+index 0000000..6d35ce6
--- /dev/null
+++ b/arch/powerpc/include/asm/vas.h
-@@ -0,0 +1,40 @@
+@@ -0,0 +1,43 @@
+/*
+ * Copyright 2016 IBM Corp.
+ *
@@ -49,6 +58,20 @@
+
+#ifndef VAS_H
+#define VAS_H
++
++/*
++ * Threshold Control Mode: Have paste operation fail if the number of
++ * requests in receive FIFO exceeds a threshold.
++ *
++ * NOTE: No special error code yet if paste is rejected because of these
++ * limits. So users can't distinguish between this and other errors.
++ */
++#define VAS_THRESH_DISABLED 0
++#define VAS_THRESH_FIFO_GT_HALF_FULL 1
++#define VAS_THRESH_FIFO_GT_QTR_FULL 2
++#define VAS_THRESH_FIFO_GT_EIGHTH_FULL 3
++
++#ifdef __KERNEL__
+
+#define VAS_RX_FIFO_SIZE_MAX (8 << 20) /* 8MB */
+/*
@@ -63,27 +86,16 @@
+ VAS_COP_TYPE_MAX,
+};
+
-+/*
-+ * Threshold Control Mode: Have paste operation fail if the number of
-+ * requests in receive FIFO exceeds a threshold.
-+ *
-+ * NOTE: No special error code yet if paste is rejected because of these
-+ * limits. So users can't distinguish between this and other errors.
-+ */
-+enum vas_thresh_ctl {
-+ VAS_THRESH_DISABLED,
-+ VAS_THRESH_FIFO_GT_HALF_FULL,
-+ VAS_THRESH_FIFO_GT_QTR_FULL,
-+ VAS_THRESH_FIFO_GT_EIGHTH_FULL,
-+};
++
++#endif /* __KERNEL__ */
+
+#endif
diff --git a/drivers/misc/vas/vas-internal.h b/drivers/misc/vas/vas-internal.h
new file mode 100644
-index 0000000..aa4e781
+index 0000000..ce48f14
--- /dev/null
+++ b/drivers/misc/vas/vas-internal.h
-@@ -0,0 +1,383 @@
+@@ -0,0 +1,392 @@
+/*
+ * Copyright 2016 IBM Corp.
+ *
@@ -128,6 +140,7 @@
+ * Each window is described by two types of window contexts:
+ *
+ * Hypervisor Window Context (HVWC) of size VAS_HVWC_SIZE bytes
++ *
+ * OS/User Window Context (UWC) of size VAS_UWC_SIZE bytes.
+ *
+ * A window context can be viewed as a set of 64-bit registers. The settings
@@ -194,10 +207,16 @@
+#define VAS_HVWC_SIZE 512
+#define VAS_UWC_SIZE PAGE_SIZE
+
-+/* Initial per-process credits. We may need to tweak these later */
++/*
++ * Initial per-process credits.
++ * Max send window credits: 4K-1 (12-bits in VAS_TX_WCRED)
++ * Max receive window credits: 64K-1 (16 bits in VAS_LRX_WCRED)
++ *
++ * TODO: Needs tuning for per-process credits
++ */
+#define VAS_WCREDS_MIN 16
-+#define VAS_WCREDS_MAX 64
-+#define VAS_WCREDS_DEFAULT 64
++#define VAS_WCREDS_MAX ((64 << 10) - 1)
++#define VAS_WCREDS_DEFAULT (1 << 10)
+
+/*
+ * VAS Window Context Register Offsets and bitmasks.
@@ -407,6 +426,7 @@
+ void *uwc_map; /* OS/User window context */
+
+ /* Fields applicable only to send windows */
++ pid_t pid; /* linux process id of sender, if applicable */
+ void *paste_kaddr;
+ char *paste_addr_name;
+ struct vas_window *rxwin;
@@ -450,17 +470,18 @@
+ bool notify_os_intr_reg;
+
+ int lpid;
-+ int pid;
++ int pidr; /* value from SPRN_PID, not linux pid */
+ int lnotify_lpid;
+ int lnotify_pid;
+ int lnotify_tid;
+ int pswid;
+ int rx_win_id;
+ int fault_win_id;
++ int tc_mode;
++
+ uint64_t irq_port;
+
+ enum vas_dma_type dma_type;
-+ enum vas_thresh_ctl tc_mode;
+ enum vas_notify_scope min_scope;
+ enum vas_notify_scope max_scope;
+ enum vas_notify_after_count notify_after_count;