Skip to contentSkip to conversation

hw/nvme: fix smart aen

PATCH Applied Klaus Jensen 2 participants 3 messages May 6, 2022 – May 12, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/nvme: fix smart aen

From: Klaus Jensen <[email protected]>

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")
---
 hw/nvme/ctrl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/nvme/ctrl.c +1 -1
index 08574c4dcbc8..a2f6069f7fe1 100644
@@ -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;
Signature · 1 line
2.36.0
Acked-by on v1 1/1
#1 lore raw
Quoted 17 lines · Klaus Jensen

From: Klaus Jensen <[email protected]>

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")
---
  hw/nvme/ctrl.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/nvme/ctrl.c +0 -0
index 08574c4dcbc8..a2f6069f7fe1 100644

hw/nvme/ctrl.c static uint16_t nvme_set_feature(NvmeCtrl *n, NvmeRequest *req) · line 5331

Quoted 8 lines
hw/nvme/ctrl.c +1 -1
@@ -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.

Signature · 1 line
zhenwei pi
author Applied
#2 lore raw
In reply to Klaus Jensen
Quoted 28 lines · Klaus Jensen

From: Klaus Jensen <[email protected]>

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")
---
 hw/nvme/ctrl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/nvme/ctrl.c +1 -1
index 08574c4dcbc8..a2f6069f7fe1 100644
@@ -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;
Signature · 1 line
2.36.0

Applied to nvme-next.