area buffer. Another value returned is the maximum length of the CCB array
that may be submitted.
+CCB_THR_INIT_V2
+
+Initializes the DAX driver for DAX2 if available. If DAX2 is not available,
+returns an error. The user should do the following to determine the DAX version
+on their system:
+
+if (ioctl(CCB_THR_INIT_V2) == SUCCESS)
+ /* DAX2 available on system */
+else if (ioctl(CCB_THR_INIT) == SUCCESS)
+ /* DAX1 available on system */
+else
+ /* no DAX available on system */
+
CCB_THR_FINI
Destroys a context for a thread. After doing this, the thread can no longer
static int __init dax_attach(void)
{
- unsigned long minor = DAX_MINOR;
+ unsigned long major, minor, minor_requested;
unsigned long max_ccbs;
int ret = 0, found_dax = 0;
struct mdesc_handle *hp = mdesc_grab();
if (!strncmp(prop, DAX1_FC_STR, strlen(DAX1_FC_STR))) {
msg = "dax1-flow-control";
dax_type = DAX1;
+ major = DAX_MAJOR;
+ minor_requested = DAX_MINOR;
} else if (!strncmp(prop, DAX2_STR, strlen(DAX2_STR))) {
msg = "dax2";
dax_type = DAX2;
+ major = DAX2_MAJOR;
+ minor_requested = DAX2_MINOR;
} else if (!strncmp(prop, DAX1_STR, strlen(DAX1_STR))) {
msg = "dax1-no-flow-control";
dax_no_flow_ctl = true;
dax_type = DAX1;
+ major = DAX_MAJOR;
+ minor_requested = DAX_MINOR;
} else {
+ major = DAX_MAJOR;
+ minor_requested = DAX_MINOR;
break;
}
found_dax = 1;
}
}
- dax_dbg("Registering DAX HV api with minor %ld", minor);
- if (sun4v_hvapi_register(HV_GRP_M7_DAX, DAX_MAJOR, &minor)) {
+ minor = minor_requested;
+ dax_dbg("Registering DAX HV api with major %ld minor %ld", major,
+ minor);
+ if (sun4v_hvapi_register(HV_GRP_DAX, major, &minor)) {
dax_err("hvapi_register failed");
if ((force & FORCE_LOAD_ON_ERROR) == 0) {
ret = -ENODEV;
goto done;
}
} else {
- dax_dbg("Max minor supported by HV = %ld", minor);
- minor = min(minor, DAX_MINOR);
- dax_dbg("registered DAX major %ld minor %ld ",
- DAX_MAJOR, minor);
+ dax_dbg("Max minor supported by HV = %ld (major %ld)", minor,
+ major);
+ minor = min(minor, minor_requested);
+ dax_dbg("registered DAX major %ld minor %ld", major, minor);
}
- dax_no_ra_pgsz = (DAX_MAJOR == 1) && (minor == 0) && !dax_has_ra_pgsz();
+ dax_no_ra_pgsz = (major == 1) && (minor == 0) && !dax_has_ra_pgsz();
dax_dbg("RA pagesize feature %spresent", dax_no_ra_pgsz ? "not " : "");
ret = hv_get_hwqueue_size(&max_ccbs);
{
dax_dbg("cmd=0x%x, f=%p, priv=%p", cmd, f, f->private_data);
switch (cmd) {
+ case DAXIOC_CCB_THR_INIT_V2:
+ if (dax_type != DAX2)
+ return -ENXIO;
+ /*
+ * fall-through: INIT_V2 is just to test if DAX2 is available,
+ * but initializing DAX1 and DAX2 is the same
+ */
case DAXIOC_CCB_THR_INIT:
return dax_ioctl_ccb_thr_init((void *)arg, f);
case DAXIOC_CCB_THR_FINI:
/* CCB thread initialization */
#define DAXIOC_CCB_THR_INIT _IOWR(DAXIOC, 6, struct dax_ccb_thr_init_arg)
+#define DAXIOC_CCB_THR_INIT_V2 _IOWR(DAXIOC, 11, struct dax_ccb_thr_init_arg)
/* free CCB thread resources */
#define DAXIOC_CCB_THR_FINI _IO(DAXIOC, 2)
/* CCB CA dequeue */
#define DAXIOC_PERF_CLEAR_COUNTERS _IOW(DAXIOC, 0xBC, void *)
/*
- * DAXIOC_CCB_THR_INIT
+ * DAXIOC_CCB_THR_INIT, DAXIOC_CCB_THR_INIT_V2
* dcti_ccb_buf_maxlen - return u32 length
* dcti_compl_maplen - return u64 mmap length
* dcti_compl_mapoff - return u64 mmap offset
#define HV_DAX_CCB_VA_SECONDARY BIT_FIELD(2UL, 12)
#define HV_DAX_CCB_VA_NUCLEUS BIT_FIELD(3UL, 12)
#define HV_DAX_CCB_VA_PRIVILEGED BIT(14)
+#define HV_DAX_VA_READ_ADI_DISABLE BIT(15) /* defined in API 2.0 */
/* dax_ccb_info()
* TRAP: HV_FAST_TRAP
#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_DAX 0x0113
#define HV_GRP_M7_PERF 0x0114
#define HV_GRP_PRIQ 0x011b
#define HV_GRP_PRIQ_PCI 0x011c
{ .group = HV_GRP_SDIO, },
{ .group = HV_GRP_SDIO_ERR, },
{ .group = HV_GRP_REBOOT_DATA, },
- { .group = HV_GRP_M7_DAX, },
+ { .group = HV_GRP_DAX, },
{ .group = HV_GRP_PRIQ, },
{ .group = HV_GRP_PRIQ_PCI, },
{ .group = HV_GRP_NIAG_PERF, .flags = FLAG_PRE_API },