Print this page
MFV: illumos-gate@48d370f1e98a10b1bdf160dd83a49e0f49f6c1b7
9809 nvme driver should attach to all NVMe 1.x devices
9810 Update parts of NVMe headers for newer specs
9811 nvmeadm(1M) should have ctf
Reviewed by: Hans Rosenfeld <hans.rosenfeld@joyent.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Yuri Pankov <yuripv@yuripv.net>
Reviewed by: Richard Lowe <richlowe@richlowe.net>
Reviewed by: Andy Fiddaman <omnios@citrus-it.co.uk>
Approved by: Dan McDonald <danmcd@joyent.com>
Author: Robert Mustacchi <rm@joyent.com>
NEX-18067 Catch up with illumos 8806 8805
8806 xattr_dir_inactive() releases used vnode with kernel panic
Reviewed by: Marcel Telka <marcel@telka.sk>
Reviewed by: Gordon Ross <gordon.w.ross@gmail.com>
Approved by: Dan McDonald <danmcd@joyent.com>
8805 xattr_dir_lookup() can leak a vnode hold
Reviewed by: Marcel Telka <marcel@telka.sk>
Reviewed by: Gordon Ross <gordon.w.ross@gmail.com>
Approved by: Dan McDonald <danmcd@joyent.com>
NEX-17991 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>
NEX-16749 some NVMe controllers get upset about NS ID of 0 when checking "Error Recovery" feature
Reviewed by: Cynthia Eastham <cynthia.eastham@nexenta.com>
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
NEX-16880 update NVME code
8804 nvme: add alias for pciclass,010802
Reviewed by: Peter Tribble <peter.tribble@gmail.com>
Reviewed by: Michal Nowak <mnowak@startmail.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
8979 nvmeadm(1m): ctl/[ns] -> ctl[/ns]
Reviewed by: Yuri Pankov <yuripv@gmx.com>
Reviewed by: Rich Lowe <richlowe@richlowe.net>
Reviewed by: Rob Johnston <rob.johnston@joyent.com>
Reviewed by: Toomas Soome <tsoome@me.com>
Approved by: Dan McDonald <danmcd@joyent.com>
8945 nvme panics when async events are not supported
Reviewed by: Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
Reviewed by: Yuri Pankov <yuripv@yuripv.net>
Reviewed by: Michal Nowak <mnowak@startmail.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
NEX-16549 nvme: "programming error: invalid NS/format" doing 'nvmeadm list' on a controller without namespaces
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
Reviewed by: Dan Fields <dan.fields@nexenta.com>
NEX-15208 nvme: Software Progress Marker feature is optional
Reviewed by: Dan Fields <dan.fields@nexenta.com>
Reviewed by: Cynthia Eastham <cynthia.eastham@nexenta.com>
NEX-8020 illumos nvme changes
Reviewed by: Dan Fields <dan.fields@nexenta.com>
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
NEX-7539 nvme fails to get error log page from Samsung PM1725
Reviewed by: Dan Fields <dan.fields@nexenta.com>
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
NEX-7538 nvme shouldn't ignore namespaces that support extended data LBAs
Reviewed by: Dan Fields <dan.fields@nexenta.com>
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
NEX-7373 nvme queue DMA attribute count_max is 0-based
Reviewed by: Gordon Ross <gordon.ross@nexenta.com
Reviewed by: Dan Fields <dan.fields@nexenta.com>
NEX-7369 bump nvme admin command timeout to 1s
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
NEX-6740 nvme checksum errors with blocksize < 4096
Reviewed by: Hans Rosenfeld <hans.rosenfeld@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
NEX-7349 nvme ignores interrupt enabling failure
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
NEX-7336 nvme initial interrupt issues
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
NEX-7322 nvme fix from Tegile needs a fix
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Bayard Bell <bayard.bell@nexenta.com>
Reviewed by: Dan Fields <dan.fields@nexenta.com>
NEX-7321 nvme version number check is broken again
Reviewed by: Steve Peng <steve.peng@nexenta.com>
Reviewed by: Rob Gittins <rob.gittins@nexenta.com>
NEX-7291 several small nvme fixes from Tegile
Reviewed by: Dan Fields <dan.fields@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
NEX-7290 nvme: id_nlbaf field is 0-based
Reviewed by: Dan Fields <dan.fields@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
NEX-7236 nvme shouldn't use ddi_intr_enable/disable to block interrupts
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Dan Fields <dan.fields@nexenta.com>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>
NEX-5192 Samsung SSD SM951-NVMe shows checksum errors
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
NEX-5792 support NVMe namespace EUI64
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
NEX-6132 nvmeadm(1M) get-feature command could use some cleanup
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
NEX-6130 basic NVMe 1.1 support
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
NEX-5791 support NVMe volatile write cache
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
NEX-4431 want NVMe management utility
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
NEX-4849 nvme version number check is broken
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: Garrett D'Amore <garrett@damore.org>
Approved by: Robert Mustacchi <rm@joyent.com>
NEX-4850 off-by-one in nvme_get_logpage()
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: Garrett D'Amore <garrett@damore.org>
Approved by: Robert Mustacchi <rm@joyent.com>
NEX-4427 blkdev should provide the device_error kstat for iostat -E
Reviewed by: Richard Elling <Richard.Elling@RichardElling.com>
Reviewed by: Garrett D'Amore <garrett@damore.org>
NEX-4424 kstat module needs cleanup
Reviewed by: Richard Elling <Richard.Elling@RichardElling.com>
Reviewed by: Garrett D'Amore <garrett@damore.org>
NEX-4420 format(1M) should be able to use device inquiry properties
Reviewed by: Dan McDonald <danmcd@omniti.com>
NEX-4419 blkdev and blkdev drivers should provide inquiry properties
Reviewed by: Garrett D'Amore <garrett@damore.org>
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
NEX-2182 need driver for Intel NVM Express (nvme)
Reviewed by: Dan Fields <dan.fields@nexenta.com>
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
NEX-2182 need driver for Intel NVM Express (nvme) (preview)
Reviewed by: Dan Fields <dan.fields@nexenta.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/nvme/nvme.c
          +++ new/usr/src/uts/common/io/nvme/nvme.c
