Merge branch 'for-4.11/block' into for-4.11/linus-merge
authorJens Axboe <axboe@fb.com>
Fri, 17 Feb 2017 21:06:45 +0000 (14:06 -0700)
committerJens Axboe <axboe@fb.com>
Fri, 17 Feb 2017 21:06:45 +0000 (14:06 -0700)
Signed-off-by: Jens Axboe <axboe@fb.com>
1  2 
MAINTAINERS
drivers/nvme/host/core.c
drivers/nvme/host/nvme.h
drivers/nvme/host/pci.c
include/linux/blkdev.h

diff --combined MAINTAINERS
@@@ -81,6 -81,7 +81,6 @@@ Descriptions of section entries
        Q: Patchwork web based patch tracking system site
        T: SCM tree type and location.
           Type is one of: git, hg, quilt, stgit, topgit
 -      B: Bug tracking system location.
        S: Status, one of the following:
           Supported:   Someone is actually paid to look after this.
           Maintained:  Someone actually looks after it.
@@@ -877,8 -878,8 +877,8 @@@ S: Odd fixe
  F:    drivers/hwmon/applesmc.c
  
  APPLETALK NETWORK LAYER
 -M:    Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
 -S:    Maintained
 +L:    netdev@vger.kernel.org
 +S:    Odd fixes
  F:    drivers/net/appletalk/
  F:    net/appletalk/
  
@@@ -976,7 -977,6 +976,7 @@@ M: Russell King <linux@armlinux.org.uk
  L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
  W:    http://www.armlinux.org.uk/
  S:    Maintained
 +T:    git git://git.armlinux.org.uk/~rmk/linux-arm.git
  F:    arch/arm/
  
  ARM SUB-ARCHITECTURES
