Print this page
9693 emulated NVMe controller on ESXi 6.7 fails to attach
Reviewed by: Dan Fields <dan.fields@nexenta.com>
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>


  66  * wraps around in that time a submission may find the next array slot to still
  67  * be used by a long-running command. In this case the array is sequentially
  68  * searched for the next free slot. The length of the command array is the same
  69  * as the configured queue length. Queue overrun is prevented by the semaphore,
  70  * so a command submission may block if the queue is full.
  71  *
  72  *
  73  * Polled I/O Support:
  74  *
  75  * For kernel core dump support the driver can do polled I/O. As interrupts are
  76  * turned off while dumping the driver will just submit a command in the regular
  77  * way, and then repeatedly attempt a command retrieval until it gets the
  78  * command back.
  79  *
  80  *
  81  * Namespace Support:
  82  *
  83  * NVMe devices can have multiple namespaces, each being a independent data
  84  * store. The driver supports multiple namespaces and creates a blkdev interface
  85  * for each namespace found. Namespaces can have various attributes to support
  86  * thin provisioning and protection information. This driver does not support
  87  * any of this and ignores namespaces that have these attributes.
  88  *
  89  * As of NVMe 1.1 namespaces can have an 64bit Extended Unique Identifier
  90  * (EUI64). This driver uses the EUI64 if present to generate the devid and
  91  * passes it to blkdev to use it in the device node names. As this is currently
  92  * untested namespaces with EUI64 are ignored by default.
  93  *
  94  * We currently support only (2 << NVME_MINOR_INST_SHIFT) - 2 namespaces in a
  95  * single controller. This is an artificial limit imposed by the driver to be
  96  * able to address a reasonable number of controllers and namespaces using a
  97  * 32bit minor node number.
  98  *
  99  *
 100  * Minor nodes:
 101  *
 102  * For each NVMe device the driver exposes one minor node for the controller and
 103  * one minor node for each namespace. The only operations supported by those
 104  * minor nodes are open(9E), close(9E), and ioctl(9E). This serves as the
 105  * interface for the nvmeadm(1M) utility.
 106  *
 107  *


