summary refs log tree commit diff stats
path: root/hw/nvme/ctrl.c
diff options
context:
space:
mode:
authorArun Kumar <arun.kka@samsung.com>2024-09-06 05:28:59 +0530
committerKlaus Jensen <k.jensen@samsung.com>2024-09-30 12:45:17 +0200
commit16eb2ea8ff736575ea5a8286b2a01933a6dba1b6 (patch)
tree316352bdc7c641771e1aafb3d20d0a03f15b6f59 /hw/nvme/ctrl.c
parent78ca36df42ffc7c06db7c388762d78d9d0339069 (diff)
downloadfocaccia-qemu-16eb2ea8ff736575ea5a8286b2a01933a6dba1b6.tar.gz
focaccia-qemu-16eb2ea8ff736575ea5a8286b2a01933a6dba1b6.zip
hw/nvme: clear masked events from the aer queue
Clear masked events from the aer queue when get log page is issued with
RAE 0 without checking for the presence of outstanding aer requests.

Signed-off-by: Arun Kumar <arun.kka@samsung.com>
[k.jensen: remove unnecessary QTAILQ_EMPTY check]
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
Diffstat (limited to 'hw/nvme/ctrl.c')
-rw-r--r--hw/nvme/ctrl.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index d5ea9ad653..a720dbc354 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -1649,9 +1649,16 @@ static void nvme_smart_event(NvmeCtrl *n, uint8_t event)
 
 static void nvme_clear_events(NvmeCtrl *n, uint8_t event_type)
 {
+    NvmeAsyncEvent *event, *next;
+
     n->aer_mask &= ~(1 << event_type);
-    if (!QTAILQ_EMPTY(&n->aer_queue)) {
-        nvme_process_aers(n);
+
+    QTAILQ_FOREACH_SAFE(event, &n->aer_queue, entry, next) {
+        if (event->result.event_type == event_type) {
+            QTAILQ_REMOVE(&n->aer_queue, event, entry);
+            n->aer_queued--;
+            g_free(event);
+        }
     }
 }