@@@ -1091,7 -1091,7 +1091,7 @@@ F:      arch/arm/boot/dts/aspeed-
  F:    drivers/*/*aspeed*
  
  ARM/ATMEL AT91RM9200, AT91SAM9 AND SAMA5 SOC SUPPORT
 -M:    Nicolas Ferre <nicolas.ferre@atmel.com>
 +M:    Nicolas Ferre <nicolas.ferre@microchip.com>
  M:    Alexandre Belloni <alexandre.belloni@free-electrons.com>
  M:    Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
  L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
@@@ -1154,7 -1154,6 +1154,7 @@@ ARM/CLKDEV SUPPOR
  M:    Russell King <linux@armlinux.org.uk>
  L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
  S:    Maintained
 +T:    git git://git.armlinux.org.uk/~rmk/linux-arm.git clkdev
  F:    arch/arm/include/asm/clkdev.h
  F:    drivers/clk/clkdev.c
  
@@@ -1690,7 -1689,6 +1690,7 @@@ M:      Krzysztof Kozlowski <krzk@kernel.org
  R:    Javier Martinez Canillas <javier@osg.samsung.com>
  L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
  L:    linux-samsung-soc@vger.kernel.org (moderated for non-subscribers)
 +Q:    https://patchwork.kernel.org/project/linux-samsung-soc/list/
  S:    Maintained
  F:    arch/arm/boot/dts/s3c*
  F:    arch/arm/boot/dts/s5p*
@@@ -1773,7 -1771,7 +1773,7 @@@ F:      drivers/soc/renesas
  F:    include/linux/soc/renesas/
  
  ARM/SOCFPGA ARCHITECTURE
 -M:    Dinh Nguyen <dinguyen@opensource.altera.com>
 +M:    Dinh Nguyen <dinguyen@kernel.org>
  S:    Maintained
  F:    arch/arm/mach-socfpga/
  F:    arch/arm/boot/dts/socfpga*
@@@ -1783,7 -1781,7 +1783,7 @@@ W:      http://www.rocketboards.or
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/dinguyen/linux.git
  
  ARM/SOCFPGA CLOCK FRAMEWORK SUPPORT
 -M:    Dinh Nguyen <dinguyen@opensource.altera.com>
 +M:    Dinh Nguyen <dinguyen@kernel.org>
  S:    Maintained
  F:    drivers/clk/socfpga/
  
@@@ -2175,56 -2173,64 +2175,56 @@@ F:   include/linux/atm
  F:    include/uapi/linux/atm*
  
  ATMEL AT91 / AT32 MCI DRIVER
 -M:    Ludovic Desroches <ludovic.desroches@atmel.com>
 +M:    Ludovic Desroches <ludovic.desroches@microchip.com>
  S:    Maintained
  F:    drivers/mmc/host/atmel-mci.c
  
  ATMEL AT91 SAMA5D2-Compatible Shutdown Controller
 -M:    Nicolas Ferre <nicolas.ferre@atmel.com>
 +M:    Nicolas Ferre <nicolas.ferre@microchip.com>
  S:    Supported
  F:    drivers/power/reset/at91-sama5d2_shdwc.c
  
  ATMEL SAMA5D2 ADC DRIVER
 -M:    Ludovic Desroches <ludovic.desroches@atmel.com>
 +M:    Ludovic Desroches <ludovic.desroches@microchip.com>
  L:    linux-iio@vger.kernel.org
  S:    Supported
  F:    drivers/iio/adc/at91-sama5d2_adc.c
  
  ATMEL Audio ALSA driver
 -M:    Nicolas Ferre <nicolas.ferre@atmel.com>
 +M:    Nicolas Ferre <nicolas.ferre@microchip.com>
  L:    alsa-devel@alsa-project.org (moderated for non-subscribers)
  S:    Supported
  F:    sound/soc/atmel
  
 -ATMEL DMA DRIVER
 -M:    Nicolas Ferre <nicolas.ferre@atmel.com>
 -L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
 -S:    Supported
 -F:    drivers/dma/at_hdmac.c
 -F:    drivers/dma/at_hdmac_regs.h
 -F:    include/linux/platform_data/dma-atmel.h
 -
  ATMEL XDMA DRIVER
 -M:    Ludovic Desroches <ludovic.desroches@atmel.com>
 +M:    Ludovic Desroches <ludovic.desroches@microchip.com>
  L:    linux-arm-kernel@lists.infradead.org
  L:    dmaengine@vger.kernel.org
  S:    Supported
  F:    drivers/dma/at_xdmac.c
  
  ATMEL I2C DRIVER
 -M:    Ludovic Desroches <ludovic.desroches@atmel.com>
 +M:    Ludovic Desroches <ludovic.desroches@microchip.com>
  L:    linux-i2c@vger.kernel.org
  S:    Supported
  F:    drivers/i2c/busses/i2c-at91.c
  
  ATMEL ISI DRIVER
 -M:    Ludovic Desroches <ludovic.desroches@atmel.com>
 +M:    Ludovic Desroches <ludovic.desroches@microchip.com>
  L:    linux-media@vger.kernel.org
  S:    Supported
  F:    drivers/media/platform/soc_camera/atmel-isi.c
  F:    include/media/atmel-isi.h
  
  ATMEL LCDFB DRIVER
 -M:    Nicolas Ferre <nicolas.ferre@atmel.com>
 +M:    Nicolas Ferre <nicolas.ferre@microchip.com>
  L:    linux-fbdev@vger.kernel.org
  S:    Maintained
  F:    drivers/video/fbdev/atmel_lcdfb.c
  F:    include/video/atmel_lcdc.h
  
  ATMEL MACB ETHERNET DRIVER
 -M:    Nicolas Ferre <nicolas.ferre@atmel.com>
 +M:    Nicolas Ferre <nicolas.ferre@microchip.com>
  S:    Supported
  F:    drivers/net/ethernet/cadence/
  
@@@ -2236,32 -2242,32 +2236,32 @@@ S:   Supporte
  F:    drivers/mtd/nand/atmel_nand*
  
  ATMEL SDMMC DRIVER
 -M:    Ludovic Desroches <ludovic.desroches@atmel.com>
 +M:    Ludovic Desroches <ludovic.desroches@microchip.com>
  L:    linux-mmc@vger.kernel.org
  S:    Supported
  F:    drivers/mmc/host/sdhci-of-at91.c
  
  ATMEL SPI DRIVER
 -M:    Nicolas Ferre <nicolas.ferre@atmel.com>
 +M:    Nicolas Ferre <nicolas.ferre@microchip.com>
  S:    Supported
  F:    drivers/spi/spi-atmel.*
  
  ATMEL SSC DRIVER
 -M:    Nicolas Ferre <nicolas.ferre@atmel.com>
 +M:    Nicolas Ferre <nicolas.ferre@microchip.com>
  L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
  S:    Supported
  F:    drivers/misc/atmel-ssc.c
  F:    include/linux/atmel-ssc.h
  
  ATMEL Timer Counter (TC) AND CLOCKSOURCE DRIVERS
 -M:    Nicolas Ferre <nicolas.ferre@atmel.com>
 +M:    Nicolas Ferre <nicolas.ferre@microchip.com>
  L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
  S:    Supported
  F:    drivers/misc/atmel_tclib.c
  F:    drivers/clocksource/tcb_clksrc.c
  
  ATMEL USBA UDC DRIVER
 -M:    Nicolas Ferre <nicolas.ferre@atmel.com>
 +M:    Nicolas Ferre <nicolas.ferre@microchip.com>
  L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
  S:    Supported
  F:    drivers/usb/gadget/udc/atmel_usba_udc.*
@@@ -3567,7 -3573,7 +3567,7 @@@ F:      drivers/infiniband/hw/cxgb3
  F:    include/uapi/rdma/cxgb3-abi.h
  
  CXGB4 ETHERNET DRIVER (CXGB4)
 -M:    Hariprasad S <hariprasad@chelsio.com>
 +M:    Ganesh Goudar <ganeshgr@chelsio.com>
  L:    netdev@vger.kernel.org
  W:    http://www.chelsio.com
  S:    Supported
@@@ -4100,24 -4106,18 +4100,24 @@@ F:   drivers/gpu/drm/bridge
  
  DRM DRIVER FOR BOCHS VIRTUAL GPU
  M:    Gerd Hoffmann <kraxel@redhat.com>
 -S:    Odd Fixes
 +L:    virtualization@lists.linux-foundation.org
 +T:    git git://git.kraxel.org/linux drm-qemu
 +S:    Maintained
  F:    drivers/gpu/drm/bochs/
  
  DRM DRIVER FOR QEMU'S CIRRUS DEVICE
  M:    Dave Airlie <airlied@redhat.com>
 -S:    Odd Fixes
 +M:    Gerd Hoffmann <kraxel@redhat.com>
 +L:    virtualization@lists.linux-foundation.org
 +T:    git git://git.kraxel.org/linux drm-qemu
 +S:    Obsolete
 +W:    https://www.kraxel.org/blog/2014/10/qemu-using-cirrus-considered-harmful/
  F:    drivers/gpu/drm/cirrus/
  
  RADEON and AMDGPU DRM DRIVERS
  M:    Alex Deucher <alexander.deucher@amd.com>
  M:    Christian König <christian.koenig@amd.com>
 -L:    dri-devel@lists.freedesktop.org
 +L:    amd-gfx@lists.freedesktop.org
  T:    git git://people.freedesktop.org/~agd5f/linux
  S:    Supported
  F:    drivers/gpu/drm/radeon/
@@@ -4153,7 -4153,7 +4153,7 @@@ F:      Documentation/gpu/i915.rs
  INTEL GVT-g DRIVERS (Intel GPU Virtualization)
  M:      Zhenyu Wang <zhenyuw@linux.intel.com>
  M:      Zhi Wang <zhi.a.wang@intel.com>
 -L:      igvt-g-dev@lists.01.org
 +L:      intel-gvt-dev@lists.freedesktop.org
  L:      intel-gfx@lists.freedesktop.org
  W:      https://01.org/igvt-g
  T:      git https://github.com/01org/gvt-linux.git
@@@ -4304,10 -4304,7 +4304,10 @@@ F:    Documentation/devicetree/bindings/di
  
  DRM DRIVER FOR QXL VIRTUAL GPU
  M:    Dave Airlie <airlied@redhat.com>
 -S:    Odd Fixes
 +M:    Gerd Hoffmann <kraxel@redhat.com>
 +L:    virtualization@lists.linux-foundation.org
 +T:    git git://git.kraxel.org/linux drm-qemu
 +S:    Maintained
  F:    drivers/gpu/drm/qxl/
  F:    include/uapi/drm/qxl_drm.h
  
@@@ -6727,8 -6724,9 +6727,8 @@@ S:      Odd Fixe
  F:    drivers/tty/ipwireless/
  
  IPX NETWORK LAYER
 -M:    Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
  L:    netdev@vger.kernel.org
 -S:    Maintained
 +S:    Odd fixes
  F:    include/net/ipx.h
  F:    include/uapi/linux/ipx.h
  F:    net/ipx/
@@@ -7500,8 -7498,8 +7500,8 @@@ S:      Maintaine
  F:    drivers/misc/lkdtm*
  
  LLC (802.2)
 -M:    Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
 -S:    Maintained
 +L:    netdev@vger.kernel.org
 +S:    Odd fixes
  F:    include/linux/llc.h
  F:    include/uapi/linux/llc.h
  F:    include/net/llc*
@@@ -7708,10 -7706,8 +7708,10 @@@ F:    drivers/net/dsa/mv88e6xxx
  F:    Documentation/devicetree/bindings/net/dsa/marvell.txt
  
  MARVELL ARMADA DRM SUPPORT
 -M:    Russell King <rmk+kernel@armlinux.org.uk>
 +M:    Russell King <linux@armlinux.org.uk>
  S:    Maintained
 +T:    git git://git.armlinux.org.uk/~rmk/linux-arm.git drm-armada-devel
 +T:    git git://git.armlinux.org.uk/~rmk/linux-arm.git drm-armada-fixes
  F:    drivers/gpu/drm/armada/
  F:    include/uapi/drm/armada_drm.h
  F:    Documentation/devicetree/bindings/display/armada/
@@@ -8183,15 -8179,6 +8183,15 @@@ S:    Maintaine
  F:    drivers/tty/serial/atmel_serial.c
  F:    include/linux/atmel_serial.h
  
 +MICROCHIP / ATMEL DMA DRIVER
 +M:    Ludovic Desroches <ludovic.desroches@microchip.com>
 +L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
 +L:    dmaengine@vger.kernel.org
 +S:    Supported
 +F:    drivers/dma/at_hdmac.c
 +F:    drivers/dma/at_hdmac_regs.h
 +F:    include/linux/platform_data/dma-atmel.h
 +
  MICROCHIP / ATMEL ISC DRIVER
  M:    Songjun Wu <songjun.wu@microchip.com>
  L:    linux-media@vger.kernel.org
@@@ -8612,10 -8599,10 +8612,10 @@@ S:   Maintaine
  F:    drivers/net/ethernet/netronome/
  
  NETWORK BLOCK DEVICE (NBD)
- M:    Markus Pargmann <mpa@pengutronix.de>
+ M:    Josef Bacik <jbacik@fb.com>
  S:    Maintained
+ L:    linux-block@vger.kernel.org
  L:    nbd-general@lists.sourceforge.net
- T:    git git://git.pengutronix.de/git/mpa/linux-nbd.git
  F:    Documentation/blockdev/nbd.txt
  F:    drivers/block/nbd.c
  F:    include/uapi/linux/nbd.h
@@@ -8916,10 -8903,8 +8916,10 @@@ S:    Supporte
  F:    drivers/nfc/nxp-nci
  
  NXP TDA998X DRM DRIVER
 -M:    Russell King <rmk+kernel@armlinux.org.uk>
 +M:    Russell King <linux@armlinux.org.uk>
  S:    Supported
 +T:    git git://git.armlinux.org.uk/~rmk/linux-arm.git drm-tda998x-devel
 +T:    git git://git.armlinux.org.uk/~rmk/linux-arm.git drm-tda998x-fixes
  F:    drivers/gpu/drm/i2c/tda998x_drv.c
  F:    include/drm/i2c/tda998x.h
  
@@@ -9735,7 -9720,7 +9735,7 @@@ S:      Maintaine
  F:    drivers/pinctrl/pinctrl-at91.*
  
  PIN CONTROLLER - ATMEL AT91 PIO4
 -M:    Ludovic Desroches <ludovic.desroches@atmel.com>
 +M:    Ludovic Desroches <ludovic.desroches@microchip.com>
  L:    linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
  L:    linux-gpio@vger.kernel.org
  S:    Supported
@@@ -10194,6 -10179,7 +10194,6 @@@ F:   drivers/media/tuners/qt1010
  QUALCOMM ATHEROS ATH9K WIRELESS DRIVER
  M:    QCA ath9k Development <ath9k-devel@qca.qualcomm.com>
  L:    linux-wireless@vger.kernel.org
 -L:    ath9k-devel@lists.ath9k.org
  W:    http://wireless.kernel.org/en/users/Drivers/ath9k
  S:    Supported
  F:    drivers/net/wireless/ath/ath9k/
@@@ -11089,6 -11075,17 +11089,17 @@@ L: linux-mmc@vger.kernel.or
  S:    Maintained
  F:    drivers/mmc/host/sdhci-spear.c
  
+ SECURE ENCRYPTING DEVICE (SED) OPAL DRIVER
+ M:    Scott Bauer <scott.bauer@intel.com>
+ M:    Jonathan Derrick <jonathan.derrick@intel.com>
+ M:    Rafael Antognolli <rafael.antognolli@intel.com>
+ L:    linux-block@vger.kernel.org
+ S:    Supported
+ F:    block/sed*
+ F:    block/opal_proto.h
+ F:    include/linux/sed*
+ F:    include/uapi/linux/sed*
  SECURITY SUBSYSTEM
  M:    James Morris <james.l.morris@oracle.com>
  M:    "Serge E. Hallyn" <serge@hallyn.com>
@@@ -13064,7 -13061,7 +13075,7 @@@ F:   drivers/input/serio/userio.
  F:    include/uapi/linux/userio.h
  
  VIRTIO CONSOLE DRIVER
 -M:    Amit Shah <amit.shah@redhat.com>
 +M:    Amit Shah <amit@kernel.org>
  L:    virtualization@lists.linux-foundation.org
  S:    Maintained
  F:    drivers/char/virtio_console.c
@@@ -13099,7 -13096,6 +13110,7 @@@ M:   David Airlie <airlied@linux.ie
  M:    Gerd Hoffmann <kraxel@redhat.com>
  L:    dri-devel@lists.freedesktop.org
  L:    virtualization@lists.linux-foundation.org
 +T:    git git://git.kraxel.org/linux drm-qemu
  S:    Maintained
  F:    drivers/gpu/drm/virtio/
  F:    include/uapi/linux/virtio_gpu.h
@@@ -13372,8 -13368,10 +13383,8 @@@ S:  Maintaine
  F:    drivers/input/misc/wistron_btns.c
  
  WL3501 WIRELESS PCMCIA CARD DRIVER
 -M:    Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
  L:    linux-wireless@vger.kernel.org
 -W:    http://oops.ghostprotocols.net:81/blog
 -S:    Maintained
 +S:    Odd fixes
  F:    drivers/net/wireless/wl3501*
  
  WOLFSON MICROELECTRONICS DRIVERS
@@@ -13449,7 -13447,6 +13460,7 @@@ F:   arch/x86
  
  X86 PLATFORM DRIVERS
  M:    Darren Hart <dvhart@infradead.org>
 +M:    Andy Shevchenko <andy@infradead.org>
  L:    platform-driver-x86@vger.kernel.org
  T:    git git://git.infradead.org/users/dvhart/linux-platform-drivers-x86.git
  S:    Maintained
@@@ -13621,7 -13618,6 +13632,7 @@@ F:   drivers/net/hamradio/z8530.
  
  ZBUD COMPRESSED PAGE ALLOCATOR
  M:    Seth Jennings <sjenning@redhat.com>
 +M:    Dan Streetman <ddstreet@ieee.org>
  L:    linux-mm@kvack.org
  S:    Maintained
  F:    mm/zbud.c
@@@ -13677,7 -13673,6 +13688,7 @@@ F:   Documentation/vm/zsmalloc.tx
  
  ZSWAP COMPRESSED SWAP CACHING
  M:    Seth Jennings <sjenning@redhat.com>
 +M:    Dan Streetman <ddstreet@ieee.org>
  L:    linux-mm@kvack.org
  S:    Maintained
  F:    mm/zswap.c
diff --combined drivers/nvme/host/core.c
@@@ -784,6 -784,13 +784,13 @@@ static int nvme_ioctl(struct block_devi
                return nvme_sg_io(ns, (void __user *)arg);
  #endif
        default:
+ #ifdef CONFIG_NVM
+               if (ns->ndev)
+                       return nvme_nvm_ioctl(ns, cmd, arg);
+ #endif
+               if (is_sed_ioctl(cmd))
+                       return sed_ioctl(ns->ctrl->opal_dev, cmd,
+                                        (void __user *) arg);
                return -ENOTTY;
        }
  }
@@@ -1051,6 -1058,28 +1058,28 @@@ static const struct pr_ops nvme_pr_ops 
        .pr_clear       = nvme_pr_clear,
  };
  
+ #ifdef CONFIG_BLK_SED_OPAL
+ int nvme_sec_submit(void *data, u16 spsp, u8 secp, void *buffer, size_t len,
+               bool send)
+ {
+       struct nvme_ctrl *ctrl = data;
+       struct nvme_command cmd;
+       memset(&cmd, 0, sizeof(cmd));
+       if (send)
+               cmd.common.opcode = nvme_admin_security_send;
+       else
+               cmd.common.opcode = nvme_admin_security_recv;
+       cmd.common.nsid = 0;
+       cmd.common.cdw10[0] = cpu_to_le32(((u32)secp) << 24 | ((u32)spsp) << 8);
+       cmd.common.cdw10[1] = cpu_to_le32(len);
+       return __nvme_submit_sync_cmd(ctrl->admin_q, &cmd, NULL, buffer, len,
+                                     ADMIN_TIMEOUT, NVME_QID_ANY, 1, 0);
+ }
+ EXPORT_SYMBOL_GPL(nvme_sec_submit);
+ #endif /* CONFIG_BLK_SED_OPAL */
  static const struct block_device_operations nvme_fops = {
        .owner          = THIS_MODULE,
        .ioctl          = nvme_ioctl,
@@@ -1106,7 -1135,12 +1135,7 @@@ int nvme_disable_ctrl(struct nvme_ctrl 
        if (ret)
                return ret;
  
 -      /* Checking for ctrl->tagset is a trick to avoid sleeping on module
 -       * load, since we only need the quirk on reset_controller. Notice
 -       * that the HGST device needs this delay only in firmware activation
 -       * procedure; unfortunately we have no (easy) way to verify this.
 -       */
 -      if ((ctrl->quirks & NVME_QUIRK_DELAY_BEFORE_CHK_RDY) && ctrl->tagset)
 +      if (ctrl->quirks & NVME_QUIRK_DELAY_BEFORE_CHK_RDY)
                msleep(NVME_QUIRK_DELAY_AMOUNT);
  
        return nvme_wait_ready(ctrl, cap, false);
@@@ -1230,6 -1264,7 +1259,7 @@@ int nvme_init_identify(struct nvme_ctr
                return -EIO;
        }
  
+       ctrl->oacs = le16_to_cpu(id->oacs);
        ctrl->vid = le16_to_cpu(id->vid);
        ctrl->oncs = le16_to_cpup(&id->oncs);
        atomic_set(&ctrl->abort_limit, id->acl + 1);
diff --combined drivers/nvme/host/nvme.h
@@@ -19,6 -19,7 +19,7 @@@
  #include <linux/kref.h>
  #include <linux/blk-mq.h>
  #include <linux/lightnvm.h>
+ #include <linux/sed-opal.h>
  
  enum {
        /*
@@@ -125,6 -126,8 +126,8 @@@ struct nvme_ctrl 
        struct list_head node;
        struct ida ns_ida;
  
+       struct opal_dev *opal_dev;
        char name[12];
        char serial[20];
        char model[40];
        u32 max_hw_sectors;
        u16 oncs;
        u16 vid;
+       u16 oacs;
        atomic_t abort_limit;
        u8 event_limit;
        u8 vwc;
@@@ -225,6 -229,14 +229,6 @@@ static inline u64 nvme_block_nr(struct 
        return (sector >> (ns->lba_shift - 9));
  }
  
 -static inline unsigned nvme_map_len(struct request *rq)
 -{
 -      if (req_op(rq) == REQ_OP_DISCARD)
 -              return sizeof(struct nvme_dsm_range);
 -      else
 -              return blk_rq_bytes(rq);
 -}
 -
  static inline void nvme_cleanup_cmd(struct request *req)
  {
        if (req->rq_flags & RQF_SPECIAL_PAYLOAD) {
@@@ -267,6 -279,9 +271,9 @@@ int nvme_init_identify(struct nvme_ctr
  void nvme_queue_scan(struct nvme_ctrl *ctrl);
  void nvme_remove_namespaces(struct nvme_ctrl *ctrl);
  
+ int nvme_sec_submit(void *data, u16 spsp, u8 secp, void *buffer, size_t len,
+               bool send);
  #define NVME_NR_AERS  1
  void nvme_complete_async_event(struct nvme_ctrl *ctrl, __le16 status,
                union nvme_result *res);
@@@ -318,6 -333,7 +325,7 @@@ int nvme_nvm_register(struct nvme_ns *n
  void nvme_nvm_unregister(struct nvme_ns *ns);
  int nvme_nvm_register_sysfs(struct nvme_ns *ns);
  void nvme_nvm_unregister_sysfs(struct nvme_ns *ns);
+ int nvme_nvm_ioctl(struct nvme_ns *ns, unsigned int cmd, unsigned long arg);
  #else
  static inline int nvme_nvm_register(struct nvme_ns *ns, char *disk_name,
                                    int node)
@@@ -335,6 -351,11 +343,11 @@@ static inline int nvme_nvm_ns_supported
  {
        return 0;
  }
+ static inline int nvme_nvm_ioctl(struct nvme_ns *ns, unsigned int cmd,
+                                                       unsigned long arg)
+ {
+       return -ENOTTY;
+ }
  #endif /* CONFIG_NVM */
  
  static inline struct nvme_ns *nvme_get_ns_from_dev(struct device *dev)
diff --combined drivers/nvme/host/pci.c
@@@ -43,6 -43,7 +43,7 @@@
  #include <linux/types.h>
  #include <linux/io-64-nonatomic-lo-hi.h>
  #include <asm/unaligned.h>
+ #include <linux/sed-opal.h>
  
  #include "nvme.h"
  
@@@ -306,11 -307,11 +307,11 @@@ static __le64 **iod_list(struct reques
        return (__le64 **)(iod->sg + blk_rq_nr_phys_segments(req));
  }
  
 -static int nvme_init_iod(struct request *rq, unsigned size,
 -              struct nvme_dev *dev)
 +static int nvme_init_iod(struct request *rq, struct nvme_dev *dev)
  {
        struct nvme_iod *iod = blk_mq_rq_to_pdu(rq);
        int nseg = blk_rq_nr_phys_segments(rq);
 +      unsigned int size = blk_rq_payload_bytes(rq);
  
        if (nseg > NVME_INT_PAGES || size > NVME_INT_BYTES(dev)) {
                iod->sg = kmalloc(nvme_iod_alloc_size(dev, size, nseg), GFP_ATOMIC);
@@@ -420,11 -421,12 +421,11 @@@ static void nvme_dif_complete(u32 p, u3
  }
  #endif
  
 -static bool nvme_setup_prps(struct nvme_dev *dev, struct request *req,
 -              int total_len)
 +static bool nvme_setup_prps(struct nvme_dev *dev, struct request *req)
  {
        struct nvme_iod *iod = blk_mq_rq_to_pdu(req);
        struct dma_pool *pool;
 -      int length = total_len;
 +      int length = blk_rq_payload_bytes(req);
        struct scatterlist *sg = iod->sg;
        int dma_len = sg_dma_len(sg);
        u64 dma_addr = sg_dma_address(sg);
  }
  
  static int nvme_map_data(struct nvme_dev *dev, struct request *req,
 -              unsigned size, struct nvme_command *cmnd)
 +              struct nvme_command *cmnd)
  {
        struct nvme_iod *iod = blk_mq_rq_to_pdu(req);
        struct request_queue *q = req->q;
                                DMA_ATTR_NO_WARN))
                goto out;
  
 -      if (!nvme_setup_prps(dev, req, size))
 +      if (!nvme_setup_prps(dev, req))
                goto out_unmap;
  
        ret = BLK_MQ_RQ_QUEUE_ERROR;
@@@ -579,6 -581,7 +580,6 @@@ static int nvme_queue_rq(struct blk_mq_
        struct nvme_dev *dev = nvmeq->dev;
        struct request *req = bd->rq;
        struct nvme_command cmnd;
 -      unsigned map_len;
        int ret = BLK_MQ_RQ_QUEUE_OK;
  
        /*
        if (ret != BLK_MQ_RQ_QUEUE_OK)
                return ret;
  
 -      map_len = nvme_map_len(req);
 -      ret = nvme_init_iod(req, map_len, dev);
 +      ret = nvme_init_iod(req, dev);
        if (ret != BLK_MQ_RQ_QUEUE_OK)
                goto out_free_cmd;
  
        if (blk_rq_nr_phys_segments(req))
 -              ret = nvme_map_data(dev, req, map_len, &cmnd);
 +              ret = nvme_map_data(dev, req, &cmnd);
  
        if (ret != BLK_MQ_RQ_QUEUE_OK)
                goto out_cleanup_iod;
@@@ -895,12 -899,11 +896,11 @@@ static enum blk_eh_timer_return nvme_ti
                return BLK_EH_HANDLED;
        }
  
-       iod->aborted = 1;
        if (atomic_dec_return(&dev->ctrl.abort_limit) < 0) {
                atomic_inc(&dev->ctrl.abort_limit);
                return BLK_EH_RESET_TIMER;
        }
+       iod->aborted = 1;
  
        memset(&cmd, 0, sizeof(cmd));
        cmd.abort.opcode = nvme_admin_abort_cmd;
@@@ -1178,6 -1181,7 +1178,7 @@@ static int nvme_alloc_admin_tags(struc
                dev->admin_tagset.timeout = ADMIN_TIMEOUT;
                dev->admin_tagset.numa_node = dev_to_node(dev->dev);
                dev->admin_tagset.cmd_size = nvme_cmd_size(dev);
+               dev->admin_tagset.flags = BLK_MQ_F_NO_SCHED;
                dev->admin_tagset.driver_data = dev;
  
                if (blk_mq_alloc_tag_set(&dev->admin_tagset))
@@@ -1738,6 -1742,7 +1739,7 @@@ static void nvme_pci_free_ctrl(struct n
        if (dev->ctrl.admin_q)
                blk_put_queue(dev->ctrl.admin_q);
        kfree(dev->queues);
+       kfree(dev->ctrl.opal_dev);
        kfree(dev);
  }
  
@@@ -1754,6 -1759,7 +1756,7 @@@ static void nvme_remove_dead_ctrl(struc
  static void nvme_reset_work(struct work_struct *work)
  {
        struct nvme_dev *dev = container_of(work, struct nvme_dev, reset_work);
+       bool was_suspend = !!(dev->ctrl.ctrl_config & NVME_CC_SHN_NORMAL);
        int result = -ENODEV;
  
        if (WARN_ON(dev->ctrl.state == NVME_CTRL_RESETTING))
        if (result)
                goto out;
  
+       if ((dev->ctrl.oacs & NVME_CTRL_OACS_SEC_SUPP) && !dev->ctrl.opal_dev) {
+               dev->ctrl.opal_dev =
+                       init_opal_dev(&dev->ctrl, &nvme_sec_submit);
+       }
+       if (was_suspend)
+               opal_unlock_from_suspend(dev->ctrl.opal_dev);
        result = nvme_setup_io_queues(dev);
        if (result)
                goto out;
diff --combined include/linux/blkdev.h
@@@ -154,6 -154,7 +154,7 @@@ struct request 
  
        /* the following two fields are internal, NEVER access directly */
        unsigned int __data_len;        /* total data len */
+       int tag;
        sector_t __sector;              /* sector cursor */
  
        struct bio *bio;
  
        unsigned short ioprio;
  
+       int internal_tag;
        void *special;          /* opaque pointer available for LLD use */
  
-       int tag;
        int errors;
  
        /*
@@@ -407,7 -409,7 +409,7 @@@ struct request_queue 
        dma_drain_needed_fn     *dma_drain_needed;
        lld_busy_fn             *lld_busy_fn;
  
-       struct blk_mq_ops       *mq_ops;
+       const struct blk_mq_ops *mq_ops;
  
        unsigned int            *mq_map;
  
        struct list_head        tag_set_list;
        struct bio_set          *bio_split;
  
+ #ifdef CONFIG_DEBUG_FS
+       struct dentry           *debugfs_dir;
+       struct dentry           *mq_debugfs_dir;
+ #endif
        bool                    mq_sysfs_init_done;
  };
  
  #define QUEUE_FLAG_FLUSH_NQ    25     /* flush not queueuable */
  #define QUEUE_FLAG_DAX         26     /* device supports DAX */
  #define QUEUE_FLAG_STATS       27     /* track rq completion times */
+ #define QUEUE_FLAG_RESTART     28     /* queue needs restart at completion */
  
  #define QUEUE_FLAG_DEFAULT    ((1 << QUEUE_FLAG_IO_STAT) |            \
                                 (1 << QUEUE_FLAG_STACKABLE)    |       \
@@@ -739,7 -747,7 +747,7 @@@ static inline bool blk_queue_is_zoned(s
        }
  }
  
 -static inline unsigned int blk_queue_zone_size(struct request_queue *q)
 +static inline unsigned int blk_queue_zone_sectors(struct request_queue *q)
  {
        return blk_queue_is_zoned(q) ? q->limits.chunk_sectors : 0;
  }
@@@ -1000,19 -1008,6 +1008,19 @@@ static inline unsigned int blk_rq_cur_s
        return blk_rq_cur_bytes(rq) >> 9;
  }
  
 +/*
 + * Some commands like WRITE SAME have a payload or data transfer size which
 + * is different from the size of the request.  Any driver that supports such
 + * commands using the RQF_SPECIAL_PAYLOAD flag needs to use this helper to
 + * calculate the data transfer size.
 + */
 +static inline unsigned int blk_rq_payload_bytes(struct request *rq)
 +{
 +      if (rq->rq_flags & RQF_SPECIAL_PAYLOAD)
 +              return rq->special_vec.bv_len;
 +      return blk_rq_bytes(rq);
 +}
 +
  static inline unsigned int blk_queue_get_max_sectors(struct request_queue *q,
                                                     int op)
  {
@@@ -1549,12 -1544,12 +1557,12 @@@ static inline bool bdev_is_zoned(struc
        return false;
  }
  
 -static inline unsigned int bdev_zone_size(struct block_device *bdev)
 +static inline unsigned int bdev_zone_sectors(struct block_device *bdev)
  {
        struct request_queue *q = bdev_get_queue(bdev);
  
        if (q)
 -              return blk_queue_zone_size(q);
 +              return blk_queue_zone_sectors(q);
  
        return 0;
  }
@@@ -1620,6 -1615,25 +1628,25 @@@ static inline bool bvec_gap_to_prev(str
        return __bvec_gap_to_prev(q, bprv, offset);
  }
  
+ /*
+  * Check if the two bvecs from two bios can be merged to one segment.
+  * If yes, no need to check gap between the two bios since the 1st bio
+  * and the 1st bvec in the 2nd bio can be handled in one segment.
+  */
+ static inline bool bios_segs_mergeable(struct request_queue *q,
+               struct bio *prev, struct bio_vec *prev_last_bv,
+               struct bio_vec *next_first_bv)
+ {
+       if (!BIOVEC_PHYS_MERGEABLE(prev_last_bv, next_first_bv))
+               return false;
+       if (!BIOVEC_SEG_BOUNDARY(q, prev_last_bv, next_first_bv))
+               return false;
+       if (prev->bi_seg_back_size + next_first_bv->bv_len >
+                       queue_max_segment_size(q))
+               return false;
+       return true;
+ }
  static inline bool bio_will_gap(struct request_queue *q, struct bio *prev,
                         struct bio *next)
  {
                bio_get_last_bvec(prev, &pb);
                bio_get_first_bvec(next, &nb);
  
-               return __bvec_gap_to_prev(q, &pb, nb.bv_offset);
+               if (!bios_segs_mergeable(q, prev, &pb, &nb))
+                       return __bvec_gap_to_prev(q, &pb, nb.bv_offset);
        }
  
        return false;