summaryrefslogtreecommitdiffstats
path: root/drivers/nvme/host/pci.c
diff options
context:
space:
mode:
authorChristoph Hellwig2017-05-20 15:14:45 +0200
committerChristoph Hellwig2017-05-26 08:54:23 +0200
commitc81bfba9983fc44210d3eb5971e0faac597bf50d (patch)
tree0b9009c4b6f35a08c1d3fc93082989901de01739 /drivers/nvme/host/pci.c
parentnvme: replace is_flags field in nvme_ctrl_ops with a flags field (diff)
downloadkernel-qcow2-linux-c81bfba9983fc44210d3eb5971e0faac597bf50d.tar.gz
kernel-qcow2-linux-c81bfba9983fc44210d3eb5971e0faac597bf50d.tar.xz
kernel-qcow2-linux-c81bfba9983fc44210d3eb5971e0faac597bf50d.zip
nvme: only setup block integrity if supported by the driver
Currently only the PCIe driver supports metadata, so we should not claim integrity support for the other drivers. This prevents nasty crashes with targets that advertise metadata support on fabrics. Also use the opportunity to factor out some code into a separate helper that isn't even compiled if CONFIG_BLK_DEV_INTEGRITY is disabled. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Keith Busch <keith.busch@intel.com>
Diffstat (limited to 'drivers/nvme/host/pci.c')
-rw-r--r--drivers/nvme/host/pci.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index bf8bec39c017..6103b178e43a 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -2047,6 +2047,7 @@ static int nvme_pci_reset_ctrl(struct nvme_ctrl *ctrl)
static const struct nvme_ctrl_ops nvme_pci_ctrl_ops = {
.name = "pcie",
.module = THIS_MODULE,
+ .flags = NVME_F_METADATA_SUPPORTED,
.reg_read32 = nvme_pci_reg_read32,
.reg_write32 = nvme_pci_reg_write32,
.reg_read64 = nvme_pci_reg_read64,