nvme: hwmon: add quirk to avoid changing temperature threshold
authorAkinobu Mita <akinobu.mita@gmail.com>
Thu, 14 Nov 2019 15:40:01 +0000 (00:40 +0900)
committerKeith Busch <kbusch@kernel.org>
Thu, 21 Nov 2019 17:21:08 +0000 (02:21 +0900)
This adds a new quirk NVME_QUIRK_NO_TEMP_THRESH_CHANGE to avoid changing
the value of the temperature threshold feature for specific devices that
show undesirable behavior.

Guenter reported:

"On my Intel NVME drive (SSDPEKKW512G7), writing any minimum limit on the
Composite temperature sensor results in a temperature warning, and that
warning is sticky until I reset the controller.

It doesn't seem to matter which temperature I write; writing -273000 has
the same result."

The Intel NVMe has the latest firmware version installed, so this isn't
a problem that was ever fixed.

Reported-by: Guenter Roeck <linux@roeck-us.net>
Cc: Keith Busch <kbusch@kernel.org>
Cc: Jens Axboe <axboe@fb.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: Jean Delvare <jdelvare@suse.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
drivers/nvme/host/hwmon.c
drivers/nvme/host/nvme.h
drivers/nvme/host/pci.c

index 97a84b4..a5af21f 100644 (file)
@@ -170,8 +170,12 @@ static umode_t nvme_hwmon_is_visible(const void *_data,
        case hwmon_temp_max:
        case hwmon_temp_min:
                if ((!channel && data->ctrl->wctemp) ||
-                   (channel && data->log.temp_sensor[channel - 1]))
+                   (channel && data->log.temp_sensor[channel - 1])) {
+                       if (data->ctrl->quirks &
+                           NVME_QUIRK_NO_TEMP_THRESH_CHANGE)
+                               return 0444;
                        return 0644;
+               }
                break;
        case hwmon_temp_alarm:
                if (!channel)
index 258534a..34ac79c 100644 (file)
@@ -114,6 +114,11 @@ enum nvme_quirks {
         * Prevent tag overlap between queues
         */
        NVME_QUIRK_SHARED_TAGS                  = (1 << 13),
+
+       /*
+        * Don't change the value of the temperature threshold feature
+        */
+       NVME_QUIRK_NO_TEMP_THRESH_CHANGE        = (1 << 14),
 };
 
 /*
index 1b1b0db..c40a672 100644 (file)
@@ -3065,7 +3065,8 @@ static const struct pci_device_id nvme_id_table[] = {
                                NVME_QUIRK_DEALLOCATE_ZEROES, },
        { PCI_VDEVICE(INTEL, 0xf1a5),   /* Intel 600P/P3100 */
                .driver_data = NVME_QUIRK_NO_DEEPEST_PS |
-                               NVME_QUIRK_MEDIUM_PRIO_SQ },
+                               NVME_QUIRK_MEDIUM_PRIO_SQ |
+                               NVME_QUIRK_NO_TEMP_THRESH_CHANGE },
        { PCI_VDEVICE(INTEL, 0xf1a6),   /* Intel 760p/Pro 7600p */
                .driver_data = NVME_QUIRK_IGNORE_DEV_SUBNQN, },
        { PCI_VDEVICE(INTEL, 0x5845),   /* Qemu emulated controller */