diff mbox series

hw/nvme: fix smart aen

Message ID 20220506063649.13361-1-its@irrelevant.dk (mailing list archive)
State New, archived
Headers show
Series hw/nvme: fix smart aen | expand

Commit Message

Klaus Jensen May 6, 2022, 6:36 a.m. UTC
From: Klaus Jensen <k.jensen@samsung.com>

Pass the right constant to nvme_smart_event(). The NVME_AER* values hold
the bit position in the SMART byte, not the shifted value that we expect
it to be in nvme_smart_event().

Fixes: c62720f137df ("hw/block/nvme: trigger async event during injecting smart warning")
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
---
 hw/nvme/ctrl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

zhenwei pi May 6, 2022, 7:31 a.m. UTC | #1
On 5/6/22 14:36, Klaus Jensen wrote:
> From: Klaus Jensen <k.jensen@samsung.com>
> 
> Pass the right constant to nvme_smart_event(). The NVME_AER* values hold
> the bit position in the SMART byte, not the shifted value that we expect
> it to be in nvme_smart_event().
> 
> Fixes: c62720f137df ("hw/block/nvme: trigger async event during injecting smart warning")
> Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
> ---
>   hw/nvme/ctrl.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
> index 08574c4dcbc8..a2f6069f7fe1 100644
> --- a/hw/nvme/ctrl.c
> +++ b/hw/nvme/ctrl.c
> @@ -5325,7 +5325,7 @@ static uint16_t nvme_set_feature(NvmeCtrl *n, NvmeRequest *req)
>   
>           if ((n->temperature >= n->features.temp_thresh_hi) ||
>               (n->temperature <= n->features.temp_thresh_low)) {
> -            nvme_smart_event(n, NVME_AER_INFO_SMART_TEMP_THRESH);
> +            nvme_smart_event(n, NVME_SMART_TEMPERATURE);
>           }
>   
>           break;

It looks good to me.

Acked-by: zhenwei pi <pizhenwei@bytedance.com>
Klaus Jensen May 12, 2022, 5:39 a.m. UTC | #2
On May  6 08:36, Klaus Jensen wrote:
> From: Klaus Jensen <k.jensen@samsung.com>
> 
> Pass the right constant to nvme_smart_event(). The NVME_AER* values hold
> the bit position in the SMART byte, not the shifted value that we expect
> it to be in nvme_smart_event().
> 
> Fixes: c62720f137df ("hw/block/nvme: trigger async event during injecting smart warning")
> Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
> ---
>  hw/nvme/ctrl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
> index 08574c4dcbc8..a2f6069f7fe1 100644
> --- a/hw/nvme/ctrl.c
> +++ b/hw/nvme/ctrl.c
> @@ -5325,7 +5325,7 @@ static uint16_t nvme_set_feature(NvmeCtrl *n, NvmeRequest *req)
>  
>          if ((n->temperature >= n->features.temp_thresh_hi) ||
>              (n->temperature <= n->features.temp_thresh_low)) {
> -            nvme_smart_event(n, NVME_AER_INFO_SMART_TEMP_THRESH);
> +            nvme_smart_event(n, NVME_SMART_TEMPERATURE);
>          }
>  
>          break;
> -- 
> 2.36.0
> 

Applied to nvme-next.
diff mbox series

Patch

diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index 08574c4dcbc8..a2f6069f7fe1 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -5325,7 +5325,7 @@  static uint16_t nvme_set_feature(NvmeCtrl *n, NvmeRequest *req)
 
         if ((n->temperature >= n->features.temp_thresh_hi) ||
             (n->temperature <= n->features.temp_thresh_low)) {
-            nvme_smart_event(n, NVME_AER_INFO_SMART_TEMP_THRESH);
+            nvme_smart_event(n, NVME_SMART_TEMPERATURE);
         }
 
         break;