↓ open down ↓ 2 lines elided ↑ open up ↑
   3    3   * Common Development and Distribution License ("CDDL"), version 1.0.
   4    4   * You may only use this file in accordance with the terms of version
   5    5   * 1.0 of the CDDL.
   6    6   *
   7    7   * A full copy of the text of the CDDL should have accompanied this
   8    8   * source.  A copy of the CDDL is also available via the Internet at
   9    9   * http://www.illumos.org/license/CDDL.
  10   10   */
  11   11  
  12   12  /*
  13      - * Copyright 2016 Nexenta Systems, Inc. All rights reserved.
       13 + * Copyright 2018 Nexenta Systems, Inc.
  14   14   * Copyright 2016 Tegile Systems, Inc. All rights reserved.
  15   15   * Copyright (c) 2016 The MathWorks, Inc.  All rights reserved.
  16      - * Copyright 2017 Joyent, Inc.
       16 + * Copyright 2018 Joyent, Inc.
  17   17   */
  18   18  
  19   19  /*
  20   20   * blkdev driver for NVMe compliant storage devices
  21   21   *
  22   22   * This driver was written to conform to version 1.2.1 of the NVMe
  23   23   * specification.  It may work with newer versions, but that is completely
  24   24   * untested and disabled by default.
  25   25   *
  26   26   * The driver has only been tested on x86 systems and will not work on big-
↓ open down ↓ 49 lines elided ↑ open up ↑
  76   76   * turned off while dumping the driver will just submit a command in the regular
  77   77   * way, and then repeatedly attempt a command retrieval until it gets the
  78   78   * command back.
  79   79   *
  80   80   *
  81   81   * Namespace Support:
  82   82   *
  83   83   * NVMe devices can have multiple namespaces, each being a independent data
  84   84   * store. The driver supports multiple namespaces and creates a blkdev interface
  85   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.
       86 + * protection information. This driver does not support any of this and ignores
       87 + * namespaces that have these attributes.
  88   88   *
  89   89   * As of NVMe 1.1 namespaces can have an 64bit Extended Unique Identifier
  90   90   * (EUI64). This driver uses the EUI64 if present to generate the devid and
  91   91   * passes it to blkdev to use it in the device node names. As this is currently
  92   92   * untested namespaces with EUI64 are ignored by default.
  93   93   *
  94   94   * We currently support only (2 << NVME_MINOR_INST_SHIFT) - 2 namespaces in a
  95   95   * single controller. This is an artificial limit imposed by the driver to be
  96   96   * able to address a reasonable number of controllers and namespaces using a
  97   97   * 32bit minor node number.
↓ open down ↓ 91 lines elided ↑ open up ↑
 189  189   * The driver currently does not support fast reboot. A quiesce(9E) entry point
 190  190   * is still provided which is used to send a shutdown notification to the
 191  191   * device.
 192  192   *
 193  193   *
 194  194   * Driver Configuration:
 195  195   *
 196  196   * The following driver properties can be changed to control some aspects of the
 197  197   * drivers operation:
 198  198   * - strict-version: can be set to 0 to allow devices conforming to newer
 199      - *   versions or namespaces with EUI64 to be used
      199 + *   major versions to be used
 200  200   * - ignore-unknown-vendor-status: can be set to 1 to not handle any vendor
 201  201   *   specific command status as a fatal error leading device faulting
 202  202   * - admin-queue-len: the maximum length of the admin queue (16-4096)
 203  203   * - io-queue-len: the maximum length of the I/O queues (16-65536)
 204  204   * - async-event-limit: the maximum number of asynchronous event requests to be
 205  205   *   posted by the driver
 206  206   * - volatile-write-cache-enable: can be set to 0 to disable the volatile write
 207  207   *   cache
 208  208   * - min-phys-block-size: the minimum physical block size to report to blkdev,
 209  209   *   which is among other things the basis for ZFS vdev ashift
↓ open down ↓ 41 lines elided ↑ open up ↑
 251  251  
 252  252  #include <sys/nvme.h>
 253  253  
 254  254  #ifdef __x86
 255  255  #include <sys/x86_archext.h>
 256  256  #endif
 257  257  
 258  258  #include "nvme_reg.h"
 259  259  #include "nvme_var.h"
 260  260  
      261 +/*
      262 + * Assertions to make sure that we've properly captured various aspects of the
      263 + * packed structures and haven't broken them during updates.
      264 + */
      265 +CTASSERT(sizeof (nvme_identify_ctrl_t) == 0x1000);
      266 +CTASSERT(offsetof(nvme_identify_ctrl_t, id_oacs) == 256);
      267 +CTASSERT(offsetof(nvme_identify_ctrl_t, id_sqes) == 512);
      268 +CTASSERT(offsetof(nvme_identify_ctrl_t, id_subnqn) == 768);
      269 +CTASSERT(offsetof(nvme_identify_ctrl_t, id_nvmof) == 1792);
      270 +CTASSERT(offsetof(nvme_identify_ctrl_t, id_psd) == 2048);
      271 +CTASSERT(offsetof(nvme_identify_ctrl_t, id_vs) == 3072);
 261  272  
      273 +CTASSERT(sizeof (nvme_identify_nsid_t) == 0x1000);
      274 +CTASSERT(offsetof(nvme_identify_nsid_t, id_fpi) == 32);
      275 +CTASSERT(offsetof(nvme_identify_nsid_t, id_nguid) == 104);
      276 +CTASSERT(offsetof(nvme_identify_nsid_t, id_lbaf) == 128);
      277 +CTASSERT(offsetof(nvme_identify_nsid_t, id_vs) == 384);
      278 +
      279 +CTASSERT(sizeof (nvme_identify_primary_caps_t) == 0x1000);
      280 +CTASSERT(offsetof(nvme_identify_primary_caps_t, nipc_vqfrt) == 32);
      281 +CTASSERT(offsetof(nvme_identify_primary_caps_t, nipc_vifrt) == 64);
      282 +
      283 +
 262  284  /* NVMe spec version supported */
 263  285  static const int nvme_version_major = 1;
 264      -static const int nvme_version_minor = 2;
 265  286  
 266  287  /* tunable for admin command timeout in seconds, default is 1s */
 267  288  int nvme_admin_cmd_timeout = 1;
 268  289  
 269  290  /* tunable for FORMAT NVM command timeout in seconds, default is 600s */
 270  291  int nvme_format_cmd_timeout = 600;
 271  292  
 272  293  static int nvme_attach(dev_info_t *, ddi_attach_cmd_t);
 273  294  static int nvme_detach(dev_info_t *, ddi_detach_cmd_t);
 274  295  static int nvme_quiesce(dev_info_t *);
