Comments
Patch
@@ -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;
@@ -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;
If the temperature threshold warning is set below the controller temperature, enqueue the async event warning. Signed-off-by: Keith Busch <keith.busch@intel.com> --- hw/nvme.c | 9 +++++++++ hw/nvme.h | 1 + 2 files changed, 10 insertions(+), 0 deletions(-)