]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
sparc64: Add DAX hypervisor services
authorAllen Pais <allen.pais@oracle.com>
Fri, 5 May 2017 05:51:32 +0000 (11:21 +0530)
committerChuck Anderson <chuck.anderson@oracle.com>
Fri, 5 May 2017 16:35:31 +0000 (09:35 -0700)
This provides the HV API for coprocessor services which
is needed to support a device driver for the DAX.

Orabug: 25996411

Reviewed-by: Bob Picco <bob.picco@oracle.com>
Signed-off-by: Sanath Kumar <sanath.s.kumar@oracle.com>
Signed-off-by: Rob Gardner <rob.gardner@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
arch/sparc/include/asm/hypervisor.h
arch/sparc/kernel/hvapi.c
arch/sparc/kernel/hvcalls.S
arch/sparc/kernel/sparc_ksyms_64.c

index b77770d1f2928c170ef5f43b988f9ea33f7b8c76..795aabb23f6ef9ac514bc5bc1beebe7edfd478c4 100644 (file)
@@ -936,6 +936,89 @@ extern unsigned long sun4v_mmu_unmap_perm_addr(unsigned long vaddr,
  */
 #define HV_FAST_MEM_SYNC               0x32
 
+/* Coprocessor services
+ *
+ * M7 and later processors provide an on-chip coprocessor which
+ * accelerates database operations, and is known internally as
+ * DAX.
+ */
+
+/* dax_ccb_submit()
+ * TRAP:       HV_FAST_TRAP
+ * FUNCTION:   HV_DAX_CCB_SUBMIT
+ * ARG0:        address of CCB array
+ * ARG1:        size (in bytes) of CCB array being submitted
+ * ARG2:        flags
+ * ARG3:        virtual queue token
+ * RET0:       status (success or error code)
+ * RET1         size (in bytes) of CCB array that was accepted (might be less than arg1)
+ * RET2         Identifies the VA in question when status is ENOMAP or ENOACCESS
+ * RET3         (if using virtual message queues) new virtual queue token
+ *
+ * ERRORS:     EWOULDBLOCK etc
+ *             ENOTSUPPORTED   etc
+ *
+ * Details.
+ */
+
+#define HV_DAX_CCB_SUBMIT               0x34
+#ifndef __ASSEMBLY__
+unsigned long sun4v_dax_ccb_submit(void *ccb, int len, long flags, long vq_token, long *submitted_len, long *error_va);
+#endif
+/* flags (ARG2) */
+#define HV_DAX_MESSAGE_CMD         (0)
+#define HV_DAX_VIRTUAL_MESSAGE_CMD (1)
+#define HV_DAX_QUERY_CMD           (2)
+#define HV_DAX_ARG0_TYPE_REAL      (0 << 4)
+#define HV_DAX_ARG0_TYPE_PRIMARY   (1 << 4)
+#define HV_DAX_ARG0_TYPE_SECONDARY (2 << 4)
+#define HV_DAX_ARG0_TYPE_NUCLEUS   (3 << 4)
+#define HV_DAX_ARG0_PRIVILEGED     (1 << 6)
+#define HV_DAX_ALL_OR_NOTHING      (1 << 7)
+#define HV_DAX_CCB_VA_REJECT       (0 << 12)
+#define HV_DAX_CCB_VA_SECONDARY    (2 << 12)
+#define HV_DAX_CCB_VA_NUCLEUS      (3 << 12)
+#define HV_DAX_CCB_VA_PRIVILEGED   (1 << 14)
+
+/* dax_ccb_info()
+ * TRAP:       HV_FAST_TRAP
+ * FUNCTION:   HV_DAX_CCB_INFO
+ * ARG0:        real address of CCB completion area
+ * RET0:       status (success or error code)
+ * RET1         CCB state
+ * RET2         queue position
+ *
+ * ERRORS:     EWOULDBLOCK etc
+ *             ENOTSUPPORTED   etc
+ *
+ * Details.
+ */
+
+#define HV_DAX_CCB_INFO                 0x35
+#define HV_DAX_STATE_COMPLETED      0
+#define HV_DAX_STATE_PENDING        1
+#define HV_DAX_STATE_INPROGRESS     2
+#define HV_DAX_STATE_NOTFOUND       3
+
+/* dax_ccb_kill()
+ * TRAP:       HV_FAST_TRAP
+ * FUNCTION:   HV_DAX_CCB_KILL
+ * ARG0:        real address of CCB completion area
+ * RET0:       status (success or error code)
+ * RET1         CCB kill status
+ *
+ * ERRORS:     EWOULDBLOCK etc
+ *             ENOTSUPPORTED   etc
+ *
+ * Details.
+ */
+
+#define HV_DAX_CCB_KILL                 0x36
+#define HV_DAX_KILL_COMPLETED       0
+#define HV_DAX_KILL_DEQUEUED        1
+#define HV_DAX_KILL_KILLED          2
+#define HV_DAX_KILL_NOTFOUND        3
+
 /* Time of day services.
  *
  * The hypervisor maintains the time of day on a per-domain basis.
@@ -3689,6 +3772,7 @@ struct hv_pci_priq_intx_info {
 #define HV_GRP_SDIO                    0x0108
 #define HV_GRP_SDIO_ERR                        0x0109
 #define HV_GRP_REBOOT_DATA             0x0110
+#define HV_GRP_M7_DAX                  0x0113
 #define HV_GRP_M7_PERF                 0x0114
 #define        HV_GRP_PRIQ                     0x011b
 #define        HV_GRP_PRIQ_PCI                 0x011c
index 18e59ecca0f20375293e7422be3e2f2a0d33c395..6f07c609e457f390a6d4757297585b214d0411ed 100644 (file)
@@ -39,6 +39,7 @@ static struct api_info api_table[] = {
        { .group = HV_GRP_SDIO,                                 },
        { .group = HV_GRP_SDIO_ERR,                             },
        { .group = HV_GRP_REBOOT_DATA,                          },
+       { .group = HV_GRP_M7_DAX,                               },
        { .group = HV_GRP_PRIQ,                                 },
        { .group = HV_GRP_PRIQ_PCI,                             },
        { .group = HV_GRP_NIAG_PERF,    .flags = FLAG_PRE_API   },
index 775aaa4365ffc74bad3a4ed1be904334a3008f1b..cbf9cc0024195c4a3596c24be459ebec113804d3 100644 (file)
@@ -216,6 +216,26 @@ ENTRY(sun4v_set_version)
         stx    %o1, [%o4]
 ENDPROC(sun4v_set_version)
 
+       /* %o0: address of CCB array
+        * %o1: size (in bytes) of CCB array
+        * %o2: flags
+        * %o3: virtual queue token
+        *
+        * returns:
+        * %o0: status
+        * %o1: size (in bytes) of the CCB array that was accepted
+        * %o2: error address
+        * %o3: new virtual queue token
+        */
+ENTRY(sun4v_dax_ccb_submit)
+       mov     %o5, %g1
+       mov     HV_DAX_CCB_SUBMIT, %o5
+       ta      HV_FAST_TRAP
+       stx     %o1, [%o4]
+       retl
+       stx     %o2, [%g1]
+ENDPROC(sun4v_dax_ccb_submit)
+
        /* %o0: pointer to unsigned long time
         *
         * returns %o0: status
index 9e034f29dcc52208ca98a648e028f955f7c8f882..9a623004efe62d8742d1036f7ad29b49701a0319 100644 (file)
@@ -38,6 +38,7 @@ EXPORT_SYMBOL(sun4v_niagara_setperf);
 EXPORT_SYMBOL(sun4v_niagara2_getperf);
 EXPORT_SYMBOL(sun4v_niagara2_setperf);
 EXPORT_SYMBOL(sun4v_mach_set_watchdog);
+EXPORT_SYMBOL(sun4v_dax_ccb_submit);
 
 /* from hweight.S */
 EXPORT_SYMBOL(__arch_hweight8);