↓ open down ↓ 802 lines elided ↑ open up ↑
1077 1098          case NVME_CQE_SC_GEN_ID_CNFL:
1078 1099                  /* Command ID Conflict */
1079 1100                  dev_err(cmd->nc_nvme->n_dip, CE_PANIC, "programming error: "
1080 1101                      "cmd ID conflict in cmd %p", (void *)cmd);
1081 1102                  return (0);
1082 1103  
1083 1104          case NVME_CQE_SC_GEN_INV_NS:
1084 1105                  /* Invalid Namespace or Format */
1085 1106                  if (!cmd->nc_dontpanic)
1086 1107                          dev_err(cmd->nc_nvme->n_dip, CE_PANIC,
1087      -                            "programming error: " "invalid NS/format in cmd %p",
     1108 +                            "programming error: invalid NS/format in cmd %p",
1088 1109                              (void *)cmd);
1089 1110                  return (EINVAL);
1090 1111  
1091 1112          case NVME_CQE_SC_GEN_NVM_LBA_RANGE:
1092 1113                  /* LBA Out Of Range */
1093 1114                  dev_err(cmd->nc_nvme->n_dip, CE_PANIC, "programming error: "
1094 1115                      "LBA out of range in cmd %p", (void *)cmd);
1095 1116                  return (0);
1096 1117  
1097 1118          /*
↓ open down ↓ 750 lines elided ↑ open up ↑
1848 1869  
1849 1870          if (bufsize != NULL)
1850 1871                  *bufsize = 0;
1851 1872  
1852 1873          cmd->nc_sqid = 0;
1853 1874          cmd->nc_callback = nvme_wakeup_cmd;
1854 1875          cmd->nc_sqe.sqe_opc = NVME_OPC_GET_FEATURES;
1855 1876          cmd->nc_sqe.sqe_cdw10 = feature;
1856 1877          cmd->nc_sqe.sqe_cdw11 = *res;
1857 1878  
     1879 +        /*
     1880 +         * For some of the optional features there doesn't seem to be a method
     1881 +         * of detecting whether it is supported other than using it.  This will
     1882 +         * cause "Invalid Field in Command" error, which is normally considered
     1883 +         * a programming error.  Set the nc_dontpanic flag to override the panic
     1884 +         * in nvme_check_generic_cmd_status().
     1885 +         */
