Skip to contentSkip to conversation

nvme-pci: add quirk for missing secondary temperature thresholds

PATCH Applied Hristo Venev 3 participants 5 messages Apr 25, 2023 – May 3, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme-pci: add quirk for missing secondary temperature thresholds

On Kingston KC3000 and Kingston FURY Renegade (both have the same PCI IDs) accessing temp3_{min,max} fails with an invalid field error (note that there is no problem setting the thresholds for temp1).

This contradicts the NVM Express Base Specification 2.0b, page 292:

The over temperature threshold and under temperature threshold features shall be implemented for all implemented temperature sensors (i.e., all Temperature Sensor fields that report a non-zero value).

Define NVME_QUIRK_NO_SECONDARY_TEMP_THRESH that disables the thresholds for all but the composite temperature and set it for this device.

---
 drivers/nvme/host/hwmon.c | 3 ++-
 drivers/nvme/host/nvme.h  | 5 +++++
 drivers/nvme/host/pci.c   | 2 ++
 3 files changed, 9 insertions(+), 1 deletion(-)
drivers/nvme/host/hwmon.c +2 -1
index 9e6e56c20ec9..7a2c4b5e018c 100644
@@ -163,7 +163,8 @@ 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] &&
+		     !(data->ctrl->quirks & NVME_QUIRK_NO_SECONDARY_TEMP_THRESH))) {
 			if (data->ctrl->quirks &
 			    NVME_QUIRK_NO_TEMP_THRESH_CHANGE)
 				return 0444;
drivers/nvme/host/nvme.h +5 -0
index bf46f122e9e1..a2d4f59e0535 100644
@@ -149,6 +149,11 @@ enum nvme_quirks {
 	 * Reports garbage in the namespace identifiers (eui64, nguid, uuid).
 	 */
 	NVME_QUIRK_BOGUS_NID			= (1 << 18),
+
+	/*
+	 * No temperature thresholds for channels other than 0 (Composite).
+	 */
+	NVME_QUIRK_NO_SECONDARY_TEMP_THRESH	= (1 << 19),
 };
 
 /*
drivers/nvme/host/pci.c +2 -0
index cd7873de3121..e457ad169dcb 100644
@@ -3416,6 +3416,8 @@ static const struct pci_device_id nvme_id_table[] = {
 		.driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, },
 	{ PCI_DEVICE(0x2646, 0x501E),   /* KINGSTON OM3PGP4xxxxQ OS21011 NVMe SSD */
 		.driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, },
+	{ PCI_DEVICE(0x2646, 0x5013),   /* Kingston KC3000, Kingston FURY Renegade */
+		.driver_data = NVME_QUIRK_NO_SECONDARY_TEMP_THRESH, },
 	{ PCI_DEVICE(0x1f40, 0x1202),   /* Netac Technologies Co. NV3000 NVMe SSD */
 		.driver_data = NVME_QUIRK_BOGUS_NID, },
 	{ PCI_DEVICE(0x1f40, 0x5236),   /* Netac Technologies Co. NV7000 NVMe SSD */
Signature · 1 line
2.40.0
maintainer
#1 lore raw
Quoted 4 lines · Hristo Venev

On Kingston KC3000 and Kingston FURY Renegade (both have the same PCI IDs) accessing temp3_{min,max} fails with an invalid field error (note that there is no problem setting the thresholds for temp1).

Quoted 9 lines

This contradicts the NVM Express Base Specification 2.0b, page 292:

The over temperature threshold and under temperature threshold features shall be implemented for all implemented temperature sensors (i.e., all Temperature Sensor fields that report a non-zero value).

Define NVME_QUIRK_NO_SECONDARY_TEMP_THRESH that disables the thresholds for all but the composite temperature and set it for this device.

The description above says that temp3_{min,max} return errors. How about temp2 ? This patch disables that as well, but it is not clear if temp2_{min,max} return errors as well. If temp2 limits work, disabling them would be overkill.

Thanks,
Guenter

Quoted 53 lines
---
 drivers/nvme/host/hwmon.c | 3 ++-
 drivers/nvme/host/nvme.h  | 5 +++++
 drivers/nvme/host/pci.c   | 2 ++
 3 files changed, 9 insertions(+), 1 deletion(-)
drivers/nvme/host/hwmon.c +2 -1
index 9e6e56c20ec9..7a2c4b5e018c 100644
@@ -163,7 +163,8 @@ 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] &&
+		     !(data->ctrl->quirks & NVME_QUIRK_NO_SECONDARY_TEMP_THRESH))) {
 			if (data->ctrl->quirks &
 			    NVME_QUIRK_NO_TEMP_THRESH_CHANGE)
 				return 0444;
drivers/nvme/host/nvme.h +5 -0
index bf46f122e9e1..a2d4f59e0535 100644
@@ -149,6 +149,11 @@ enum nvme_quirks {
 	 * Reports garbage in the namespace identifiers (eui64, nguid, uuid).
 	 */
 	NVME_QUIRK_BOGUS_NID			= (1 << 18),
+
+	/*
+	 * No temperature thresholds for channels other than 0 (Composite).
+	 */
+	NVME_QUIRK_NO_SECONDARY_TEMP_THRESH	= (1 << 19),
 };
 
 /*
drivers/nvme/host/pci.c +2 -0
index cd7873de3121..e457ad169dcb 100644
@@ -3416,6 +3416,8 @@ static const struct pci_device_id nvme_id_table[] = {
 		.driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, },
 	{ PCI_DEVICE(0x2646, 0x501E),   /* KINGSTON OM3PGP4xxxxQ OS21011 NVMe SSD */
 		.driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, },
+	{ PCI_DEVICE(0x2646, 0x5013),   /* Kingston KC3000, Kingston FURY Renegade */
+		.driver_data = NVME_QUIRK_NO_SECONDARY_TEMP_THRESH, },
 	{ PCI_DEVICE(0x1f40, 0x1202),   /* Netac Technologies Co. NV3000 NVMe SSD */
 		.driver_data = NVME_QUIRK_BOGUS_NID, },
 	{ PCI_DEVICE(0x1f40, 0x5236),   /* Netac Technologies Co. NV7000 NVMe SSD */
Signature · 1 line
2.40.0
#2 lore raw
Quoted 20 lines · Guenter Roeck
Quoted 14 lines · Hristo Venev

On Kingston KC3000 and Kingston FURY Renegade (both have the same PCI
IDs) accessing temp3_{min,max} fails with an invalid field error (note
that there is no problem setting the thresholds for temp1).

This contradicts the NVM Express Base Specification 2.0b, page 292:

  The over temperature threshold and under temperature threshold features shall be implemented for all implemented temperature sensors
  (i.e., all Temperature Sensor fields that report a non-zero value).

Quoted 4 lines

Define NVME_QUIRK_NO_SECONDARY_TEMP_THRESH that disables the thresholds
for all but the composite temperature and set it for this device.

Quoted 6 lines

The description above says that temp3_{min,max} return errors. How about temp2 ? This patch disables that as well, but it is not clear
if temp2_{min,max} return errors as well. If temp2 limits work, disabling
them would be overkill.

temp2 doesn't exist. The only temperature sensors on that SSD are temp1 and temp3.

Quoted 69 lines

Thanks,
Guenter

Quoted 65 lines

---
 drivers/nvme/host/hwmon.c | 3 ++-
 drivers/nvme/host/nvme.h  | 5 +++++
 drivers/nvme/host/pci.c   | 2 ++

 3 files changed, 9 insertions(+), 1 deletion(-)
drivers/nvme/host/hwmon.c +0 -0
index 9e6e56c20ec9..7a2c4b5e018c 100644
@@ -163,7 +163,8 @@ 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] &&
+                    !(data->ctrl->quirks & NVME_QUIRK_NO_SECONDARY_TEMP_THRESH))) {
                        if (data->ctrl->quirks & NVME_QUIRK_NO_TEMP_THRESH_CHANGE) return 0444;

drivers/nvme/host/nvme.h +0 -0
index bf46f122e9e1..a2d4f59e0535 100644
@@ -149,6 +149,11 @@ enum nvme_quirks {
          * Reports garbage in the namespace identifiers (eui64,

nguid, uuid).
         */
        NVME_QUIRK_BOGUS_NID                    = (1 << 18), +
+       /*
+        * No temperature thresholds for channels other than 0 (Composite).
+        */
+       NVME_QUIRK_NO_SECONDARY_TEMP_THRESH     = (1 << 19), };

 /*

drivers/nvme/host/pci.c +0 -0
index cd7873de3121..e457ad169dcb 100644
@@ -3416,6 +3416,8 @@ static const struct pci_device_id
 nvme_id_table[] = {
                 .driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, },

        { PCI_DEVICE(0x2646, 0x501E),   /* KINGSTON OM3PGP4xxxxQ OS21011 NVMe SSD */
                .driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, }, +       { PCI_DEVICE(0x2646, 0x5013),   /* Kingston KC3000, Kingston FURY Renegade */
+               .driver_data = NVME_QUIRK_NO_SECONDARY_TEMP_THRESH, },
        { PCI_DEVICE(0x1f40, 0x1202),   /* Netac Technologies Co. NV3000 NVMe SSD */
                .driver_data = NVME_QUIRK_BOGUS_NID, }, { PCI_DEVICE(0x1f40, 0x5236),   /* Netac Technologies Co. NV7000 NVMe SSD */

Signature · 1 line
2.40.0
maintainer Reviewed-by
#3 lore raw
Quoted 28 lines · Hristo Venev
Quoted 20 lines · Guenter Roeck
Quoted 14 lines · Hristo Venev

On Kingston KC3000 and Kingston FURY Renegade (both have the same PCI
IDs) accessing temp3_{min,max} fails with an invalid field error (note
that there is no problem setting the thresholds for temp1).

This contradicts the NVM Express Base Specification 2.0b, page 292:

  The over temperature threshold and under temperature threshold features shall be implemented for all implemented temperature
sensors
  (i.e., all Temperature Sensor fields that report a non-zero
value).

Quoted 4 lines

Define NVME_QUIRK_NO_SECONDARY_TEMP_THRESH that disables the thresholds
for all but the composite temperature and set it for this device.

Quoted 6 lines

The description above says that temp3_{min,max} return errors. How about temp2 ? This patch disables that as well, but it is not clear
if temp2_{min,max} return errors as well. If temp2 limits work, disabling
them would be overkill.

Quoted 3 lines

temp2 doesn't exist. The only temperature sensors on that SSD are temp1 and temp3.

Interesting. In that case

Guenter

Quoted 70 lines
Quoted 69 lines

Thanks,
Guenter

Quoted 65 lines
---
  drivers/nvme/host/hwmon.c | 3 ++-
  drivers/nvme/host/nvme.h  | 5 +++++
  drivers/nvme/host/pci.c   | 2 ++
  3 files changed, 9 insertions(+), 1 deletion(-)
drivers/nvme/host/hwmon.c +1 -1
index 9e6e56c20ec9..7a2c4b5e018c 100644
@@ -163,7 +163,8 @@ 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]

