FEMU  原版 master 7e238cc
FEMU: Accurate, Scalable and Extensible NVMe SSD Emulator (FAST'18)
nvme.h
浏览该文件的文档.
1 #ifndef __FEMU_NVME_H
2 #define __FEMU_NVME_H
3 
10 #include "qemu/osdep.h"
11 #include "qemu/uuid.h"
12 #include "qemu/units.h"
13 #include "qemu/cutils.h"
14 #include "hw/pci/msix.h"
15 #include "hw/pci/msi.h"
16 #include "hw/virtio/vhost.h"
17 #include "qapi/error.h"
18 #include "sysemu/kvm.h"
19 
20 #include "backend/dram.h"
21 #include "inc/rte_ring.h"
22 #include "inc/pqueue.h"
23 #include "nand/nand.h"
24 #include "timing-model/timing.h"
25 
26 #define NVME_ID_NS_LBADS(ns) \
27  ((ns)->id_ns.lbaf[NVME_ID_NS_FLBAS_INDEX((ns)->id_ns.flbas)].lbads)
28 
29 #define NVME_ID_NS_LBADS_BYTES(ns) (1 << NVME_ID_NS_LBADS(ns))
30 
31 #define NVME_ID_NS_MS(ns) \
32  le16_to_cpu( \
33  ((ns)->id_ns.lbaf[NVME_ID_NS_FLBAS_INDEX((ns)->id_ns.flbas)].ms) \
34  )
35 
36 #define NVME_ID_NS_LBAF_DS(ns, lba_index) (ns->id_ns.lbaf[lba_index].lbads)
37 #define NVME_ID_NS_LBAF_MS(ns, lba_index) (ns->id_ns.lbaf[lba_index].ms)
38 
39 typedef struct NvmeBar {
40  uint64_t cap;
41  uint32_t vs;
42  uint32_t intms;
43  uint32_t intmc;
44  uint32_t cc;
45  uint32_t rsvd1;
46  uint32_t csts;
47  uint32_t nssrc;
48  uint32_t aqa;
49  uint64_t asq;
50  uint64_t acq;
51  uint32_t cmbloc;
52  uint32_t cmbsz;
53 } NvmeBar;
54 
66 };
67 
69  CAP_MQES_MASK = 0xffff,
70  CAP_CQR_MASK = 0x1,
71  CAP_AMS_MASK = 0x3,
72  CAP_TO_MASK = 0xff,
75  CAP_CSS_MASK = 0xff,
76  CAP_OC_MASK = 0x1,
79 };
80 
81 #define NVME_MAX_QS PCI_MSIX_FLAGS_QSIZE
82 #define NVME_MAX_QUEUE_ENTRIES 0xffff
83 #define NVME_MAX_STRIDE 12
84 #define NVME_MAX_NUM_NAMESPACES 256
85 #define NVME_MAX_QUEUE_ES 0xf
86 #define NVME_MIN_CQUEUE_ES 0x4
87 #define NVME_MIN_SQUEUE_ES 0x6
88 #define NVME_SPARE_THRESHOLD 20
89 #define NVME_TEMPERATURE 0x143
90 #define NVME_OP_ABORTED 0xff
91 
92 #define NVME_CAP_MQES(cap) (((cap) >> CAP_MQES_SHIFT) & CAP_MQES_MASK)
93 #define NVME_CAP_CQR(cap) (((cap) >> CAP_CQR_SHIFT) & CAP_CQR_MASK)
94 #define NVME_CAP_AMS(cap) (((cap) >> CAP_AMS_SHIFT) & CAP_AMS_MASK)
95 #define NVME_CAP_TO(cap) (((cap) >> CAP_TO_SHIFT) & CAP_TO_MASK)
96 #define NVME_CAP_DSTRD(cap) (((cap) >> CAP_DSTRD_SHIFT) & CAP_DSTRD_MASK)
97 #define NVME_CAP_NSSRS(cap) (((cap) >> CAP_NSSRS_SHIFT) & CAP_NSSRS_MASK)
98 #define NVME_CAP_CSS(cap) (((cap) >> CAP_CSS_SHIFT) & CAP_CSS_MASK)
99 #define NVME_CAP_OC12(cap) (((cap) >> CAP_Oc12SHIFT) & CAP_Oc12MASK)
100 #define NVME_CAP_MPSMIN(cap)(((cap) >> CAP_MPSMIN_SHIFT) & CAP_MPSMIN_MASK)
101 #define NVME_CAP_MPSMAX(cap)(((cap) >> CAP_MPSMAX_SHIFT) & CAP_MPSMAX_MASK)
102 
103 #define NVME_CAP_SET_MQES(cap, val) (cap |= (uint64_t)(val & CAP_MQES_MASK) \
104  << CAP_MQES_SHIFT)
105 #define NVME_CAP_SET_CQR(cap, val) (cap |= (uint64_t)(val & CAP_CQR_MASK) \
106  << CAP_CQR_SHIFT)
107 #define NVME_CAP_SET_AMS(cap, val) (cap |= (uint64_t)(val & CAP_AMS_MASK) \
108  << CAP_AMS_SHIFT)
109 #define NVME_CAP_SET_TO(cap, val) (cap |= (uint64_t)(val & CAP_TO_MASK) \
110  << CAP_TO_SHIFT)
111 #define NVME_CAP_SET_DSTRD(cap, val) (cap |= (uint64_t)(val & CAP_DSTRD_MASK) \
112  << CAP_DSTRD_SHIFT)
113 #define NVME_CAP_SET_NSSRS(cap, val) (cap |= (uint64_t)(val & CAP_NSSRS_MASK) \
114  << CAP_NSSRS_SHIFT)
115 #define NVME_CAP_SET_CSS(cap, val) (cap |= (uint64_t)(val & CAP_CSS_MASK) \
116  << CAP_CSS_SHIFT)
117 #define NVME_CAP_SET_OC(cap, val) (cap |= (uint64_t)(val & CAP_OC_MASK)\
118  << CAP_OC_SHIFT)
119 #define NVME_CAP_SET_MPSMIN(cap, val) (cap |= (uint64_t)(val & CAP_MPSMIN_MASK)\
120  << CAP_MPSMIN_SHIFT)
121 #define NVME_CAP_SET_MPSMAX(cap, val) (cap |= (uint64_t)(val & CAP_MPSMAX_MASK)\
122  << CAP_MPSMAX_SHIFT)
123 enum NvmeCsi {
124  NVME_CSI_NVM = 0x00,
126 };
127 
132 };
133 
142 };
143 
145  CC_EN_MASK = 0x1,
146  CC_CSS_MASK = 0x7,
147  CC_MPS_MASK = 0xf,
148  CC_AMS_MASK = 0x7,
149  CC_SHN_MASK = 0x3,
152 };
153 
154 #define NVME_CC_EN(cc) ((cc >> CC_EN_SHIFT) & CC_EN_MASK)
155 #define NVME_CC_CSS(cc) ((cc >> CC_CSS_SHIFT) & CC_CSS_MASK)
156 #define NVME_CC_MPS(cc) ((cc >> CC_MPS_SHIFT) & CC_MPS_MASK)
157 #define NVME_CC_AMS(cc) ((cc >> CC_AMS_SHIFT) & CC_AMS_MASK)
158 #define NVME_CC_SHN(cc) ((cc >> CC_SHN_SHIFT) & CC_SHN_MASK)
159 #define NVME_CC_IOSQES(cc) ((cc >> CC_IOSQES_SHIFT) & CC_IOSQES_MASK)
160 #define NVME_CC_IOCQES(cc) ((cc >> CC_IOCQES_SHIFT) & CC_IOCQES_MASK)
161 
162 enum NvmeCcCss {
166 };
167 
173 };
174 
180 };
181 
182 enum NvmeCsts {
189 };
190 
191 #define NVME_CSTS_RDY(csts) ((csts >> CSTS_RDY_SHIFT) & CSTS_RDY_MASK)
192 #define NVME_CSTS_CFS(csts) ((csts >> CSTS_CFS_SHIFT) & CSTS_CFS_MASK)
193 #define NVME_CSTS_SHST(csts) ((csts >> CSTS_SHST_SHIFT) & CSTS_SHST_MASK)
194 #define NVME_CSTS_NSSRO(csts) ((csts >> CSTS_NSSRO_SHIFT) & CSTS_NSSRO_MASK)
195 
199 };
200 
202  AQA_ASQS_MASK = 0xfff,
203  AQA_ACQS_MASK = 0xfff,
204 };
205 
206 #define NVME_AQA_ASQS(aqa) ((aqa >> AQA_ASQS_SHIFT) & AQA_ASQS_MASK)
207 #define NVME_AQA_ACQS(aqa) ((aqa >> AQA_ACQS_SHIFT) & AQA_ACQS_MASK)
208 
212 };
213 
216  CMBLOC_OFST_MASK = 0xfffff,
217 };
218 
219 #define NVME_CMBLOC_BIR(cmbloc) ((cmbloc >> CMBLOC_BIR_SHIFT) & CMBLOC_BIR_MASK)
220 #define NVME_CMBLOC_OFST(cmbloc)((cmbloc >> CMBLOC_OFST_SHIFT) & CMBLOC_OFST_MASK)
221 
222 #define NVME_CMBLOC_SET_BIR(cmbloc, val) (cmbloc |= (uint64_t)(val & CMBLOC_BIR_MASK) \
223  << CMBLOC_BIR_SHIFT)
224 #define NVME_CMBLOC_SET_OFST(cmbloc, val) (cmbloc |= (uint64_t)(val & CMBLOC_OFST_MASK) \
225  << CMBLOC_OFST_SHIFT)
234 };
235 
243  CMBSZ_SZ_MASK = 0xfffff,
244 };
245 
246 #define NVME_CMBSZ_SQS(cmbsz) ((cmbsz >> CMBSZ_SQS_SHIFT) & CMBSZ_SQS_MASK)
247 #define NVME_CMBSZ_CQS(cmbsz) ((cmbsz >> CMBSZ_CQS_SHIFT) & CMBSZ_CQS_MASK)
248 #define NVME_CMBSZ_LISTS(cmbsz)((cmbsz >> CMBSZ_LISTS_SHIFT) & CMBSZ_LISTS_MASK)
249 #define NVME_CMBSZ_RDS(cmbsz) ((cmbsz >> CMBSZ_RDS_SHIFT) & CMBSZ_RDS_MASK)
250 #define NVME_CMBSZ_WDS(cmbsz) ((cmbsz >> CMBSZ_WDS_SHIFT) & CMBSZ_WDS_MASK)
251 #define NVME_CMBSZ_SZU(cmbsz) ((cmbsz >> CMBSZ_SZU_SHIFT) & CMBSZ_SZU_MASK)
252 #define NVME_CMBSZ_SZ(cmbsz) ((cmbsz >> CMBSZ_SZ_SHIFT) & CMBSZ_SZ_MASK)
253 
254 #define NVME_CMBSZ_SET_SQS(cmbsz, val) (cmbsz |= (uint64_t)(val & CMBSZ_SQS_MASK) \
255  << CMBSZ_SQS_SHIFT)
256 #define NVME_CMBSZ_SET_CQS(cmbsz, val) (cmbsz |= (uint64_t)(val & CMBSZ_CQS_MASK) \
257  << CMBSZ_CQS_SHIFT)
258 #define NVME_CMBSZ_SET_LISTS(cmbsz, val) (cmbsz |= (uint64_t)(val & CMBSZ_LISTS_MASK) \
259  << CMBSZ_LISTS_SHIFT)
260 #define NVME_CMBSZ_SET_RDS(cmbsz, val) (cmbsz |= (uint64_t)(val & CMBSZ_RDS_MASK) \
261  << CMBSZ_RDS_SHIFT)
262 #define NVME_CMBSZ_SET_WDS(cmbsz, val) (cmbsz |= (uint64_t)(val & CMBSZ_WDS_MASK) \
263  << CMBSZ_WDS_SHIFT)
264 #define NVME_CMBSZ_SET_SZU(cmbsz, val) (cmbsz |= (uint64_t)(val & CMBSZ_SZU_MASK) \
265  << CMBSZ_SZU_SHIFT)
266 #define NVME_CMBSZ_SET_SZ(cmbsz, val) (cmbsz |= (uint64_t)(val & CMBSZ_SZ_MASK) \
267  << CMBSZ_SZ_SHIFT)
268 
269 #define NVME_CMBSZ_GETSIZE(cmbsz) (NVME_CMBSZ_SZ(cmbsz) * (1<<(12+4*NVME_CMBSZ_SZU(cmbsz))))
270 
271 typedef struct QEMU_PACKED NvmeSglDescriptor {
272  uint64_t addr;
273  uint32_t len;
274  uint8_t rsvd[3];
275  uint8_t type;
277 
278 #define NVME_SGL_TYPE(type) ((type >> 4) & 0xf)
279 #define NVME_SGL_SUBTYPE(type) (type & 0xf)
280 
281 typedef union NvmeCmdDptr {
282  struct {
283  uint64_t prp1;
284  uint64_t prp2;
285  };
286 
288 } NvmeCmdDptr;
289 
290 enum NvmePsdt {
294 };
295 
296 typedef struct NvmeCmd {
297  uint16_t opcode : 8;
298  uint16_t fuse : 2;
299  uint16_t res1 : 4;
300  uint16_t psdt : 2;
301  uint16_t cid;
302  uint32_t nsid;
303  uint64_t res2;
304  uint64_t mptr;
306  uint32_t cdw10;
307  uint32_t cdw11;
308  uint32_t cdw12;
309  uint32_t cdw13;
310  uint32_t cdw14;
311  uint32_t cdw15;
312 } NvmeCmd;
313 
314 #define NVME_CMD_FLAGS_FUSE(flags) (flags & 0x3)
315 #define NVME_CMD_FLAGS_PSDT(flags) ((flags >> 6) & 0x3)
316 
336 };
337 
345  NVME_CMD_DSM = 0x09,
352 };
353 
354 typedef struct NvmeDeleteQ {
355  uint8_t opcode;
356  uint8_t flags;
357  uint16_t cid;
358  uint32_t rsvd1[9];
359  uint16_t qid;
360  uint16_t rsvd10;
361  uint32_t rsvd11[5];
362 } NvmeDeleteQ;
363 
364 typedef struct NvmeCreateCq {
365  uint8_t opcode;
366  uint8_t flags;
367  uint16_t cid;
368  uint32_t rsvd1[5];
369  uint64_t prp1;
370  uint64_t rsvd8;
371  uint16_t cqid;
372  uint16_t qsize;
373  uint16_t cq_flags;
374  uint16_t irq_vector;
375  uint32_t rsvd12[4];
376 } NvmeCreateCq;
377 
378 #define NVME_CQ_FLAGS_PC(cq_flags) (cq_flags & 0x1)
379 #define NVME_CQ_FLAGS_IEN(cq_flags) ((cq_flags >> 1) & 0x1)
380 
381 typedef struct NvmeCreateSq {
382  uint8_t opcode;
383  uint8_t flags;
384  uint16_t cid;
385  uint32_t rsvd1[5];
386  uint64_t prp1;
387  uint64_t rsvd8;
388  uint16_t sqid;
389  uint16_t qsize;
390  uint16_t sq_flags;
391  uint16_t cqid;
392  uint32_t rsvd12[4];
393 } NvmeCreateSq;
394 
395 #define NVME_SQ_FLAGS_PC(sq_flags) (sq_flags & 0x1)
396 #define NVME_SQ_FLAGS_QPRIO(sq_flags) ((sq_flags >> 1) & 0x3)
397 
404 };
405 
406 typedef struct NvmeIdentity {
407  uint8_t opcode;
408  uint8_t flags;
409  uint16_t cid;
410  uint32_t nsid;
411  uint64_t rsvd2[2];
412  uint64_t prp1;
413  uint64_t prp2;
414  uint32_t cns;
415  uint16_t nvmsetid;
416  uint8_t rsvd11;
417  uint8_t csi;
418  uint32_t rsvd12[4];
419 } NvmeIdentify;
420 
421 typedef struct NvmeRwCmd {
422  uint8_t opcode;
423  uint8_t flags;
424  uint16_t cid;
425  uint32_t nsid;
426  uint64_t rsvd2;
427  uint64_t mptr;
428  uint64_t prp1;
429  uint64_t prp2;
430  uint64_t slba;
431  uint16_t nlb;
432  uint16_t control;
433  uint32_t dsmgmt;
434  uint32_t reftag;
435  uint16_t apptag;
436  uint16_t appmask;
437 } NvmeRwCmd;
438 
439 enum {
440  NVME_RW_LR = 1 << 15,
441  NVME_RW_FUA = 1 << 14,
461 };
462 
463 typedef struct NvmeDsmCmd {
464  uint8_t opcode;
465  uint8_t flags;
466  uint16_t cid;
467  uint32_t nsid;
468  uint64_t rsvd2[2];
469  uint64_t prp1;
470  uint64_t prp2;
471  uint32_t nr;
472  uint32_t attributes;
473  uint32_t rsvd12[4];
474 } NvmeDsmCmd;
475 
476 enum {
477  NVME_DSMGMT_IDR = 1 << 0,
478  NVME_DSMGMT_IDW = 1 << 1,
479  NVME_DSMGMT_AD = 1 << 2,
480 };
481 
482 typedef struct NvmeDsmRange {
483  uint32_t cattr;
484  uint32_t nlb;
485  uint64_t slba;
486 } NvmeDsmRange;
487 
502 };
503 
504 typedef struct NvmeAerResult {
505  uint8_t event_type;
506  uint8_t event_info;
507  uint8_t log_page;
508  uint8_t resv;
509 } NvmeAerResult;
510 
511 typedef struct NvmeCqe {
512  union {
513  struct {
514  uint32_t result;
515  uint32_t rsvd;
516  } n;
517  uint64_t res64;
518  };
519  uint16_t sq_head;
520  uint16_t sq_id;
521  uint16_t cid;
522  uint16_t status;
523 } NvmeCqe;
524 
526  NVME_SUCCESS = 0x0000,
540  NVME_LBA_RANGE = 0x0080,
548  NVME_RESERVED = 0x0104,
564  NVME_ZONE_FULL = 0x01b9,
579  NVME_DULB = 0x0287,
580  NVME_MORE = 0x2000,
581  NVME_DNR = 0x4000,
583 };
584 
585 #define NVME_SET_CSI(vec, csi) (vec |= (uint8_t)(1 << (csi)))
586 
587 typedef struct NvmeFwSlotInfoLog {
588  uint8_t afi;
589  uint8_t reserved1[7];
590  uint8_t frs1[8];
591  uint8_t frs2[8];
592  uint8_t frs3[8];
593  uint8_t frs4[8];
594  uint8_t frs5[8];
595  uint8_t frs6[8];
596  uint8_t frs7[8];
597  uint8_t reserved2[448];
599 
600 typedef struct NvmeErrorLog {
601  uint64_t error_count;
602  uint16_t sqid;
603  uint16_t cid;
604  uint16_t status_field;
606  uint64_t lba;
607  uint32_t nsid;
608  uint8_t vs;
609  uint8_t resv[35];
610 } NvmeErrorLog;
611 
612 typedef struct NvmeSmartLog {
614  uint8_t temperature[2];
618  uint8_t reserved1[26];
619  uint64_t data_units_read[2];
620  uint64_t data_units_written[2];
621  uint64_t host_read_commands[2];
622  uint64_t host_write_commands[2];
623  uint64_t controller_busy_time[2];
624  uint64_t power_cycles[2];
625  uint64_t power_on_hours[2];
626  uint64_t unsafe_shutdowns[2];
627  uint64_t media_errors[2];
629  uint8_t reserved2[320];
630 } NvmeSmartLog;
631 
638 };
639 
640 typedef struct NvmeEffectsLog {
641  uint32_t acs[256];
642  uint32_t iocs[256];
643  uint8_t resv[2048];
645 
646 enum {
654 };
655 
661 };
662 
663 typedef struct NvmePSD {
664  uint16_t mp;
665  uint16_t reserved;
666  uint32_t enlat;
667  uint32_t exlat;
668  uint8_t rrt;
669  uint8_t rrl;
670  uint8_t rwt;
671  uint8_t rwl;
672  uint8_t resv[16];
673 } NvmePSD;
674 
675 #define NVME_IDENTIFY_DATA_SIZE 4096
676 
677 enum NvmeIdCns {
690 };
691 
692 typedef struct QEMU_PACKED NvmeIdCtrl {
693  uint16_t vid;
694  uint16_t ssvid;
695  uint8_t sn[20];
696  uint8_t mn[40];
697  uint8_t fr[8];
698  uint8_t rab;
699  uint8_t ieee[3];
700  uint8_t cmic;
701  uint8_t mdts;
702  uint16_t cntlid;
703  uint32_t ver;
704  uint32_t rtd3r;
705  uint32_t rtd3e;
706  uint32_t oaes;
707  uint32_t ctratt;
708  uint8_t rsvd100[12];
709  uint8_t fguid[16];
710  uint8_t rsvd128[128];
711  uint16_t oacs;
712  uint8_t acl;
713  uint8_t aerl;
714  uint8_t frmw;
715  uint8_t lpa;
716  uint8_t elpe;
717  uint8_t npss;
718  uint8_t avscc;
719  uint8_t apsta;
720  uint16_t wctemp;
721  uint16_t cctemp;
722  uint16_t mtfa;
723  uint32_t hmpre;
724  uint32_t hmmin;
725  uint8_t tnvmcap[16];
726  uint8_t unvmcap[16];
727  uint32_t rpmbs;
728  uint16_t edstt;
729  uint8_t dsto;
730  uint8_t fwug;
731  uint16_t kas;
732  uint16_t hctma;
733  uint16_t mntmt;
734  uint16_t mxtmt;
735  uint32_t sanicap;
736  uint8_t rsvd332[180];
737  uint8_t sqes;
738  uint8_t cqes;
739  uint16_t maxcmd;
740  uint32_t nn;
741  uint16_t oncs;
742  uint16_t fuses;
743  uint8_t fna;
744  uint8_t vwc;
745  uint16_t awun;
746  uint16_t awupf;
747  uint8_t nvscc;
748  uint8_t rsvd531;
749  uint16_t acwu;
750  uint8_t rsvd534[2];
751  uint32_t sgls;
752  uint8_t rsvd540[228];
753  uint8_t subnqn[256];
754  uint8_t rsvd1024[1024];
755  NvmePSD psd[32];
756  uint8_t vs[1024];
757 } NvmeIdCtrl;
758 
762  NVME_OACS_FW = 1 << 2,
764  NVME_OACS_DBBUF = 1 << 8,
765 };
766 
770  NVME_ONCS_DSM = 1 << 2,
774 };
775 
778 };
779 
782  NVME_LPA_CSE = 1 << 1,
784 };
785 
786 #define NVME_CTRL_SQES_MIN(sqes) ((sqes) & 0xf)
787 #define NVME_CTRL_SQES_MAX(sqes) (((sqes) >> 4) & 0xf)
788 #define NVME_CTRL_CQES_MIN(cqes) ((cqes) & 0xf)
789 #define NVME_CTRL_CQES_MAX(cqes) (((cqes) >> 4) & 0xf)
790 
791 typedef struct NvmeFeatureVal {
792  uint32_t arbitration;
793  uint32_t power_mgmt;
794  uint32_t temp_thresh;
795  uint32_t err_rec;
796  uint32_t volatile_wc;
797  uint32_t num_io_queues;
798  uint32_t int_coalescing;
799  uint32_t *int_vector_config;
800  uint32_t write_atomicity;
801  uint32_t async_config;
802  uint32_t sw_prog_marker;
804 
805 #define NVME_ARB_AB(arb) (arb & 0x7)
806 #define NVME_ARB_LPW(arb) ((arb >> 8) & 0xff)
807 #define NVME_ARB_MPW(arb) ((arb >> 16) & 0xff)
808 #define NVME_ARB_HPW(arb) ((arb >> 24) & 0xff)
809 
810 #define NVME_INTC_THR(intc) (intc & 0xff)
811 #define NVME_INTC_TIME(intc) ((intc >> 8) & 0xff)
812 
813 #define NVME_ERR_REC_DULBE(err_rec) (err_rec & 0x10000)
814 
829  NVME_FID_MAX = 0x100
830 };
831 
832 typedef enum NvmeFeatureCap {
837 
838 typedef enum NvmeGetFeatureSelect {
844 
845 typedef struct NvmeRangeType {
846  uint8_t type;
847  uint8_t attributes;
848  uint8_t rsvd2[14];
849  uint64_t slba;
850  uint64_t nlb;
851  uint8_t guid[16];
852  uint8_t rsvd48[16];
853 } NvmeRangeType;
854 
855 typedef struct NvmeLBAF {
856  uint16_t ms;
857  uint8_t lbads;
858  uint8_t rp;
859 } NvmeLBAF;
860 
861 #define NVME_NSID_BROADCAST 0xffffffff
862 
863 typedef struct NvmeIdNs {
864  uint64_t nsze;
865  uint64_t ncap;
866  uint64_t nuse;
867  uint8_t nsfeat;
868  uint8_t nlbaf;
869  uint8_t flbas;
870  uint8_t mc;
871  uint8_t dpc;
872  uint8_t dps;
873  uint8_t nmic;
874  uint8_t rescap;
875  uint8_t fpi;
876  uint8_t dlfeat;
877  uint16_t nawun;
878  uint16_t nawupf;
879  uint16_t nacwu;
880  uint16_t nabsn;
881  uint16_t nabo;
882  uint16_t nabspf;
883  uint16_t noiob;
884  uint8_t nvmcap[16];
885  uint16_t npwg;
886  uint16_t npwa;
887  uint16_t npdg;
888  uint16_t npda;
889  uint16_t nows;
890  uint8_t rsvd74[30];
891  uint8_t nguid[16];
892  uint64_t eui64;
894  uint8_t rsvd192[192];
895  uint8_t vs[3712];
896 } NvmeIdNs;
897 
898 typedef struct QEMU_PACKED NvmeIdNsDescr {
899  uint8_t nidt;
900  uint8_t nidl;
901  uint8_t rsvd2[2];
902 } NvmeIdNsDescr;
903 
909 };
910 
916 };
917 
918 #define NVME_ID_NS_NSFEAT_THIN(nsfeat) ((nsfeat & 0x1))
919 #define NVME_ID_NS_FLBAS_EXTENDED(flbas) ((flbas >> 4) & 0x1)
920 #define NVME_ID_NS_FLBAS_INDEX(flbas) ((flbas & 0xf))
921 #define NVME_ID_NS_MC_SEPARATE(mc) ((mc >> 1) & 0x1)
922 #define NVME_ID_NS_MC_EXTENDED(mc) ((mc & 0x1))
923 #define NVME_ID_NS_DPC_LAST_EIGHT(dpc) ((dpc >> 4) & 0x1)
924 #define NVME_ID_NS_DPC_FIRST_EIGHT(dpc) ((dpc >> 3) & 0x1)
925 #define NVME_ID_NS_DPC_TYPE_3(dpc) ((dpc >> 2) & 0x1)
926 #define NVME_ID_NS_DPC_TYPE_2(dpc) ((dpc >> 1) & 0x1)
927 #define NVME_ID_NS_DPC_TYPE_1(dpc) ((dpc & 0x1))
928 #define NVME_ID_NS_DPC_TYPE_MASK 0x7
929 
937 };
938 
939 static inline void nvme_check_size(void)
940 {
941  QEMU_BUILD_BUG_ON(sizeof(NvmeAerResult) != 4);
942  QEMU_BUILD_BUG_ON(sizeof(NvmeCqe) != 16);
943  QEMU_BUILD_BUG_ON(sizeof(NvmeDsmRange) != 16);
944  QEMU_BUILD_BUG_ON(sizeof(NvmeCmd) != 64);
945  QEMU_BUILD_BUG_ON(sizeof(NvmeDeleteQ) != 64);
946  QEMU_BUILD_BUG_ON(sizeof(NvmeCreateCq) != 64);
947  QEMU_BUILD_BUG_ON(sizeof(NvmeCreateSq) != 64);
948  QEMU_BUILD_BUG_ON(sizeof(NvmeIdentify) != 64);
949  QEMU_BUILD_BUG_ON(sizeof(NvmeRwCmd) != 64);
950  QEMU_BUILD_BUG_ON(sizeof(NvmeDsmCmd) != 64);
951  QEMU_BUILD_BUG_ON(sizeof(NvmeRangeType) != 64);
952  QEMU_BUILD_BUG_ON(sizeof(NvmeErrorLog) != 64);
953  QEMU_BUILD_BUG_ON(sizeof(NvmeFwSlotInfoLog) != 512);
954  QEMU_BUILD_BUG_ON(sizeof(NvmeSmartLog) != 512);
955  QEMU_BUILD_BUG_ON(sizeof(NvmeIdCtrl) != 4096);
956  QEMU_BUILD_BUG_ON(sizeof(NvmeIdNs) != 4096);
957 
958  /* Coperd: FIXME, check FEMU OC structure size */
959  //oc12_check_size();
960 }
961 
962 typedef struct NvmeAsyncEvent {
966 
967 typedef struct NvmeRequest {
968  struct NvmeSQueue *sq;
969  struct NvmeCQueue *cq;
970  struct NvmeNamespace *ns;
971  uint16_t status;
972  uint64_t slba;
973  uint16_t is_write;
974  uint16_t nlb;
975  uint16_t ctrl;
976  uint64_t meta_size;
977  uint64_t mptr;
978  void *meta_buf;
979  uint64_t oc12_slba;
980  uint64_t *oc12_ppa_list;
983  uint8_t cmd_opcode;
984  QEMUSGList qsg;
985  QEMUIOVector iov;
987  int64_t stime;
988  int64_t reqlat;
989  int64_t gcrt;
990  int64_t expire_time;
991 
992  /* OC2.0: sector offset relative to slba where reads become invalid */
993  uint64_t predef;
994 
995  /* ZNS */
996  void *opaque;
997 
998  /* position in the priority queue for delay emulation */
999  size_t pos;
1000 } NvmeRequest;
1001 
1002 typedef struct DMAOff {
1003  QEMUSGList *qsg;
1004  int ndx;
1005  dma_addr_t ptr;
1006  dma_addr_t len;
1007 } DMAOff;
1008 
1009 typedef struct NvmeSQueue {
1010  struct FemuCtrl *ctrl;
1011  uint8_t phys_contig;
1012  uint8_t arb_burst;
1013  uint16_t sqid;
1014  uint16_t cqid;
1015  uint32_t head;
1016  uint32_t tail;
1017  uint32_t size;
1018  uint64_t dma_addr;
1019  uint64_t dma_addr_hva;
1020  uint64_t completed;
1021  uint64_t *prp_list;
1023  QTAILQ_HEAD(sq_req_list, NvmeRequest) req_list;
1024  QTAILQ_HEAD(out_req_list, NvmeRequest) out_req_list;
1025  QTAILQ_ENTRY(NvmeSQueue) entry;
1026 
1027  uint64_t db_addr;
1028  uint64_t db_addr_hva;
1029  uint64_t eventidx_addr;
1032 } NvmeSQueue;
1033 
1034 typedef struct NvmeCQueue {
1035  struct FemuCtrl *ctrl;
1036  uint8_t phys_contig;
1037  uint8_t phase;
1038  uint16_t cqid;
1039  uint16_t irq_enabled;
1040  uint32_t head;
1041  uint32_t tail;
1042  int32_t virq;
1043  uint32_t vector;
1044  uint32_t size;
1045  uint64_t dma_addr;
1046  uint64_t dma_addr_hva;
1047  uint64_t *prp_list;
1048  EventNotifier guest_notifier;
1049  QEMUTimer *timer;
1050  QTAILQ_HEAD(sq_list, NvmeSQueue) sq_list;
1051  QTAILQ_HEAD(cq_req_list, NvmeRequest) req_list;
1052  uint64_t db_addr;
1053  uint64_t db_addr_hva;
1054  uint64_t eventidx_addr;
1057 } NvmeCQueue;
1058 
1059 typedef struct Oc12Bbt Oc12Bbt;
1060 typedef struct Oc12Ctrl Oc12Ctrl;
1061 
1063 typedef struct NvmeZone NvmeZone;
1064 
1065 typedef struct NvmeNamespace {
1066  struct FemuCtrl *ctrl;
1069  unsigned long *util;
1070  unsigned long *uncorrectable;
1071  uint32_t id;
1072  uint64_t size; /* Coperd: for ZNS, FIXME */
1073  uint64_t ns_blks;
1074  uint64_t start_block;
1077  uint32_t tbl_entries;
1078  uint64_t *tbl;
1080 
1081  /* Coperd: OC20 */
1082  struct {
1083  uint64_t begin;
1084  uint64_t predef;
1085  uint64_t data;
1086  uint64_t meta;
1087  } blk;
1088 
1089  void *state;
1090 } NvmeNamespace;
1091 
1092 #define TYPE_NVME "femu"
1093 #define FEMU(obj) OBJECT_CHECK(FemuCtrl, (obj), TYPE_NVME)
1094 
1095 /* Coperd: OC2.0 */
1096 typedef struct Oc20Params {
1097  /* qemu configurable device characteristics */
1098  uint32_t mccap;
1099  uint32_t ws_min;
1100  uint32_t ws_opt;
1101  uint32_t mw_cunits;
1102 
1103  uint8_t debug;
1104  uint8_t early_reset;
1105  uint8_t sgl_lbal;
1106 
1110 } Oc20Params;
1111 
1112 typedef struct NvmeParams {
1113  char *serial;
1114  uint32_t num_namespaces;
1115  uint32_t num_queues;
1116  uint32_t max_q_ents;
1117  uint8_t max_sqes;
1118  uint8_t max_cqes;
1119  uint8_t db_stride;
1120  uint8_t aerl;
1121  uint8_t acl;
1122  uint8_t elpe;
1123  uint8_t mdts;
1124  uint8_t cqr;
1125  uint8_t vwc;
1126  uint8_t dpc;
1127  uint8_t dps;
1128  uint8_t intc;
1129  uint8_t intc_thresh;
1130  uint8_t intc_time;
1131  uint8_t extended;
1132  uint8_t mpsmin;
1133  uint8_t mpsmax;
1134  uint8_t ms;
1135  uint8_t ms_max;
1136  uint8_t mc;
1137  uint16_t vid;
1138  uint16_t did;
1139  uint8_t dlfeat;
1140  uint32_t cmb_size_mb;
1141  uint8_t dialect;
1142  uint16_t oacs;
1143  uint16_t oncs;
1144 
1145  /* dialects */
1147 } NvmeParams;
1148 
1149 /* do NOT go beyound 256 (uint8_t) */
1150 #define FEMU_MAX_NUM_CHNLS (32)
1151 #define FEMU_MAX_NUM_CHIPS (128)
1152 
1153 typedef struct OcCtrlParams {
1154  uint16_t sec_size;
1155  uint8_t secs_per_pg;
1156  uint16_t pgs_per_blk;
1158  uint8_t num_ch;
1159  uint8_t num_lun;
1160  uint8_t num_pln;
1161  uint16_t sos;
1162 } OcCtrlParams;
1163 
1164 struct FemuCtrl;
1169 typedef struct FemuExtCtrlOps {
1170  void *state;
1171  void (*init)(struct FemuCtrl *, Error **);
1172  void (*exit)(struct FemuCtrl *);
1173  uint16_t (*rw_check_req)(struct FemuCtrl *, NvmeCmd *, NvmeRequest *);
1174  int (*start_ctrl)(struct FemuCtrl *);
1175  uint16_t (*admin_cmd)(struct FemuCtrl *, NvmeCmd *);
1176  uint16_t (*io_cmd)(struct FemuCtrl *, NvmeNamespace *, NvmeCmd *, NvmeRequest *);
1177  uint16_t (*get_log)(struct FemuCtrl *, NvmeCmd *);
1178 } FemuExtCtrlOps;
1179 
1184 typedef struct FemuCtrl {
1185  PCIDevice parent_obj;
1186  MemoryRegion iomem;
1187  MemoryRegion ctrl_mem;
1189 
1190  /* Coperd: ZNS FIXME */
1191  QemuUUID uuid;
1192  uint32_t zasl_bs;
1193  uint8_t zasl;
1194  bool zoned;
1196  uint64_t zone_size_bs;
1199  uint32_t max_open_zones;
1201 
1202  const uint32_t *iocs;
1203  uint8_t csi;
1206  QTAILQ_HEAD(, NvmeZone) exp_open_zones;
1207  QTAILQ_HEAD(, NvmeZone) imp_open_zones;
1208  QTAILQ_HEAD(, NvmeZone) closed_zones;
1209  QTAILQ_HEAD(, NvmeZone) full_zones;
1210  uint32_t num_zones;
1211  uint64_t zone_size;
1212  uint64_t zone_capacity;
1213  uint32_t zone_size_log2;
1214  uint8_t *zd_extensions;
1215  int32_t nr_open_zones;
1217 
1218  /* Coperd: OC2.0 FIXME */
1221 
1222  time_t start_time;
1223  uint16_t temperature;
1224  uint16_t page_size;
1225  uint16_t page_bits;
1226  uint16_t max_prp_ents;
1227  uint16_t cqe_size;
1228  uint16_t sqe_size;
1229  uint16_t oacs;
1230  uint16_t oncs;
1231  uint32_t reg_size;
1232  uint32_t num_namespaces;
1233  uint32_t num_io_queues;
1234  uint32_t max_q_ents;
1235  uint64_t ns_size;
1236  uint8_t db_stride;
1237  uint8_t aerl;
1238  uint8_t acl;
1239  uint8_t elpe;
1240  uint8_t elp_index;
1241  uint8_t error_count;
1242  uint8_t mdts;
1243  uint8_t cqr;
1244  uint8_t max_sqes;
1245  uint8_t max_cqes;
1246  uint8_t meta;
1247  uint8_t vwc;
1248  uint8_t mc;
1249  uint8_t dpc;
1250  uint8_t dps;
1251  uint8_t nlbaf;
1252  uint8_t extended;
1253  uint8_t lba_index;
1254  uint8_t mpsmin;
1255  uint8_t mpsmax;
1256  uint8_t ms;
1257  uint8_t ms_max;
1258  uint8_t intc;
1259  uint8_t intc_thresh;
1260  uint8_t intc_time;
1263  uint8_t num_errors;
1264  uint8_t cqes_pending;
1265  uint16_t vid;
1266  uint16_t did;
1267  uint8_t dlfeat;
1268  uint32_t cmbsz;
1269  uint32_t cmbloc;
1270  uint8_t *cmbuf;
1271 
1272  QemuThread *poller;
1275 
1276  char *serial;
1286 
1287  QSIMPLEQ_HEAD(aer_queue, NvmeAsyncEvent) aer_queue;
1288  QEMUTimer *aer_timer;
1289  uint8_t aer_mask;
1290 
1291  uint64_t dbs_addr;
1292  uint64_t eis_addr;
1293  uint64_t dbs_addr_hva;
1294  uint64_t eis_addr_hva;
1295 
1296  uint8_t femu_mode;
1297  uint8_t lver; /* Coperd: OCSSD version, 0x1 -> OC1.2, 0x2 -> OC2.0 */
1298  uint32_t memsz;
1300 
1303  pthread_spinlock_t chip_locks[FEMU_MAX_NUM_CHIPS];
1305  pthread_spinlock_t chnl_locks[FEMU_MAX_NUM_CHNLS];
1306 
1307  /* Latency numbers for whitebox-mode only */
1308  int64_t upg_rd_lat_ns;
1309  int64_t cpg_rd_lat_ns;
1310  int64_t cupg_rd_lat_ns;
1311  int64_t clpg_rd_lat_ns;
1312  int64_t lpg_rd_lat_ns;
1313  int64_t upg_wr_lat_ns;
1314  int64_t cpg_wr_lat_ns;
1317  int64_t lpg_wr_lat_ns;
1318  int64_t blk_er_lat_ns;
1320 
1321  struct ssd *ssd;
1324 
1325  char devname[64];
1326  struct rte_ring **to_ftl;
1327  struct rte_ring **to_poller;
1329  bool *should_isr;
1331 
1332  int64_t nr_tt_ios;
1333  int64_t nr_tt_late_ios;
1335 
1337  uint32_t num_poller;
1338 
1339  uint8_t flash_type;
1340 } FemuCtrl;
1341 
1344  int index;
1346 
1347 typedef struct NvmeDifTuple {
1348  uint16_t guard_tag;
1349  uint16_t app_tag;
1350  uint32_t ref_tag;
1351 } NvmeDifTuple;
1352 
1353 #define SQ_POLLING_PERIOD_NS (5000)
1354 #define CQ_POLLING_PERIOD_NS (5000)
1355 #define FEMU_MAX_INF_REQS (65536)
1356 
1357 enum {
1364 };
1365 
1366 enum {
1367  OCSSD12 = 0x1,
1368  OCSSD20 = 0x2,
1369 };
1370 
1374 };
1375 
1376 static inline bool OCSSD(FemuCtrl *n)
1377 {
1378  return (n->femu_mode == FEMU_OCSSD_MODE);
1379 }
1380 
1381 static inline bool BBSSD(FemuCtrl *n)
1382 {
1383  return (n->femu_mode == FEMU_BBSSD_MODE);
1384 }
1385 
1386 static inline bool NOSSD(FemuCtrl *n)
1387 {
1388  return (n->femu_mode == FEMU_NOSSD_MODE);
1389 }
1390 
1391 static inline bool ZNSSD(FemuCtrl *n)
1392 {
1393  return (n->femu_mode == FEMU_ZNSSD_MODE);
1394 }
1395 
1396 /* Basic NVMe Queue Pair operation APIs from nvme-util.c */
1397 int nvme_check_sqid(FemuCtrl *n, uint16_t sqid);
1398 int nvme_check_cqid(FemuCtrl *n, uint16_t cqid);
1399 void nvme_inc_cq_tail(NvmeCQueue *cq);
1400 void nvme_inc_sq_head(NvmeSQueue *sq);
1402 uint8_t nvme_cq_full(NvmeCQueue *cq);
1403 uint8_t nvme_sq_empty(NvmeSQueue *sq);
1405 uint16_t nvme_init_sq(NvmeSQueue *sq, FemuCtrl *n, uint64_t dma_addr, uint16_t
1406  sqid, uint16_t cqid, uint16_t size, enum NvmeQueueFlags
1407  prio, int contig);
1408 void nvme_free_sq(NvmeSQueue *sq, FemuCtrl *n);
1409 void nvme_free_cq(NvmeCQueue *cq, FemuCtrl *n);
1410 uint16_t nvme_init_cq(NvmeCQueue *cq, FemuCtrl *n, uint64_t dma_addr, uint16_t
1411  cqid, uint16_t vector, uint16_t size, uint16_t
1412  irq_enabled, int contig);
1413 void nvme_set_ctrl_name(FemuCtrl *n, const char *mn, const char *sn, int *dev_id);
1414 
1415 /* Public APIs from intr.c for interrupt operations */
1416 void nvme_isr_notify_admin(void *opaque);
1417 void nvme_isr_notify_io(void *opaque);
1418 int nvme_setup_virq(FemuCtrl *n, NvmeCQueue *cq);
1419 int nvme_clear_virq(FemuCtrl *n);
1420 
1421 /* Public DMA APIs from dma.c */
1422 void nvme_addr_read(FemuCtrl *n, hwaddr addr, void *buf, int size);
1423 void nvme_addr_write(FemuCtrl *n, hwaddr addr, void *buf, int size);
1424 uint16_t nvme_map_prp(QEMUSGList *qsg, QEMUIOVector *iov, uint64_t prp1,
1425  uint64_t prp2, uint32_t len, FemuCtrl *n);
1426 uint16_t dma_write_prp(FemuCtrl *n, uint8_t *ptr, uint32_t len, uint64_t
1427  prp1, uint64_t prp2);
1428 uint16_t dma_read_prp(FemuCtrl *n, uint8_t *ptr, uint32_t len, uint64_t
1429  prp1, uint64_t prp2);
1430 
1431 
1432 /* Misc */
1433 uint64_t *nvme_setup_discontig(FemuCtrl *n, uint64_t prp_addr, uint16_t
1434  queue_depth, uint16_t entry_size);
1435 void nvme_set_error_page(FemuCtrl *n, uint16_t sqid, uint16_t cid, uint16_t
1436  status, uint16_t location, uint64_t lba, uint32_t
1437  nsid);
1438 uint16_t femu_nvme_rw_check_req(FemuCtrl *n, NvmeNamespace *ns, NvmeCmd *cmd,
1439  NvmeRequest *req, uint64_t slba, uint64_t elba,
1440  uint32_t nlb, uint16_t ctrl, uint64_t data_size,
1441  uint64_t meta_size);
1442 
1443 
1444 void nvme_process_sq_admin(void *opaque);
1445 void nvme_post_cqes_io(void *opaque);
1446 void nvme_create_poller(FemuCtrl *n);
1447 
1448 /* NVMe I/O */
1449 uint16_t nvme_rw(FemuCtrl *n, NvmeNamespace *ns, NvmeCmd *cmd, NvmeRequest *req);
1450 
1456 
1457 static inline uint64_t ns_blks(NvmeNamespace *ns, uint8_t lba_idx)
1458 {
1459  FemuCtrl *n = ns->ctrl;
1460  NvmeIdNs *id_ns = &ns->id_ns;
1461  uint64_t ns_size = n->ns_size;
1462 
1463  uint32_t lba_ds = (1 << id_ns->lbaf[lba_idx].lbads);
1464  uint32_t lba_sz = lba_ds + n->meta;
1465 
1466  return ns_size / lba_sz;
1467 }
1468 
1478 static inline hwaddr nvme_discontig(uint64_t *dma_addr, uint16_t page_size,
1479  uint16_t queue_idx, uint16_t entry_size)
1480 {
1481  uint16_t entries_per_page = page_size / entry_size;
1482  uint16_t prp_index = queue_idx / entries_per_page;
1483  uint16_t index_in_prp = queue_idx % entries_per_page;
1484 
1485  return dma_addr[prp_index] + index_in_prp * entry_size;
1486 }
1487 
1488 static inline uint16_t nvme_check_mdts(FemuCtrl *n, size_t len)
1489 {
1490  uint8_t mdts = n->mdts;
1491 
1492  if (mdts && len > n->page_size << mdts) {
1493  return NVME_INVALID_FIELD | NVME_DNR;
1494  }
1495 
1496  return NVME_SUCCESS;
1497 }
1498 
1499 #define MN_MAX_LEN (64)
1500 #define ID_MAX_LEN (4)
1501 
1502 //#define FEMU_DEBUG_NVME
1503 #ifdef FEMU_DEBUG_NVME
1504 #define femu_debug(fmt, ...) \
1505  do { printf("[FEMU] Dbg: " fmt, ## __VA_ARGS__); } while (0)
1506 #else
1507 #define femu_debug(fmt, ...) \
1508  do { } while (0)
1509 #endif
1510 
1511 #define femu_err(fmt, ...) \
1512  do { fprintf(stderr, "[FEMU] Err: " fmt, ## __VA_ARGS__); } while (0)
1513 
1514 #define femu_log(fmt, ...) \
1515  do { printf("[FEMU] Log: " fmt, ## __VA_ARGS__); } while (0)
1516 
1517 
1518 #endif /* __FEMU_NVME_H */
1519 
dma_write_prp
uint16_t dma_write_prp(FemuCtrl *n, uint8_t *ptr, uint32_t len, uint64_t prp1, uint64_t prp2)
Definition: dma.c:112
NvmePollerThreadArgument
Definition: nvme.h:1342
NvmeAerResult::event_type
uint8_t event_type
Definition: nvme.h:505
NvmeFwSlotInfoLog::reserved2
uint8_t reserved2[448]
Definition: nvme.h:597
NvmeCmd::cdw15
uint32_t cdw15
Definition: nvme.h:311
SsdDramBackend
DRAM backend SSD address space
Definition: dram.h:18
AQA_ASQS_MASK
@ AQA_ASQS_MASK
Definition: nvme.h:202
NvmeDsmCmd::cid
uint16_t cid
Definition: nvme.h:466
NvmeCQueue
Definition: nvme.h:1034
timing.h
nvme_nsid_valid
static bool nvme_nsid_valid(FemuCtrl *n, uint32_t nsid)
Definition: nvme-admin.c:271
NVME_SMART_TEMPERATURE
@ NVME_SMART_TEMPERATURE
Definition: nvme.h:634
NvmeCmd
Definition: nvme.h:296
nvme_smart_info
static uint16_t nvme_smart_info(FemuCtrl *n, NvmeCmd *cmd, uint32_t buf_len)
Definition: nvme-admin.c:710
OcCtrlParams::num_ch
uint8_t num_ch
Definition: nvme.h:1158
NvmeCmd
struct NvmeCmd NvmeCmd
nvme_isr_notify_io
void nvme_isr_notify_io(void *opaque)
中断通知上层取cq
Definition: intr.c:202
NvmeSQueue::eventidx_addr
uint64_t eventidx_addr
Definition: nvme.h:1029
nvme_copy_cmd
static void nvme_copy_cmd(NvmeCmd *dst, NvmeCmd *src)
从dram中取cmd
Definition: nvme-io.c:30
NvmeCmd::cdw11
uint32_t cdw11
Definition: nvme.h:307
NVME_RW_PRINFO_PRACT
@ NVME_RW_PRINFO_PRACT
Definition: nvme.h:457
CAP_OC_SHIFT
@ CAP_OC_SHIFT
Definition: nvme.h:63
NvmeIdCtrl::mn
uint8_t mn[40]
Definition: nvme.h:696
NvmeIdCtrl::nn
uint32_t nn
Definition: nvme.h:740
NVME_IDENTIFY_DATA_SIZE
#define NVME_IDENTIFY_DATA_SIZE
Definition: nvme-admin.c:9
CMBSZ_SZ_MASK
@ CMBSZ_SZ_MASK
Definition: nvme.h:243
NvmeIdCtrl::sgls
uint32_t sgls
Definition: nvme.h:751
CMBSZ_WDS_SHIFT
@ CMBSZ_WDS_SHIFT
Definition: nvme.h:231
CC_IOSQES_SHIFT
@ CC_IOSQES_SHIFT
Definition: nvme.h:140
NvmeParams::oacs
uint16_t oacs
Definition: nvme.h:1142
NVME_RW_DSM_LATENCY_NORM
@ NVME_RW_DSM_LATENCY_NORM
Definition: nvme.h:453
FemuCtrl::chnl_locks
pthread_spinlock_t chnl_locks[FEMU_MAX_NUM_CHNLS]
Definition: nvme.h:1305
CQ_POLLING_PERIOD_NS
#define CQ_POLLING_PERIOD_NS
Definition: nvme.h:1354
NvmeCQueue::is_active
bool is_active
Definition: nvme.h:1056
FemuCtrl::cqes_pending
uint8_t cqes_pending
Definition: nvme.h:1264
NvmeDsmCmd
Definition: nvme.h:463
NvmeRwCmd::reftag
uint32_t reftag
Definition: nvme.h:434
NvmeCapMask
NvmeCapMask
Definition: nvme.h:68
NvmePollerThreadArgument
struct NvmePollerThreadArgument NvmePollerThreadArgument
NvmeRequest::cmd
NvmeCmd cmd
Definition: nvme.h:981
NvmeNamespace::tbl_dsk_start_offset
uint64_t tbl_dsk_start_offset
Definition: nvme.h:1076
FemuCtrl::flash_type
uint8_t flash_type
Definition: nvme.h:1339
NVME_CMD_ZONE_MGMT_SEND
@ NVME_CMD_ZONE_MGMT_SEND
Definition: nvme.h:346
NVME_LBA_RANGE
@ NVME_LBA_RANGE
Definition: nvme.h:540
nvme_rw
uint16_t nvme_rw(FemuCtrl *n, NvmeNamespace *ns, NvmeCmd *cmd, NvmeRequest *req)
nvme读写命令
Definition: nvme-io.c:370
nvme_format
static uint16_t nvme_format(FemuCtrl *n, NvmeCmd *cmd)
Definition: nvme-admin.c:922
NvmeRequest
struct NvmeRequest NvmeRequest
NvmeParams::dialect
uint8_t dialect
Definition: nvme.h:1141
NVME_CMD_EFF_LBCC
@ NVME_CMD_EFF_LBCC
Definition: nvme.h:648
CAP_MPSMIN_MASK
@ CAP_MPSMIN_MASK
Definition: nvme.h:77
NvmeIdNs::nuse
uint64_t nuse
Definition: nvme.h:866
FemuCtrl::cmbloc
uint32_t cmbloc
Definition: nvme.h:1269
NvmeIdNs::nabspf
uint16_t nabspf
Definition: nvme.h:882
FemuCtrl::zone_capacity
uint64_t zone_capacity
Definition: nvme.h:1212
NvmeIdentity::rsvd11
uint8_t rsvd11
Definition: nvme.h:416
FemuCtrl::zone_size_bs
uint64_t zone_size_bs
Definition: nvme.h:1196
NvmeDsmCmd
struct NvmeDsmCmd NvmeDsmCmd
nvme_register_bbssd
int nvme_register_bbssd(FemuCtrl *n)
注册blackbox相关函数
Definition: bb.c:145
NvmeNamespace::id
uint32_t id
Definition: nvme.h:1071
FemuCtrl::mpsmax
uint8_t mpsmax
Definition: nvme.h:1255
NVME_RW_DSM_FREQ_UNSPEC
@ NVME_RW_DSM_FREQ_UNSPEC
Definition: nvme.h:442
nvme_cse_iocs_zoned
static const uint32_t nvme_cse_iocs_zoned[256]
Definition: nvme-admin.c:62
nvme_check_mdts
static uint16_t nvme_check_mdts(FemuCtrl *n, size_t len)
Definition: nvme.h:1488
NVME_NSID_BROADCAST
#define NVME_NSID_BROADCAST
Definition: nvme.h:861
NvmeSmartLog::reserved2
uint8_t reserved2[320]
Definition: nvme.h:629
nvme_io_cmd
static uint16_t nvme_io_cmd(FemuCtrl *n, NvmeCmd *cmd, NvmeRequest *req)
nvme处理io类型的commad,识别cmd类型并调用相关函数
Definition: nvme-io.c:597
NvmeCreateSq
struct NvmeCreateSq NvmeCreateSq
NvmeIdNsDescr::nidl
uint8_t nidl
Definition: nvme.h:900
NVME_SQ_FLAGS_PC
#define NVME_SQ_FLAGS_PC(sq_flags)
Definition: nvme.h:395
FemuCtrl::cupg_rd_lat_ns
int64_t cupg_rd_lat_ns
Definition: nvme.h:1310
NvmeSglDescriptor::type
uint8_t type
Definition: nvme.h:275
nvme_clear_virq
int nvme_clear_virq(FemuCtrl *n)
Definition: intr.c:246
NvmeSmartLog::host_read_commands
uint64_t host_read_commands[2]
Definition: nvme.h:621
NvmeIdCtrl::cqes
uint8_t cqes
Definition: nvme.h:738
FemuCtrl::elpe
uint8_t elpe
Definition: nvme.h:1239
ssd
模拟一个ssd
Definition: ftl.h:247
NvmeIdentity::nvmsetid
uint16_t nvmsetid
Definition: nvme.h:415
NvmePSD::reserved
uint16_t reserved
Definition: nvme.h:665
NvmeIdNs::rsvd74
uint8_t rsvd74[30]
Definition: nvme.h:890
nvme_cmd_effects
static uint16_t nvme_cmd_effects(FemuCtrl *n, NvmeCmd *cmd, uint8_t csi, uint32_t buf_len, uint64_t off)
Definition: nvme-admin.c:747
nvme_flush
static uint16_t nvme_flush(FemuCtrl *n, NvmeNamespace *ns, NvmeCmd *cmd, NvmeRequest *req)
处理io cmd:flush命令
Definition: nvme-io.c:531
NvmeIdCtrl::sanicap
uint32_t sanicap
Definition: nvme.h:735
NvmeAqaMask
NvmeAqaMask
Definition: nvme.h:201
NVME_SMART_SPARE
@ NVME_SMART_SPARE
Definition: nvme.h:633
CSTS_RDY_SHIFT
@ CSTS_RDY_SHIFT
Definition: nvme.h:169
NVME_CMP_FAILURE
@ NVME_CMP_FAILURE
Definition: nvme.h:577
NvmeDeleteQ
Definition: nvme.h:354
NvmeSQueue::ctrl
struct FemuCtrl * ctrl
Definition: nvme.h:1010
FemuCtrl
femu相关控制参数和数据成员
Definition: nvme.h:1184
NvmeSmartLog
struct NvmeSmartLog NvmeSmartLog
CMBSZ_RDS_MASK
@ CMBSZ_RDS_MASK
Definition: nvme.h:240
NVME_MAX_QSIZE_EXCEEDED
@ NVME_MAX_QSIZE_EXCEEDED
Definition: nvme.h:546
NvmeCmd::res1
uint16_t res1
Definition: nvme.h:299
NvmeIdNs::npda
uint16_t npda
Definition: nvme.h:888
FemuCtrl::print_log
bool print_log
Definition: nvme.h:1334
FemuCtrl::cmbsz
uint32_t cmbsz
Definition: nvme.h:1268
FemuCtrl::sq
NvmeSQueue ** sq
sq队列列表(io)
Definition: nvme.h:1280
NvmeCreateSq::qsize
uint16_t qsize
Definition: nvme.h:389
NvmeSQueue::db_addr
uint64_t db_addr
Definition: nvme.h:1027
nvme_compare
static uint16_t nvme_compare(FemuCtrl *n, NvmeNamespace *ns, NvmeCmd *cmd, NvmeRequest *req)
处理io cmd:compare命令
Definition: nvme-io.c:471
pqueue_pop
void * pqueue_pop(pqueue_t *q)
Definition: pqueue.c:172
FemuCtrl::ext_ops
FemuExtCtrlOps ext_ops
nvme到各模式ssd接口
Definition: nvme.h:1220
NvmeParams::cqr
uint8_t cqr
Definition: nvme.h:1124
CAP_AMS_MASK
@ CAP_AMS_MASK
Definition: nvme.h:71
NvmeCqe::status
uint16_t status
Definition: nvme.h:522
nvme_identify
static uint16_t nvme_identify(FemuCtrl *n, NvmeCmd *cmd)
Definition: nvme-admin.c:523
FEMU_KVSSD_MODE
@ FEMU_KVSSD_MODE
Definition: nvme.h:1363
NvmeCQueue::vector
uint32_t vector
Definition: nvme.h:1043
NvmeIdNs
Definition: nvme.h:863
NvmeParams::db_stride
uint8_t db_stride
Definition: nvme.h:1119
NvmePSD::rwl
uint8_t rwl
Definition: nvme.h:671
nvme_abort_req
static uint16_t nvme_abort_req(FemuCtrl *n, NvmeCmd *cmd, uint32_t *result)
Definition: nvme-admin.c:834
nvme_setup_virq
int nvme_setup_virq(FemuCtrl *n, NvmeCQueue *cq)
Definition: intr.c:216
NVME_TIMESTAMP
@ NVME_TIMESTAMP
Definition: nvme.h:827
NvmeParams::num_queues
uint32_t num_queues
Definition: nvme.h:1115
NvmeIdNs::nabsn
uint16_t nabsn
Definition: nvme.h:880
nvme_update_sq_eventidx
static void nvme_update_sq_eventidx(const NvmeSQueue *sq)
Definition: nvme-io.c:11
NvmeCreateSq::sq_flags
uint16_t sq_flags
Definition: nvme.h:390
ID_MAX_LEN
#define ID_MAX_LEN
Definition: nvme.h:1500
NVME_ARB_LPW
#define NVME_ARB_LPW(arb)
Definition: nvme.h:806
unlikely
#define unlikely(x)
Definition: rte_branch_prediction.h:38
NVME_RW_DSM_FREQ_RW
@ NVME_RW_DSM_FREQ_RW
Definition: nvme.h:447
NVME_ASYNCHRONOUS_EVENT_CONF
@ NVME_ASYNCHRONOUS_EVENT_CONF
Definition: nvme.h:826
NvmeRequest::qsg
QEMUSGList qsg
dma用
Definition: nvme.h:984
NvmePSD::rrt
uint8_t rrt
Definition: nvme.h:668
NvmeCreateCq
Definition: nvme.h:364
NVME_ADM_CMD_ACTIVATE_FW
@ NVME_ADM_CMD_ACTIVATE_FW
Definition: nvme.h:328
FemuExtCtrlOps::get_log
uint16_t(* get_log)(struct FemuCtrl *, NvmeCmd *)
Definition: nvme.h:1177
NvmeCQueue::cqid
uint16_t cqid
Definition: nvme.h:1038
NVME_ID_CNS_CS_NS
@ NVME_ID_CNS_CS_NS
Definition: nvme.h:682
NvmeCreateSq
Definition: nvme.h:381
NvmeSmartLog::temperature
uint8_t temperature[2]
Definition: nvme.h:614
NvmeIdNs::nlbaf
uint8_t nlbaf
Definition: nvme.h:868
NvmeCreateSq::flags
uint8_t flags
Definition: nvme.h:383
NVME_RW_DSM_FREQ_ONCE
@ NVME_RW_DSM_FREQ_ONCE
Definition: nvme.h:448
NVME_AER_INFO_ERR_TRANS_INTERNAL_ERR
@ NVME_AER_INFO_ERR_TRANS_INTERNAL_ERR
Definition: nvme.h:497
NVME_ZONE_INVALID_WRITE
@ NVME_ZONE_INVALID_WRITE
Definition: nvme.h:567
CAP_MPSMAX_SHIFT
@ CAP_MPSMAX_SHIFT
Definition: nvme.h:65
nvme_fw_log_info
static uint16_t nvme_fw_log_info(FemuCtrl *n, NvmeCmd *cmd, uint32_t buf_len)
Definition: nvme-admin.c:686
NVME_FW_REQ_RESET
@ NVME_FW_REQ_RESET
Definition: nvme.h:555
nvme_init_cq
uint16_t nvme_init_cq(NvmeCQueue *cq, FemuCtrl *n, uint64_t dma_addr, uint16_t cqid, uint16_t vector, uint16_t size, uint16_t irq_enabled, int contig)
Definition: nvme-util.c:237
NvmeEffectsLog::iocs
uint32_t iocs[256]
Definition: nvme.h:642
nvme_check_cqid
int nvme_check_cqid(FemuCtrl *n, uint16_t cqid)
Definition: nvme-util.c:14
FemuCtrl::reg_size
uint32_t reg_size
Definition: nvme.h:1231
NvmeAerResult::event_info
uint8_t event_info
Definition: nvme.h:506
FemuCtrl::serial
char * serial
Definition: nvme.h:1276
NvmeIdCtrl::rtd3r
uint32_t rtd3r
Definition: nvme.h:704
NVME_CMD_DSM
@ NVME_CMD_DSM
Definition: nvme.h:345
NvmeIdCtrl::rab
uint8_t rab
Definition: nvme.h:698
NvmeParams
struct NvmeParams NvmeParams
NvmeDsmCmd::prp1
uint64_t prp1
Definition: nvme.h:469
BBSSD
static bool BBSSD(FemuCtrl *n)
Definition: nvme.h:1381
NVME_ID_CNS_IO_COMMAND_SET
@ NVME_ID_CNS_IO_COMMAND_SET
Definition: nvme.h:689
FemuCtrl::mpsmin
uint8_t mpsmin
Definition: nvme.h:1254
NvmeNamespace::uncorrectable
unsigned long * uncorrectable
Definition: nvme.h:1070
femu_log
#define femu_log(fmt,...)
Definition: nvme.h:1514
NvmeRwCmd::prp1
uint64_t prp1
Definition: nvme.h:428
Oc12Ctrl
Definition: oc12.h:216
NvmeRwCmd
struct NvmeRwCmd NvmeRwCmd
NVME_E2E_GUARD_ERROR
@ NVME_E2E_GUARD_ERROR
Definition: nvme.h:574
NvmeIdCtrl
struct QEMU_PACKED NvmeIdCtrl NvmeIdCtrl
NvmeIdCtrl::cntlid
uint16_t cntlid
Definition: nvme.h:702
FemuCtrl::zasl_bs
uint32_t zasl_bs
Definition: nvme.h:1192
NvmeBar::cmbsz
uint32_t cmbsz
Definition: nvme.h:52
NVME_RW_PRINFO_PRCHK_GUARD
@ NVME_RW_PRINFO_PRCHK_GUARD
Definition: nvme.h:458
NvmeCmd::mptr
uint64_t mptr
Definition: nvme.h:304
NvmeDsmCmd::attributes
uint32_t attributes
Definition: nvme.h:472
NvmeFeatureCap
NvmeFeatureCap
Definition: nvme.h:832
FemuExtCtrlOps
struct FemuExtCtrlOps FemuExtCtrlOps
扩展操作接口,具体实现在各模式ssd中
nvme_process_sq_admin
void nvme_process_sq_admin(void *opaque)
处理admin命令的sq队列
Definition: nvme-admin.c:1036
NvmeSmartLog::percentage_used
uint8_t percentage_used
Definition: nvme.h:617
DMAOff::len
dma_addr_t len
Definition: nvme.h:1006
FemuCtrl::zd_extensions
uint8_t * zd_extensions
Definition: nvme.h:1214
NVME_ADM_CMD_CREATE_SQ
@ NVME_ADM_CMD_CREATE_SQ
Definition: nvme.h:319
get_pri
static pqueue_pri_t get_pri(void *a)
Definition: nvme-io.c:288
NvmeSQueue::dma_addr_hva
uint64_t dma_addr_hva
Definition: nvme.h:1019
NvmeNamespace::tbl_entries
uint32_t tbl_entries
Definition: nvme.h:1077
NvmeZone
Definition: zns.h:101
NvmeDeleteQ::flags
uint8_t flags
Definition: nvme.h:356
nvme_process_cq_cpl
static void nvme_process_cq_cpl(void *arg, int index_poller)
从to_poller队列中取req,放入cq中,然后通知上层操作已完成
Definition: nvme-io.c:158
NVME_SMART_MEDIA_READ_ONLY
@ NVME_SMART_MEDIA_READ_ONLY
Definition: nvme.h:636
FemuCtrl::ms_max
uint8_t ms_max
Definition: nvme.h:1257
NvmeCmd::cid
uint16_t cid
Definition: nvme.h:301
nvme_check_sqid
int nvme_check_sqid(FemuCtrl *n, uint16_t sqid)
Definition: nvme-util.c:9
FemuCtrl::vwc
uint8_t vwc
Definition: nvme.h:1247
FemuCtrl::page_bits
uint16_t page_bits
Definition: nvme.h:1225
NvmeCQueue::tail
uint32_t tail
Definition: nvme.h:1041
NvmeFwSlotInfoLog::frs2
uint8_t frs2[8]
Definition: nvme.h:591
NvmeIdCtrl::dsto
uint8_t dsto
Definition: nvme.h:729
FemuExtCtrlOps::rw_check_req
uint16_t(* rw_check_req)(struct FemuCtrl *, NvmeCmd *, NvmeRequest *)
Definition: nvme.h:1173
nvme_csi_has_nvm_support
static bool nvme_csi_has_nvm_support(NvmeNamespace *ns)
Definition: nvme-admin.c:294
FemuCtrl::aer_reqs
NvmeRequest ** aer_reqs
Definition: nvme.h:1278
Oc20Params::ws_opt
uint32_t ws_opt
Definition: nvme.h:1100
NVME_LOG_CMD_EFFECTS
@ NVME_LOG_CMD_EFFECTS
Definition: nvme.h:660
nvme_check_size
static void nvme_check_size(void)
Definition: nvme.h:939
NvmeSQueue::QTAILQ_HEAD
QTAILQ_HEAD(sq_req_list, NvmeRequest) req_list
存放req
NVME_ADM_CMD_DELETE_SQ
@ NVME_ADM_CMD_DELETE_SQ
Definition: nvme.h:318
NvmeFeatureVal::write_atomicity
uint32_t write_atomicity
Definition: nvme.h:800
NVME_TEMPERATURE_THRESHOLD
@ NVME_TEMPERATURE_THRESHOLD
Definition: nvme.h:819
NVME_ID_NS_MC_EXTENDED
#define NVME_ID_NS_MC_EXTENDED(mc)
Definition: nvme.h:922
NvmeFwSlotInfoLog
struct NvmeFwSlotInfoLog NvmeFwSlotInfoLog
NVME_RW_DSM_FREQ_RARE
@ NVME_RW_DSM_FREQ_RARE
Definition: nvme.h:444
NvmeSmartLog::unsafe_shutdowns
uint64_t unsafe_shutdowns[2]
Definition: nvme.h:626
NVME_RW_FUA
@ NVME_RW_FUA
Definition: nvme.h:441
NvmeNsIdentifierLength
NvmeNsIdentifierLength
Definition: nvme.h:904
NvmeDeleteQ::opcode
uint8_t opcode
Definition: nvme.h:355
NVME_PSDT_SGL_MPTR_CONTIGUOUS
@ NVME_PSDT_SGL_MPTR_CONTIGUOUS
Definition: nvme.h:292
NvmeNamespace::meta
uint64_t meta
Definition: nvme.h:1086
NvmeDeleteQ::qid
uint16_t qid
Definition: nvme.h:359
CC_CSS_MASK
@ CC_CSS_MASK
Definition: nvme.h:146
NvmeBar::cc
uint32_t cc
Definition: nvme.h:44
NvmeIdCtrl::cctemp
uint16_t cctemp
Definition: nvme.h:721
NvmePSD::rrl
uint8_t rrl
Definition: nvme.h:669
NVME_LOG_SMART_INFO
@ NVME_LOG_SMART_INFO
Definition: nvme.h:658
NvmeCmd::fuse
uint16_t fuse
Definition: nvme.h:298
FemuCtrl::zasl
uint8_t zasl
Definition: nvme.h:1193
NVME_ZONE_OFFLINE
@ NVME_ZONE_OFFLINE
Definition: nvme.h:566
NvmeCreateCq::cqid
uint16_t cqid
Definition: nvme.h:371
OcCtrlParams::max_sec_per_rq
uint8_t max_sec_per_rq
Definition: nvme.h:1157
NvmeFeatureVal::arbitration
uint32_t arbitration
Definition: nvme.h:792
CC_IOCQES_SHIFT
@ CC_IOCQES_SHIFT
Definition: nvme.h:141
CMBSZ_SZ_SHIFT
@ CMBSZ_SZ_SHIFT
Definition: nvme.h:233
NVME_CSTS_FAILED
@ NVME_CSTS_FAILED
Definition: nvme.h:184
FemuCtrl::chnl_pg_xfer_lat_ns
int64_t chnl_pg_xfer_lat_ns
Definition: nvme.h:1319
CAP_CSS_SHIFT
@ CAP_CSS_SHIFT
Definition: nvme.h:62
FemuCtrl::multipoller_enabled
uint8_t multipoller_enabled
是否创建多个nvme poller
Definition: nvme.h:1336
backend_rw
int backend_rw(SsdDramBackend *b, QEMUSGList *qsg, uint64_t *lbal, bool is_write)
Definition: dram.c:37
lba
uint64_t lba
Definition: oc12.h:2
NVME_LOG_ERROR_INFO
@ NVME_LOG_ERROR_INFO
Definition: nvme.h:657
NVME_CMD_FLUSH
@ NVME_CMD_FLUSH
Definition: nvme.h:339
NvmeCmd::cdw13
uint32_t cdw13
Definition: nvme.h:309
NvmeRangeType::nlb
uint64_t nlb
Definition: nvme.h:850
FemuCtrl::upg_wr_lat_ns
int64_t upg_wr_lat_ns
Definition: nvme.h:1313
nvme_identify_ns_descr_list
static uint16_t nvme_identify_ns_descr_list(FemuCtrl *n, NvmeCmd *cmd)
Definition: nvme-admin.c:468
NvmeCreateCq::flags
uint8_t flags
Definition: nvme.h:366
femu_debug
#define femu_debug(fmt,...)
Definition: nvme.h:1507
FemuCtrl::cqr
uint8_t cqr
Definition: nvme.h:1243
nvme_addr_read
void nvme_addr_read(FemuCtrl *n, hwaddr addr, void *buf, int size)
Definition: dma.c:3
NvmeSQueue
struct NvmeSQueue NvmeSQueue
nvme_admin_cmd
static uint16_t nvme_admin_cmd(FemuCtrl *n, NvmeCmd *cmd, NvmeCqe *cqe)
识别、执行admin命令
Definition: nvme-admin.c:965
NvmeRequest::status
uint16_t status
Definition: nvme.h:971
FemuCtrl::iocs
const uint32_t * iocs
Definition: nvme.h:1202
NVME_CSI_ZONED
@ NVME_CSI_ZONED
Definition: nvme.h:125
FemuCtrl::vid
uint16_t vid
Definition: nvme.h:1265
NvmeIdentity
Definition: nvme.h:406
NVME_SUCCESS
@ NVME_SUCCESS
Definition: nvme.h:526
NVME_SOFTWARE_PROGRESS_MARKER
@ NVME_SOFTWARE_PROGRESS_MARKER
Definition: nvme.h:828
NvmeNamespace::tbl
uint64_t * tbl
Definition: nvme.h:1078
FemuCtrl::bar
NvmeBar bar
Definition: nvme.h:1188
NVME_ADM_CMD_FEMU_FLIP
@ NVME_ADM_CMD_FEMU_FLIP
Definition: nvme.h:335
FemuCtrl::num_poller
uint32_t num_poller
nvme poller个数(前提是multupoller_enabled开启)
Definition: nvme.h:1337
NVME_CSTS_SHST_NORMAL
@ NVME_CSTS_SHST_NORMAL
Definition: nvme.h:185
NVME_ADM_CMD_GET_LOG_PAGE
@ NVME_ADM_CMD_GET_LOG_PAGE
Definition: nvme.h:320
CC_EN_SHIFT
@ CC_EN_SHIFT
Definition: nvme.h:135
nvme_identify_ctrl
static uint16_t nvme_identify_ctrl(FemuCtrl *n, NvmeCmd *cmd)
Definition: nvme-admin.c:358
CAP_MQES_MASK
@ CAP_MQES_MASK
Definition: nvme.h:69
NvmeNamespace::util
unsigned long * util
Definition: nvme.h:1069
CAP_DSTRD_SHIFT
@ CAP_DSTRD_SHIFT
Definition: nvme.h:60
NVME_ADM_CMD_DELETE_CQ
@ NVME_ADM_CMD_DELETE_CQ
Definition: nvme.h:321
NvmeQueueFlags
NvmeQueueFlags
Definition: nvme.h:398
pqueue_pri_t
unsigned long long pqueue_pri_t
Definition: pqueue.h:39
dma_write_prp
uint16_t dma_write_prp(FemuCtrl *n, uint8_t *ptr, uint32_t len, uint64_t prp1, uint64_t prp2)
Definition: dma.c:112
NvmeIdNs::npwg
uint16_t npwg
Definition: nvme.h:885
FemuCtrl::sqe_size
uint16_t sqe_size
Definition: nvme.h:1228
NVME_CC_CSS_CSI
@ NVME_CC_CSS_CSI
Definition: nvme.h:164
OCSSD12
@ OCSSD12
Definition: nvme.h:1367
nvme_set_error_page
void nvme_set_error_page(FemuCtrl *n, uint16_t sqid, uint16_t cid, uint16_t status, uint16_t location, uint64_t lba, uint32_t nsid)
Definition: nvme-util.c:96
NvmeDifTuple::ref_tag
uint32_t ref_tag
Definition: nvme.h:1350
NvmeRwCmd::slba
uint64_t slba
Definition: nvme.h:430
Oc20Params::resetfail_fname
char * resetfail_fname
Definition: nvme.h:1108
NVME_LPA_NS_SMART
@ NVME_LPA_NS_SMART
Definition: nvme.h:781
Oc20Params::ws_min
uint32_t ws_min
Definition: nvme.h:1099
NvmeRwCmd::apptag
uint16_t apptag
Definition: nvme.h:435
DMAOff
struct DMAOff DMAOff
NvmeRequest::ctrl
uint16_t ctrl
Definition: nvme.h:975
rte_ring.h
NvmeParams::elpe
uint8_t elpe
Definition: nvme.h:1122
FemuCtrl::chip_next_avail_time
volatile int64_t chip_next_avail_time[FEMU_MAX_NUM_CHIPS]
Definition: nvme.h:1302
NvmeIdCtrl::rpmbs
uint32_t rpmbs
Definition: nvme.h:727
NvmeRequest::pos
size_t pos
Definition: nvme.h:999
NvmeBar::csts
uint32_t csts
Definition: nvme.h:46
NVME_OACS_SECURITY
@ NVME_OACS_SECURITY
Definition: nvme.h:760
NvmeParams::serial
char * serial
Definition: nvme.h:1113
NVME_RESERVED
@ NVME_RESERVED
Definition: nvme.h:548
FemuCtrl::poller
QemuThread * poller
Definition: nvme.h:1272
FemuCtrl::zone_size_log2
uint32_t zone_size_log2
Definition: nvme.h:1213
FemuExtCtrlOps::exit
void(* exit)(struct FemuCtrl *)
Definition: nvme.h:1172
NvmeCstsMask
NvmeCstsMask
Definition: nvme.h:175
NVME_NIDT_EUI64
@ NVME_NIDT_EUI64
Definition: nvme.h:912
nvme_identify_nslist_csi
static uint16_t nvme_identify_nslist_csi(FemuCtrl *n, NvmeCmd *cmd)
Definition: nvme-admin.c:431
nvme_inc_sq_head
void nvme_inc_sq_head(NvmeSQueue *sq)
Definition: nvme-util.c:28
NvmeDsmCmd::nsid
uint32_t nsid
Definition: nvme.h:467
NVME_CMD_COMPARE
@ NVME_CMD_COMPARE
Definition: nvme.h:343
NvmePSD
struct NvmePSD NvmePSD
NvmeCQueue::dma_addr
uint64_t dma_addr
Definition: nvme.h:1045
NvmeDeleteQ::rsvd11
uint32_t rsvd11[5]
Definition: nvme.h:361
FemuCtrl::dbs_addr_hva
uint64_t dbs_addr_hva
Definition: nvme.h:1293
NVME_ARB_AB
#define NVME_ARB_AB(arb)
Definition: nvme.h:805
NvmeIdNs::npdg
uint16_t npdg
Definition: nvme.h:887
NvmeParams::ms
uint8_t ms
Definition: nvme.h:1134
NvmeParams::aerl
uint8_t aerl
Definition: nvme.h:1120
CC_IOCQES_MASK
@ CC_IOCQES_MASK
Definition: nvme.h:151
NVME_DATA_TRAS_ERROR
@ NVME_DATA_TRAS_ERROR
Definition: nvme.h:530
NvmeIdCtrl::npss
uint8_t npss
Definition: nvme.h:717
NVME_DSMGMT_IDW
@ NVME_DSMGMT_IDW
Definition: nvme.h:478
NVME_CMD_EFF_CSUPP
@ NVME_CMD_EFF_CSUPP
Definition: nvme.h:647
NvmeSmartLog::number_of_error_log_entries
uint64_t number_of_error_log_entries[2]
Definition: nvme.h:628
NVME_ID_CNS_CS_NS_ACTIVE_LIST
@ NVME_ID_CNS_CS_NS_ACTIVE_LIST
Definition: nvme.h:684
nvme_del_cq
static uint16_t nvme_del_cq(FemuCtrl *n, NvmeCmd *cmd)
Definition: nvme-admin.c:194
NVME_NIDL_UUID
@ NVME_NIDL_UUID
Definition: nvme.h:907
NvmeDsmCmd::prp2
uint64_t prp2
Definition: nvme.h:470
AQA_ACQS_SHIFT
@ AQA_ACQS_SHIFT
Definition: nvme.h:198
nvme_rw
uint16_t nvme_rw(FemuCtrl *n, NvmeNamespace *ns, NvmeCmd *cmd, NvmeRequest *req)
nvme读写命令
Definition: nvme-io.c:370
FemuCtrl::db_stride
uint8_t db_stride
Definition: nvme.h:1236
rte_ring_empty
static int rte_ring_empty(const struct rte_ring *r)
Definition: rte_ring.h:909
FemuCtrl::num_errors
uint8_t num_errors
Definition: nvme.h:1263
FemuCtrl::lpg_rd_lat_ns
int64_t lpg_rd_lat_ns
Definition: nvme.h:1312
nvme_create_poller
void nvme_create_poller(FemuCtrl *n)
创建poller线程,以及两个ring queue:to_ftl和to_poller
Definition: nvme-io.c:313
NvmeRequest::nlb
uint16_t nlb
逻辑块个数
Definition: nvme.h:974
FemuCtrl::max_sqes
uint8_t max_sqes
Definition: nvme.h:1244
NvmeIdCtrlZoned
Definition: zns.h:10
FemuCtrl::dbs_addr
uint64_t dbs_addr
Definition: nvme.h:1291
NvmeCqe::res64
uint64_t res64
Definition: nvme.h:517
NvmeEffectsLog
Definition: nvme.h:640
NvmeCQueue::size
uint32_t size
Definition: nvme.h:1044
NvmeParams::intc_time
uint8_t intc_time
Definition: nvme.h:1130
NvmeRangeType::attributes
uint8_t attributes
Definition: nvme.h:847
FemuCtrl::features
NvmeFeatureVal features
Definition: nvme.h:1284
NVME_ERROR_RECOVERY
@ NVME_ERROR_RECOVERY
Definition: nvme.h:820
DPS_FIRST_EIGHT
@ DPS_FIRST_EIGHT
Definition: nvme.h:936
NvmeFeatureVal::temp_thresh
uint32_t temp_thresh
Definition: nvme.h:794
NvmeIdCtrl::elpe
uint8_t elpe
Definition: nvme.h:716
NVME_NIDT_UUID
@ NVME_NIDT_UUID
Definition: nvme.h:914
NvmeCreateCq::rsvd1
uint32_t rsvd1[5]
Definition: nvme.h:368
NvmeRequest::oc12_ppa_list
uint64_t * oc12_ppa_list
Definition: nvme.h:980
NVME_E2E_APP_ERROR
@ NVME_E2E_APP_ERROR
Definition: nvme.h:575
FemuCtrl::dlfeat
uint8_t dlfeat
Definition: nvme.h:1267
dma_read_prp
uint16_t dma_read_prp(FemuCtrl *n, uint8_t *ptr, uint32_t len, uint64_t prp1, uint64_t prp2)
Definition: dma.c:137
FemuCtrl::ms
uint8_t ms
Definition: nvme.h:1256
NvmeNamespace
Definition: nvme.h:1065
NvmeNamespace::begin
uint64_t begin
Definition: nvme.h:1083
NVME_GETFEAT_SELECT_DEFAULT
@ NVME_GETFEAT_SELECT_DEFAULT
Definition: nvme.h:840
nvme_update_cq_head
void nvme_update_cq_head(NvmeCQueue *cq)
Definition: nvme-util.c:45
NVME_SMART_RELIABILITY
@ NVME_SMART_RELIABILITY
Definition: nvme.h:635
NVME_DSMGMT_AD
@ NVME_DSMGMT_AD
Definition: nvme.h:479
NvmeRangeType::guid
uint8_t guid[16]
Definition: nvme.h:851
NvmePSD
Definition: nvme.h:663
NvmeDsmRange
Definition: nvme.h:482
NvmeErrorLog::resv
uint8_t resv[35]
Definition: nvme.h:609
NvmeNamespace::start_block
uint64_t start_block
Definition: nvme.h:1074
NVME_CMD_WRITE
@ NVME_CMD_WRITE
Definition: nvme.h:340
NvmeParams
Definition: nvme.h:1112
FemuCtrl::elp_index
uint8_t elp_index
Definition: nvme.h:1240
NVME_RW_PRINFO_PRCHK_APP
@ NVME_RW_PRINFO_PRCHK_APP
Definition: nvme.h:459
NvmeParams::acl
uint8_t acl
Definition: nvme.h:1121
NVME_OACS_DBBUF
@ NVME_OACS_DBBUF
Definition: nvme.h:764
NVME_DNR
@ NVME_DNR
Definition: nvme.h:581
NvmeIdCtrl::mtfa
uint16_t mtfa
Definition: nvme.h:722
OCSSD20
@ OCSSD20
Definition: nvme.h:1368
NvmeCqe::result
uint32_t result
Definition: nvme.h:514
FEMU_RING_TYPE_MP_SC
@ FEMU_RING_TYPE_MP_SC
Definition: rte_ring.h:1123
CSTS_NSSRO_MASK
@ CSTS_NSSRO_MASK
Definition: nvme.h:179
FemuCtrl::lpg_wr_lat_ns
int64_t lpg_wr_lat_ns
Definition: nvme.h:1317
nvme_check_cqid
int nvme_check_cqid(FemuCtrl *n, uint16_t cqid)
Definition: nvme-util.c:14
nvme_process_sq_io
static void nvme_process_sq_io(void *opaque, int index_poller)
从sq中取出req,放入to_ftl队列中,交由ftl处理
Definition: nvme-io.c:57
NvmeFwSlotInfoLog
Definition: nvme.h:587
NvmeDeleteQ::rsvd1
uint32_t rsvd1[9]
Definition: nvme.h:358
CMBLOC_BIR_MASK
@ CMBLOC_BIR_MASK
Definition: nvme.h:215
NvmeCreateSq::cid
uint16_t cid
Definition: nvme.h:384
NvmeSQueue::arb_burst
uint8_t arb_burst
Definition: nvme.h:1012
NVME_AER_TYPE_IO_SPECIFIC
@ NVME_AER_TYPE_IO_SPECIFIC
Definition: nvme.h:491
Oc12Bbt
Definition: oc12.h:161
NvmeSQueue::is_active
bool is_active
Definition: nvme.h:1031
NVME_Q_PRIO_NORMAL
@ NVME_Q_PRIO_NORMAL
Definition: nvme.h:402
NvmeBar::intms
uint32_t intms
Definition: nvme.h:42
NvmeCmd::nsid
uint32_t nsid
Definition: nvme.h:302
NvmeIdNsDps
NvmeIdNsDps
Definition: nvme.h:930
NvmeRangeType::rsvd2
uint8_t rsvd2[14]
Definition: nvme.h:848
NvmeRwCmd::dsmgmt
uint32_t dsmgmt
Definition: nvme.h:433
OC20AdminCommands
OC20AdminCommands
Definition: nvme.h:1371
OcCtrlParams::pgs_per_blk
uint16_t pgs_per_blk
Definition: nvme.h:1156
NvmeDsmCmd::rsvd2
uint64_t rsvd2[2]
Definition: nvme.h:468
FemuCtrl::clpg_wr_lat_ns
int64_t clpg_wr_lat_ns
Definition: nvme.h:1316
NvmeIdCtrl::ver
uint32_t ver
Definition: nvme.h:703
nvme_inc_cq_tail
void nvme_inc_cq_tail(NvmeCQueue *cq)
Definition: nvme-util.c:19
nvme_inc_sq_head
void nvme_inc_sq_head(NvmeSQueue *sq)
Definition: nvme-util.c:28
NVME_CAP_CSS_NVM
@ NVME_CAP_CSS_NVM
Definition: nvme.h:129
femu_ring_dequeue
size_t femu_ring_dequeue(struct rte_ring *ring, void **objs, size_t count)
Definition: rte_ring.c:228
NvmeSmartLog::available_spare_threshold
uint8_t available_spare_threshold
Definition: nvme.h:616
NvmeRangeType
Definition: nvme.h:845
FEMU_ZNSSD_MODE
@ FEMU_ZNSSD_MODE
Definition: nvme.h:1361
CC_IOSQES_MASK
@ CC_IOSQES_MASK
Definition: nvme.h:150
NVME_FID_NOT_NSID_SPEC
@ NVME_FID_NOT_NSID_SPEC
Definition: nvme.h:558
NVME_ID_NS_DPC_LAST_EIGHT
#define NVME_ID_NS_DPC_LAST_EIGHT(dpc)
Definition: nvme.h:923
nvme_setup_discontig
uint64_t * nvme_setup_discontig(FemuCtrl *n, uint64_t prp_addr, uint16_t queue_depth, uint16_t entry_size)
Definition: nvme-util.c:69
NvmeDifTuple
struct NvmeDifTuple NvmeDifTuple
NVME_ONCS_WRITE_UNCORR
@ NVME_ONCS_WRITE_UNCORR
Definition: nvme.h:769
NVME_AER_INFO_SMART_RELIABILITY
@ NVME_AER_INFO_SMART_RELIABILITY
Definition: nvme.h:499
CAP_DSTRD_MASK
@ CAP_DSTRD_MASK
Definition: nvme.h:73
NvmeDsmCmd::flags
uint8_t flags
Definition: nvme.h:465
nvme_ns
static NvmeNamespace * nvme_ns(FemuCtrl *n, uint32_t nsid)
Definition: nvme-admin.c:276
NVME_CSI_NVM
@ NVME_CSI_NVM
Definition: nvme.h:124
FemuCtrl
struct FemuCtrl FemuCtrl
femu相关控制参数和数据成员
NVME_SMART_FAILED_VOLATILE_MEDIA
@ NVME_SMART_FAILED_VOLATILE_MEDIA
Definition: nvme.h:637
NVME_ID_CNS_NS
@ NVME_ID_CNS_NS
Definition: nvme.h:678
NvmeIdCtrl::lpa
uint8_t lpa
Definition: nvme.h:715
NvmeIdCtrl::hctma
uint16_t hctma
Definition: nvme.h:732
FEMU_OCSSD_MODE
@ FEMU_OCSSD_MODE
Definition: nvme.h:1358
pqueue_init
pqueue_t * pqueue_init(size_t n, pqueue_cmp_pri_f cmppri, pqueue_get_pri_f getpri, pqueue_set_pri_f setpri, pqueue_get_pos_f getpos, pqueue_set_pos_f setpos)
Definition: pqueue.c:37
NvmeCreateCq
struct NvmeCreateCq NvmeCreateCq
NvmeParams::dpc
uint8_t dpc
Definition: nvme.h:1126
NVME_INVALID_MEMORY_ADDRESS
@ NVME_INVALID_MEMORY_ADDRESS
Definition: nvme.h:571
NvmeNsIdentifierType
NvmeNsIdentifierType
Definition: nvme.h:911
NVME_UNRECOVERED_READ
@ NVME_UNRECOVERED_READ
Definition: nvme.h:573
NVME_INVALID_QUEUE_DEL
@ NVME_INVALID_QUEUE_DEL
Definition: nvme.h:556
NvmeSQueue::cqid
uint16_t cqid
Definition: nvme.h:1014
nvme_isr_notify_io
void nvme_isr_notify_io(void *opaque)
中断通知上层取cq
Definition: intr.c:202
NvmeErrorLog::nsid
uint32_t nsid
Definition: nvme.h:607
FemuCtrl::nr_active_zones
int32_t nr_active_zones
Definition: nvme.h:1216
NVME_CMD_OC_READ
@ NVME_CMD_OC_READ
Definition: nvme.h:351
NvmeIdentity::opcode
uint8_t opcode
Definition: nvme.h:407
NvmeIdentity::rsvd12
uint32_t rsvd12[4]
Definition: nvme.h:418
NvmeRequest::iov
QEMUIOVector iov
Definition: nvme.h:985
NVME_NUMBER_OF_QUEUES
@ NVME_NUMBER_OF_QUEUES
Definition: nvme.h:822
NvmeFeatureVal::async_config
uint32_t async_config
Definition: nvme.h:801
NvmeNamespace::predef
uint64_t predef
Definition: nvme.h:1084
nvme_create_poller
void nvme_create_poller(FemuCtrl *n)
创建poller线程,以及两个ring queue:to_ftl和to_poller
Definition: nvme-io.c:313
nvme_setup_virq
int nvme_setup_virq(FemuCtrl *n, NvmeCQueue *cq)
Definition: intr.c:216
NVME_CMD_ZONE_MGMT_RECV
@ NVME_CMD_ZONE_MGMT_RECV
Definition: nvme.h:347
nvme_free_sq
void nvme_free_sq(NvmeSQueue *sq, FemuCtrl *n)
Definition: nvme-util.c:152
NVME_FEAT_CAP_CHANGE
@ NVME_FEAT_CAP_CHANGE
Definition: nvme.h:835
NvmeRequest::gcrt
int64_t gcrt
Definition: nvme.h:989
NvmeSQueue
Definition: nvme.h:1009
CMBSZ_SQS_SHIFT
@ CMBSZ_SQS_SHIFT
Definition: nvme.h:227
NvmeLBAF::rp
uint8_t rp
Definition: nvme.h:858
NvmeIdNs::ncap
uint64_t ncap
Definition: nvme.h:865
NvmeFwSlotInfoLog::afi
uint8_t afi
Definition: nvme.h:588
rte_ring::size
uint32_t size
Definition: rte_ring.h:136
NVME_SPARE_THRESHOLD
#define NVME_SPARE_THRESHOLD
Definition: nvme.h:88
NvmeCmdDptr
union NvmeCmdDptr NvmeCmdDptr
NVME_GETFEAT_SELECT_CURRENT
@ NVME_GETFEAT_SELECT_CURRENT
Definition: nvme.h:839
NvmeNamespace::ctrl
struct FemuCtrl * ctrl
Definition: nvme.h:1066
FemuCtrl::admin_sq
NvmeSQueue admin_sq
sq队列(admin)
Definition: nvme.h:1282
NvmeSQueue::db_addr_hva
uint64_t db_addr_hva
Definition: nvme.h:1028
NvmeCqe
struct NvmeCqe NvmeCqe
NVME_CSTS_SHST_PROGRESS
@ NVME_CSTS_SHST_PROGRESS
Definition: nvme.h:186
NvmeDsmCmd::nr
uint32_t nr
Definition: nvme.h:471
NVME_CQ_FLAGS_IEN
#define NVME_CQ_FLAGS_IEN(cq_flags)
Definition: nvme.h:379
nvme_identify_cmd_set
static uint16_t nvme_identify_cmd_set(FemuCtrl *n, NvmeCmd *cmd)
Definition: nvme-admin.c:510
NvmeRwCmd::flags
uint8_t flags
Definition: nvme.h:423
AQA_ACQS_MASK
@ AQA_ACQS_MASK
Definition: nvme.h:203
NvmeDsmCmd::opcode
uint8_t opcode
Definition: nvme.h:464
NvmeDsmRange::nlb
uint32_t nlb
Definition: nvme.h:484
NVME_FEAT_CAP_SAVE
@ NVME_FEAT_CAP_SAVE
Definition: nvme.h:833
nvme_set_db_memory
static uint16_t nvme_set_db_memory(FemuCtrl *n, const NvmeCmd *cmd)
Definition: nvme-admin.c:215
FemuCtrl::intc
uint8_t intc
Definition: nvme.h:1258
NVME_RW_DSM_FREQ_READS
@ NVME_RW_DSM_FREQ_READS
Definition: nvme.h:445
nvme_register_ocssd12
int nvme_register_ocssd12(FemuCtrl *n)
Definition: oc12.c:1084
femu_ring_create
struct rte_ring * femu_ring_create(enum femu_ring_type type, size_t count)
Definition: rte_ring.c:187
NvmeFwSlotInfoLog::frs1
uint8_t frs1[8]
Definition: nvme.h:590
NvmeCreateSq::sqid
uint16_t sqid
Definition: nvme.h:388
NvmeSmartLog::data_units_written
uint64_t data_units_written[2]
Definition: nvme.h:620
femu_nvme_rw_check_req
uint16_t femu_nvme_rw_check_req(FemuCtrl *n, NvmeNamespace *ns, NvmeCmd *cmd, NvmeRequest *req, uint64_t slba, uint64_t elba, uint32_t nlb, uint16_t ctrl, uint64_t data_size, uint64_t meta_size)
Definition: nvme-util.c:113
NvmeIdCtrl::apsta
uint8_t apsta
Definition: nvme.h:719
NvmeIdNs::nawupf
uint16_t nawupf
Definition: nvme.h:878
NvmeIdCtrlZoned::rsvd1
uint8_t rsvd1[4095]
Definition: zns.h:12
CAP_TO_SHIFT
@ CAP_TO_SHIFT
Definition: nvme.h:59
NvmeRequest::stime
int64_t stime
io开始时间
Definition: nvme.h:987
OcCtrlParams::num_lun
uint8_t num_lun
Definition: nvme.h:1159
NvmeCreateSq::rsvd1
uint32_t rsvd1[5]
Definition: nvme.h:385
NvmeParams::vwc
uint8_t vwc
Definition: nvme.h:1125
NvmeCmd::cdw14
uint32_t cdw14
Definition: nvme.h:310
nvme_create_sq
static uint16_t nvme_create_sq(FemuCtrl *n, NvmeCmd *cmd)
Definition: nvme-admin.c:107
NvmeNamespace::id_ns
NvmeIdNs id_ns
Definition: nvme.h:1067
FemuCtrl::error_count
uint8_t error_count
Definition: nvme.h:1241
NVME_NIDT_CSI
@ NVME_NIDT_CSI
Definition: nvme.h:915
NvmeDsmCmd::rsvd12
uint32_t rsvd12[4]
Definition: nvme.h:473
NvmeCQueue::QTAILQ_HEAD
QTAILQ_HEAD(sq_list, NvmeSQueue) sq_list
NvmeBar::cap
uint64_t cap
Definition: nvme.h:40
NvmeParams::max_q_ents
uint32_t max_q_ents
Definition: nvme.h:1116
NvmeIdNs::nvmcap
uint8_t nvmcap[16]
Definition: nvme.h:884
NVME_POWER_LOSS_ABORT
@ NVME_POWER_LOSS_ABORT
Definition: nvme.h:531
NvmeIdCtrl::awupf
uint16_t awupf
Definition: nvme.h:746
NVME_RW_DSM_FREQ_WRITES
@ NVME_RW_DSM_FREQ_WRITES
Definition: nvme.h:446
NvmeEffectsLog
struct NvmeEffectsLog NvmeEffectsLog
NVME_CMD_EFF_NIC
@ NVME_CMD_EFF_NIC
Definition: nvme.h:650
NvmeCQueue::phys_contig
uint8_t phys_contig
存储在mbe中的地址是否连续
Definition: nvme.h:1036
FemuCtrl::aer_mask
uint8_t aer_mask
Definition: nvme.h:1289
NvmeRequest::ns
struct NvmeNamespace * ns
Definition: nvme.h:970
NVME_ID_NS_DPC_FIRST_EIGHT
#define NVME_ID_NS_DPC_FIRST_EIGHT(dpc)
Definition: nvme.h:924
NVME_ID_CNS_CS_NS_PRESENT
@ NVME_ID_CNS_CS_NS_PRESENT
Definition: nvme.h:688
CAP_CQR_MASK
@ CAP_CQR_MASK
Definition: nvme.h:70
nvme_set_ctrl_name
void nvme_set_ctrl_name(FemuCtrl *n, const char *mn, const char *sn, int *dev_id)
Definition: nvme-util.c:294
NvmeIdCtrl::wctemp
uint16_t wctemp
Definition: nvme.h:720
NVME_ARBITRATION
@ NVME_ARBITRATION
Definition: nvme.h:816
nvme_create_cq
static uint16_t nvme_create_cq(FemuCtrl *n, NvmeCmd *cmd)
Definition: nvme-admin.c:148
NvmeFwSlotInfoLog::frs3
uint8_t frs3[8]
Definition: nvme.h:592
NvmeIdNs::vs
uint8_t vs[3712]
Definition: nvme.h:895
CMBSZ_LISTS_SHIFT
@ CMBSZ_LISTS_SHIFT
Definition: nvme.h:229
NvmeParams::mdts
uint8_t mdts
Definition: nvme.h:1123
nvme_set_feature
static uint16_t nvme_set_feature(FemuCtrl *n, NvmeCmd *cmd, NvmeCqe *cqe)
Definition: nvme-admin.c:616
NvmeDsmRange::cattr
uint32_t cattr
Definition: nvme.h:483
NVME_RW_LR
@ NVME_RW_LR
Definition: nvme.h:440
FemuCtrl::nr_tt_ios
int64_t nr_tt_ios
总io数量
Definition: nvme.h:1332
NvmeBar
Definition: nvme.h:39
NvmeCqe
Definition: nvme.h:511
NvmeErrorLog
Definition: nvme.h:600
OC20_ADM_CMD_SET_LOG_PAGE
@ OC20_ADM_CMD_SET_LOG_PAGE
Definition: nvme.h:1373
NvmeParams::dps
uint8_t dps
Definition: nvme.h:1127
NVME_AER_TYPE_VENDOR_SPECIFIC
@ NVME_AER_TYPE_VENDOR_SPECIFIC
Definition: nvme.h:492
NvmeIoCommands
NvmeIoCommands
Definition: nvme.h:338
NvmeRangeType::slba
uint64_t slba
Definition: nvme.h:849
FemuCtrl::mdts
uint8_t mdts
Definition: nvme.h:1242
FemuCtrl::start_time
time_t start_time
Definition: nvme.h:1222
NvmeIdentity::flags
uint8_t flags
Definition: nvme.h:408
CC_SHN_SHIFT
@ CC_SHN_SHIFT
Definition: nvme.h:139
NvmeRwCmd::control
uint16_t control
Definition: nvme.h:432
NVME_AER_TYPE_SMART
@ NVME_AER_TYPE_SMART
Definition: nvme.h:490
NvmeIdCtrlZoned
struct NvmeIdCtrlZoned NvmeIdCtrlZoned
NvmeErrorLog::lba
uint64_t lba
Definition: nvme.h:606
NvmeIdNs::nacwu
uint16_t nacwu
Definition: nvme.h:879
nvme_free_cq
void nvme_free_cq(NvmeCQueue *cq, FemuCtrl *n)
Definition: nvme-util.c:282
NVME_NIDL_EUI64
@ NVME_NIDL_EUI64
Definition: nvme.h:905
FemuCtrl::completed
int completed
Definition: nvme.h:1323
Oc20Params::sgl_lbal
uint8_t sgl_lbal
Definition: nvme.h:1105
NvmeFwSlotInfoLog::frs4
uint8_t frs4[8]
Definition: nvme.h:593
NvmeRangeType
struct NvmeRangeType NvmeRangeType
NVME_CMD_OC_ERASE
@ NVME_CMD_OC_ERASE
Definition: nvme.h:349
NVME_CAP_EXCEEDED
@ NVME_CAP_EXCEEDED
Definition: nvme.h:541
FemuCtrl::uuid
QemuUUID uuid
Definition: nvme.h:1191
FemuCtrl::should_isr
bool * should_isr
是否中断通知上层来取cq
Definition: nvme.h:1329
NvmeIdCtrl::oaes
uint32_t oaes
Definition: nvme.h:706
rte_ring
Definition: rte_ring.h:127
femu_nvme_rw_check_req
uint16_t femu_nvme_rw_check_req(FemuCtrl *n, NvmeNamespace *ns, NvmeCmd *cmd, NvmeRequest *req, uint64_t slba, uint64_t elba, uint32_t nlb, uint16_t ctrl, uint64_t data_size, uint64_t meta_size)
Definition: nvme-util.c:113
OcCtrlParams
struct OcCtrlParams OcCtrlParams
NVME_Q_PRIO_URGENT
@ NVME_Q_PRIO_URGENT
Definition: nvme.h:400
nvme_init_sq
uint16_t nvme_init_sq(NvmeSQueue *sq, FemuCtrl *n, uint64_t dma_addr, uint16_t sqid, uint16_t cqid, uint16_t size, enum NvmeQueueFlags prio, int contig)
初始化sq队列,预分配空间
Definition: nvme-util.c:169
NvmeIdCtrl::rsvd531
uint8_t rsvd531
Definition: nvme.h:748
nop_init
static void nop_init(FemuCtrl *n, Error **errp)
Definition: nop.c:24
CSTS_RDY_MASK
@ CSTS_RDY_MASK
Definition: nvme.h:176
pqueue_insert
int pqueue_insert(pqueue_t *q, void *d)
Definition: pqueue.c:122
NvmeSmartWarn
NvmeSmartWarn
Definition: nvme.h:632
NvmeSmartLog::power_on_hours
uint64_t power_on_hours[2]
Definition: nvme.h:625
NVME_INTERRUPT_COALESCING
@ NVME_INTERRUPT_COALESCING
Definition: nvme.h:823
NVME_ADM_CMD_SET_DB_MEMORY
@ NVME_ADM_CMD_SET_DB_MEMORY
Definition: nvme.h:333
DMAOff::qsg
QEMUSGList * qsg
Definition: nvme.h:1003
NVME_MORE
@ NVME_MORE
Definition: nvme.h:580
nvme_addr_read
void nvme_addr_read(FemuCtrl *n, hwaddr addr, void *buf, int size)
Definition: dma.c:3
NvmeIdentity::csi
uint8_t csi
Definition: nvme.h:417
NvmeIdCtrl::ctratt
uint32_t ctratt
Definition: nvme.h:707
NVME_ARB_HPW
#define NVME_ARB_HPW(arb)
Definition: nvme.h:808
NvmeIdentity::rsvd2
uint64_t rsvd2[2]
Definition: nvme.h:411
NVME_ARB_MPW
#define NVME_ARB_MPW(arb)
Definition: nvme.h:807
NVME_CMD_SEQ_ERROR
@ NVME_CMD_SEQ_ERROR
Definition: nvme.h:538
nvme_rpt_empty_id_struct
static uint16_t nvme_rpt_empty_id_struct(FemuCtrl *n, NvmeCmd *cmd)
Definition: nvme-admin.c:285
NvmeCmd::cdw12
uint32_t cdw12
Definition: nvme.h:308
NvmeIdCtrl::nvscc
uint8_t nvscc
Definition: nvme.h:747
NvmeRequest::oc12_slba
uint64_t oc12_slba
Definition: nvme.h:979
NvmeIdCtrl::vwc
uint8_t vwc
Definition: nvme.h:744
nvme_write_uncor
static uint16_t nvme_write_uncor(FemuCtrl *n, NvmeNamespace *ns, NvmeCmd *cmd, NvmeRequest *req)
处理io cmd:write uncorrectable命令
Definition: nvme-io.c:571
NvmeIdNs::npwa
uint16_t npwa
Definition: nvme.h:886
NVME_ONCS_WRITE_ZEROS
@ NVME_ONCS_WRITE_ZEROS
Definition: nvme.h:771
NvmePSD::resv
uint8_t resv[16]
Definition: nvme.h:672
NvmePsdt
NvmePsdt
Definition: nvme.h:290
NVME_AER_INFO_SMART_SPARE_THRESH
@ NVME_AER_INFO_SMART_SPARE_THRESH
Definition: nvme.h:501
set_pri
static void set_pri(void *a, pqueue_pri_t pri)
Definition: nvme-io.c:293
NVME_ID_CNS_NS_PRESENT_LIST
@ NVME_ID_CNS_NS_PRESENT_LIST
Definition: nvme.h:685
nvme_register_nossd
int nvme_register_nossd(FemuCtrl *n)
Definition: nop.c:29
NvmeIdCtrlLpa
NvmeIdCtrlLpa
Definition: nvme.h:780
FemuCtrl::extended
uint8_t extended
Definition: nvme.h:1252
NvmeSmartLog::power_cycles
uint64_t power_cycles[2]
Definition: nvme.h:624
NvmeIdentity::prp1
uint64_t prp1
Definition: nvme.h:412
NVME_WRITE_ATOMICITY
@ NVME_WRITE_ATOMICITY
Definition: nvme.h:825
NVME_PSDT_SGL_MPTR_SGL
@ NVME_PSDT_SGL_MPTR_SGL
Definition: nvme.h:293
Oc20Params
struct Oc20Params Oc20Params
CAP_CQR_SHIFT
@ CAP_CQR_SHIFT
Definition: nvme.h:57
NvmeRwCmd
Definition: nvme.h:421
NvmeIdCtrl::awun
uint16_t awun
Definition: nvme.h:745
NvmeCreateCq::irq_vector
uint16_t irq_vector
Definition: nvme.h:374
FemuCtrl::zone_size
uint64_t zone_size
Definition: nvme.h:1211
NVME_CAP_CSS_CSI_SUPP
@ NVME_CAP_CSS_CSI_SUPP
Definition: nvme.h:130
FemuCtrl::params
NvmeParams params
Definition: nvme.h:1219
NvmeIdCtrlOncs
NvmeIdCtrlOncs
Definition: nvme.h:767
CMBLOC_OFST_MASK
@ CMBLOC_OFST_MASK
Definition: nvme.h:216
NVME_ID_CNS_CS_CTRL
@ NVME_ID_CNS_CS_CTRL
Definition: nvme.h:683
NvmeIdNs::fpi
uint8_t fpi
Definition: nvme.h:875
NvmeRequest::predef
uint64_t predef
Definition: nvme.h:993
NVME_CONFLICTING_ATTRS
@ NVME_CONFLICTING_ATTRS
Definition: nvme.h:560
NVME_INTERNAL_DEV_ERROR
@ NVME_INTERNAL_DEV_ERROR
Definition: nvme.h:532
DPS_TYPE_3
@ DPS_TYPE_3
Definition: nvme.h:934
FEMU_SMARTSSD_MODE
@ FEMU_SMARTSSD_MODE
Definition: nvme.h:1362
CAP_OC_MASK
@ CAP_OC_MASK
Definition: nvme.h:76
NvmeCQueue::db_addr
uint64_t db_addr
Definition: nvme.h:1052
NvmeBar::acq
uint64_t acq
Definition: nvme.h:50
NvmeParams::extended
uint8_t extended
Definition: nvme.h:1131
FemuCtrl::vector_poll_started
bool vector_poll_started
Definition: nvme.h:1274
FemuCtrl::eis_addr
uint64_t eis_addr
Definition: nvme.h:1292
DPS_TYPE_MASK
@ DPS_TYPE_MASK
Definition: nvme.h:935
NvmeSglDescriptor::addr
uint64_t addr
Definition: nvme.h:272
NvmeSmartLog
Definition: nvme.h:612
NVME_ZONE_BOUNDARY_ERROR
@ NVME_ZONE_BOUNDARY_ERROR
Definition: nvme.h:563
NvmePSD::mp
uint16_t mp
Definition: nvme.h:664
CMBLOC_BIR_SHIFT
@ CMBLOC_BIR_SHIFT
Definition: nvme.h:210
CAP_MPSMIN_SHIFT
@ CAP_MPSMIN_SHIFT
Definition: nvme.h:64
NvmeSglDescriptor::len
uint32_t len
Definition: nvme.h:273
NvmeCreateSq::rsvd12
uint32_t rsvd12[4]
Definition: nvme.h:392
NvmeCapCss
NvmeCapCss
Definition: nvme.h:128
FemuCtrl::oc12_ctrl
Oc12Ctrl * oc12_ctrl
Definition: nvme.h:1301
FemuCtrl::cqe_size
uint16_t cqe_size
Definition: nvme.h:1227
NVME_ONCS_FEATURES
@ NVME_ONCS_FEATURES
Definition: nvme.h:772
NVME_FW_REQ_SUSYSTEM_RESET
@ NVME_FW_REQ_SUSYSTEM_RESET
Definition: nvme.h:559
NvmeCreateCq::cq_flags
uint16_t cq_flags
Definition: nvme.h:373
OcCtrlParams::sos
uint16_t sos
Definition: nvme.h:1161
nvme_identify_ctrl_csi
static uint16_t nvme_identify_ctrl_csi(FemuCtrl *n, NvmeCmd *cmd)
Definition: nvme-admin.c:367
FemuCtrl::meta
uint8_t meta
Definition: nvme.h:1246
NVME_CMD_OC_WRITE
@ NVME_CMD_OC_WRITE
Definition: nvme.h:350
FemuCtrl::num_io_queues
uint32_t num_io_queues
sq(cq)个数
Definition: nvme.h:1233
FemuCtrl::chip_locks
pthread_spinlock_t chip_locks[FEMU_MAX_NUM_CHIPS]
Definition: nvme.h:1303
NvmeCQueue::db_addr_hva
uint64_t db_addr_hva
Definition: nvme.h:1053
NvmeDifTuple::guard_tag
uint16_t guard_tag
Definition: nvme.h:1348
OCSSD
static bool OCSSD(FemuCtrl *n)
Definition: nvme.h:1376
NvmeSglDescriptor
struct QEMU_PACKED NvmeSglDescriptor NvmeSglDescriptor
DPS_TYPE_NONE
@ DPS_TYPE_NONE
Definition: nvme.h:931
NvmeAsyncEventRequest
NvmeAsyncEventRequest
Definition: nvme.h:488
NvmeCsi
NvmeCsi
Definition: nvme.h:123
NvmeParams::intc
uint8_t intc
Definition: nvme.h:1128
nvme_free_sq
void nvme_free_sq(NvmeSQueue *sq, FemuCtrl *n)
Definition: nvme-util.c:152
nvme_update_sq_tail
void nvme_update_sq_tail(NvmeSQueue *sq)
Definition: nvme-util.c:33
nvme_cse_acs
static const uint32_t nvme_cse_acs[256]
Definition: nvme-admin.c:38
NvmeAdminCommands
NvmeAdminCommands
Definition: nvme.h:317
NvmeSmartLog::reserved1
uint8_t reserved1[26]
Definition: nvme.h:618
NvmeParams::vid
uint16_t vid
Definition: nvme.h:1137
NVME_ID_CNS_NS_DESCR_LIST
@ NVME_ID_CNS_NS_DESCR_LIST
Definition: nvme.h:681
NVME_ADM_CMD_SECURITY_SEND
@ NVME_ADM_CMD_SECURITY_SEND
Definition: nvme.h:331
NvmeCQueue
struct NvmeCQueue NvmeCQueue
NvmeRequest::opaque
void * opaque
Definition: nvme.h:996
dma_read_prp
uint16_t dma_read_prp(FemuCtrl *n, uint8_t *ptr, uint32_t len, uint64_t prp1, uint64_t prp2)
Definition: dma.c:137
NVME_CMD_WRITE_UNCOR
@ NVME_CMD_WRITE_UNCOR
Definition: nvme.h:342
FemuCtrl::max_cqes
uint8_t max_cqes
Definition: nvme.h:1245
NvmeBar::asq
uint64_t asq
Definition: nvme.h:49
nvme_identify_ns
static uint16_t nvme_identify_ns(FemuCtrl *n, NvmeCmd *cmd)
Definition: nvme-admin.c:306
NVME_RW_DSM_FREQ_TEMP
@ NVME_RW_DSM_FREQ_TEMP
Definition: nvme.h:450
NvmeIdCtrl::mdts
uint8_t mdts
Definition: nvme.h:701
FemuCtrl::aerl
uint8_t aerl
Definition: nvme.h:1237
NvmeRequest::cq
struct NvmeCQueue * cq
Definition: nvme.h:969
NVME_INVALID_CQID
@ NVME_INVALID_CQID
Definition: nvme.h:544
NvmeRequest::is_write
uint16_t is_write
是否为写操作
Definition: nvme.h:973
FemuCtrl::max_q_ents
uint32_t max_q_ents
Definition: nvme.h:1234
FemuCtrl::temperature
uint16_t temperature
Definition: nvme.h:1223
CAP_MPSMAX_MASK
@ CAP_MPSMAX_MASK
Definition: nvme.h:78
NvmeRangeType::type
uint8_t type
Definition: nvme.h:846
NvmeErrorLog::sqid
uint16_t sqid
Definition: nvme.h:602
NvmeCqe::sq_id
uint16_t sq_id
Definition: nvme.h:520
nvme_addr_write
void nvme_addr_write(FemuCtrl *n, hwaddr addr, void *buf, int size)
Definition: dma.c:13
FemuCtrl::max_active_zones
uint32_t max_active_zones
Definition: nvme.h:1198
NvmeNamespace::data
uint64_t data
Definition: nvme.h:1085
FemuCtrl::ns_size
uint64_t ns_size
Definition: nvme.h:1235
AQA_ASQS_SHIFT
@ AQA_ASQS_SHIFT
Definition: nvme.h:197
CC_EN_MASK
@ CC_EN_MASK
Definition: nvme.h:145
CC_AMS_MASK
@ CC_AMS_MASK
Definition: nvme.h:148
FemuCtrl::femu_mode
uint8_t femu_mode
Definition: nvme.h:1296
NvmeCQueue::virq
int32_t virq
Definition: nvme.h:1042
NvmeErrorLog::param_error_location
uint16_t param_error_location
Definition: nvme.h:605
nvme_get_feature
static uint16_t nvme_get_feature(FemuCtrl *n, NvmeCmd *cmd, NvmeCqe *cqe)
Definition: nvme-admin.c:554
NvmeCQueue::head
uint32_t head
Definition: nvme.h:1040
pqueue_t
Definition: pqueue.h:54
NVME_SQ_FLAGS_QPRIO
#define NVME_SQ_FLAGS_QPRIO(sq_flags)
Definition: nvme.h:396
NvmeIdCtrl::aerl
uint8_t aerl
Definition: nvme.h:713
nvme_identify_ns_csi
static uint16_t nvme_identify_ns_csi(FemuCtrl *n, NvmeCmd *cmd)
Definition: nvme-admin.c:331
NvmeRequest::reqlat
int64_t reqlat
io延迟
Definition: nvme.h:988
nvme_sq_empty
uint8_t nvme_sq_empty(NvmeSQueue *sq)
Definition: nvme-util.c:64
NVME_OACS_FW
@ NVME_OACS_FW
Definition: nvme.h:762
NvmeParams::intc_thresh
uint8_t intc_thresh
Definition: nvme.h:1129
NvmeIdentity::nsid
uint32_t nsid
Definition: nvme.h:410
FemuCtrl::id_ctrl
NvmeIdCtrl id_ctrl
Definition: nvme.h:1285
NVME_INTERRUPT_VECTOR_CONF
@ NVME_INTERRUPT_VECTOR_CONF
Definition: nvme.h:824
nvme_setup_discontig
uint64_t * nvme_setup_discontig(FemuCtrl *n, uint64_t prp_addr, uint16_t queue_depth, uint16_t entry_size)
Definition: nvme-util.c:69
nvme_register_znssd
int nvme_register_znssd(FemuCtrl *n)
Definition: zns.c:1312
NvmeFeatureIds
NvmeFeatureIds
Definition: nvme.h:815
NvmeCmd::res2
uint64_t res2
Definition: nvme.h:303
NvmeSQueue::phys_contig
uint8_t phys_contig
在mbe中的地址是否连续
Definition: nvme.h:1011
NvmeIdCtrl::subnqn
uint8_t subnqn[256]
Definition: nvme.h:753
NVME_AER_INFO_ERR_DIAG_FAIL
@ NVME_AER_INFO_ERR_DIAG_FAIL
Definition: nvme.h:495
nvme_dsm
static uint16_t nvme_dsm(FemuCtrl *n, NvmeNamespace *ns, NvmeCmd *cmd, NvmeRequest *req)
处理io cmd:dataset management命令
Definition: nvme-io.c:424
CMBSZ_SZU_SHIFT
@ CMBSZ_SZU_SHIFT
Definition: nvme.h:232
Oc20Params::chunkstate_fname
char * chunkstate_fname
Definition: nvme.h:1107
NvmeIdNs::nabo
uint16_t nabo
Definition: nvme.h:881
CMBSZ_SZU_MASK
@ CMBSZ_SZU_MASK
Definition: nvme.h:242
CSTS_SHST_MASK
@ CSTS_SHST_MASK
Definition: nvme.h:178
CAP_AMS_SHIFT
@ CAP_AMS_SHIFT
Definition: nvme.h:58
NVME_RW_DSM_COMPRESSED
@ NVME_RW_DSM_COMPRESSED
Definition: nvme.h:456
FEMU_MAX_NUM_CHIPS
#define FEMU_MAX_NUM_CHIPS
Definition: nvme.h:1151
FemuCtrl::eis_addr_hva
uint64_t eis_addr_hva
Definition: nvme.h:1294
NvmeIdCtrl::oacs
uint16_t oacs
Definition: nvme.h:711
NVME_CMD_EFF_CSE_MASK
@ NVME_CMD_EFF_CSE_MASK
Definition: nvme.h:652
NVME_ZONE_TOO_MANY_ACTIVE
@ NVME_ZONE_TOO_MANY_ACTIVE
Definition: nvme.h:568
CAP_NSSRS_SHIFT
@ CAP_NSSRS_SHIFT
Definition: nvme.h:61
nvme_isr_notify_admin
void nvme_isr_notify_admin(void *opaque)
通知上层admin命令已完成
Definition: intr.c:192
NvmeRequest::meta_size
uint64_t meta_size
Definition: nvme.h:976
NVME_LBA_RANGE_TYPE
@ NVME_LBA_RANGE_TYPE
Definition: nvme.h:818
CMBLOC_OFST_SHIFT
@ CMBLOC_OFST_SHIFT
Definition: nvme.h:211
NvmeIdCtrl::sn
uint8_t sn[20]
Definition: nvme.h:695
cmp_pri
static int cmp_pri(pqueue_pri_t next, pqueue_pri_t curr)
Definition: nvme-io.c:283
NvmeAsyncEvent::QSIMPLEQ_ENTRY
QSIMPLEQ_ENTRY(NvmeAsyncEvent) entry
NvmeCmdDptr
Definition: nvme.h:281
NvmeCstsShift
NvmeCstsShift
Definition: nvme.h:168
NvmeCreateSq::cqid
uint16_t cqid
Definition: nvme.h:391
NvmeIdCtrl::oncs
uint16_t oncs
Definition: nvme.h:741
NOSSD
static bool NOSSD(FemuCtrl *n)
Definition: nvme.h:1386
FemuCtrl::max_open_zones
uint32_t max_open_zones
Definition: nvme.h:1199
NvmeEffectsLog::resv
uint8_t resv[2048]
Definition: nvme.h:643
NVME_NO_COMPLETE
@ NVME_NO_COMPLETE
Definition: nvme.h:582
NvmeRangeType::rsvd48
uint8_t rsvd48[16]
Definition: nvme.h:852
CAP_TO_MASK
@ CAP_TO_MASK
Definition: nvme.h:72
NvmeIdCtrlFrmw
NvmeIdCtrlFrmw
Definition: nvme.h:776
NvmeIdNsZoned
Definition: zns.h:88
FemuCtrl::aer_timer
QEMUTimer * aer_timer
Definition: nvme.h:1288
NvmeIdentity::cns
uint32_t cns
Definition: nvme.h:414
NVME_CQ_FLAGS_PC
#define NVME_CQ_FLAGS_PC(cq_flags)
Definition: nvme.h:378
NvmeFwSlotInfoLog::reserved1
uint8_t reserved1[7]
Definition: nvme.h:589
NVME_INVALID_LOG_ID
@ NVME_INVALID_LOG_ID
Definition: nvme.h:553
FemuCtrl::dps
uint8_t dps
Definition: nvme.h:1250
nvme_cq_full
uint8_t nvme_cq_full(NvmeCQueue *cq)
Definition: nvme-util.c:57
FemuCtrl::mc
uint8_t mc
Definition: nvme.h:1248
NvmeCmd::dptr
NvmeCmdDptr dptr
Definition: nvme.h:305
NVME_ONCS_COMPARE
@ NVME_ONCS_COMPARE
Definition: nvme.h:768
FemuCtrl::intc_thresh
uint8_t intc_thresh
Definition: nvme.h:1259
NVME_INVALID_OPCODE
@ NVME_INVALID_OPCODE
Definition: nvme.h:527
NvmeParams::did
uint16_t did
Definition: nvme.h:1138
NVME_OACS_FORMAT
@ NVME_OACS_FORMAT
Definition: nvme.h:761
NVME_NIDL_NGUID
@ NVME_NIDL_NGUID
Definition: nvme.h:906
NvmeFwSlotInfoLog::frs7
uint8_t frs7[8]
Definition: nvme.h:596
nvme_identify_nslist
static uint16_t nvme_identify_nslist(FemuCtrl *n, NvmeCmd *cmd)
Definition: nvme-admin.c:392
NvmeErrorLog
struct NvmeErrorLog NvmeErrorLog
NVME_ONCS_DSM
@ NVME_ONCS_DSM
Definition: nvme.h:770
NvmeRwCmd::prp2
uint64_t prp2
Definition: nvme.h:429
NVME_RW_DSM_LATENCY_LOW
@ NVME_RW_DSM_LATENCY_LOW
Definition: nvme.h:454
nvme_cse_iocs_nvm
static const uint32_t nvme_cse_iocs_nvm[256]
Definition: nvme-admin.c:53
NVME_ADM_CMD_GET_FEATURES
@ NVME_ADM_CMD_GET_FEATURES
Definition: nvme.h:326
NvmeIdNs::nsfeat
uint8_t nsfeat
Definition: nvme.h:867
NvmeParams::oc20
Oc20Params oc20
Definition: nvme.h:1146
NvmeCreateCq::cid
uint16_t cid
Definition: nvme.h:367
NVME_ID_CNS_CTRL
@ NVME_ID_CNS_CTRL
Definition: nvme.h:679
FemuCtrl::pq
pqueue_t ** pq
pqueue,暂存req的队列
Definition: nvme.h:1328
NvmeFeatureVal
Definition: nvme.h:791
FemuCtrl::nr_tt_late_ios
int64_t nr_tt_late_ios
没有按预计时延(超时)返回的io数量
Definition: nvme.h:1333
NvmeCqe::rsvd
uint32_t rsvd
Definition: nvme.h:515
FemuCtrl::cq
NvmeCQueue ** cq
cq队列列表(io)
Definition: nvme.h:1281
NvmeIdCtrl::sqes
uint8_t sqes
Definition: nvme.h:737
NvmeIdNs::nawun
uint16_t nawun
Definition: nvme.h:877
nvme_format_namespace
static uint16_t nvme_format_namespace(NvmeNamespace *ns, uint8_t lba_idx, uint8_t meta_loc, uint8_t pil, uint8_t pi, uint8_t sec_erase)
Definition: nvme-admin.c:884
NvmeIdNs::nsze
uint64_t nsze
Definition: nvme.h:864
nvme_register_nossd
int nvme_register_nossd(FemuCtrl *n)
Definition: nop.c:29
NvmeIdNs::eui64
uint64_t eui64
Definition: nvme.h:892
NvmeCqe::n
struct NvmeCqe::@15::@17 n
NvmeIdCtrlZoned::zasl
uint8_t zasl
Definition: zns.h:11
NvmeIdNs::dlfeat
uint8_t dlfeat
Definition: nvme.h:876
NvmeIdCtrl::fwug
uint8_t fwug
Definition: nvme.h:730
NvmeIdCns
NvmeIdCns
Definition: nvme.h:677
NvmeDsmRange
struct NvmeDsmRange NvmeDsmRange
NVME_CC_CSS
#define NVME_CC_CSS(cc)
Definition: nvme.h:155
NvmeParams::num_namespaces
uint32_t num_namespaces
Definition: nvme.h:1114
NVME_GETFEAT_SELECT_CAP
@ NVME_GETFEAT_SELECT_CAP
Definition: nvme.h:842
femu_ring_enqueue
size_t femu_ring_enqueue(struct rte_ring *ring, void **objs, size_t count)
Definition: rte_ring.c:223
NvmeCQueue::irq_enabled
uint16_t irq_enabled
irq 中断用
Definition: nvme.h:1039
NVME_FID_NOT_SAVEABLE
@ NVME_FID_NOT_SAVEABLE
Definition: nvme.h:557
NvmeEffectsLog::acs
uint32_t acs[256]
Definition: nvme.h:641
nvme_init_cq
uint16_t nvme_init_cq(NvmeCQueue *cq, FemuCtrl *n, uint64_t dma_addr, uint16_t cqid, uint16_t vector, uint16_t size, uint16_t irq_enabled, int contig)
Definition: nvme-util.c:237
NvmeCQueue::eventidx_addr_hva
uint64_t eventidx_addr_hva
Definition: nvme.h:1055
NvmePSD::enlat
uint32_t enlat
Definition: nvme.h:666
NVME_NIDL_CSI
@ NVME_NIDL_CSI
Definition: nvme.h:908
FemuCtrl::iomem
MemoryRegion iomem
Definition: nvme.h:1186
NvmeNamespace::bbtbl
Oc12Bbt ** bbtbl
Definition: nvme.h:1079
NVME_CMD_WRITE_ZEROES
@ NVME_CMD_WRITE_ZEROES
Definition: nvme.h:344
NVME_ADM_CMD_DOWNLOAD_FW
@ NVME_ADM_CMD_DOWNLOAD_FW
Definition: nvme.h:329
FemuCtrl::csi
uint8_t csi
Definition: nvme.h:1203
FemuCtrl::memsz
uint32_t memsz
Definition: nvme.h:1298
NVME_CSTS_NSSRO
#define NVME_CSTS_NSSRO(csts)
Definition: nvme.h:194
NvmeCreateSq::prp1
uint64_t prp1
Definition: nvme.h:386
NVME_CSTS_READY
@ NVME_CSTS_READY
Definition: nvme.h:183
FEMU_MAX_INF_REQS
#define FEMU_MAX_INF_REQS
Definition: nvme.h:1355
NVME_AER_INFO_SMART_TEMP_THRESH
@ NVME_AER_INFO_SMART_TEMP_THRESH
Definition: nvme.h:500
NvmeAerResult
struct NvmeAerResult NvmeAerResult
NvmeCmdDptr::prp1
uint64_t prp1
Definition: nvme.h:283
NvmeBar::cmbloc
uint32_t cmbloc
Definition: nvme.h:51
MN_MAX_LEN
#define MN_MAX_LEN
Definition: nvme.h:1499
NVME_INVALID_FW_IMAGE
@ NVME_INVALID_FW_IMAGE
Definition: nvme.h:551
OcCtrlParams::secs_per_pg
uint8_t secs_per_pg
Definition: nvme.h:1155
NVME_CID_CONFLICT
@ NVME_CID_CONFLICT
Definition: nvme.h:529
NvmeAerResult::resv
uint8_t resv
Definition: nvme.h:508
NvmeCmblocMask
NvmeCmblocMask
Definition: nvme.h:214
nvme_process_sq_admin
void nvme_process_sq_admin(void *opaque)
处理admin命令的sq队列
Definition: nvme-admin.c:1036
NVME_CMD_EFF_CCC
@ NVME_CMD_EFF_CCC
Definition: nvme.h:651
NvmeIdNs::mc
uint8_t mc
Definition: nvme.h:870
nvme_sq_empty
uint8_t nvme_sq_empty(NvmeSQueue *sq)
Definition: nvme-util.c:64
NvmeSQueue::sqid
uint16_t sqid
Definition: nvme.h:1013
FemuExtCtrlOps
扩展操作接口,具体实现在各模式ssd中
Definition: nvme.h:1169
nvme_inc_cq_tail
void nvme_inc_cq_tail(NvmeCQueue *cq)
Definition: nvme-util.c:19
NVME_LOG_FW_SLOT_INFO
@ NVME_LOG_FW_SLOT_INFO
Definition: nvme.h:659
FemuCtrl::intc_time
uint8_t intc_time
Definition: nvme.h:1260
nvme_error_log_info
static uint16_t nvme_error_log_info(FemuCtrl *n, NvmeCmd *cmd, uint32_t buf_len)
Definition: nvme-admin.c:698
nvme_cq_full
uint8_t nvme_cq_full(NvmeCQueue *cq)
Definition: nvme-util.c:57
nop_io_cmd
static uint16_t nop_io_cmd(FemuCtrl *n, NvmeNamespace *ns, NvmeCmd *cmd, NvmeRequest *req)
Definition: nop.c:12
NvmeIdCtrl::kas
uint16_t kas
Definition: nvme.h:731
NVME_POWER_MANAGEMENT
@ NVME_POWER_MANAGEMENT
Definition: nvme.h:817
CMBSZ_LISTS_MASK
@ CMBSZ_LISTS_MASK
Definition: nvme.h:239
NvmeLBAF::ms
uint16_t ms
Definition: nvme.h:856
OcCtrlParams::sec_size
uint16_t sec_size
Definition: nvme.h:1154
NvmeBar::intmc
uint32_t intmc
Definition: nvme.h:43
rsvd
uint64_t rsvd
Definition: oc12.h:3
NvmeCQueue::dma_addr_hva
uint64_t dma_addr_hva
Definition: nvme.h:1046
FemuCtrl::ssd
struct ssd * ssd
指向模拟的ssd
Definition: nvme.h:1321
dram.h
DRAM后端相关声明
NvmeCQueue::guest_notifier
EventNotifier guest_notifier
Definition: nvme.h:1048
NVME_ADM_CMD_SECURITY_RECV
@ NVME_ADM_CMD_SECURITY_RECV
Definition: nvme.h:332
NvmeIdNs::nows
uint16_t nows
Definition: nvme.h:889
NVME_ID_CNS_NS_ACTIVE_LIST
@ NVME_ID_CNS_NS_ACTIVE_LIST
Definition: nvme.h:680
NvmeNamespace::meta_start_offset
uint64_t meta_start_offset
Definition: nvme.h:1075
NvmeIdNs::lbaf
NvmeLBAF lbaf[16]
Definition: nvme.h:893
CMBSZ_CQS_MASK
@ CMBSZ_CQS_MASK
Definition: nvme.h:238
NvmeIdCtrl::hmmin
uint32_t hmmin
Definition: nvme.h:724
NVME_RW_DSM_FREQ_TYPICAL
@ NVME_RW_DSM_FREQ_TYPICAL
Definition: nvme.h:443
NvmeCapShift
NvmeCapShift
Definition: nvme.h:55
FemuCtrl::lver
uint8_t lver
femu模式,包括blackbox,ocssd,...
Definition: nvme.h:1297
Oc20Params::writefail_fname
char * writefail_fname
Definition: nvme.h:1109
NvmeCmd::cdw10
uint32_t cdw10
Definition: nvme.h:306
NvmeSQueue::io_req
NvmeRequest * io_req
Definition: nvme.h:1022
FemuCtrl::temp_warn_issued
uint8_t temp_warn_issued
Definition: nvme.h:1262
NVME_WRITE_TO_RO
@ NVME_WRITE_TO_RO
Definition: nvme.h:562
nvme_post_cqes_io
void nvme_post_cqes_io(void *opaque)
将剩余的req都填入cq
Definition: nvme-io.c:651
NVME_VOLATILE_WRITE_CACHE
@ NVME_VOLATILE_WRITE_CACHE
Definition: nvme.h:821
NvmeCmd::opcode
uint16_t opcode
Definition: nvme.h:297
NVME_ZONE_FULL
@ NVME_ZONE_FULL
Definition: nvme.h:564
NVME_INVALID_PROT_INFO
@ NVME_INVALID_PROT_INFO
Definition: nvme.h:561
NvmeRwCmd::cid
uint16_t cid
Definition: nvme.h:424
NVME_AER_TYPE_ERROR
@ NVME_AER_TYPE_ERROR
Definition: nvme.h:489
NvmeIdentity::cid
uint16_t cid
Definition: nvme.h:409
NvmeParams::max_sqes
uint8_t max_sqes
Definition: nvme.h:1117
nvme.h
nvme相关数据声明
NvmeIdNs::nmic
uint8_t nmic
Definition: nvme.h:873
LogIdentifier
LogIdentifier
Definition: nvme.h:656
CSTS_NSSRO_SHIFT
@ CSTS_NSSRO_SHIFT
Definition: nvme.h:172
NvmeRwCmd::rsvd2
uint64_t rsvd2
Definition: nvme.h:426
FemuCtrl::admin_cq
NvmeCQueue admin_cq
cq队列(admin)
Definition: nvme.h:1283
nvme_del_sq
static uint16_t nvme_del_sq(FemuCtrl *n, NvmeCmd *cmd)
Definition: nvme-admin.c:74
FemuCtrl::oncs
uint16_t oncs
Definition: nvme.h:1230
NvmeFeatureVal::int_vector_config
uint32_t * int_vector_config
Definition: nvme.h:799
FemuCtrl::id_ns_zoned
NvmeIdNsZoned * id_ns_zoned
Definition: nvme.h:1204
NvmeIdNs::dpc
uint8_t dpc
Definition: nvme.h:871
NvmeIdCtrl::edstt
uint16_t edstt
Definition: nvme.h:728
NvmeSQueue::eventidx_addr_hva
uint64_t eventidx_addr_hva
Definition: nvme.h:1030
CC_SHN_MASK
@ CC_SHN_MASK
Definition: nvme.h:149
NvmeCcCss
NvmeCcCss
Definition: nvme.h:162
NVME_CMD_ABORT_REQ
@ NVME_CMD_ABORT_REQ
Definition: nvme.h:533
FemuCtrl::oacs
uint16_t oacs
Definition: nvme.h:1229
nvme_update_sq_tail
void nvme_update_sq_tail(NvmeSQueue *sq)
Definition: nvme-util.c:33
NVME_RW_DSM_SEQ_REQ
@ NVME_RW_DSM_SEQ_REQ
Definition: nvme.h:455
NvmeParams::oncs
uint16_t oncs
Definition: nvme.h:1143
NvmeCmd::psdt
uint16_t psdt
Definition: nvme.h:300
NvmeCmblocShift
NvmeCmblocShift
Definition: nvme.h:209
NvmeCQueue::ctrl
struct FemuCtrl * ctrl
Definition: nvme.h:1035
FemuCtrl::to_ftl
struct rte_ring ** to_ftl
生产者:nvme poller;消费者:ftl
Definition: nvme.h:1326
NVME_CSTS_SHST_COMPLETE
@ NVME_CSTS_SHST_COMPLETE
Definition: nvme.h:187
NvmeRwCmd::opcode
uint8_t opcode
Definition: nvme.h:422
nvme_map_prp
uint16_t nvme_map_prp(QEMUSGList *qsg, QEMUIOVector *iov, uint64_t prp1, uint64_t prp2, uint32_t len, FemuCtrl *n)
Definition: dma.c:23
FemuCtrl::zone_array
NvmeZone * zone_array
Definition: nvme.h:1205
NVME_ZONE_READ_ONLY
@ NVME_ZONE_READ_ONLY
Definition: nvme.h:565
NVME_AER_INFO_ERR_FW_IMG_LOAD_ERR
@ NVME_AER_INFO_ERR_FW_IMG_LOAD_ERR
Definition: nvme.h:498
NvmeNamespace::blk
struct NvmeNamespace::@18 blk
FemuCtrl::cpg_rd_lat_ns
int64_t cpg_rd_lat_ns
Definition: nvme.h:1309
nvme_discontig
static hwaddr nvme_discontig(uint64_t *dma_addr, uint16_t page_size, uint16_t queue_idx, uint16_t entry_size)
地址不连续时取cmd地址
Definition: nvme.h:1478
CMBSZ_CQS_SHIFT
@ CMBSZ_CQS_SHIFT
Definition: nvme.h:228
NVME_RW_DSM_FREQ_PREFETCH
@ NVME_RW_DSM_FREQ_PREFETCH
Definition: nvme.h:449
pqueue_peek
void * pqueue_peek(pqueue_t *q)
Definition: pqueue.c:186
FemuCtrl::upg_rd_lat_ns
int64_t upg_rd_lat_ns
Definition: nvme.h:1308
NvmeNamespace::lba_range
NvmeRangeType lba_range[64]
Definition: nvme.h:1068
NVME_CMD_EFF_UUID_SEL
@ NVME_CMD_EFF_UUID_SEL
Definition: nvme.h:653
NvmeCreateCq::rsvd12
uint32_t rsvd12[4]
Definition: nvme.h:375
NvmeSmartLog::available_spare
uint8_t available_spare
Definition: nvme.h:615
NvmeCsts
NvmeCsts
Definition: nvme.h:182
NvmeIdNs::rsvd192
uint8_t rsvd192[192]
Definition: nvme.h:894
NvmeCreateSq::rsvd8
uint64_t rsvd8
Definition: nvme.h:387
NvmeAerResult
Definition: nvme.h:504
NvmeCQueue::prp_list
uint64_t * prp_list
Definition: nvme.h:1047
FemuCtrl::cpg_wr_lat_ns
int64_t cpg_wr_lat_ns
Definition: nvme.h:1314
NvmeParams::mc
uint8_t mc
Definition: nvme.h:1136
NvmeIdNsDescr
Definition: nvme.h:898
NvmeDeleteQ::cid
uint16_t cid
Definition: nvme.h:357
NVME_RW_PRINFO_PRCHK_REF
@ NVME_RW_PRINFO_PRCHK_REF
Definition: nvme.h:460
ZNSSD
static bool ZNSSD(FemuCtrl *n)
Definition: nvme.h:1391
NVME_Q_PRIO_HIGH
@ NVME_Q_PRIO_HIGH
Definition: nvme.h:401
FEMU_BBSSD_MODE
@ FEMU_BBSSD_MODE
Definition: nvme.h:1359
NvmeNamespace::size
uint64_t size
Definition: nvme.h:1072
NvmeCmdDptr::sgl
NvmeSglDescriptor sgl
Definition: nvme.h:287
NVME_FEAT_CAP_NS
@ NVME_FEAT_CAP_NS
Definition: nvme.h:834
NVME_ADM_CMD_FEMU_DEBUG
@ NVME_ADM_CMD_FEMU_DEBUG
Definition: nvme.h:334
NvmeStatusCodes
NvmeStatusCodes
Definition: nvme.h:525
NvmeDeleteQ
struct NvmeDeleteQ NvmeDeleteQ
nvme_register_ocssd20
int nvme_register_ocssd20(FemuCtrl *n)
Definition: oc20.c:1363
NVME_CAP_CSS_ADMIN_ONLY
@ NVME_CAP_CSS_ADMIN_ONLY
Definition: nvme.h:131
NvmeRequest::cqe
NvmeCqe cqe
Definition: nvme.h:982
NvmeCreateCq::opcode
uint8_t opcode
Definition: nvme.h:365
NVME_AER_LIMIT_EXCEEDED
@ NVME_AER_LIMIT_EXCEEDED
Definition: nvme.h:549
NVME_LPA_EXTENDED
@ NVME_LPA_EXTENDED
Definition: nvme.h:783
OcCtrlParams
Definition: nvme.h:1153
CMBSZ_RDS_SHIFT
@ CMBSZ_RDS_SHIFT
Definition: nvme.h:230
NvmeNamespace::state
void * state
Definition: nvme.h:1089
CAP_NSSRS_MASK
@ CAP_NSSRS_MASK
Definition: nvme.h:74
NvmeSmartLog::controller_busy_time
uint64_t controller_busy_time[2]
Definition: nvme.h:623
NvmeCcShift
NvmeCcShift
Definition: nvme.h:134
NVME_RW_DSM_LATENCY_IDLE
@ NVME_RW_DSM_LATENCY_IDLE
Definition: nvme.h:452
NVME_AER_INFO_ERR_PERS_INTERNAL_ERR
@ NVME_AER_INFO_ERR_PERS_INTERNAL_ERR
Definition: nvme.h:496
NVME_ADM_CMD_CREATE_CQ
@ NVME_ADM_CMD_CREATE_CQ
Definition: nvme.h:322
NVME_E2E_REF_ERROR
@ NVME_E2E_REF_ERROR
Definition: nvme.h:576
NvmeAsyncEvent
Definition: nvme.h:962
NvmeIdNs::flbas
uint8_t flbas
Definition: nvme.h:869
nvme_addr_write
void nvme_addr_write(FemuCtrl *n, hwaddr addr, void *buf, int size)
Definition: dma.c:13
NVME_ZONE_INVAL_TRANSITION
@ NVME_ZONE_INVAL_TRANSITION
Definition: nvme.h:570
NvmeCcMask
NvmeCcMask
Definition: nvme.h:144
NvmeIdNsDescr
struct QEMU_PACKED NvmeIdNsDescr NvmeIdNsDescr
NvmeIdCtrlOacs
NvmeIdCtrlOacs
Definition: nvme.h:759
Oc20Params::early_reset
uint8_t early_reset
Definition: nvme.h:1104
NVME_CMD_ABORT_MISSING_FUSE
@ NVME_CMD_ABORT_MISSING_FUSE
Definition: nvme.h:536
NvmeBar::rsvd1
uint32_t rsvd1
Definition: nvme.h:45
CAP_CSS_MASK
@ CAP_CSS_MASK
Definition: nvme.h:75
NvmeAerResult::log_page
uint8_t log_page
Definition: nvme.h:507
Oc20Params::mccap
uint32_t mccap
Definition: nvme.h:1098
NvmeIdCtrl::hmpre
uint32_t hmpre
Definition: nvme.h:723
NvmeAsyncEvent
struct NvmeAsyncEvent NvmeAsyncEvent
NvmeSmartLog::host_write_commands
uint64_t host_write_commands[2]
Definition: nvme.h:622
NvmeSmartLog::critical_warning
uint8_t critical_warning
Definition: nvme.h:613
NvmeFwSlotInfoLog::frs6
uint8_t frs6[8]
Definition: nvme.h:595
NvmeCreateCq::rsvd8
uint64_t rsvd8
Definition: nvme.h:370
NVME_CC_CSS_ADMIN_ONLY
@ NVME_CC_CSS_ADMIN_ONLY
Definition: nvme.h:165
NvmeCQueue::timer
QEMUTimer * timer
Definition: nvme.h:1049
FemuExtCtrlOps::io_cmd
uint16_t(* io_cmd)(struct FemuCtrl *, NvmeNamespace *, NvmeCmd *, NvmeRequest *)
Definition: nvme.h:1176
OcCtrlParams::num_pln
uint8_t num_pln
Definition: nvme.h:1160
nvme_init_sq
uint16_t nvme_init_sq(NvmeSQueue *sq, FemuCtrl *n, uint64_t dma_addr, uint16_t sqid, uint16_t cqid, uint16_t size, enum NvmeQueueFlags prio, int contig)
初始化sq队列,预分配空间
Definition: nvme-util.c:169
NVME_CAP_CQR
#define NVME_CAP_CQR(cap)
Definition: nvme.h:93
NvmeFwSlotInfoLog::frs5
uint8_t frs5[8]
Definition: nvme.h:594
NvmeDeleteQ::rsvd10
uint16_t rsvd10
Definition: nvme.h:360
CSTS_CFS_MASK
@ CSTS_CFS_MASK
Definition: nvme.h:177
FemuCtrl::to_poller
struct rte_ring ** to_poller
生产者:ftl;消费者:nvme poller
Definition: nvme.h:1327
NvmeIdCtrl::acwu
uint16_t acwu
Definition: nvme.h:749
Oc20Params::debug
uint8_t debug
Definition: nvme.h:1103
NVME_ADM_CMD_ASYNC_EV_REQ
@ NVME_ADM_CMD_ASYNC_EV_REQ
Definition: nvme.h:327
pqueue.h
Priority Queue function declarations
FemuCtrl::cross_zone_read
bool cross_zone_read
Definition: nvme.h:1195
FemuExtCtrlOps::admin_cmd
uint16_t(* admin_cmd)(struct FemuCtrl *, NvmeCmd *)
Definition: nvme.h:1175
NvmeLBAF::lbads
uint8_t lbads
Definition: nvme.h:857
DPS_TYPE_1
@ DPS_TYPE_1
Definition: nvme.h:932
nand.h
NvmeIdCtrl::cmic
uint8_t cmic
Definition: nvme.h:700
NvmeSglDescriptor
Definition: nvme.h:271
FemuExtCtrlOps::init
void(* init)(struct FemuCtrl *, Error **)
Definition: nvme.h:1171
NvmeRequest::expire_time
int64_t expire_time
io应该结束的时间
Definition: nvme.h:990
NvmePollerThreadArgument::n
FemuCtrl * n
Definition: nvme.h:1343
CSTS_CFS_SHIFT
@ CSTS_CFS_SHIFT
Definition: nvme.h:170
nvme_map_prp
uint16_t nvme_map_prp(QEMUSGList *qsg, QEMUIOVector *iov, uint64_t prp1, uint64_t prp2, uint32_t len, FemuCtrl *n)
Definition: dma.c:23
set_pos
static void set_pos(void *a, size_t pos)
Definition: nvme-io.c:303
NvmeDifTuple::app_tag
uint16_t app_tag
Definition: nvme.h:1349
NVME_AER_INFO_ERR_INVALID_DB
@ NVME_AER_INFO_ERR_INVALID_DB
Definition: nvme.h:494
nvme_isr_notify_admin
void nvme_isr_notify_admin(void *opaque)
通知上层admin命令已完成
Definition: intr.c:192
NvmeRequest::sq
struct NvmeSQueue * sq
Definition: nvme.h:968
NvmeParams::ms_max
uint8_t ms_max
Definition: nvme.h:1135
FemuCtrl::chnl_next_avail_time
volatile int64_t chnl_next_avail_time[FEMU_MAX_NUM_CHNLS]
Definition: nvme.h:1304
NvmeIdCtrl::fr
uint8_t fr[8]
Definition: nvme.h:697
nvme_update_cq_head
void nvme_update_cq_head(NvmeCQueue *cq)
Definition: nvme-util.c:45
CC_MPS_MASK
@ CC_MPS_MASK
Definition: nvme.h:147
FemuCtrl::num_namespaces
uint32_t num_namespaces
Definition: nvme.h:1232
NVME_CMD_ZONE_APPEND
@ NVME_CMD_ZONE_APPEND
Definition: nvme.h:348
NvmeSmartLog::data_units_read
uint64_t data_units_read[2]
Definition: nvme.h:619
FemuCtrl::QSIMPLEQ_HEAD
QSIMPLEQ_HEAD(aer_queue, NvmeAsyncEvent) aer_queue
NvmeCqe::sq_head
uint16_t sq_head
Definition: nvme.h:519
NVME_CMD_ABORT_FAILED_FUSE
@ NVME_CMD_ABORT_FAILED_FUSE
Definition: nvme.h:535
NvmeFeatureVal::int_coalescing
uint32_t int_coalescing
Definition: nvme.h:798
DPS_TYPE_2
@ DPS_TYPE_2
Definition: nvme.h:933
NvmeSQueue::prp_list
uint64_t * prp_list
Definition: nvme.h:1021
NvmeSQueue::tail
uint32_t tail
Definition: nvme.h:1016
FemuCtrl::max_prp_ents
uint16_t max_prp_ents
Definition: nvme.h:1226
NVME_DSMGMT_IDR
@ NVME_DSMGMT_IDR
Definition: nvme.h:477
FemuCtrl::cupg_wr_lat_ns
int64_t cupg_wr_lat_ns
Definition: nvme.h:1315
NvmeIdNsDescr::nidt
uint8_t nidt
Definition: nvme.h:899
NvmeSQueue::head
uint32_t head
Definition: nvme.h:1015
NVME_LPA_CSE
@ NVME_LPA_CSE
Definition: nvme.h:782
FemuCtrl::mbe
SsdDramBackend * mbe
femu后端内存(实际数据)
Definition: nvme.h:1322
NvmeRequest::cmd_opcode
uint8_t cmd_opcode
Definition: nvme.h:983
NVME_ACCESS_DENIED
@ NVME_ACCESS_DENIED
Definition: nvme.h:578
NvmeAsyncEvent::result
NvmeAerResult result
Definition: nvme.h:964
NVME_ADM_CMD_IDENTIFY
@ NVME_ADM_CMD_IDENTIFY
Definition: nvme.h:323
NvmeIdNs::noiob
uint16_t noiob
Definition: nvme.h:883
NvmeCmbszMask
NvmeCmbszMask
Definition: nvme.h:236
NVME_DULB
@ NVME_DULB
Definition: nvme.h:579
NVME_INVALID_QID
@ NVME_INVALID_QID
Definition: nvme.h:545
CC_MPS_SHIFT
@ CC_MPS_SHIFT
Definition: nvme.h:137
NvmeFeatureVal
struct NvmeFeatureVal NvmeFeatureVal
NvmeIdCtrl::mntmt
uint16_t mntmt
Definition: nvme.h:733
NvmeRwCmd::mptr
uint64_t mptr
Definition: nvme.h:427
bb_init_ctrl_str
static void bb_init_ctrl_str(FemuCtrl *n)
Definition: nop.c:3
nvme_check_sqid
int nvme_check_sqid(FemuCtrl *n, uint16_t sqid)
Definition: nvme-util.c:9
NvmeRequest::meta_buf
void * meta_buf
Definition: nvme.h:978
NvmeIdNs
struct NvmeIdNs NvmeIdNs
CC_AMS_SHIFT
@ CC_AMS_SHIFT
Definition: nvme.h:138
nvme_get_log
static uint16_t nvme_get_log(FemuCtrl *n, NvmeCmd *cmd)
Definition: nvme-admin.c:787
NvmeCQueue::eventidx_addr
uint64_t eventidx_addr
Definition: nvme.h:1054
FemuExtCtrlOps::state
void * state
Definition: nvme.h:1170
NvmeCmbszShift
NvmeCmbszShift
Definition: nvme.h:226
Oc20Params::mw_cunits
uint32_t mw_cunits
Definition: nvme.h:1101
NVME_PSDT_PRP
@ NVME_PSDT_PRP
Definition: nvme.h:291
NvmeIdCtrl::fna
uint8_t fna
Definition: nvme.h:743
NvmeParams::dlfeat
uint8_t dlfeat
Definition: nvme.h:1139
NVME_INVALID_FORMAT
@ NVME_INVALID_FORMAT
Definition: nvme.h:554
FemuCtrl::parent_obj
PCIDevice parent_obj
Definition: nvme.h:1185
NVME_OP_ABORTED
#define NVME_OP_ABORTED
Definition: nvme.h:90
NVME_CMD_READ
@ NVME_CMD_READ
Definition: nvme.h:341
CC_CSS_SHIFT
@ CC_CSS_SHIFT
Definition: nvme.h:136
FemuCtrl::ctrl_mem
MemoryRegion ctrl_mem
Definition: nvme.h:1187
NVME_ID_NS_MC_SEPARATE
#define NVME_ID_NS_MC_SEPARATE(mc)
Definition: nvme.h:921
OC20_ADM_CMD_IDENTIFY
@ OC20_ADM_CMD_IDENTIFY
Definition: nvme.h:1372
NVME_NS_RESV_CONFLICT
@ NVME_NS_RESV_CONFLICT
Definition: nvme.h:543
FemuCtrl::nlbaf
uint8_t nlbaf
Definition: nvme.h:1251
NvmeBar::nssrc
uint32_t nssrc
Definition: nvme.h:47
NvmeErrorLog::vs
uint8_t vs
Definition: nvme.h:608
NvmeBar::aqa
uint32_t aqa
Definition: nvme.h:48
NVME_ADM_CMD_SET_FEATURES
@ NVME_ADM_CMD_SET_FEATURES
Definition: nvme.h:325
NVME_INVALID_IRQ_VECTOR
@ NVME_INVALID_IRQ_VECTOR
Definition: nvme.h:552
FemuCtrl::devname
char devname[64]
Definition: nvme.h:1325
femu_ring_count
size_t femu_ring_count(struct rte_ring *ring)
Definition: rte_ring.c:218
NvmeRequest::slba
uint64_t slba
开始lba
Definition: nvme.h:972
FemuCtrl::zd_extension_size
uint32_t zd_extension_size
Definition: nvme.h:1200
NvmeLBAF
struct NvmeLBAF NvmeLBAF
NvmeSQueue::size
uint32_t size
Definition: nvme.h:1017
NvmeFeatureVal::sw_prog_marker
uint32_t sw_prog_marker
Definition: nvme.h:802
NVME_FRMW_SLOT1_RO
@ NVME_FRMW_SLOT1_RO
Definition: nvme.h:777
FemuCtrl::QTAILQ_HEAD
QTAILQ_HEAD(, NvmeZone) exp_open_zones
NvmeBar
struct NvmeBar NvmeBar
DMAOff::ptr
dma_addr_t ptr
Definition: nvme.h:1005
NvmeRwCmd::appmask
uint16_t appmask
Definition: nvme.h:436
NVME_Q_PRIO_LOW
@ NVME_Q_PRIO_LOW
Definition: nvme.h:403
NvmeParams::mpsmax
uint8_t mpsmax
Definition: nvme.h:1133
NVME_Q_PC
@ NVME_Q_PC
Definition: nvme.h:399
NvmePollerThreadArgument::index
int index
poller序号
Definition: nvme.h:1344
nvme_set_error_page
void nvme_set_error_page(FemuCtrl *n, uint16_t sqid, uint16_t cid, uint16_t status, uint16_t location, uint64_t lba, uint32_t nsid)
Definition: nvme-util.c:96
NVME_FID_MAX
@ NVME_FID_MAX
Definition: nvme.h:829
NvmeIdNs::dps
uint8_t dps
Definition: nvme.h:872
NvmeCreateSq::opcode
uint8_t opcode
Definition: nvme.h:382
NvmeIdentity::prp2
uint64_t prp2
Definition: nvme.h:413
FemuCtrl::nr_open_zones
int32_t nr_open_zones
Definition: nvme.h:1215
FemuExtCtrlOps::start_ctrl
int(* start_ctrl)(struct FemuCtrl *)
Definition: nvme.h:1174
NVME_CMD_ABORT_SQ_DEL
@ NVME_CMD_ABORT_SQ_DEL
Definition: nvme.h:534
NVME_INVALID_NSID
@ NVME_INVALID_NSID
Definition: nvme.h:537
NVME_ONCS_RESRVATIONS
@ NVME_ONCS_RESRVATIONS
Definition: nvme.h:773
FemuCtrl::blk_er_lat_ns
int64_t blk_er_lat_ns
Definition: nvme.h:1318
pqueue_size
size_t pqueue_size(pqueue_t *q)
Definition: pqueue.c:68
NvmeSQueue::QTAILQ_ENTRY
QTAILQ_ENTRY(NvmeSQueue) entry
NvmeCmdDptr::prp2
uint64_t prp2
Definition: nvme.h:284
NvmeParams::mpsmin
uint8_t mpsmin
Definition: nvme.h:1132
nvme_set_ctrl_name
void nvme_set_ctrl_name(FemuCtrl *n, const char *mn, const char *sn, int *dev_id)
Definition: nvme-util.c:294
CMBSZ_SQS_MASK
@ CMBSZ_SQS_MASK
Definition: nvme.h:237
FemuCtrl::zoned
bool zoned
Definition: nvme.h:1194
NVME_OACS_Oc12DEV
@ NVME_OACS_Oc12DEV
Definition: nvme.h:763
NvmeDsmRange::slba
uint64_t slba
Definition: nvme.h:485
FemuCtrl::namespaces
NvmeNamespace * namespaces
Definition: nvme.h:1279
FemuCtrl::poller_on
bool poller_on
Definition: nvme.h:1330
NvmeIdCtrl::frmw
uint8_t frmw
Definition: nvme.h:714
nvme_post_cqes_io
void nvme_post_cqes_io(void *opaque)
将剩余的req都填入cq
Definition: nvme-io.c:651
NVME_GETFEAT_SELECT_SAVED
@ NVME_GETFEAT_SELECT_SAVED
Definition: nvme.h:841
FemuCtrl::did
uint16_t did
Definition: nvme.h:1266
NvmeDifTuple
Definition: nvme.h:1347
ns_blks
static uint64_t ns_blks(NvmeNamespace *ns, uint8_t lba_idx)
Definition: nvme.h:1457
NvmeRwCmd::nlb
uint16_t nlb
Definition: nvme.h:431
NvmeIdCtrl::vid
uint16_t vid
Definition: nvme.h:693
FemuCtrl::clpg_rd_lat_ns
int64_t clpg_rd_lat_ns
Definition: nvme.h:1311
NvmeFeatureVal::volatile_wc
uint32_t volatile_wc
Definition: nvme.h:796
FemuCtrl::elpes
NvmeErrorLog * elpes
Definition: nvme.h:1277
NvmeIdCtrl::rtd3e
uint32_t rtd3e
Definition: nvme.h:705
NvmeRwCmd::nsid
uint32_t nsid
Definition: nvme.h:425
FemuCtrl::dpc
uint8_t dpc
Definition: nvme.h:1249
NVME_ZONE_TOO_MANY_OPEN
@ NVME_ZONE_TOO_MANY_OPEN
Definition: nvme.h:569
FemuCtrl::dataplane_started
bool dataplane_started
Definition: nvme.h:1273
NvmeRequest::QTAILQ_ENTRY
QTAILQ_ENTRY(NvmeRequest) entry
NVME_CC_CSS_NVM
@ NVME_CC_CSS_NVM
Definition: nvme.h:163
NvmeIdCtrl::acl
uint8_t acl
Definition: nvme.h:712
NVME_CMD_EFF_NCC
@ NVME_CMD_EFF_NCC
Definition: nvme.h:649
NvmeIdCtrl::ssvid
uint16_t ssvid
Definition: nvme.h:694
FemuCtrl::outstanding_aers
uint8_t outstanding_aers
Definition: nvme.h:1261
FemuCtrl::num_zones
uint32_t num_zones
Definition: nvme.h:1210
nvme_free_cq
void nvme_free_cq(NvmeCQueue *cq, FemuCtrl *n)
Definition: nvme-util.c:282
NvmeNamespace
struct NvmeNamespace NvmeNamespace
get_pos
static size_t get_pos(void *a)
Definition: nvme-io.c:298
NVME_ID_CNS_CS_NS_PRESENT_LIST
@ NVME_ID_CNS_CS_NS_PRESENT_LIST
Definition: nvme.h:687
CSTS_SHST_SHIFT
@ CSTS_SHST_SHIFT
Definition: nvme.h:171
Oc20Params
Definition: nvme.h:1096
NVME_RW_DSM_LATENCY_NONE
@ NVME_RW_DSM_LATENCY_NONE
Definition: nvme.h:451
nvme_poller
static void * nvme_poller(void *arg)
nvme poller线程函数,不断处理sq和生成cq
Definition: nvme-io.c:240
NvmeRequest
Definition: nvme.h:967
NVME_AER_INFO_ERR_INVALID_SQ
@ NVME_AER_INFO_ERR_INVALID_SQ
Definition: nvme.h:493
CAP_MQES_SHIFT
@ CAP_MQES_SHIFT
Definition: nvme.h:56
FemuCtrl::lba_index
uint8_t lba_index
Definition: nvme.h:1253
NvmeFeatureVal::num_io_queues
uint32_t num_io_queues
Definition: nvme.h:797
NvmeIdCtrl
Definition: nvme.h:692
NVME_INVALID_FW_SLOT
@ NVME_INVALID_FW_SLOT
Definition: nvme.h:550
nvme_write_zeros
static uint16_t nvme_write_zeros(FemuCtrl *n, NvmeNamespace *ns, NvmeCmd *cmd, NvmeRequest *req)
处理io cmd:write zeros命令
Definition: nvme-io.c:546
FemuCtrl::oc_params
OcCtrlParams oc_params
Definition: nvme.h:1299
NvmeCQueue::phase
uint8_t phase
Definition: nvme.h:1037
NvmeErrorLog::error_count
uint64_t error_count
Definition: nvme.h:601
NvmeNamespace::ns_blks
uint64_t ns_blks
Definition: nvme.h:1073
NvmeGetFeatureSelect
NvmeGetFeatureSelect
Definition: nvme.h:838
NVME_ADM_CMD_FORMAT_NVM
@ NVME_ADM_CMD_FORMAT_NVM
Definition: nvme.h:330
NvmeErrorLog::cid
uint16_t cid
Definition: nvme.h:603
NvmeLBAF
Definition: nvme.h:855
NvmeIdNs::nguid
uint8_t nguid[16]
Definition: nvme.h:891
FemuCtrl::page_size
uint16_t page_size
Definition: nvme.h:1224
nvme_post_cqe
static void nvme_post_cqe(NvmeCQueue *cq, NvmeRequest *req)
将req实际封装入cq
Definition: nvme-io.c:126
NVME_WRITE_FAULT
@ NVME_WRITE_FAULT
Definition: nvme.h:572
NvmeAqaShift
NvmeAqaShift
Definition: nvme.h:196
NvmeFeatureVal::power_mgmt
uint32_t power_mgmt
Definition: nvme.h:793
NvmeIdentify
struct NvmeIdentity NvmeIdentify
NvmeSQueue::dma_addr
uint64_t dma_addr
数据在dram中地址
Definition: nvme.h:1018
NvmeCreateCq::qsize
uint16_t qsize
Definition: nvme.h:372
NvmeIdCtrl::fuses
uint16_t fuses
Definition: nvme.h:742
NVME_CAP_MQES
#define NVME_CAP_MQES(cap)
Definition: nvme.h:92
NvmeErrorLog::status_field
uint16_t status_field
Definition: nvme.h:604
NVME_ADM_CMD_ABORT
@ NVME_ADM_CMD_ABORT
Definition: nvme.h:324
FEMU_NOSSD_MODE
@ FEMU_NOSSD_MODE
Definition: nvme.h:1360
NvmeIdNs::rescap
uint8_t rescap
Definition: nvme.h:874
NvmeSQueue::completed
uint64_t completed
已完成req数量
Definition: nvme.h:1020
NVME_ID_CNS_NS_PRESENT
@ NVME_ID_CNS_NS_PRESENT
Definition: nvme.h:686
NVME_INVALID_FIELD
@ NVME_INVALID_FIELD
Definition: nvme.h:528
NvmePSD::exlat
uint32_t exlat
Definition: nvme.h:667
FEMU_MAX_NUM_CHNLS
#define FEMU_MAX_NUM_CHNLS
Definition: nvme.h:1150
NVME_ID_NS_FLBAS_INDEX
#define NVME_ID_NS_FLBAS_INDEX(flbas)
Definition: nvme.h:920
NvmeParams::max_cqes
uint8_t max_cqes
Definition: nvme.h:1118
NvmeSmartLog::media_errors
uint64_t media_errors[2]
Definition: nvme.h:627
NvmeCreateCq::prp1
uint64_t prp1
Definition: nvme.h:369
DMAOff
Definition: nvme.h:1002
NVME_NIDT_NGUID
@ NVME_NIDT_NGUID
Definition: nvme.h:913
NvmeRequest::mptr
uint64_t mptr
Definition: nvme.h:977
FemuCtrl::acl
uint8_t acl
Definition: nvme.h:1238
FemuCtrl::zone_cap_bs
bool zone_cap_bs
Definition: nvme.h:1197
NVME_INVALID_CMD_SET
@ NVME_INVALID_CMD_SET
Definition: nvme.h:539
NvmeParams::cmb_size_mb
uint32_t cmb_size_mb
Definition: nvme.h:1140
NvmeCqe::cid
uint16_t cid
cmd id
Definition: nvme.h:521
NVME_SET_CSI
#define NVME_SET_CSI(vec, csi)
Definition: nvme.h:585
CMBSZ_WDS_MASK
@ CMBSZ_WDS_MASK
Definition: nvme.h:241
NvmeIdCtrl::avscc
uint8_t avscc
Definition: nvme.h:718
FemuCtrl::cmbuf
uint8_t * cmbuf
Definition: nvme.h:1270
NvmeFeatureVal::err_rec
uint32_t err_rec
Definition: nvme.h:795
femu_err
#define femu_err(fmt,...)
Definition: nvme.h:1511
DMAOff::ndx
int ndx
Definition: nvme.h:1004
NVME_ACL_EXCEEDED
@ NVME_ACL_EXCEEDED
Definition: nvme.h:547
NvmeIdCtrl::maxcmd
uint16_t maxcmd
Definition: nvme.h:739
NvmePSD::rwt
uint8_t rwt
Definition: nvme.h:670
NvmeIdCtrl::mxtmt
uint16_t mxtmt
Definition: nvme.h:734
NvmeBar::vs
uint32_t vs
Definition: nvme.h:41
NVME_NS_NOT_READY
@ NVME_NS_NOT_READY
Definition: nvme.h:542