FEMU
原版 master 7e238cc
FEMU: Accurate, Scalable and Extensible NVMe SSD Emulator (FAST'18)
|
|
浏览该文件的文档.
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"
26 #define NVME_ID_NS_LBADS(ns) \
27 ((ns)->id_ns.lbaf[NVME_ID_NS_FLBAS_INDEX((ns)->id_ns.flbas)].lbads)
29 #define NVME_ID_NS_LBADS_BYTES(ns) (1 << NVME_ID_NS_LBADS(ns))
31 #define NVME_ID_NS_MS(ns) \
33 ((ns)->id_ns.lbaf[NVME_ID_NS_FLBAS_INDEX((ns)->id_ns.flbas)].ms) \
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)
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
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)
103 #define NVME_CAP_SET_MQES(cap, val) (cap |= (uint64_t)(val & CAP_MQES_MASK) \
105 #define NVME_CAP_SET_CQR(cap, val) (cap |= (uint64_t)(val & CAP_CQR_MASK) \
107 #define NVME_CAP_SET_AMS(cap, val) (cap |= (uint64_t)(val & CAP_AMS_MASK) \
109 #define NVME_CAP_SET_TO(cap, val) (cap |= (uint64_t)(val & CAP_TO_MASK) \
111 #define NVME_CAP_SET_DSTRD(cap, val) (cap |= (uint64_t)(val & CAP_DSTRD_MASK) \
113 #define NVME_CAP_SET_NSSRS(cap, val) (cap |= (uint64_t)(val & CAP_NSSRS_MASK) \
115 #define NVME_CAP_SET_CSS(cap, val) (cap |= (uint64_t)(val & CAP_CSS_MASK) \
117 #define NVME_CAP_SET_OC(cap, val) (cap |= (uint64_t)(val & CAP_OC_MASK)\
119 #define NVME_CAP_SET_MPSMIN(cap, val) (cap |= (uint64_t)(val & CAP_MPSMIN_MASK)\
121 #define NVME_CAP_SET_MPSMAX(cap, val) (cap |= (uint64_t)(val & CAP_MPSMAX_MASK)\
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)
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)
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)
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)
222 #define NVME_CMBLOC_SET_BIR(cmbloc, val) (cmbloc |= (uint64_t)(val & CMBLOC_BIR_MASK) \
224 #define NVME_CMBLOC_SET_OFST(cmbloc, val) (cmbloc |= (uint64_t)(val & CMBLOC_OFST_MASK) \
225 << CMBLOC_OFST_SHIFT)
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)
254 #define NVME_CMBSZ_SET_SQS(cmbsz, val) (cmbsz |= (uint64_t)(val & CMBSZ_SQS_MASK) \
256 #define NVME_CMBSZ_SET_CQS(cmbsz, val) (cmbsz |= (uint64_t)(val & CMBSZ_CQS_MASK) \
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) \
262 #define NVME_CMBSZ_SET_WDS(cmbsz, val) (cmbsz |= (uint64_t)(val & CMBSZ_WDS_MASK) \
264 #define NVME_CMBSZ_SET_SZU(cmbsz, val) (cmbsz |= (uint64_t)(val & CMBSZ_SZU_MASK) \
266 #define NVME_CMBSZ_SET_SZ(cmbsz, val) (cmbsz |= (uint64_t)(val & CMBSZ_SZ_MASK) \
269 #define NVME_CMBSZ_GETSIZE(cmbsz) (NVME_CMBSZ_SZ(cmbsz) * (1<<(12+4*NVME_CMBSZ_SZU(cmbsz))))
278 #define NVME_SGL_TYPE(type) ((type >> 4) & 0xf)
279 #define NVME_SGL_SUBTYPE(type) (type & 0xf)
314 #define NVME_CMD_FLAGS_FUSE(flags) (flags & 0x3)
315 #define NVME_CMD_FLAGS_PSDT(flags) ((flags >> 6) & 0x3)
378 #define NVME_CQ_FLAGS_PC(cq_flags) (cq_flags & 0x1)
379 #define NVME_CQ_FLAGS_IEN(cq_flags) ((cq_flags >> 1) & 0x1)
395 #define NVME_SQ_FLAGS_PC(sq_flags) (sq_flags & 0x1)
396 #define NVME_SQ_FLAGS_QPRIO(sq_flags) ((sq_flags >> 1) & 0x3)
585 #define NVME_SET_CSI(vec, csi) (vec |= (uint8_t)(1 << (csi)))
675 #define NVME_IDENTIFY_DATA_SIZE 4096
710 uint8_t rsvd128[128];
736 uint8_t rsvd332[180];
752 uint8_t rsvd540[228];
754 uint8_t rsvd1024[1024];
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)
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)
810 #define NVME_INTC_THR(intc) (intc & 0xff)
811 #define NVME_INTC_TIME(intc) ((intc >> 8) & 0xff)
813 #define NVME_ERR_REC_DULBE(err_rec) (err_rec & 0x10000)
861 #define NVME_NSID_BROADCAST 0xffffffff
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
942 QEMU_BUILD_BUG_ON(
sizeof(
NvmeCqe) != 16);
944 QEMU_BUILD_BUG_ON(
sizeof(
NvmeCmd) != 64);
949 QEMU_BUILD_BUG_ON(
sizeof(
NvmeRwCmd) != 64);
955 QEMU_BUILD_BUG_ON(
sizeof(
NvmeIdCtrl) != 4096);
956 QEMU_BUILD_BUG_ON(
sizeof(
NvmeIdNs) != 4096);
1092 #define TYPE_NVME "femu"
1093 #define FEMU(obj) OBJECT_CHECK(FemuCtrl, (obj), TYPE_NVME)
1150 #define FEMU_MAX_NUM_CHNLS (32)
1151 #define FEMU_MAX_NUM_CHIPS (128)
1353 #define SQ_POLLING_PERIOD_NS (5000)
1354 #define CQ_POLLING_PERIOD_NS (5000)
1355 #define FEMU_MAX_INF_REQS (65536)
1411 cqid, uint16_t vector, uint16_t size, uint16_t
1412 irq_enabled,
int contig);
1424 uint16_t
nvme_map_prp(QEMUSGList *qsg, QEMUIOVector *iov, uint64_t prp1,
1425 uint64_t prp2, uint32_t len,
FemuCtrl *n);
1427 prp1, uint64_t prp2);
1429 prp1, uint64_t prp2);
1434 queue_depth, uint16_t entry_size);
1436 status, uint16_t location, uint64_t
lba, uint32_t
1440 uint32_t nlb, uint16_t ctrl, uint64_t data_size,
1441 uint64_t meta_size);
1461 uint64_t ns_size = n->
ns_size;
1463 uint32_t lba_ds = (1 << id_ns->
lbaf[lba_idx].
lbads);
1464 uint32_t lba_sz = lba_ds + n->
meta;
1466 return ns_size / lba_sz;
1479 uint16_t queue_idx, uint16_t entry_size)
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;
1485 return dma_addr[prp_index] + index_in_prp * entry_size;
1490 uint8_t mdts = n->
mdts;
1492 if (mdts && len > n->
page_size << mdts) {
1499 #define MN_MAX_LEN (64)
1500 #define ID_MAX_LEN (4)
1503 #ifdef FEMU_DEBUG_NVME
1504 #define femu_debug(fmt, ...) \
1505 do { printf("[FEMU] Dbg: " fmt, ## __VA_ARGS__); } while (0)
1507 #define femu_debug(fmt, ...) \
1511 #define femu_err(fmt, ...) \
1512 do { fprintf(stderr, "[FEMU] Err: " fmt, ## __VA_ARGS__); } while (0)
1514 #define femu_log(fmt, ...) \
1515 do { printf("[FEMU] Log: " fmt, ## __VA_ARGS__); } while (0)
uint16_t dma_write_prp(FemuCtrl *n, uint8_t *ptr, uint32_t len, uint64_t prp1, uint64_t prp2)
Definition: dma.c:112
uint8_t event_type
Definition: nvme.h:505
uint8_t reserved2[448]
Definition: nvme.h:597
uint32_t cdw15
Definition: nvme.h:311
DRAM backend SSD address space
Definition: dram.h:18
@ AQA_ASQS_MASK
Definition: nvme.h:202
uint16_t cid
Definition: nvme.h:466
static bool nvme_nsid_valid(FemuCtrl *n, uint32_t nsid)
Definition: nvme-admin.c:271
@ NVME_SMART_TEMPERATURE
Definition: nvme.h:634
static uint16_t nvme_smart_info(FemuCtrl *n, NvmeCmd *cmd, uint32_t buf_len)
Definition: nvme-admin.c:710
uint8_t num_ch
Definition: nvme.h:1158
void nvme_isr_notify_io(void *opaque)
中断通知上层取cq
Definition: intr.c:202
uint64_t eventidx_addr
Definition: nvme.h:1029
static void nvme_copy_cmd(NvmeCmd *dst, NvmeCmd *src)
从dram中取cmd
Definition: nvme-io.c:30
uint32_t cdw11
Definition: nvme.h:307
@ NVME_RW_PRINFO_PRACT
Definition: nvme.h:457
@ CAP_OC_SHIFT
Definition: nvme.h:63
uint8_t mn[40]
Definition: nvme.h:696
uint32_t nn
Definition: nvme.h:740
#define NVME_IDENTIFY_DATA_SIZE
Definition: nvme-admin.c:9
@ CMBSZ_SZ_MASK
Definition: nvme.h:243
uint32_t sgls
Definition: nvme.h:751
@ CMBSZ_WDS_SHIFT
Definition: nvme.h:231
@ CC_IOSQES_SHIFT
Definition: nvme.h:140
uint16_t oacs
Definition: nvme.h:1142
@ NVME_RW_DSM_LATENCY_NORM
Definition: nvme.h:453
pthread_spinlock_t chnl_locks[FEMU_MAX_NUM_CHNLS]
Definition: nvme.h:1305
#define CQ_POLLING_PERIOD_NS
Definition: nvme.h:1354
bool is_active
Definition: nvme.h:1056
uint8_t cqes_pending
Definition: nvme.h:1264
uint32_t reftag
Definition: nvme.h:434
NvmeCapMask
Definition: nvme.h:68
struct NvmePollerThreadArgument NvmePollerThreadArgument
NvmeCmd cmd
Definition: nvme.h:981
uint64_t tbl_dsk_start_offset
Definition: nvme.h:1076
uint8_t flash_type
Definition: nvme.h:1339
@ NVME_CMD_ZONE_MGMT_SEND
Definition: nvme.h:346
@ NVME_LBA_RANGE
Definition: nvme.h:540
uint16_t nvme_rw(FemuCtrl *n, NvmeNamespace *ns, NvmeCmd *cmd, NvmeRequest *req)
nvme读写命令
Definition: nvme-io.c:370
static uint16_t nvme_format(FemuCtrl *n, NvmeCmd *cmd)
Definition: nvme-admin.c:922
struct NvmeRequest NvmeRequest
uint8_t dialect
Definition: nvme.h:1141
@ NVME_CMD_EFF_LBCC
Definition: nvme.h:648
@ CAP_MPSMIN_MASK
Definition: nvme.h:77
uint64_t nuse
Definition: nvme.h:866
uint32_t cmbloc
Definition: nvme.h:1269
uint16_t nabspf
Definition: nvme.h:882
uint64_t zone_capacity
Definition: nvme.h:1212
uint8_t rsvd11
Definition: nvme.h:416
uint64_t zone_size_bs
Definition: nvme.h:1196
struct NvmeDsmCmd NvmeDsmCmd
int nvme_register_bbssd(FemuCtrl *n)
注册blackbox相关函数
Definition: bb.c:145
uint32_t id
Definition: nvme.h:1071
uint8_t mpsmax
Definition: nvme.h:1255
@ NVME_RW_DSM_FREQ_UNSPEC
Definition: nvme.h:442
static const uint32_t nvme_cse_iocs_zoned[256]
Definition: nvme-admin.c:62
static uint16_t nvme_check_mdts(FemuCtrl *n, size_t len)
Definition: nvme.h:1488
#define NVME_NSID_BROADCAST
Definition: nvme.h:861
uint8_t reserved2[320]
Definition: nvme.h:629
static uint16_t nvme_io_cmd(FemuCtrl *n, NvmeCmd *cmd, NvmeRequest *req)
nvme处理io类型的commad,识别cmd类型并调用相关函数
Definition: nvme-io.c:597
struct NvmeCreateSq NvmeCreateSq
uint8_t nidl
Definition: nvme.h:900
#define NVME_SQ_FLAGS_PC(sq_flags)
Definition: nvme.h:395
int64_t cupg_rd_lat_ns
Definition: nvme.h:1310
uint8_t type
Definition: nvme.h:275
int nvme_clear_virq(FemuCtrl *n)
Definition: intr.c:246
uint64_t host_read_commands[2]
Definition: nvme.h:621
uint8_t cqes
Definition: nvme.h:738
uint8_t elpe
Definition: nvme.h:1239
模拟一个ssd
Definition: ftl.h:247
uint16_t nvmsetid
Definition: nvme.h:415
uint16_t reserved
Definition: nvme.h:665
uint8_t rsvd74[30]
Definition: nvme.h:890
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
static uint16_t nvme_flush(FemuCtrl *n, NvmeNamespace *ns, NvmeCmd *cmd, NvmeRequest *req)
处理io cmd:flush命令
Definition: nvme-io.c:531
uint32_t sanicap
Definition: nvme.h:735
NvmeAqaMask
Definition: nvme.h:201
@ NVME_SMART_SPARE
Definition: nvme.h:633
@ CSTS_RDY_SHIFT
Definition: nvme.h:169
@ NVME_CMP_FAILURE
Definition: nvme.h:577
struct FemuCtrl * ctrl
Definition: nvme.h:1010
femu相关控制参数和数据成员
Definition: nvme.h:1184
struct NvmeSmartLog NvmeSmartLog
@ CMBSZ_RDS_MASK
Definition: nvme.h:240
@ NVME_MAX_QSIZE_EXCEEDED
Definition: nvme.h:546
uint16_t res1
Definition: nvme.h:299
uint16_t npda
Definition: nvme.h:888
bool print_log
Definition: nvme.h:1334
uint32_t cmbsz
Definition: nvme.h:1268
NvmeSQueue ** sq
sq队列列表(io)
Definition: nvme.h:1280
uint16_t qsize
Definition: nvme.h:389
uint64_t db_addr
Definition: nvme.h:1027
static uint16_t nvme_compare(FemuCtrl *n, NvmeNamespace *ns, NvmeCmd *cmd, NvmeRequest *req)
处理io cmd:compare命令
Definition: nvme-io.c:471
void * pqueue_pop(pqueue_t *q)
Definition: pqueue.c:172
FemuExtCtrlOps ext_ops
nvme到各模式ssd接口
Definition: nvme.h:1220
uint8_t cqr
Definition: nvme.h:1124
@ CAP_AMS_MASK
Definition: nvme.h:71
uint16_t status
Definition: nvme.h:522
static uint16_t nvme_identify(FemuCtrl *n, NvmeCmd *cmd)
Definition: nvme-admin.c:523
@ FEMU_KVSSD_MODE
Definition: nvme.h:1363
uint32_t vector
Definition: nvme.h:1043
uint8_t db_stride
Definition: nvme.h:1119
uint8_t rwl
Definition: nvme.h:671
static uint16_t nvme_abort_req(FemuCtrl *n, NvmeCmd *cmd, uint32_t *result)
Definition: nvme-admin.c:834
int nvme_setup_virq(FemuCtrl *n, NvmeCQueue *cq)
Definition: intr.c:216
@ NVME_TIMESTAMP
Definition: nvme.h:827
uint32_t num_queues
Definition: nvme.h:1115
uint16_t nabsn
Definition: nvme.h:880
static void nvme_update_sq_eventidx(const NvmeSQueue *sq)
Definition: nvme-io.c:11
uint16_t sq_flags
Definition: nvme.h:390
#define ID_MAX_LEN
Definition: nvme.h:1500
#define NVME_ARB_LPW(arb)
Definition: nvme.h:806
#define unlikely(x)
Definition: rte_branch_prediction.h:38
@ NVME_RW_DSM_FREQ_RW
Definition: nvme.h:447
@ NVME_ASYNCHRONOUS_EVENT_CONF
Definition: nvme.h:826
QEMUSGList qsg
dma用
Definition: nvme.h:984
uint8_t rrt
Definition: nvme.h:668
@ NVME_ADM_CMD_ACTIVATE_FW
Definition: nvme.h:328
uint16_t(* get_log)(struct FemuCtrl *, NvmeCmd *)
Definition: nvme.h:1177
uint16_t cqid
Definition: nvme.h:1038
@ NVME_ID_CNS_CS_NS
Definition: nvme.h:682
uint8_t temperature[2]
Definition: nvme.h:614
uint8_t nlbaf
Definition: nvme.h:868
uint8_t flags
Definition: nvme.h:383
@ NVME_RW_DSM_FREQ_ONCE
Definition: nvme.h:448
@ NVME_AER_INFO_ERR_TRANS_INTERNAL_ERR
Definition: nvme.h:497
@ NVME_ZONE_INVALID_WRITE
Definition: nvme.h:567
@ CAP_MPSMAX_SHIFT
Definition: nvme.h:65
static uint16_t nvme_fw_log_info(FemuCtrl *n, NvmeCmd *cmd, uint32_t buf_len)
Definition: nvme-admin.c:686
@ NVME_FW_REQ_RESET
Definition: nvme.h:555
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
uint32_t iocs[256]
Definition: nvme.h:642
int nvme_check_cqid(FemuCtrl *n, uint16_t cqid)
Definition: nvme-util.c:14
uint32_t reg_size
Definition: nvme.h:1231
uint8_t event_info
Definition: nvme.h:506
char * serial
Definition: nvme.h:1276
uint32_t rtd3r
Definition: nvme.h:704
@ NVME_CMD_DSM
Definition: nvme.h:345
uint8_t rab
Definition: nvme.h:698
struct NvmeParams NvmeParams
uint64_t prp1
Definition: nvme.h:469
static bool BBSSD(FemuCtrl *n)
Definition: nvme.h:1381
@ NVME_ID_CNS_IO_COMMAND_SET
Definition: nvme.h:689
uint8_t mpsmin
Definition: nvme.h:1254
unsigned long * uncorrectable
Definition: nvme.h:1070
#define femu_log(fmt,...)
Definition: nvme.h:1514
uint64_t prp1
Definition: nvme.h:428
struct NvmeRwCmd NvmeRwCmd
@ NVME_E2E_GUARD_ERROR
Definition: nvme.h:574
struct QEMU_PACKED NvmeIdCtrl NvmeIdCtrl
uint16_t cntlid
Definition: nvme.h:702
uint32_t zasl_bs
Definition: nvme.h:1192
uint32_t cmbsz
Definition: nvme.h:52
@ NVME_RW_PRINFO_PRCHK_GUARD
Definition: nvme.h:458
uint64_t mptr
Definition: nvme.h:304
uint32_t attributes
Definition: nvme.h:472
NvmeFeatureCap
Definition: nvme.h:832
struct FemuExtCtrlOps FemuExtCtrlOps
扩展操作接口,具体实现在各模式ssd中
void nvme_process_sq_admin(void *opaque)
处理admin命令的sq队列
Definition: nvme-admin.c:1036
uint8_t percentage_used
Definition: nvme.h:617
dma_addr_t len
Definition: nvme.h:1006
uint8_t * zd_extensions
Definition: nvme.h:1214
@ NVME_ADM_CMD_CREATE_SQ
Definition: nvme.h:319
static pqueue_pri_t get_pri(void *a)
Definition: nvme-io.c:288
uint64_t dma_addr_hva
Definition: nvme.h:1019
uint32_t tbl_entries
Definition: nvme.h:1077
uint8_t flags
Definition: nvme.h:356
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
Definition: nvme.h:636
uint8_t ms_max
Definition: nvme.h:1257
uint16_t cid
Definition: nvme.h:301
int nvme_check_sqid(FemuCtrl *n, uint16_t sqid)
Definition: nvme-util.c:9
uint8_t vwc
Definition: nvme.h:1247
uint16_t page_bits
Definition: nvme.h:1225
uint32_t tail
Definition: nvme.h:1041
uint8_t frs2[8]
Definition: nvme.h:591
uint8_t dsto
Definition: nvme.h:729
uint16_t(* rw_check_req)(struct FemuCtrl *, NvmeCmd *, NvmeRequest *)
Definition: nvme.h:1173
static bool nvme_csi_has_nvm_support(NvmeNamespace *ns)
Definition: nvme-admin.c:294
NvmeRequest ** aer_reqs
Definition: nvme.h:1278
uint32_t ws_opt
Definition: nvme.h:1100
@ NVME_LOG_CMD_EFFECTS
Definition: nvme.h:660
static void nvme_check_size(void)
Definition: nvme.h:939
QTAILQ_HEAD(sq_req_list, NvmeRequest) req_list
存放req
@ NVME_ADM_CMD_DELETE_SQ
Definition: nvme.h:318
uint32_t write_atomicity
Definition: nvme.h:800
@ NVME_TEMPERATURE_THRESHOLD
Definition: nvme.h:819
#define NVME_ID_NS_MC_EXTENDED(mc)
Definition: nvme.h:922
struct NvmeFwSlotInfoLog NvmeFwSlotInfoLog
@ NVME_RW_DSM_FREQ_RARE
Definition: nvme.h:444
uint64_t unsafe_shutdowns[2]
Definition: nvme.h:626
@ NVME_RW_FUA
Definition: nvme.h:441
NvmeNsIdentifierLength
Definition: nvme.h:904
uint8_t opcode
Definition: nvme.h:355
@ NVME_PSDT_SGL_MPTR_CONTIGUOUS
Definition: nvme.h:292
uint64_t meta
Definition: nvme.h:1086
uint16_t qid
Definition: nvme.h:359
@ CC_CSS_MASK
Definition: nvme.h:146
uint32_t cc
Definition: nvme.h:44
uint16_t cctemp
Definition: nvme.h:721
uint8_t rrl
Definition: nvme.h:669
@ NVME_LOG_SMART_INFO
Definition: nvme.h:658
uint16_t fuse
Definition: nvme.h:298
uint8_t zasl
Definition: nvme.h:1193
@ NVME_ZONE_OFFLINE
Definition: nvme.h:566
uint16_t cqid
Definition: nvme.h:371
uint8_t max_sec_per_rq
Definition: nvme.h:1157
uint32_t arbitration
Definition: nvme.h:792
@ CC_IOCQES_SHIFT
Definition: nvme.h:141
@ CMBSZ_SZ_SHIFT
Definition: nvme.h:233
@ NVME_CSTS_FAILED
Definition: nvme.h:184
int64_t chnl_pg_xfer_lat_ns
Definition: nvme.h:1319
@ CAP_CSS_SHIFT
Definition: nvme.h:62
uint8_t multipoller_enabled
是否创建多个nvme poller
Definition: nvme.h:1336
int backend_rw(SsdDramBackend *b, QEMUSGList *qsg, uint64_t *lbal, bool is_write)
Definition: dram.c:37
uint64_t lba
Definition: oc12.h:2
@ NVME_LOG_ERROR_INFO
Definition: nvme.h:657
@ NVME_CMD_FLUSH
Definition: nvme.h:339
uint32_t cdw13
Definition: nvme.h:309
uint64_t nlb
Definition: nvme.h:850
int64_t upg_wr_lat_ns
Definition: nvme.h:1313
static uint16_t nvme_identify_ns_descr_list(FemuCtrl *n, NvmeCmd *cmd)
Definition: nvme-admin.c:468
uint8_t flags
Definition: nvme.h:366
#define femu_debug(fmt,...)
Definition: nvme.h:1507
uint8_t cqr
Definition: nvme.h:1243
void nvme_addr_read(FemuCtrl *n, hwaddr addr, void *buf, int size)
Definition: dma.c:3
struct NvmeSQueue NvmeSQueue
static uint16_t nvme_admin_cmd(FemuCtrl *n, NvmeCmd *cmd, NvmeCqe *cqe)
识别、执行admin命令
Definition: nvme-admin.c:965
uint16_t status
Definition: nvme.h:971
const uint32_t * iocs
Definition: nvme.h:1202
@ NVME_CSI_ZONED
Definition: nvme.h:125
uint16_t vid
Definition: nvme.h:1265
@ NVME_SUCCESS
Definition: nvme.h:526
@ NVME_SOFTWARE_PROGRESS_MARKER
Definition: nvme.h:828
uint64_t * tbl
Definition: nvme.h:1078
NvmeBar bar
Definition: nvme.h:1188
@ NVME_ADM_CMD_FEMU_FLIP
Definition: nvme.h:335
uint32_t num_poller
nvme poller个数(前提是multupoller_enabled开启)
Definition: nvme.h:1337
@ NVME_CSTS_SHST_NORMAL
Definition: nvme.h:185
@ NVME_ADM_CMD_GET_LOG_PAGE
Definition: nvme.h:320
@ CC_EN_SHIFT
Definition: nvme.h:135
static uint16_t nvme_identify_ctrl(FemuCtrl *n, NvmeCmd *cmd)
Definition: nvme-admin.c:358
@ CAP_MQES_MASK
Definition: nvme.h:69
unsigned long * util
Definition: nvme.h:1069
@ CAP_DSTRD_SHIFT
Definition: nvme.h:60
@ NVME_ADM_CMD_DELETE_CQ
Definition: nvme.h:321
NvmeQueueFlags
Definition: nvme.h:398
unsigned long long pqueue_pri_t
Definition: pqueue.h:39
uint16_t dma_write_prp(FemuCtrl *n, uint8_t *ptr, uint32_t len, uint64_t prp1, uint64_t prp2)
Definition: dma.c:112
uint16_t npwg
Definition: nvme.h:885
uint16_t sqe_size
Definition: nvme.h:1228
@ NVME_CC_CSS_CSI
Definition: nvme.h:164
@ OCSSD12
Definition: nvme.h:1367
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
uint32_t ref_tag
Definition: nvme.h:1350
uint64_t slba
Definition: nvme.h:430
char * resetfail_fname
Definition: nvme.h:1108
@ NVME_LPA_NS_SMART
Definition: nvme.h:781
uint32_t ws_min
Definition: nvme.h:1099
uint16_t apptag
Definition: nvme.h:435
uint16_t ctrl
Definition: nvme.h:975
uint8_t elpe
Definition: nvme.h:1122
volatile int64_t chip_next_avail_time[FEMU_MAX_NUM_CHIPS]
Definition: nvme.h:1302
uint32_t rpmbs
Definition: nvme.h:727
size_t pos
Definition: nvme.h:999
uint32_t csts
Definition: nvme.h:46
@ NVME_OACS_SECURITY
Definition: nvme.h:760
char * serial
Definition: nvme.h:1113
@ NVME_RESERVED
Definition: nvme.h:548
QemuThread * poller
Definition: nvme.h:1272
uint32_t zone_size_log2
Definition: nvme.h:1213
void(* exit)(struct FemuCtrl *)
Definition: nvme.h:1172
NvmeCstsMask
Definition: nvme.h:175
@ NVME_NIDT_EUI64
Definition: nvme.h:912
static uint16_t nvme_identify_nslist_csi(FemuCtrl *n, NvmeCmd *cmd)
Definition: nvme-admin.c:431
void nvme_inc_sq_head(NvmeSQueue *sq)
Definition: nvme-util.c:28
uint32_t nsid
Definition: nvme.h:467
@ NVME_CMD_COMPARE
Definition: nvme.h:343
uint64_t dma_addr
Definition: nvme.h:1045
uint32_t rsvd11[5]
Definition: nvme.h:361
uint64_t dbs_addr_hva
Definition: nvme.h:1293
#define NVME_ARB_AB(arb)
Definition: nvme.h:805
uint16_t npdg
Definition: nvme.h:887
uint8_t ms
Definition: nvme.h:1134
uint8_t aerl
Definition: nvme.h:1120
@ CC_IOCQES_MASK
Definition: nvme.h:151
@ NVME_DATA_TRAS_ERROR
Definition: nvme.h:530
uint8_t npss
Definition: nvme.h:717
@ NVME_DSMGMT_IDW
Definition: nvme.h:478
@ NVME_CMD_EFF_CSUPP
Definition: nvme.h:647
uint64_t number_of_error_log_entries[2]
Definition: nvme.h:628
@ NVME_ID_CNS_CS_NS_ACTIVE_LIST
Definition: nvme.h:684
static uint16_t nvme_del_cq(FemuCtrl *n, NvmeCmd *cmd)
Definition: nvme-admin.c:194
@ NVME_NIDL_UUID
Definition: nvme.h:907
uint64_t prp2
Definition: nvme.h:470
@ AQA_ACQS_SHIFT
Definition: nvme.h:198
uint16_t nvme_rw(FemuCtrl *n, NvmeNamespace *ns, NvmeCmd *cmd, NvmeRequest *req)
nvme读写命令
Definition: nvme-io.c:370
uint8_t db_stride
Definition: nvme.h:1236
static int rte_ring_empty(const struct rte_ring *r)
Definition: rte_ring.h:909
uint8_t num_errors
Definition: nvme.h:1263
int64_t lpg_rd_lat_ns
Definition: nvme.h:1312
void nvme_create_poller(FemuCtrl *n)
创建poller线程,以及两个ring queue:to_ftl和to_poller
Definition: nvme-io.c:313
uint16_t nlb
逻辑块个数
Definition: nvme.h:974
uint8_t max_sqes
Definition: nvme.h:1244
uint64_t dbs_addr
Definition: nvme.h:1291
uint64_t res64
Definition: nvme.h:517
uint32_t size
Definition: nvme.h:1044
uint8_t intc_time
Definition: nvme.h:1130
uint8_t attributes
Definition: nvme.h:847
NvmeFeatureVal features
Definition: nvme.h:1284
@ NVME_ERROR_RECOVERY
Definition: nvme.h:820
@ DPS_FIRST_EIGHT
Definition: nvme.h:936
uint32_t temp_thresh
Definition: nvme.h:794
uint8_t elpe
Definition: nvme.h:716
@ NVME_NIDT_UUID
Definition: nvme.h:914
uint32_t rsvd1[5]
Definition: nvme.h:368
uint64_t * oc12_ppa_list
Definition: nvme.h:980
@ NVME_E2E_APP_ERROR
Definition: nvme.h:575
uint8_t dlfeat
Definition: nvme.h:1267
uint16_t dma_read_prp(FemuCtrl *n, uint8_t *ptr, uint32_t len, uint64_t prp1, uint64_t prp2)
Definition: dma.c:137
uint8_t ms
Definition: nvme.h:1256
uint64_t begin
Definition: nvme.h:1083
@ NVME_GETFEAT_SELECT_DEFAULT
Definition: nvme.h:840
void nvme_update_cq_head(NvmeCQueue *cq)
Definition: nvme-util.c:45
@ NVME_SMART_RELIABILITY
Definition: nvme.h:635
@ NVME_DSMGMT_AD
Definition: nvme.h:479
uint8_t guid[16]
Definition: nvme.h:851
uint8_t resv[35]
Definition: nvme.h:609
uint64_t start_block
Definition: nvme.h:1074
@ NVME_CMD_WRITE
Definition: nvme.h:340
uint8_t elp_index
Definition: nvme.h:1240
@ NVME_RW_PRINFO_PRCHK_APP
Definition: nvme.h:459
uint8_t acl
Definition: nvme.h:1121
@ NVME_OACS_DBBUF
Definition: nvme.h:764
@ NVME_DNR
Definition: nvme.h:581
uint16_t mtfa
Definition: nvme.h:722
@ OCSSD20
Definition: nvme.h:1368
uint32_t result
Definition: nvme.h:514
@ FEMU_RING_TYPE_MP_SC
Definition: rte_ring.h:1123
@ CSTS_NSSRO_MASK
Definition: nvme.h:179
int64_t lpg_wr_lat_ns
Definition: nvme.h:1317
int nvme_check_cqid(FemuCtrl *n, uint16_t cqid)
Definition: nvme-util.c:14
static void nvme_process_sq_io(void *opaque, int index_poller)
从sq中取出req,放入to_ftl队列中,交由ftl处理
Definition: nvme-io.c:57
uint32_t rsvd1[9]
Definition: nvme.h:358
@ CMBLOC_BIR_MASK
Definition: nvme.h:215
uint16_t cid
Definition: nvme.h:384
uint8_t arb_burst
Definition: nvme.h:1012
@ NVME_AER_TYPE_IO_SPECIFIC
Definition: nvme.h:491
bool is_active
Definition: nvme.h:1031
@ NVME_Q_PRIO_NORMAL
Definition: nvme.h:402
uint32_t intms
Definition: nvme.h:42
uint32_t nsid
Definition: nvme.h:302
NvmeIdNsDps
Definition: nvme.h:930
uint8_t rsvd2[14]
Definition: nvme.h:848
uint32_t dsmgmt
Definition: nvme.h:433
OC20AdminCommands
Definition: nvme.h:1371
uint16_t pgs_per_blk
Definition: nvme.h:1156
uint64_t rsvd2[2]
Definition: nvme.h:468
int64_t clpg_wr_lat_ns
Definition: nvme.h:1316
uint32_t ver
Definition: nvme.h:703
void nvme_inc_cq_tail(NvmeCQueue *cq)
Definition: nvme-util.c:19
void nvme_inc_sq_head(NvmeSQueue *sq)
Definition: nvme-util.c:28
@ NVME_CAP_CSS_NVM
Definition: nvme.h:129
size_t femu_ring_dequeue(struct rte_ring *ring, void **objs, size_t count)
Definition: rte_ring.c:228
uint8_t available_spare_threshold
Definition: nvme.h:616
@ FEMU_ZNSSD_MODE
Definition: nvme.h:1361
@ CC_IOSQES_MASK
Definition: nvme.h:150
@ NVME_FID_NOT_NSID_SPEC
Definition: nvme.h:558
#define NVME_ID_NS_DPC_LAST_EIGHT(dpc)
Definition: nvme.h:923
uint64_t * nvme_setup_discontig(FemuCtrl *n, uint64_t prp_addr, uint16_t queue_depth, uint16_t entry_size)
Definition: nvme-util.c:69
struct NvmeDifTuple NvmeDifTuple
@ NVME_ONCS_WRITE_UNCORR
Definition: nvme.h:769
@ NVME_AER_INFO_SMART_RELIABILITY
Definition: nvme.h:499
@ CAP_DSTRD_MASK
Definition: nvme.h:73
uint8_t flags
Definition: nvme.h:465
static NvmeNamespace * nvme_ns(FemuCtrl *n, uint32_t nsid)
Definition: nvme-admin.c:276
@ NVME_CSI_NVM
Definition: nvme.h:124
struct FemuCtrl FemuCtrl
femu相关控制参数和数据成员
@ NVME_SMART_FAILED_VOLATILE_MEDIA
Definition: nvme.h:637
@ NVME_ID_CNS_NS
Definition: nvme.h:678
uint8_t lpa
Definition: nvme.h:715
uint16_t hctma
Definition: nvme.h:732
@ FEMU_OCSSD_MODE
Definition: nvme.h:1358
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
struct NvmeCreateCq NvmeCreateCq
uint8_t dpc
Definition: nvme.h:1126
@ NVME_INVALID_MEMORY_ADDRESS
Definition: nvme.h:571
NvmeNsIdentifierType
Definition: nvme.h:911
@ NVME_UNRECOVERED_READ
Definition: nvme.h:573
@ NVME_INVALID_QUEUE_DEL
Definition: nvme.h:556
uint16_t cqid
Definition: nvme.h:1014
void nvme_isr_notify_io(void *opaque)
中断通知上层取cq
Definition: intr.c:202
uint32_t nsid
Definition: nvme.h:607
int32_t nr_active_zones
Definition: nvme.h:1216
@ NVME_CMD_OC_READ
Definition: nvme.h:351
uint8_t opcode
Definition: nvme.h:407
uint32_t rsvd12[4]
Definition: nvme.h:418
QEMUIOVector iov
Definition: nvme.h:985
@ NVME_NUMBER_OF_QUEUES
Definition: nvme.h:822
uint32_t async_config
Definition: nvme.h:801
uint64_t predef
Definition: nvme.h:1084
void nvme_create_poller(FemuCtrl *n)
创建poller线程,以及两个ring queue:to_ftl和to_poller
Definition: nvme-io.c:313
int nvme_setup_virq(FemuCtrl *n, NvmeCQueue *cq)
Definition: intr.c:216
@ NVME_CMD_ZONE_MGMT_RECV
Definition: nvme.h:347
void nvme_free_sq(NvmeSQueue *sq, FemuCtrl *n)
Definition: nvme-util.c:152
@ NVME_FEAT_CAP_CHANGE
Definition: nvme.h:835
int64_t gcrt
Definition: nvme.h:989
@ CMBSZ_SQS_SHIFT
Definition: nvme.h:227
uint8_t rp
Definition: nvme.h:858
uint64_t ncap
Definition: nvme.h:865
uint8_t afi
Definition: nvme.h:588
uint32_t size
Definition: rte_ring.h:136
#define NVME_SPARE_THRESHOLD
Definition: nvme.h:88
union NvmeCmdDptr NvmeCmdDptr
@ NVME_GETFEAT_SELECT_CURRENT
Definition: nvme.h:839
struct FemuCtrl * ctrl
Definition: nvme.h:1066
NvmeSQueue admin_sq
sq队列(admin)
Definition: nvme.h:1282
uint64_t db_addr_hva
Definition: nvme.h:1028
@ NVME_CSTS_SHST_PROGRESS
Definition: nvme.h:186
uint32_t nr
Definition: nvme.h:471
#define NVME_CQ_FLAGS_IEN(cq_flags)
Definition: nvme.h:379
static uint16_t nvme_identify_cmd_set(FemuCtrl *n, NvmeCmd *cmd)
Definition: nvme-admin.c:510
uint8_t flags
Definition: nvme.h:423
@ AQA_ACQS_MASK
Definition: nvme.h:203
uint8_t opcode
Definition: nvme.h:464
uint32_t nlb
Definition: nvme.h:484
@ NVME_FEAT_CAP_SAVE
Definition: nvme.h:833
static uint16_t nvme_set_db_memory(FemuCtrl *n, const NvmeCmd *cmd)
Definition: nvme-admin.c:215
uint8_t intc
Definition: nvme.h:1258
@ NVME_RW_DSM_FREQ_READS
Definition: nvme.h:445
int nvme_register_ocssd12(FemuCtrl *n)
Definition: oc12.c:1084
struct rte_ring * femu_ring_create(enum femu_ring_type type, size_t count)
Definition: rte_ring.c:187
uint8_t frs1[8]
Definition: nvme.h:590
uint16_t sqid
Definition: nvme.h:388
uint64_t data_units_written[2]
Definition: nvme.h:620
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
uint8_t apsta
Definition: nvme.h:719
uint16_t nawupf
Definition: nvme.h:878
uint8_t rsvd1[4095]
Definition: zns.h:12
@ CAP_TO_SHIFT
Definition: nvme.h:59
int64_t stime
io开始时间
Definition: nvme.h:987
uint8_t num_lun
Definition: nvme.h:1159
uint32_t rsvd1[5]
Definition: nvme.h:385
uint8_t vwc
Definition: nvme.h:1125
uint32_t cdw14
Definition: nvme.h:310
static uint16_t nvme_create_sq(FemuCtrl *n, NvmeCmd *cmd)
Definition: nvme-admin.c:107
NvmeIdNs id_ns
Definition: nvme.h:1067
uint8_t error_count
Definition: nvme.h:1241
@ NVME_NIDT_CSI
Definition: nvme.h:915
uint32_t rsvd12[4]
Definition: nvme.h:473
QTAILQ_HEAD(sq_list, NvmeSQueue) sq_list
uint64_t cap
Definition: nvme.h:40
uint32_t max_q_ents
Definition: nvme.h:1116
uint8_t nvmcap[16]
Definition: nvme.h:884
@ NVME_POWER_LOSS_ABORT
Definition: nvme.h:531
uint16_t awupf
Definition: nvme.h:746
@ NVME_RW_DSM_FREQ_WRITES
Definition: nvme.h:446
struct NvmeEffectsLog NvmeEffectsLog
@ NVME_CMD_EFF_NIC
Definition: nvme.h:650
uint8_t phys_contig
存储在mbe中的地址是否连续
Definition: nvme.h:1036
uint8_t aer_mask
Definition: nvme.h:1289
struct NvmeNamespace * ns
Definition: nvme.h:970
#define NVME_ID_NS_DPC_FIRST_EIGHT(dpc)
Definition: nvme.h:924
@ NVME_ID_CNS_CS_NS_PRESENT
Definition: nvme.h:688
@ CAP_CQR_MASK
Definition: nvme.h:70
void nvme_set_ctrl_name(FemuCtrl *n, const char *mn, const char *sn, int *dev_id)
Definition: nvme-util.c:294
uint16_t wctemp
Definition: nvme.h:720
@ NVME_ARBITRATION
Definition: nvme.h:816
static uint16_t nvme_create_cq(FemuCtrl *n, NvmeCmd *cmd)
Definition: nvme-admin.c:148
uint8_t frs3[8]
Definition: nvme.h:592
uint8_t vs[3712]
Definition: nvme.h:895
@ CMBSZ_LISTS_SHIFT
Definition: nvme.h:229
uint8_t mdts
Definition: nvme.h:1123
static uint16_t nvme_set_feature(FemuCtrl *n, NvmeCmd *cmd, NvmeCqe *cqe)
Definition: nvme-admin.c:616
uint32_t cattr
Definition: nvme.h:483
@ NVME_RW_LR
Definition: nvme.h:440
int64_t nr_tt_ios
总io数量
Definition: nvme.h:1332
@ OC20_ADM_CMD_SET_LOG_PAGE
Definition: nvme.h:1373
uint8_t dps
Definition: nvme.h:1127
@ NVME_AER_TYPE_VENDOR_SPECIFIC
Definition: nvme.h:492
NvmeIoCommands
Definition: nvme.h:338
uint64_t slba
Definition: nvme.h:849
uint8_t mdts
Definition: nvme.h:1242
time_t start_time
Definition: nvme.h:1222
uint8_t flags
Definition: nvme.h:408
@ CC_SHN_SHIFT
Definition: nvme.h:139
uint16_t control
Definition: nvme.h:432
@ NVME_AER_TYPE_SMART
Definition: nvme.h:490
struct NvmeIdCtrlZoned NvmeIdCtrlZoned
uint64_t lba
Definition: nvme.h:606
uint16_t nacwu
Definition: nvme.h:879
void nvme_free_cq(NvmeCQueue *cq, FemuCtrl *n)
Definition: nvme-util.c:282
@ NVME_NIDL_EUI64
Definition: nvme.h:905
int completed
Definition: nvme.h:1323
uint8_t sgl_lbal
Definition: nvme.h:1105
uint8_t frs4[8]
Definition: nvme.h:593
struct NvmeRangeType NvmeRangeType
@ NVME_CMD_OC_ERASE
Definition: nvme.h:349
@ NVME_CAP_EXCEEDED
Definition: nvme.h:541
QemuUUID uuid
Definition: nvme.h:1191
bool * should_isr
是否中断通知上层来取cq
Definition: nvme.h:1329
uint32_t oaes
Definition: nvme.h:706
Definition: rte_ring.h:127
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
struct OcCtrlParams OcCtrlParams
@ NVME_Q_PRIO_URGENT
Definition: nvme.h:400
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
uint8_t rsvd531
Definition: nvme.h:748
static void nop_init(FemuCtrl *n, Error **errp)
Definition: nop.c:24
@ CSTS_RDY_MASK
Definition: nvme.h:176
int pqueue_insert(pqueue_t *q, void *d)
Definition: pqueue.c:122
NvmeSmartWarn
Definition: nvme.h:632
uint64_t power_on_hours[2]
Definition: nvme.h:625
@ NVME_INTERRUPT_COALESCING
Definition: nvme.h:823
@ NVME_ADM_CMD_SET_DB_MEMORY
Definition: nvme.h:333
QEMUSGList * qsg
Definition: nvme.h:1003
@ NVME_MORE
Definition: nvme.h:580
void nvme_addr_read(FemuCtrl *n, hwaddr addr, void *buf, int size)
Definition: dma.c:3
uint8_t csi
Definition: nvme.h:417
uint32_t ctratt
Definition: nvme.h:707
#define NVME_ARB_HPW(arb)
Definition: nvme.h:808
uint64_t rsvd2[2]
Definition: nvme.h:411
#define NVME_ARB_MPW(arb)
Definition: nvme.h:807
@ NVME_CMD_SEQ_ERROR
Definition: nvme.h:538
static uint16_t nvme_rpt_empty_id_struct(FemuCtrl *n, NvmeCmd *cmd)
Definition: nvme-admin.c:285
uint32_t cdw12
Definition: nvme.h:308
uint8_t nvscc
Definition: nvme.h:747
uint64_t oc12_slba
Definition: nvme.h:979
uint8_t vwc
Definition: nvme.h:744
static uint16_t nvme_write_uncor(FemuCtrl *n, NvmeNamespace *ns, NvmeCmd *cmd, NvmeRequest *req)
处理io cmd:write uncorrectable命令
Definition: nvme-io.c:571
uint16_t npwa
Definition: nvme.h:886
@ NVME_ONCS_WRITE_ZEROS
Definition: nvme.h:771
uint8_t resv[16]
Definition: nvme.h:672
NvmePsdt
Definition: nvme.h:290
@ NVME_AER_INFO_SMART_SPARE_THRESH
Definition: nvme.h:501
static void set_pri(void *a, pqueue_pri_t pri)
Definition: nvme-io.c:293
@ NVME_ID_CNS_NS_PRESENT_LIST
Definition: nvme.h:685
int nvme_register_nossd(FemuCtrl *n)
Definition: nop.c:29
NvmeIdCtrlLpa
Definition: nvme.h:780
uint8_t extended
Definition: nvme.h:1252
uint64_t power_cycles[2]
Definition: nvme.h:624
uint64_t prp1
Definition: nvme.h:412
@ NVME_WRITE_ATOMICITY
Definition: nvme.h:825
@ NVME_PSDT_SGL_MPTR_SGL
Definition: nvme.h:293
struct Oc20Params Oc20Params
@ CAP_CQR_SHIFT
Definition: nvme.h:57
uint16_t awun
Definition: nvme.h:745
uint16_t irq_vector
Definition: nvme.h:374
uint64_t zone_size
Definition: nvme.h:1211
@ NVME_CAP_CSS_CSI_SUPP
Definition: nvme.h:130
NvmeParams params
Definition: nvme.h:1219
NvmeIdCtrlOncs
Definition: nvme.h:767
@ CMBLOC_OFST_MASK
Definition: nvme.h:216
@ NVME_ID_CNS_CS_CTRL
Definition: nvme.h:683
uint8_t fpi
Definition: nvme.h:875
uint64_t predef
Definition: nvme.h:993
@ NVME_CONFLICTING_ATTRS
Definition: nvme.h:560
@ NVME_INTERNAL_DEV_ERROR
Definition: nvme.h:532
@ DPS_TYPE_3
Definition: nvme.h:934
@ FEMU_SMARTSSD_MODE
Definition: nvme.h:1362
@ CAP_OC_MASK
Definition: nvme.h:76
uint64_t db_addr
Definition: nvme.h:1052
uint64_t acq
Definition: nvme.h:50
uint8_t extended
Definition: nvme.h:1131
bool vector_poll_started
Definition: nvme.h:1274
uint64_t eis_addr
Definition: nvme.h:1292
@ DPS_TYPE_MASK
Definition: nvme.h:935
uint64_t addr
Definition: nvme.h:272
@ NVME_ZONE_BOUNDARY_ERROR
Definition: nvme.h:563
uint16_t mp
Definition: nvme.h:664
@ CMBLOC_BIR_SHIFT
Definition: nvme.h:210
@ CAP_MPSMIN_SHIFT
Definition: nvme.h:64
uint32_t len
Definition: nvme.h:273
uint32_t rsvd12[4]
Definition: nvme.h:392
NvmeCapCss
Definition: nvme.h:128
Oc12Ctrl * oc12_ctrl
Definition: nvme.h:1301
uint16_t cqe_size
Definition: nvme.h:1227
@ NVME_ONCS_FEATURES
Definition: nvme.h:772
@ NVME_FW_REQ_SUSYSTEM_RESET
Definition: nvme.h:559
uint16_t cq_flags
Definition: nvme.h:373
uint16_t sos
Definition: nvme.h:1161
static uint16_t nvme_identify_ctrl_csi(FemuCtrl *n, NvmeCmd *cmd)
Definition: nvme-admin.c:367
uint8_t meta
Definition: nvme.h:1246
@ NVME_CMD_OC_WRITE
Definition: nvme.h:350
uint32_t num_io_queues
sq(cq)个数
Definition: nvme.h:1233
pthread_spinlock_t chip_locks[FEMU_MAX_NUM_CHIPS]
Definition: nvme.h:1303
uint64_t db_addr_hva
Definition: nvme.h:1053
uint16_t guard_tag
Definition: nvme.h:1348
static bool OCSSD(FemuCtrl *n)
Definition: nvme.h:1376
struct QEMU_PACKED NvmeSglDescriptor NvmeSglDescriptor
@ DPS_TYPE_NONE
Definition: nvme.h:931
NvmeAsyncEventRequest
Definition: nvme.h:488
NvmeCsi
Definition: nvme.h:123
uint8_t intc
Definition: nvme.h:1128
void nvme_free_sq(NvmeSQueue *sq, FemuCtrl *n)
Definition: nvme-util.c:152
void nvme_update_sq_tail(NvmeSQueue *sq)
Definition: nvme-util.c:33
static const uint32_t nvme_cse_acs[256]
Definition: nvme-admin.c:38
NvmeAdminCommands
Definition: nvme.h:317
uint8_t reserved1[26]
Definition: nvme.h:618
uint16_t vid
Definition: nvme.h:1137
@ NVME_ID_CNS_NS_DESCR_LIST
Definition: nvme.h:681
@ NVME_ADM_CMD_SECURITY_SEND
Definition: nvme.h:331
struct NvmeCQueue NvmeCQueue
void * opaque
Definition: nvme.h:996
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
Definition: nvme.h:342
uint8_t max_cqes
Definition: nvme.h:1245
uint64_t asq
Definition: nvme.h:49
static uint16_t nvme_identify_ns(FemuCtrl *n, NvmeCmd *cmd)
Definition: nvme-admin.c:306
@ NVME_RW_DSM_FREQ_TEMP
Definition: nvme.h:450
uint8_t mdts
Definition: nvme.h:701
uint8_t aerl
Definition: nvme.h:1237
struct NvmeCQueue * cq
Definition: nvme.h:969
@ NVME_INVALID_CQID
Definition: nvme.h:544
uint16_t is_write
是否为写操作
Definition: nvme.h:973
uint32_t max_q_ents
Definition: nvme.h:1234
uint16_t temperature
Definition: nvme.h:1223
@ CAP_MPSMAX_MASK
Definition: nvme.h:78
uint8_t type
Definition: nvme.h:846
uint16_t sqid
Definition: nvme.h:602
uint16_t sq_id
Definition: nvme.h:520
void nvme_addr_write(FemuCtrl *n, hwaddr addr, void *buf, int size)
Definition: dma.c:13
uint32_t max_active_zones
Definition: nvme.h:1198
uint64_t data
Definition: nvme.h:1085
uint64_t ns_size
Definition: nvme.h:1235
@ AQA_ASQS_SHIFT
Definition: nvme.h:197
@ CC_EN_MASK
Definition: nvme.h:145
@ CC_AMS_MASK
Definition: nvme.h:148
uint8_t femu_mode
Definition: nvme.h:1296
int32_t virq
Definition: nvme.h:1042
uint16_t param_error_location
Definition: nvme.h:605
static uint16_t nvme_get_feature(FemuCtrl *n, NvmeCmd *cmd, NvmeCqe *cqe)
Definition: nvme-admin.c:554
uint32_t head
Definition: nvme.h:1040
#define NVME_SQ_FLAGS_QPRIO(sq_flags)
Definition: nvme.h:396
uint8_t aerl
Definition: nvme.h:713
static uint16_t nvme_identify_ns_csi(FemuCtrl *n, NvmeCmd *cmd)
Definition: nvme-admin.c:331
int64_t reqlat
io延迟
Definition: nvme.h:988
uint8_t nvme_sq_empty(NvmeSQueue *sq)
Definition: nvme-util.c:64
@ NVME_OACS_FW
Definition: nvme.h:762
uint8_t intc_thresh
Definition: nvme.h:1129
uint32_t nsid
Definition: nvme.h:410
NvmeIdCtrl id_ctrl
Definition: nvme.h:1285
@ NVME_INTERRUPT_VECTOR_CONF
Definition: nvme.h:824
uint64_t * nvme_setup_discontig(FemuCtrl *n, uint64_t prp_addr, uint16_t queue_depth, uint16_t entry_size)
Definition: nvme-util.c:69
int nvme_register_znssd(FemuCtrl *n)
Definition: zns.c:1312
NvmeFeatureIds
Definition: nvme.h:815
uint64_t res2
Definition: nvme.h:303
uint8_t phys_contig
在mbe中的地址是否连续
Definition: nvme.h:1011
uint8_t subnqn[256]
Definition: nvme.h:753
@ NVME_AER_INFO_ERR_DIAG_FAIL
Definition: nvme.h:495
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
Definition: nvme.h:232
char * chunkstate_fname
Definition: nvme.h:1107
uint16_t nabo
Definition: nvme.h:881
@ CMBSZ_SZU_MASK
Definition: nvme.h:242
@ CSTS_SHST_MASK
Definition: nvme.h:178
@ CAP_AMS_SHIFT
Definition: nvme.h:58
@ NVME_RW_DSM_COMPRESSED
Definition: nvme.h:456
#define FEMU_MAX_NUM_CHIPS
Definition: nvme.h:1151
uint64_t eis_addr_hva
Definition: nvme.h:1294
uint16_t oacs
Definition: nvme.h:711
@ NVME_CMD_EFF_CSE_MASK
Definition: nvme.h:652
@ NVME_ZONE_TOO_MANY_ACTIVE
Definition: nvme.h:568
@ CAP_NSSRS_SHIFT
Definition: nvme.h:61
void nvme_isr_notify_admin(void *opaque)
通知上层admin命令已完成
Definition: intr.c:192
uint64_t meta_size
Definition: nvme.h:976
@ NVME_LBA_RANGE_TYPE
Definition: nvme.h:818
@ CMBLOC_OFST_SHIFT
Definition: nvme.h:211
uint8_t sn[20]
Definition: nvme.h:695
static int cmp_pri(pqueue_pri_t next, pqueue_pri_t curr)
Definition: nvme-io.c:283
QSIMPLEQ_ENTRY(NvmeAsyncEvent) entry
NvmeCstsShift
Definition: nvme.h:168
uint16_t cqid
Definition: nvme.h:391
uint16_t oncs
Definition: nvme.h:741
static bool NOSSD(FemuCtrl *n)
Definition: nvme.h:1386
uint32_t max_open_zones
Definition: nvme.h:1199
uint8_t resv[2048]
Definition: nvme.h:643
@ NVME_NO_COMPLETE
Definition: nvme.h:582
uint8_t rsvd48[16]
Definition: nvme.h:852
@ CAP_TO_MASK
Definition: nvme.h:72
NvmeIdCtrlFrmw
Definition: nvme.h:776
QEMUTimer * aer_timer
Definition: nvme.h:1288
uint32_t cns
Definition: nvme.h:414
#define NVME_CQ_FLAGS_PC(cq_flags)
Definition: nvme.h:378
uint8_t reserved1[7]
Definition: nvme.h:589
@ NVME_INVALID_LOG_ID
Definition: nvme.h:553
uint8_t dps
Definition: nvme.h:1250
uint8_t nvme_cq_full(NvmeCQueue *cq)
Definition: nvme-util.c:57
uint8_t mc
Definition: nvme.h:1248
NvmeCmdDptr dptr
Definition: nvme.h:305
@ NVME_ONCS_COMPARE
Definition: nvme.h:768
uint8_t intc_thresh
Definition: nvme.h:1259
@ NVME_INVALID_OPCODE
Definition: nvme.h:527
uint16_t did
Definition: nvme.h:1138
@ NVME_OACS_FORMAT
Definition: nvme.h:761
@ NVME_NIDL_NGUID
Definition: nvme.h:906
uint8_t frs7[8]
Definition: nvme.h:596
static uint16_t nvme_identify_nslist(FemuCtrl *n, NvmeCmd *cmd)
Definition: nvme-admin.c:392
struct NvmeErrorLog NvmeErrorLog
@ NVME_ONCS_DSM
Definition: nvme.h:770
uint64_t prp2
Definition: nvme.h:429
@ NVME_RW_DSM_LATENCY_LOW
Definition: nvme.h:454
static const uint32_t nvme_cse_iocs_nvm[256]
Definition: nvme-admin.c:53
@ NVME_ADM_CMD_GET_FEATURES
Definition: nvme.h:326
uint8_t nsfeat
Definition: nvme.h:867
Oc20Params oc20
Definition: nvme.h:1146
uint16_t cid
Definition: nvme.h:367
@ NVME_ID_CNS_CTRL
Definition: nvme.h:679
pqueue_t ** pq
pqueue,暂存req的队列
Definition: nvme.h:1328
int64_t nr_tt_late_ios
没有按预计时延(超时)返回的io数量
Definition: nvme.h:1333
uint32_t rsvd
Definition: nvme.h:515
NvmeCQueue ** cq
cq队列列表(io)
Definition: nvme.h:1281
uint8_t sqes
Definition: nvme.h:737
uint16_t nawun
Definition: nvme.h:877
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
uint64_t nsze
Definition: nvme.h:864
int nvme_register_nossd(FemuCtrl *n)
Definition: nop.c:29
uint64_t eui64
Definition: nvme.h:892
struct NvmeCqe::@15::@17 n
uint8_t zasl
Definition: zns.h:11
uint8_t dlfeat
Definition: nvme.h:876
uint8_t fwug
Definition: nvme.h:730
NvmeIdCns
Definition: nvme.h:677
struct NvmeDsmRange NvmeDsmRange
#define NVME_CC_CSS(cc)
Definition: nvme.h:155
uint32_t num_namespaces
Definition: nvme.h:1114
@ NVME_GETFEAT_SELECT_CAP
Definition: nvme.h:842
size_t femu_ring_enqueue(struct rte_ring *ring, void **objs, size_t count)
Definition: rte_ring.c:223
uint16_t irq_enabled
irq 中断用
Definition: nvme.h:1039
@ NVME_FID_NOT_SAVEABLE
Definition: nvme.h:557
uint32_t acs[256]
Definition: nvme.h:641
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
uint64_t eventidx_addr_hva
Definition: nvme.h:1055
uint32_t enlat
Definition: nvme.h:666
@ NVME_NIDL_CSI
Definition: nvme.h:908
MemoryRegion iomem
Definition: nvme.h:1186
Oc12Bbt ** bbtbl
Definition: nvme.h:1079
@ NVME_CMD_WRITE_ZEROES
Definition: nvme.h:344
@ NVME_ADM_CMD_DOWNLOAD_FW
Definition: nvme.h:329
uint8_t csi
Definition: nvme.h:1203
uint32_t memsz
Definition: nvme.h:1298
#define NVME_CSTS_NSSRO(csts)
Definition: nvme.h:194
uint64_t prp1
Definition: nvme.h:386
@ NVME_CSTS_READY
Definition: nvme.h:183
#define FEMU_MAX_INF_REQS
Definition: nvme.h:1355
@ NVME_AER_INFO_SMART_TEMP_THRESH
Definition: nvme.h:500
struct NvmeAerResult NvmeAerResult
uint64_t prp1
Definition: nvme.h:283
uint32_t cmbloc
Definition: nvme.h:51
#define MN_MAX_LEN
Definition: nvme.h:1499
@ NVME_INVALID_FW_IMAGE
Definition: nvme.h:551
uint8_t secs_per_pg
Definition: nvme.h:1155
@ NVME_CID_CONFLICT
Definition: nvme.h:529
uint8_t resv
Definition: nvme.h:508
NvmeCmblocMask
Definition: nvme.h:214
void nvme_process_sq_admin(void *opaque)
处理admin命令的sq队列
Definition: nvme-admin.c:1036
@ NVME_CMD_EFF_CCC
Definition: nvme.h:651
uint8_t mc
Definition: nvme.h:870
uint8_t nvme_sq_empty(NvmeSQueue *sq)
Definition: nvme-util.c:64
uint16_t sqid
Definition: nvme.h:1013
扩展操作接口,具体实现在各模式ssd中
Definition: nvme.h:1169
void nvme_inc_cq_tail(NvmeCQueue *cq)
Definition: nvme-util.c:19
@ NVME_LOG_FW_SLOT_INFO
Definition: nvme.h:659
uint8_t intc_time
Definition: nvme.h:1260
static uint16_t nvme_error_log_info(FemuCtrl *n, NvmeCmd *cmd, uint32_t buf_len)
Definition: nvme-admin.c:698
uint8_t nvme_cq_full(NvmeCQueue *cq)
Definition: nvme-util.c:57
static uint16_t nop_io_cmd(FemuCtrl *n, NvmeNamespace *ns, NvmeCmd *cmd, NvmeRequest *req)
Definition: nop.c:12
uint16_t kas
Definition: nvme.h:731
@ NVME_POWER_MANAGEMENT
Definition: nvme.h:817
@ CMBSZ_LISTS_MASK
Definition: nvme.h:239
uint16_t ms
Definition: nvme.h:856
uint16_t sec_size
Definition: nvme.h:1154
uint32_t intmc
Definition: nvme.h:43
uint64_t rsvd
Definition: oc12.h:3
uint64_t dma_addr_hva
Definition: nvme.h:1046
struct ssd * ssd
指向模拟的ssd
Definition: nvme.h:1321
EventNotifier guest_notifier
Definition: nvme.h:1048
@ NVME_ADM_CMD_SECURITY_RECV
Definition: nvme.h:332
uint16_t nows
Definition: nvme.h:889
@ NVME_ID_CNS_NS_ACTIVE_LIST
Definition: nvme.h:680
uint64_t meta_start_offset
Definition: nvme.h:1075
NvmeLBAF lbaf[16]
Definition: nvme.h:893
@ CMBSZ_CQS_MASK
Definition: nvme.h:238
uint32_t hmmin
Definition: nvme.h:724
@ NVME_RW_DSM_FREQ_TYPICAL
Definition: nvme.h:443
NvmeCapShift
Definition: nvme.h:55
uint8_t lver
femu模式,包括blackbox,ocssd,...
Definition: nvme.h:1297
char * writefail_fname
Definition: nvme.h:1109
uint32_t cdw10
Definition: nvme.h:306
NvmeRequest * io_req
Definition: nvme.h:1022
uint8_t temp_warn_issued
Definition: nvme.h:1262
@ NVME_WRITE_TO_RO
Definition: nvme.h:562
void nvme_post_cqes_io(void *opaque)
将剩余的req都填入cq
Definition: nvme-io.c:651
@ NVME_VOLATILE_WRITE_CACHE
Definition: nvme.h:821
uint16_t opcode
Definition: nvme.h:297
@ NVME_ZONE_FULL
Definition: nvme.h:564
@ NVME_INVALID_PROT_INFO
Definition: nvme.h:561
uint16_t cid
Definition: nvme.h:424
@ NVME_AER_TYPE_ERROR
Definition: nvme.h:489
uint16_t cid
Definition: nvme.h:409
uint8_t max_sqes
Definition: nvme.h:1117
uint8_t nmic
Definition: nvme.h:873
LogIdentifier
Definition: nvme.h:656
@ CSTS_NSSRO_SHIFT
Definition: nvme.h:172
uint64_t rsvd2
Definition: nvme.h:426
NvmeCQueue admin_cq
cq队列(admin)
Definition: nvme.h:1283
static uint16_t nvme_del_sq(FemuCtrl *n, NvmeCmd *cmd)
Definition: nvme-admin.c:74
uint16_t oncs
Definition: nvme.h:1230
uint32_t * int_vector_config
Definition: nvme.h:799
NvmeIdNsZoned * id_ns_zoned
Definition: nvme.h:1204
uint8_t dpc
Definition: nvme.h:871
uint16_t edstt
Definition: nvme.h:728
uint64_t eventidx_addr_hva
Definition: nvme.h:1030
@ CC_SHN_MASK
Definition: nvme.h:149
NvmeCcCss
Definition: nvme.h:162
@ NVME_CMD_ABORT_REQ
Definition: nvme.h:533
uint16_t oacs
Definition: nvme.h:1229
void nvme_update_sq_tail(NvmeSQueue *sq)
Definition: nvme-util.c:33
@ NVME_RW_DSM_SEQ_REQ
Definition: nvme.h:455
uint16_t oncs
Definition: nvme.h:1143
uint16_t psdt
Definition: nvme.h:300
NvmeCmblocShift
Definition: nvme.h:209
struct FemuCtrl * ctrl
Definition: nvme.h:1035
struct rte_ring ** to_ftl
生产者:nvme poller;消费者:ftl
Definition: nvme.h:1326
@ NVME_CSTS_SHST_COMPLETE
Definition: nvme.h:187
uint8_t opcode
Definition: nvme.h:422
uint16_t nvme_map_prp(QEMUSGList *qsg, QEMUIOVector *iov, uint64_t prp1, uint64_t prp2, uint32_t len, FemuCtrl *n)
Definition: dma.c:23
NvmeZone * zone_array
Definition: nvme.h:1205
@ NVME_ZONE_READ_ONLY
Definition: nvme.h:565
@ NVME_AER_INFO_ERR_FW_IMG_LOAD_ERR
Definition: nvme.h:498
struct NvmeNamespace::@18 blk
int64_t cpg_rd_lat_ns
Definition: nvme.h:1309
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
Definition: nvme.h:228
@ NVME_RW_DSM_FREQ_PREFETCH
Definition: nvme.h:449
void * pqueue_peek(pqueue_t *q)
Definition: pqueue.c:186
int64_t upg_rd_lat_ns
Definition: nvme.h:1308
NvmeRangeType lba_range[64]
Definition: nvme.h:1068
@ NVME_CMD_EFF_UUID_SEL
Definition: nvme.h:653
uint32_t rsvd12[4]
Definition: nvme.h:375
uint8_t available_spare
Definition: nvme.h:615
NvmeCsts
Definition: nvme.h:182
uint8_t rsvd192[192]
Definition: nvme.h:894
uint64_t rsvd8
Definition: nvme.h:387
uint64_t * prp_list
Definition: nvme.h:1047
int64_t cpg_wr_lat_ns
Definition: nvme.h:1314
uint8_t mc
Definition: nvme.h:1136
uint16_t cid
Definition: nvme.h:357
@ NVME_RW_PRINFO_PRCHK_REF
Definition: nvme.h:460
static bool ZNSSD(FemuCtrl *n)
Definition: nvme.h:1391
@ NVME_Q_PRIO_HIGH
Definition: nvme.h:401
@ FEMU_BBSSD_MODE
Definition: nvme.h:1359
uint64_t size
Definition: nvme.h:1072
NvmeSglDescriptor sgl
Definition: nvme.h:287
@ NVME_FEAT_CAP_NS
Definition: nvme.h:834
@ NVME_ADM_CMD_FEMU_DEBUG
Definition: nvme.h:334
NvmeStatusCodes
Definition: nvme.h:525
struct NvmeDeleteQ NvmeDeleteQ
int nvme_register_ocssd20(FemuCtrl *n)
Definition: oc20.c:1363
@ NVME_CAP_CSS_ADMIN_ONLY
Definition: nvme.h:131
NvmeCqe cqe
Definition: nvme.h:982
uint8_t opcode
Definition: nvme.h:365
@ NVME_AER_LIMIT_EXCEEDED
Definition: nvme.h:549
@ NVME_LPA_EXTENDED
Definition: nvme.h:783
@ CMBSZ_RDS_SHIFT
Definition: nvme.h:230
void * state
Definition: nvme.h:1089
@ CAP_NSSRS_MASK
Definition: nvme.h:74
uint64_t controller_busy_time[2]
Definition: nvme.h:623
NvmeCcShift
Definition: nvme.h:134
@ NVME_RW_DSM_LATENCY_IDLE
Definition: nvme.h:452
@ NVME_AER_INFO_ERR_PERS_INTERNAL_ERR
Definition: nvme.h:496
@ NVME_ADM_CMD_CREATE_CQ
Definition: nvme.h:322
@ NVME_E2E_REF_ERROR
Definition: nvme.h:576
uint8_t flbas
Definition: nvme.h:869
void nvme_addr_write(FemuCtrl *n, hwaddr addr, void *buf, int size)
Definition: dma.c:13
@ NVME_ZONE_INVAL_TRANSITION
Definition: nvme.h:570
NvmeCcMask
Definition: nvme.h:144
struct QEMU_PACKED NvmeIdNsDescr NvmeIdNsDescr
NvmeIdCtrlOacs
Definition: nvme.h:759
uint8_t early_reset
Definition: nvme.h:1104
@ NVME_CMD_ABORT_MISSING_FUSE
Definition: nvme.h:536
uint32_t rsvd1
Definition: nvme.h:45
@ CAP_CSS_MASK
Definition: nvme.h:75
uint8_t log_page
Definition: nvme.h:507
uint32_t mccap
Definition: nvme.h:1098
uint32_t hmpre
Definition: nvme.h:723
struct NvmeAsyncEvent NvmeAsyncEvent
uint64_t host_write_commands[2]
Definition: nvme.h:622
uint8_t critical_warning
Definition: nvme.h:613
uint8_t frs6[8]
Definition: nvme.h:595
uint64_t rsvd8
Definition: nvme.h:370
@ NVME_CC_CSS_ADMIN_ONLY
Definition: nvme.h:165
QEMUTimer * timer
Definition: nvme.h:1049
uint16_t(* io_cmd)(struct FemuCtrl *, NvmeNamespace *, NvmeCmd *, NvmeRequest *)
Definition: nvme.h:1176
uint8_t num_pln
Definition: nvme.h:1160
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
#define NVME_CAP_CQR(cap)
Definition: nvme.h:93
uint8_t frs5[8]
Definition: nvme.h:594
uint16_t rsvd10
Definition: nvme.h:360
@ CSTS_CFS_MASK
Definition: nvme.h:177
struct rte_ring ** to_poller
生产者:ftl;消费者:nvme poller
Definition: nvme.h:1327
uint16_t acwu
Definition: nvme.h:749
uint8_t debug
Definition: nvme.h:1103
@ NVME_ADM_CMD_ASYNC_EV_REQ
Definition: nvme.h:327
Priority Queue function declarations
bool cross_zone_read
Definition: nvme.h:1195
uint16_t(* admin_cmd)(struct FemuCtrl *, NvmeCmd *)
Definition: nvme.h:1175
uint8_t lbads
Definition: nvme.h:857
@ DPS_TYPE_1
Definition: nvme.h:932
uint8_t cmic
Definition: nvme.h:700
void(* init)(struct FemuCtrl *, Error **)
Definition: nvme.h:1171
int64_t expire_time
io应该结束的时间
Definition: nvme.h:990
FemuCtrl * n
Definition: nvme.h:1343
@ CSTS_CFS_SHIFT
Definition: nvme.h:170
uint16_t nvme_map_prp(QEMUSGList *qsg, QEMUIOVector *iov, uint64_t prp1, uint64_t prp2, uint32_t len, FemuCtrl *n)
Definition: dma.c:23
static void set_pos(void *a, size_t pos)
Definition: nvme-io.c:303
uint16_t app_tag
Definition: nvme.h:1349
@ NVME_AER_INFO_ERR_INVALID_DB
Definition: nvme.h:494
void nvme_isr_notify_admin(void *opaque)
通知上层admin命令已完成
Definition: intr.c:192
struct NvmeSQueue * sq
Definition: nvme.h:968
uint8_t ms_max
Definition: nvme.h:1135
volatile int64_t chnl_next_avail_time[FEMU_MAX_NUM_CHNLS]
Definition: nvme.h:1304
uint8_t fr[8]
Definition: nvme.h:697
void nvme_update_cq_head(NvmeCQueue *cq)
Definition: nvme-util.c:45
@ CC_MPS_MASK
Definition: nvme.h:147
uint32_t num_namespaces
Definition: nvme.h:1232
@ NVME_CMD_ZONE_APPEND
Definition: nvme.h:348
uint64_t data_units_read[2]
Definition: nvme.h:619
QSIMPLEQ_HEAD(aer_queue, NvmeAsyncEvent) aer_queue
uint16_t sq_head
Definition: nvme.h:519
@ NVME_CMD_ABORT_FAILED_FUSE
Definition: nvme.h:535
uint32_t int_coalescing
Definition: nvme.h:798
@ DPS_TYPE_2
Definition: nvme.h:933
uint64_t * prp_list
Definition: nvme.h:1021
uint32_t tail
Definition: nvme.h:1016
uint16_t max_prp_ents
Definition: nvme.h:1226
@ NVME_DSMGMT_IDR
Definition: nvme.h:477
int64_t cupg_wr_lat_ns
Definition: nvme.h:1315
uint8_t nidt
Definition: nvme.h:899
uint32_t head
Definition: nvme.h:1015
@ NVME_LPA_CSE
Definition: nvme.h:782
SsdDramBackend * mbe
femu后端内存(实际数据)
Definition: nvme.h:1322
uint8_t cmd_opcode
Definition: nvme.h:983
@ NVME_ACCESS_DENIED
Definition: nvme.h:578
NvmeAerResult result
Definition: nvme.h:964
@ NVME_ADM_CMD_IDENTIFY
Definition: nvme.h:323
uint16_t noiob
Definition: nvme.h:883
NvmeCmbszMask
Definition: nvme.h:236
@ NVME_DULB
Definition: nvme.h:579
@ NVME_INVALID_QID
Definition: nvme.h:545
@ CC_MPS_SHIFT
Definition: nvme.h:137
struct NvmeFeatureVal NvmeFeatureVal
uint16_t mntmt
Definition: nvme.h:733
uint64_t mptr
Definition: nvme.h:427
static void bb_init_ctrl_str(FemuCtrl *n)
Definition: nop.c:3
int nvme_check_sqid(FemuCtrl *n, uint16_t sqid)
Definition: nvme-util.c:9
void * meta_buf
Definition: nvme.h:978
@ CC_AMS_SHIFT
Definition: nvme.h:138
static uint16_t nvme_get_log(FemuCtrl *n, NvmeCmd *cmd)
Definition: nvme-admin.c:787
uint64_t eventidx_addr
Definition: nvme.h:1054
void * state
Definition: nvme.h:1170
NvmeCmbszShift
Definition: nvme.h:226
uint32_t mw_cunits
Definition: nvme.h:1101
@ NVME_PSDT_PRP
Definition: nvme.h:291
uint8_t fna
Definition: nvme.h:743
uint8_t dlfeat
Definition: nvme.h:1139
@ NVME_INVALID_FORMAT
Definition: nvme.h:554
PCIDevice parent_obj
Definition: nvme.h:1185
#define NVME_OP_ABORTED
Definition: nvme.h:90
@ NVME_CMD_READ
Definition: nvme.h:341
@ CC_CSS_SHIFT
Definition: nvme.h:136
MemoryRegion ctrl_mem
Definition: nvme.h:1187
#define NVME_ID_NS_MC_SEPARATE(mc)
Definition: nvme.h:921
@ OC20_ADM_CMD_IDENTIFY
Definition: nvme.h:1372
@ NVME_NS_RESV_CONFLICT
Definition: nvme.h:543
uint8_t nlbaf
Definition: nvme.h:1251
uint32_t nssrc
Definition: nvme.h:47
uint8_t vs
Definition: nvme.h:608
uint32_t aqa
Definition: nvme.h:48
@ NVME_ADM_CMD_SET_FEATURES
Definition: nvme.h:325
@ NVME_INVALID_IRQ_VECTOR
Definition: nvme.h:552
char devname[64]
Definition: nvme.h:1325
size_t femu_ring_count(struct rte_ring *ring)
Definition: rte_ring.c:218
uint64_t slba
开始lba
Definition: nvme.h:972
uint32_t zd_extension_size
Definition: nvme.h:1200
uint32_t size
Definition: nvme.h:1017
uint32_t sw_prog_marker
Definition: nvme.h:802
@ NVME_FRMW_SLOT1_RO
Definition: nvme.h:777
QTAILQ_HEAD(, NvmeZone) exp_open_zones
dma_addr_t ptr
Definition: nvme.h:1005
uint16_t appmask
Definition: nvme.h:436
@ NVME_Q_PRIO_LOW
Definition: nvme.h:403
uint8_t mpsmax
Definition: nvme.h:1133
@ NVME_Q_PC
Definition: nvme.h:399
int index
poller序号
Definition: nvme.h:1344
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
Definition: nvme.h:829
uint8_t dps
Definition: nvme.h:872
uint8_t opcode
Definition: nvme.h:382
uint64_t prp2
Definition: nvme.h:413
int32_t nr_open_zones
Definition: nvme.h:1215
int(* start_ctrl)(struct FemuCtrl *)
Definition: nvme.h:1174
@ NVME_CMD_ABORT_SQ_DEL
Definition: nvme.h:534
@ NVME_INVALID_NSID
Definition: nvme.h:537
@ NVME_ONCS_RESRVATIONS
Definition: nvme.h:773
int64_t blk_er_lat_ns
Definition: nvme.h:1318
size_t pqueue_size(pqueue_t *q)
Definition: pqueue.c:68
QTAILQ_ENTRY(NvmeSQueue) entry
uint64_t prp2
Definition: nvme.h:284
uint8_t mpsmin
Definition: nvme.h:1132
void nvme_set_ctrl_name(FemuCtrl *n, const char *mn, const char *sn, int *dev_id)
Definition: nvme-util.c:294
@ CMBSZ_SQS_MASK
Definition: nvme.h:237
bool zoned
Definition: nvme.h:1194
@ NVME_OACS_Oc12DEV
Definition: nvme.h:763
uint64_t slba
Definition: nvme.h:485
NvmeNamespace * namespaces
Definition: nvme.h:1279
bool poller_on
Definition: nvme.h:1330
uint8_t frmw
Definition: nvme.h:714
void nvme_post_cqes_io(void *opaque)
将剩余的req都填入cq
Definition: nvme-io.c:651
@ NVME_GETFEAT_SELECT_SAVED
Definition: nvme.h:841
uint16_t did
Definition: nvme.h:1266
static uint64_t ns_blks(NvmeNamespace *ns, uint8_t lba_idx)
Definition: nvme.h:1457
uint16_t nlb
Definition: nvme.h:431
uint16_t vid
Definition: nvme.h:693
int64_t clpg_rd_lat_ns
Definition: nvme.h:1311
uint32_t volatile_wc
Definition: nvme.h:796
NvmeErrorLog * elpes
Definition: nvme.h:1277
uint32_t rtd3e
Definition: nvme.h:705
uint32_t nsid
Definition: nvme.h:425
uint8_t dpc
Definition: nvme.h:1249
@ NVME_ZONE_TOO_MANY_OPEN
Definition: nvme.h:569
bool dataplane_started
Definition: nvme.h:1273
QTAILQ_ENTRY(NvmeRequest) entry
@ NVME_CC_CSS_NVM
Definition: nvme.h:163
uint8_t acl
Definition: nvme.h:712
@ NVME_CMD_EFF_NCC
Definition: nvme.h:649
uint16_t ssvid
Definition: nvme.h:694
uint8_t outstanding_aers
Definition: nvme.h:1261
uint32_t num_zones
Definition: nvme.h:1210
void nvme_free_cq(NvmeCQueue *cq, FemuCtrl *n)
Definition: nvme-util.c:282
struct NvmeNamespace NvmeNamespace
static size_t get_pos(void *a)
Definition: nvme-io.c:298
@ NVME_ID_CNS_CS_NS_PRESENT_LIST
Definition: nvme.h:687
@ CSTS_SHST_SHIFT
Definition: nvme.h:171
@ NVME_RW_DSM_LATENCY_NONE
Definition: nvme.h:451
static void * nvme_poller(void *arg)
nvme poller线程函数,不断处理sq和生成cq
Definition: nvme-io.c:240
@ NVME_AER_INFO_ERR_INVALID_SQ
Definition: nvme.h:493
@ CAP_MQES_SHIFT
Definition: nvme.h:56
uint8_t lba_index
Definition: nvme.h:1253
uint32_t num_io_queues
Definition: nvme.h:797
@ NVME_INVALID_FW_SLOT
Definition: nvme.h:550
static uint16_t nvme_write_zeros(FemuCtrl *n, NvmeNamespace *ns, NvmeCmd *cmd, NvmeRequest *req)
处理io cmd:write zeros命令
Definition: nvme-io.c:546
OcCtrlParams oc_params
Definition: nvme.h:1299
uint8_t phase
Definition: nvme.h:1037
uint64_t error_count
Definition: nvme.h:601
uint64_t ns_blks
Definition: nvme.h:1073
NvmeGetFeatureSelect
Definition: nvme.h:838
@ NVME_ADM_CMD_FORMAT_NVM
Definition: nvme.h:330
uint16_t cid
Definition: nvme.h:603
uint8_t nguid[16]
Definition: nvme.h:891
uint16_t page_size
Definition: nvme.h:1224
static void nvme_post_cqe(NvmeCQueue *cq, NvmeRequest *req)
将req实际封装入cq
Definition: nvme-io.c:126
@ NVME_WRITE_FAULT
Definition: nvme.h:572
NvmeAqaShift
Definition: nvme.h:196
uint32_t power_mgmt
Definition: nvme.h:793
struct NvmeIdentity NvmeIdentify
uint64_t dma_addr
数据在dram中地址
Definition: nvme.h:1018
uint16_t qsize
Definition: nvme.h:372
uint16_t fuses
Definition: nvme.h:742
#define NVME_CAP_MQES(cap)
Definition: nvme.h:92
uint16_t status_field
Definition: nvme.h:604
@ NVME_ADM_CMD_ABORT
Definition: nvme.h:324
@ FEMU_NOSSD_MODE
Definition: nvme.h:1360
uint8_t rescap
Definition: nvme.h:874
uint64_t completed
已完成req数量
Definition: nvme.h:1020
@ NVME_ID_CNS_NS_PRESENT
Definition: nvme.h:686
@ NVME_INVALID_FIELD
Definition: nvme.h:528
uint32_t exlat
Definition: nvme.h:667
#define FEMU_MAX_NUM_CHNLS
Definition: nvme.h:1150
#define NVME_ID_NS_FLBAS_INDEX(flbas)
Definition: nvme.h:920
uint8_t max_cqes
Definition: nvme.h:1118
uint64_t media_errors[2]
Definition: nvme.h:627
uint64_t prp1
Definition: nvme.h:369
@ NVME_NIDT_NGUID
Definition: nvme.h:913
uint64_t mptr
Definition: nvme.h:977
uint8_t acl
Definition: nvme.h:1238
bool zone_cap_bs
Definition: nvme.h:1197
@ NVME_INVALID_CMD_SET
Definition: nvme.h:539
uint32_t cmb_size_mb
Definition: nvme.h:1140
uint16_t cid
cmd id
Definition: nvme.h:521
#define NVME_SET_CSI(vec, csi)
Definition: nvme.h:585
@ CMBSZ_WDS_MASK
Definition: nvme.h:241
uint8_t avscc
Definition: nvme.h:718
uint8_t * cmbuf
Definition: nvme.h:1270
uint32_t err_rec
Definition: nvme.h:795
#define femu_err(fmt,...)
Definition: nvme.h:1511
int ndx
Definition: nvme.h:1004
@ NVME_ACL_EXCEEDED
Definition: nvme.h:547
uint16_t maxcmd
Definition: nvme.h:739
uint8_t rwt
Definition: nvme.h:670
uint16_t mxtmt
Definition: nvme.h:734
uint32_t vs
Definition: nvme.h:41
@ NVME_NS_NOT_READY
Definition: nvme.h:542