summaryrefslogtreecommitdiffstats
path: root/hw/block/nvme.h
diff options
context:
space:
mode:
authorKlaus Jensen2020-07-06 08:12:53 +0200
committerKlaus Jensen2020-09-02 08:48:50 +0200
commit5d5a53302b95c50197d007407d24e2da3397926a (patch)
treeff0142aa35b225521425b1aff84fff8d6897e999 /hw/block/nvme.h
parenthw/block/nvme: add support for the get log page command (diff)
downloadqemu-5d5a53302b95c50197d007407d24e2da3397926a.tar.gz
qemu-5d5a53302b95c50197d007407d24e2da3397926a.tar.xz
qemu-5d5a53302b95c50197d007407d24e2da3397926a.zip
hw/block/nvme: add support for the asynchronous event request command
Add support for the Asynchronous Event Request command. Required for compliance with NVMe revision 1.3d. See NVM Express 1.3d, Section 5.2 ("Asynchronous Event Request command"). Mostly imported from Keith's qemu-nvme tree. Modified with a max number of queued events (controllable with the aer_max_queued device parameter). The spec states that the controller *should* retain events, so we do best effort here. Signed-off-by: Klaus Jensen <klaus.jensen@cnexlabs.com> Signed-off-by: Klaus Jensen <k.jensen@samsung.com> Acked-by: Keith Busch <kbusch@kernel.org> Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> Reviewed-by: Dmitry Fomichev <dmitry.fomichev@wdc.com> Message-Id: <20200706061303.246057-9-its@irrelevant.dk>
Diffstat (limited to 'hw/block/nvme.h')
-rw-r--r--hw/block/nvme.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/hw/block/nvme.h b/hw/block/nvme.h
index 8228978e93..1837233617 100644
--- a/hw/block/nvme.h
+++ b/hw/block/nvme.h
@@ -9,10 +9,12 @@ typedef struct NvmeParams {
uint32_t max_ioqpairs;
uint16_t msix_qsize;
uint32_t cmb_size_mb;
+ uint8_t aerl;
+ uint32_t aer_max_queued;
} NvmeParams;
typedef struct NvmeAsyncEvent {
- QSIMPLEQ_ENTRY(NvmeAsyncEvent) entry;
+ QTAILQ_ENTRY(NvmeAsyncEvent) entry;
NvmeAerResult result;
} NvmeAsyncEvent;
@@ -94,6 +96,7 @@ typedef struct NvmeCtrl {
uint32_t num_namespaces;
uint32_t max_q_ents;
uint64_t ns_size;
+ uint8_t outstanding_aers;
uint8_t *cmbuf;
uint32_t irq_status;
uint64_t host_timestamp; /* Timestamp sent by the host */
@@ -103,6 +106,11 @@ typedef struct NvmeCtrl {
HostMemoryBackend *pmrdev;
+ uint8_t aer_mask;
+ NvmeRequest **aer_reqs;
+ QTAILQ_HEAD(, NvmeAsyncEvent) aer_queue;
+ int aer_queued;
+
NvmeNamespace *namespaces;
NvmeSQueue **sq;
NvmeCQueue **cq;