1858 1886          switch (feature) {
1859 1887          case NVME_FEAT_ARBITRATION:
1860 1888          case NVME_FEAT_POWER_MGMT:
1861 1889          case NVME_FEAT_TEMPERATURE:
1862      -        case NVME_FEAT_ERROR:
1863 1890          case NVME_FEAT_NQUEUES:
1864 1891          case NVME_FEAT_INTR_COAL:
1865 1892          case NVME_FEAT_INTR_VECT:
1866 1893          case NVME_FEAT_WRITE_ATOM:
1867 1894          case NVME_FEAT_ASYNC_EVENT:
1868      -        case NVME_FEAT_PROGRESS:
1869 1895                  break;
1870 1896  
     1897 +        case NVME_FEAT_ERROR:
     1898 +                /*
     1899 +                 * Per-namespace Deallocated or Unwritten Logical Block
     1900 +                 * Error Enable (DULBE) feature was added after initial NVMe
     1901 +                 * specification, but we currently only check this feature with
     1902 +                 * NS ID of 0 (the controller itself), and some controllers get
     1903 +                 * upset, reporting the error.  For the moment, override the
     1904 +                 * panic by setting the nc_dontpanic flag.
     1905 +                 */
     1906 +                cmd->nc_dontpanic = B_TRUE;
     1907 +                break;
     1908 +
1871 1909          case NVME_FEAT_WRITE_CACHE:
1872 1910                  if (!nvme->n_write_cache_present)
1873 1911                          goto fail;
1874 1912                  break;
1875 1913  
1876 1914          case NVME_FEAT_LBA_RANGE:
1877 1915                  if (!nvme->n_lba_range_supported)
1878 1916                          goto fail;
1879 1917  
1880      -                /*
1881      -                 * The LBA Range Type feature is optional. There doesn't seem
1882      -                 * be a method of detecting whether it is supported other than
1883      -                 * using it. This will cause a "invalid field in command" error,
1884      -                 * which is normally considered a programming error and causes
1885      -                 * panic in nvme_check_generic_cmd_status().
1886      -                 */
1887 1918                  cmd->nc_dontpanic = B_TRUE;
1888 1919                  cmd->nc_sqe.sqe_nsid = nsid;
1889 1920                  ASSERT(bufsize != NULL);
1890 1921                  *bufsize = NVME_LBA_RANGE_BUFSIZE;
1891      -
1892 1922                  break;
1893 1923  
1894 1924          case NVME_FEAT_AUTO_PST:
1895 1925                  if (!nvme->n_auto_pst_supported)
1896 1926                          goto fail;
1897 1927  
1898 1928                  ASSERT(bufsize != NULL);
1899 1929                  *bufsize = NVME_AUTO_PST_BUFSIZE;
1900 1930                  break;
1901 1931  
     1932 +        case NVME_FEAT_PROGRESS:
     1933 +                if (!nvme->n_progress_supported)
     1934 +                        goto fail;
     1935 +
     1936 +                cmd->nc_dontpanic = B_TRUE;
     1937 +                break;
     1938 +
1902 1939          default:
1903 1940                  goto fail;
1904 1941          }
1905 1942  
1906 1943          if (bufsize != NULL && *bufsize != 0) {
1907 1944                  if (nvme_zalloc_dma(nvme, *bufsize, DDI_DMA_READ,
1908 1945                      &nvme->n_prp_dma_attr, &cmd->nc_dma) != DDI_SUCCESS) {
1909 1946                          dev_err(nvme->n_dip, CE_WARN,
1910 1947                              "!nvme_zalloc_dma failed for GET FEATURES");
1911 1948                          ret = ENOMEM;
↓ open down ↓ 14 lines elided ↑ open up ↑
1926 1963                          ddi_dma_nextcookie(cmd->nc_dma->nd_dmah,
1927 1964                              &cmd->nc_dma->nd_cookie);
1928 1965                          cmd->nc_sqe.sqe_dptr.d_prp[1] =
1929 1966                              cmd->nc_dma->nd_cookie.dmac_laddress;
1930 1967                  }
1931 1968          }
1932 1969  
1933 1970          nvme_admin_cmd(cmd, nvme_admin_cmd_timeout);
1934 1971  
1935 1972          if ((ret = nvme_check_cmd_status(cmd)) != 0) {
1936      -                if (feature == NVME_FEAT_LBA_RANGE &&
1937      -                    cmd->nc_cqe.cqe_sf.sf_sct == NVME_CQE_SCT_GENERIC &&
1938      -                    cmd->nc_cqe.cqe_sf.sf_sc == NVME_CQE_SC_GEN_INV_FLD)
1939      -                        nvme->n_lba_range_supported = B_FALSE;
1940      -                else
     1973 +                boolean_t known = B_TRUE;
     1974 +
     1975 +                /* Check if this is unsupported optional feature */
     1976 +                if (cmd->nc_cqe.cqe_sf.sf_sct == NVME_CQE_SCT_GENERIC &&
     1977 +                    cmd->nc_cqe.cqe_sf.sf_sc == NVME_CQE_SC_GEN_INV_FLD) {
     1978 +                        switch (feature) {
     1979 +                        case NVME_FEAT_LBA_RANGE:
     1980 +                                nvme->n_lba_range_supported = B_FALSE;
     1981 +                                break;
     1982 +                        case NVME_FEAT_PROGRESS:
     1983 +                                nvme->n_progress_supported = B_FALSE;
     1984 +                                break;
     1985 +                        default:
     1986 +                                known = B_FALSE;
     1987 +                                break;
     1988 +                        }
     1989 +                } else {
     1990 +                        known = B_FALSE;
     1991 +                }
     1992 +
     1993 +                /* Report the error otherwise */
     1994 +                if (!known) {
1941 1995                          dev_err(nvme->n_dip, CE_WARN,
1942 1996                              "!GET FEATURES %d failed with sct = %x, sc = %x",
1943 1997                              feature, cmd->nc_cqe.cqe_sf.sf_sct,
1944 1998                              cmd->nc_cqe.cqe_sf.sf_sc);
     1999 +                }
     2000 +
1945 2001                  goto fail;
1946 2002          }
1947 2003  
1948 2004          if (bufsize != NULL && *bufsize != 0) {
1949 2005                  ASSERT(buf != NULL);
1950 2006                  *buf = kmem_alloc(*bufsize, KM_SLEEP);
1951 2007                  bcopy(cmd->nc_dma->nd_memp, *buf, *bufsize);
1952 2008          }
1953 2009  
1954 2010          *res = cmd->nc_cqe.cqe_dw0;
↓ open down ↓ 237 lines elided ↑ open up ↑
2192 2248                  last_rp = idns->id_lbaf[j].lbaf_rp;
2193 2249                  ns->ns_best_block_size =
2194 2250                      1 << idns->id_lbaf[j].lbaf_lbads;
2195 2251          }
2196 2252  
2197 2253          if (ns->ns_best_block_size < nvme->n_min_block_size)
2198 2254                  ns->ns_best_block_size = nvme->n_min_block_size;
2199 2255  
2200 2256          /*
2201 2257           * We currently don't support namespaces that use either:
2202      -         * - thin provisioning
2203 2258           * - protection information
2204 2259           * - illegal block size (< 512)
2205 2260           */
2206      -        if (idns->id_nsfeat.f_thin ||
2207      -            idns->id_dps.dp_pinfo) {
     2261 +        if (idns->id_dps.dp_pinfo) {
2208 2262                  dev_err(nvme->n_dip, CE_WARN,
2209      -                    "!ignoring namespace %d, unsupported features: "
2210      -                    "thin = %d, pinfo = %d", nsid,
2211      -                    idns->id_nsfeat.f_thin, idns->id_dps.dp_pinfo);
     2263 +                    "!ignoring namespace %d, unsupported feature: "
     2264 +                    "pinfo = %d", nsid, idns->id_dps.dp_pinfo);
2212 2265                  ns->ns_ignore = B_TRUE;
2213 2266          } else if (ns->ns_block_size < 512) {
2214 2267                  dev_err(nvme->n_dip, CE_WARN,
2215 2268                      "!ignoring namespace %d, unsupported block size %"PRIu64,
2216 2269                      nsid, (uint64_t)ns->ns_block_size);
2217 2270                  ns->ns_ignore = B_TRUE;
2218 2271          } else {
2219 2272                  ns->ns_ignore = B_FALSE;
2220 2273          }
2221 2274  
↓ open down ↓ 15 lines elided ↑ open up ↑
2237 2290          char model[sizeof (nvme->n_idctl->id_model) + 1];
2238 2291          char *vendor, *product;
2239 2292  
2240 2293          /* Check controller version */
2241 2294          vs.r = nvme_get32(nvme, NVME_REG_VS);
2242 2295          nvme->n_version.v_major = vs.b.vs_mjr;
2243 2296          nvme->n_version.v_minor = vs.b.vs_mnr;
2244 2297          dev_err(nvme->n_dip, CE_CONT, "?NVMe spec version %d.%d",
2245 2298              nvme->n_version.v_major, nvme->n_version.v_minor);
2246 2299  
2247      -        if (NVME_VERSION_HIGHER(&nvme->n_version,
2248      -            nvme_version_major, nvme_version_minor)) {
2249      -                dev_err(nvme->n_dip, CE_WARN, "!no support for version > %d.%d",
2250      -                    nvme_version_major, nvme_version_minor);
     2300 +        if (nvme->n_version.v_major > nvme_version_major) {
     2301 +                dev_err(nvme->n_dip, CE_WARN, "!no support for version > %d.x",
     2302 +                    nvme_version_major);
2251 2303                  if (nvme->n_strict_version)
2252 2304                          goto fail;
2253 2305          }
2254 2306  
2255 2307          /* retrieve controller configuration */
2256 2308          cap.r = nvme_get64(nvme, NVME_REG_CAP);
2257 2309  
2258 2310          if ((cap.b.cap_css & NVME_CAP_CSS_NVM) == 0) {
2259 2311                  dev_err(nvme->n_dip, CE_WARN,
2260 2312                      "!NVM command set not supported by hardware");
↓ open down ↓ 253 lines elided ↑ open up ↑
2514 2566          nvme->n_lba_range_supported = B_TRUE;
2515 2567  
2516 2568          /*
2517 2569           * Check support for Autonomous Power State Transition.
2518 2570           */
2519 2571          if (NVME_VERSION_ATLEAST(&nvme->n_version, 1, 1))
2520 2572                  nvme->n_auto_pst_supported =
2521 2573                      nvme->n_idctl->id_apsta.ap_sup == 0 ? B_FALSE : B_TRUE;
2522 2574  
2523 2575          /*
     2576 +         * Assume Software Progress Marker feature is supported.  If it isn't
     2577 +         * this will be set to B_FALSE by nvme_get_features().
     2578 +         */
     2579 +        nvme->n_progress_supported = B_TRUE;
     2580 +
     2581 +        /*
2524 2582           * Identify Namespaces
2525 2583           */
2526 2584          nvme->n_namespace_count = nvme->n_idctl->id_nn;
     2585 +
     2586 +        if (nvme->n_namespace_count == 0) {
     2587 +                dev_err(nvme->n_dip, CE_WARN,
     2588 +                    "!controllers without namespaces are not supported");
     2589 +                goto fail;
     2590 +        }
     2591 +
2527 2592          if (nvme->n_namespace_count > NVME_MINOR_MAX) {
2528 2593                  dev_err(nvme->n_dip, CE_WARN,
2529 2594                      "!too many namespaces: %d, limiting to %d\n",
2530 2595                      nvme->n_namespace_count, NVME_MINOR_MAX);
2531 2596                  nvme->n_namespace_count = NVME_MINOR_MAX;
2532 2597          }
2533 2598  
2534 2599          nvme->n_ns = kmem_zalloc(sizeof (nvme_namespace_t) *
2535 2600              nvme->n_namespace_count, KM_SLEEP);
2536 2601  
↓ open down ↓ 1393 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX