All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme-pci: add quirk for missing secondary temperature thresholds
@ 2023-04-25 19:58 Hristo Venev
  2023-04-25 23:39 ` Guenter Roeck
  2023-05-03 16:23 ` Christoph Hellwig
  0 siblings, 2 replies; 5+ messages in thread
From: Hristo Venev @ 2023-04-25 19:58 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg,
	linux-nvme, 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).

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

Signed-off-by: Hristo Venev <hristo@venev.name>
---
 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(-)

diff --git a/drivers/nvme/host/hwmon.c b/drivers/nvme/host/hwmon.c
index 9e6e56c20ec9..7a2c4b5e018c 100644
--- a/drivers/nvme/host/hwmon.c
+++ b/drivers/nvme/host/hwmon.c
@@ -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;
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index bf46f122e9e1..a2d4f59e0535 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -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),
 };
 
 /*
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index cd7873de3121..e457ad169dcb 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -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 */
-- 
2.40.0



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] nvme-pci: add quirk for missing secondary temperature thresholds
  2023-04-25 19:58 [PATCH] nvme-pci: add quirk for missing secondary temperature thresholds Hristo Venev
@ 2023-04-25 23:39 ` Guenter Roeck
  2023-04-26  5:57   ` Hristo Venev
  2023-05-03 16:23 ` Christoph Hellwig
  1 sibling, 1 reply; 5+ messages in thread
From: Guenter Roeck @ 2023-04-25 23:39 UTC (permalink / raw)
  To: Hristo Venev
  Cc: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg, linux-nvme

On Tue, Apr 25, 2023 at 10:58:54PM +0300, Hristo Venev wrote:
> 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.
> 

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

> Signed-off-by: Hristo Venev <hristo@venev.name>
> ---
>  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(-)
> 
> diff --git a/drivers/nvme/host/hwmon.c b/drivers/nvme/host/hwmon.c
> index 9e6e56c20ec9..7a2c4b5e018c 100644
> --- a/drivers/nvme/host/hwmon.c
> +++ b/drivers/nvme/host/hwmon.c
> @@ -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;
> diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
> index bf46f122e9e1..a2d4f59e0535 100644
> --- a/drivers/nvme/host/nvme.h
> +++ b/drivers/nvme/host/nvme.h
> @@ -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),
>  };
>  
>  /*
> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index cd7873de3121..e457ad169dcb 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -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 */
> -- 
> 2.40.0
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] nvme-pci: add quirk for missing secondary temperature thresholds
  2023-04-25 23:39 ` Guenter Roeck
@ 2023-04-26  5:57   ` Hristo Venev
  2023-04-26 13:44     ` Guenter Roeck
  0 siblings, 1 reply; 5+ messages in thread
From: Hristo Venev @ 2023-04-26  5:57 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg, linux-nvme

On Tue, 2023-04-25 at 16:39 -0700, Guenter Roeck wrote:
> On Tue, Apr 25, 2023 at 10:58:54PM +0300, Hristo Venev wrote:
> > 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.
> > 
> 
> 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.

> 
> Thanks,
> Guenter
> 
> > Signed-off-by: Hristo Venev <hristo@venev.name>
> > ---
> >  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(-)
> > 
> > diff --git a/drivers/nvme/host/hwmon.c b/drivers/nvme/host/hwmon.c
> > index 9e6e56c20ec9..7a2c4b5e018c 100644
> > --- a/drivers/nvme/host/hwmon.c
> > +++ b/drivers/nvme/host/hwmon.c
> > @@ -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;
> > diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
> > index bf46f122e9e1..a2d4f59e0535 100644
> > --- a/drivers/nvme/host/nvme.h
> > +++ b/drivers/nvme/host/nvme.h
> > @@ -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),
> >  };
> >  
> >  /*
> > diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> > index cd7873de3121..e457ad169dcb 100644
> > --- a/drivers/nvme/host/pci.c
> > +++ b/drivers/nvme/host/pci.c
> > @@ -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 */
> > -- 
> > 2.40.0
> > 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] nvme-pci: add quirk for missing secondary temperature thresholds
  2023-04-26  5:57   ` Hristo Venev
@ 2023-04-26 13:44     ` Guenter Roeck
  0 siblings, 0 replies; 5+ messages in thread
From: Guenter Roeck @ 2023-04-26 13:44 UTC (permalink / raw)
  To: Hristo Venev
  Cc: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg, linux-nvme

On 4/25/23 22:57, Hristo Venev wrote:
> On Tue, 2023-04-25 at 16:39 -0700, Guenter Roeck wrote:
>> On Tue, Apr 25, 2023 at 10:58:54PM +0300, Hristo Venev wrote:
>>> 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.
>>>
>>
>> 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.
> 

Interesting. In that case

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

Guenter

>>
>> Thanks,
>> Guenter
>>
>>> Signed-off-by: Hristo Venev <hristo@venev.name>
>>> ---
>>>   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(-)
>>>
>>> diff --git a/drivers/nvme/host/hwmon.c b/drivers/nvme/host/hwmon.c
>>> index 9e6e56c20ec9..7a2c4b5e018c 100644
>>> --- a/drivers/nvme/host/hwmon.c
>>> +++ b/drivers/nvme/host/hwmon.c
>>> @@ -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;
>>> diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
>>> index bf46f122e9e1..a2d4f59e0535 100644
>>> --- a/drivers/nvme/host/nvme.h
>>> +++ b/drivers/nvme/host/nvme.h
>>> @@ -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),
>>>   };
>>>   
>>>   /*
>>> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
>>> index cd7873de3121..e457ad169dcb 100644
>>> --- a/drivers/nvme/host/pci.c
>>> +++ b/drivers/nvme/host/pci.c
>>> @@ -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 */
>>> -- 
>>> 2.40.0
>>>
> 



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] nvme-pci: add quirk for missing secondary temperature thresholds
  2023-04-25 19:58 [PATCH] nvme-pci: add quirk for missing secondary temperature thresholds Hristo Venev
  2023-04-25 23:39 ` Guenter Roeck
@ 2023-05-03 16:23 ` Christoph Hellwig
  1 sibling, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2023-05-03 16:23 UTC (permalink / raw)
  To: Hristo Venev
  Cc: Guenter Roeck, Keith Busch, Jens Axboe, Christoph Hellwig,
	Sagi Grimberg, linux-nvme

Thanks,

applied to nvme-6.4.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-05-03 16:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-25 19:58 [PATCH] nvme-pci: add quirk for missing secondary temperature thresholds Hristo Venev
2023-04-25 23:39 ` Guenter Roeck
2023-04-26  5:57   ` Hristo Venev
2023-04-26 13:44     ` Guenter Roeck
2023-05-03 16:23 ` Christoph Hellwig

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.