&&
+                    !(data->ctrl->quirks & NVME_QUIRK_NO_SECONDARY_TEMP_THRESH))) {
                        if (data->ctrl->quirks & NVME_QUIRK_NO_TEMP_THRESH_CHANGE) return 0444;

drivers/nvme/host/nvme.h +0 -0
index bf46f122e9e1..a2d4f59e0535 100644
@@ -149,6 +149,11 @@ enum nvme_quirks {
          * Reports garbage in the namespace identifiers (eui64,

nguid, uuid).
         */
        NVME_QUIRK_BOGUS_NID                    = (1 << 18),
+
+       /*
+        * No temperature thresholds for channels other than 0 (Composite).
+        */
+       NVME_QUIRK_NO_SECONDARY_TEMP_THRESH     = (1 << 19),
 };

 /*

drivers/nvme/host/pci.c +0 -0
index cd7873de3121..e457ad169dcb 100644
@@ -3416,6 +3416,8 @@ static const struct pci_device_id
 nvme_id_table[] = {
                 .driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, },
         { PCI_DEVICE(0x2646, 0x501E),   /* KINGSTON OM3PGP4xxxxQ

OS21011 NVMe SSD */
                .driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, },
+       { PCI_DEVICE(0x2646, 0x5013),   /* Kingston KC3000, Kingston FURY Renegade */
+               .driver_data = NVME_QUIRK_NO_SECONDARY_TEMP_THRESH, },
        { PCI_DEVICE(0x1f40, 0x1202),   /* Netac Technologies Co.
NV3000 NVMe SSD */
                .driver_data = NVME_QUIRK_BOGUS_NID, }, { PCI_DEVICE(0x1f40, 0x5236),   /* Netac Technologies Co.
NV7000 NVMe SSD */

Signature · 1 line
2.40.0