]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
nvme: disable Write Zeroes for qemu controllers
authorChristoph Hellwig <hch@lst.de>
Wed, 13 Mar 2019 17:55:05 +0000 (18:55 +0100)
committerJens Axboe <axboe@kernel.dk>
Wed, 13 Mar 2019 18:57:34 +0000 (12:57 -0600)
Qemu started out with a broken implementation of Write Zeroes written
by yours truly.  Disable Write Zeroes on qemu for now, eventually
we need to go back and make all the qemu quirks version specific,
but that is left for another time.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Keith Busch <keith.busch@intel.com>
Tested-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/nvme/host/core.c
drivers/nvme/host/nvme.h
drivers/nvme/host/pci.c

index b92fab43406608991cf8dee06db38a26f0431632..951e9f31b57c2cde0bfab4abb48d1805bb3641a6 100644 (file)
@@ -1531,7 +1531,8 @@ static inline void nvme_config_write_zeroes(struct nvme_ns *ns)
        u32 max_sectors;
        unsigned short bs = 1 << ns->lba_shift;
 
-       if (!(ns->ctrl->oncs & NVME_CTRL_ONCS_WRITE_ZEROES))
+       if (!(ns->ctrl->oncs & NVME_CTRL_ONCS_WRITE_ZEROES) ||
+           (ns->ctrl->quirks & NVME_QUIRK_DISABLE_WRITE_ZEROES))
                return;
        /*
         * Even though NVMe spec explicitly states that MDTS is not
index b91f1838bbd5d3ee9f27e6d5388066686cbc4774..527d645450230d40780062356366d025dd5ca500 100644 (file)
@@ -87,6 +87,11 @@ enum nvme_quirks {
         * Ignore device provided subnqn.
         */
        NVME_QUIRK_IGNORE_DEV_SUBNQN            = (1 << 8),
+
+       /*
+        * Broken Write Zeroes.
+        */
+       NVME_QUIRK_DISABLE_WRITE_ZEROES         = (1 << 9),
 };
 
 /*
index f54718b63637dbfcdb3984cc7fcf7a69048be484..3a2377888a46bcf34b60e374d2a88b3f807e00fa 100644 (file)
@@ -2975,7 +2975,8 @@ static const struct pci_device_id nvme_id_table[] = {
        { PCI_VDEVICE(INTEL, 0xf1a6),   /* Intel 760p/Pro 7600p */
                .driver_data = NVME_QUIRK_IGNORE_DEV_SUBNQN, },
        { PCI_VDEVICE(INTEL, 0x5845),   /* Qemu emulated controller */
-               .driver_data = NVME_QUIRK_IDENTIFY_CNS, },
+               .driver_data = NVME_QUIRK_IDENTIFY_CNS |
+                               NVME_QUIRK_DISABLE_WRITE_ZEROES, },
        { PCI_DEVICE(0x1bb1, 0x0100),   /* Seagate Nytro Flash Storage */
                .driver_data = NVME_QUIRK_DELAY_BEFORE_CHK_RDY, },
        { PCI_DEVICE(0x1c58, 0x0003),   /* HGST adapter */