qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 08/11] QEMU NVMe: Enqueue critial temperature event


From: Keith Busch
Subject: [Qemu-devel] [PATCH 08/11] QEMU NVMe: Enqueue critial temperature event
Date: Tue, 26 Feb 2013 17:47:11 -0700

If the temperature threshold warning is set below the controller temperature,
enqueue the async event warning.

Signed-off-by: Keith Busch <address@hidden>
---
 hw/nvme.c |    9 +++++++++
 hw/nvme.h |    1 +
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/hw/nvme.c b/hw/nvme.c
index c65c179..3e5cfc0 100644
--- a/hw/nvme.c
+++ b/hw/nvme.c
@@ -792,6 +792,15 @@ static uint16_t nvme_set_feature(NvmeCtrl *n, NvmeCmd 
*cmd, NvmeRequest *req)
                 DMA_DIRECTION_TO_DEVICE);
     case NVME_TEMPERATURE_THRESHOLD:
         n->features.temp_thresh = dw11;
+        if (n->features.temp_thresh <= n->temperature && !n->temp_warn_issued) 
{
+            n->temp_warn_issued = 1;
+            nvme_enqueue_event(n, NVME_AER_TYPE_SMART,
+                    NVME_AER_INFO_SMART_TEMP_THRESH,
+                    NVME_LOG_SMART_INFO);
+        } else if (n->features.temp_thresh > n->temperature &&
+                !(n->aer_mask & 1 << NVME_AER_TYPE_SMART)) {
+            n->temp_warn_issued = 0;
+        }
         break;
     case NVME_ERROR_RECOVERY:
         n->features.err_rec = dw11;
diff --git a/hw/nvme.h b/hw/nvme.h
index 53c0f39..b7d6615 100644
--- a/hw/nvme.h
+++ b/hw/nvme.h
@@ -684,6 +684,7 @@ typedef struct NvmeCtrl {
     uint8_t     vwc;
     uint8_t     lba_index;
     uint8_t     outstanding_aers;
+    uint8_t     temp_warn_issued;
 
     NvmeErrorLog    *elpes;
     NvmeRequest     **aer_reqs;
-- 
1.7.0.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]