2206          * performance. A value of 3 means "degraded", 0 is best.
2207          */
2208         last_rp = 3;
2209         for (int j = 0; j <= idns->id_nlbaf; j++) {
2210                 if (idns->id_lbaf[j].lbaf_lbads == 0)
2211                         break;
2212                 if (idns->id_lbaf[j].lbaf_ms != 0)
2213                         continue;
2214                 if (idns->id_lbaf[j].lbaf_rp >= last_rp)
2215                         continue;
2216                 last_rp = idns->id_lbaf[j].lbaf_rp;
2217                 ns->ns_best_block_size =
2218                     1 << idns->id_lbaf[j].lbaf_lbads;
2219         }
2220 
2221         if (ns->ns_best_block_size < nvme->n_min_block_size)
2222                 ns->ns_best_block_size = nvme->n_min_block_size;
2223 
2224         /*
2225          * We currently don't support namespaces that use either:
2226          * - thin provisioning
2227          * - protection information
2228          * - illegal block size (< 512)
2229          */
2230         if (idns->id_nsfeat.f_thin ||
2231             idns->id_dps.dp_pinfo) {
2232                 dev_err(nvme->n_dip, CE_WARN,
2233                     "!ignoring namespace %d, unsupported features: "
2234                     "thin = %d, pinfo = %d", nsid,
2235                     idns->id_nsfeat.f_thin, idns->id_dps.dp_pinfo);
2236                 ns->ns_ignore = B_TRUE;
2237         } else if (ns->ns_block_size < 512) {
2238                 dev_err(nvme->n_dip, CE_WARN,
2239                     "!ignoring namespace %d, unsupported block size %"PRIu64,
2240                     nsid, (uint64_t)ns->ns_block_size);
2241                 ns->ns_ignore = B_TRUE;
2242         } else {
2243                 ns->ns_ignore = B_FALSE;
2244         }
2245 
2246         return (DDI_SUCCESS);
2247 }
2248 
2249 static int
2250 nvme_init(nvme_t *nvme)
2251 {
2252         nvme_reg_cc_t cc = { 0 };
2253         nvme_reg_aqa_t aqa = { 0 };
2254         nvme_reg_asq_t asq = { 0 };
2255         nvme_reg_acq_t acq = { 0 };




  66  * wraps around in that time a submission may find the next array slot to still
  67  * be used by a long-running command. In this case the array is sequentially
  68  * searched for the next free slot. The length of the command array is the same
  69  * as the configured queue length. Queue overrun is prevented by the semaphore,
  70  * so a command submission may block if the queue is full.
  71  *
  72  *
  73  * Polled I/O Support:
  74  *
  75  * For kernel core dump support the driver can do polled I/O. As interrupts are
  76  * turned off while dumping the driver will just submit a command in the regular
  77  * way, and then repeatedly attempt a command retrieval until it gets the
  78  * command back.
  79  *
  80  *
  81  * Namespace Support:
  82  *
  83  * NVMe devices can have multiple namespaces, each being a independent data
  84  * store. The driver supports multiple namespaces and creates a blkdev interface
  85  * for each namespace found. Namespaces can have various attributes to support
  86  * protection information. This driver does not support any of this and ignores
  87  * namespaces that have these attributes.
  88  *
  89  * As of NVMe 1.1 namespaces can have an 64bit Extended Unique Identifier
  90  * (EUI64). This driver uses the EUI64 if present to generate the devid and
  91  * passes it to blkdev to use it in the device node names. As this is currently
  92  * untested namespaces with EUI64 are ignored by default.
  93  *
  94  * We currently support only (2 << NVME_MINOR_INST_SHIFT) - 2 namespaces in a
  95  * single controller. This is an artificial limit imposed by the driver to be
  96  * able to address a reasonable number of controllers and namespaces using a
  97  * 32bit minor node number.
  98  *
  99  *
 100  * Minor nodes:
 101  *
 102  * For each NVMe device the driver exposes one minor node for the controller and
 103  * one minor node for each namespace. The only operations supported by those
 104  * minor nodes are open(9E), close(9E), and ioctl(9E). This serves as the
 105  * interface for the nvmeadm(1M) utility.
 106  *
 107  *


2206          * performance. A value of 3 means "degraded", 0 is best.
2207          */
2208         last_rp = 3;
2209         for (int j = 0; j <= idns->id_nlbaf; j++) {
2210                 if (idns->id_lbaf[j].lbaf_lbads == 0)
2211                         break;
2212                 if (idns->id_lbaf[j].lbaf_ms != 0)
2213                         continue;
2214                 if (idns->id_lbaf[j].lbaf_rp >= last_rp)
2215                         continue;
2216                 last_rp = idns->id_lbaf[j].lbaf_rp;
2217                 ns->ns_best_block_size =
2218                     1 << idns->id_lbaf[j].lbaf_lbads;
2219         }
2220 
2221         if (ns->ns_best_block_size < nvme->n_min_block_size)
2222                 ns->ns_best_block_size = nvme->n_min_block_size;
2223 
2224         /*
2225          * We currently don't support namespaces that use either:

2226          * - protection information
2227          * - illegal block size (< 512)
2228          */
2229         if (idns->id_dps.dp_pinfo) {

2230                 dev_err(nvme->n_dip, CE_WARN,
2231                     "!ignoring namespace %d, unsupported feature: "
2232                     "pinfo = %d", nsid, idns->id_dps.dp_pinfo);

2233                 ns->ns_ignore = B_TRUE;
2234         } else if (ns->ns_block_size < 512) {
2235                 dev_err(nvme->n_dip, CE_WARN,
2236                     "!ignoring namespace %d, unsupported block size %"PRIu64,
2237                     nsid, (uint64_t)ns->ns_block_size);
2238                 ns->ns_ignore = B_TRUE;
2239         } else {
2240                 ns->ns_ignore = B_FALSE;
2241         }
2242 
2243         return (DDI_SUCCESS);
2244 }
2245 
2246 static int
2247 nvme_init(nvme_t *nvme)
2248 {
2249         nvme_reg_cc_t cc = { 0 };
2250         nvme_reg_aqa_t aqa = { 0 };
2251         nvme_reg_asq_t asq = { 0 };
2252         nvme_reg_acq_t acq = { 0 };