• Sreekanth Reddy's avatar
    scsi: mpt3sas: Add support for NVMe shutdown · d3f623ae
    Sreekanth Reddy authored
    Introduce function _scsih_nvme_shutdown() to issue IO Unit Control message
    to IOC firmware with operation code 'shutdown'. This causes IOC firmware to
    issue NVMe shutdown commands to all NVMe drives attached to it.
    
    NVMe Shutdown:
    
    NVMe devices need to have a specific shutdown sequence performed before
    power is removed. For this, the IOC firmware needs to be notified when the
    system is being shutdown. So during the system shutdown time, driver issues
    an IO Unit Control request with operation code MPI26_CTRL_OP_SHUTDOWN to
    inform firmware that a shutdown is initiated.
    
    This shutdown command is issued only if NVMe devices are attached to the
    controller.
    
    During each NVMe device addition, driver reads pcie device page2 to get
    shutdown latency (e.g. drive's RTD3 Entry Latency) and updates the max
    latency value among the added NVMe drives in ioc->max_shutdown_latency.
    This is used as the timeout value for IO Unit Control command at the time
    of shutdown.
    
    When a NVMe drive is removed and its shutdown latency matches which
    ioc->max_shutdown_latency then ioc->max_shutdown_latency is updated to next
    max value (by iterating over the list of available devices).  If the
    shutdown latency is 0, then default timeout is set to six seconds.
    
    Link: https://lore.kernel.org/r/20191226111333.26131-3-sreekanth.reddy@broadcom.comSigned-off-by: default avatarSreekanth Reddy <sreekanth.reddy@broadcom.com>
    Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
    d3f623ae
mpt3sas_scsih.c 324 KB