FEMU
原版 master 7e238cc
FEMU: Accurate, Scalable and Extensible NVMe SSD Emulator (FAST'18)
|
|
uint16_t dma_write_prp(FemuCtrl *n, uint8_t *ptr, uint32_t len, uint64_t prp1, uint64_t prp2)
Definition: dma.c:112
#define NVME_CMBLOC_BIR(cmbloc)
Definition: nvme.h:219
void nvme_isr_notify_io(void *opaque)
中断通知上层取cq
Definition: intr.c:202
int(* pqueue_cmp_pri_f)(pqueue_pri_t next, pqueue_pri_t curr)
Definition: pqueue.h:44
uint64_t nuse
Definition: nvme.h:866
uint32_t cmbloc
Definition: nvme.h:1269
uint32_t id
Definition: nvme.h:1071
uint8_t mpsmax
Definition: nvme.h:1255
uint8_t cqes
Definition: nvme.h:738
uint8_t elpe
Definition: nvme.h:1239
static void nvme_clear_ctrl(FemuCtrl *n, bool shutdown)
Definition: femu.c:8
femu相关控制参数和数据成员
Definition: nvme.h:1184
uint16_t npda
Definition: nvme.h:888
uint32_t cmbsz
Definition: nvme.h:1268
NvmeSQueue ** sq
sq队列列表(io)
Definition: nvme.h:1280
uint64_t db_addr
Definition: nvme.h:1027
void * pqueue_pop(pqueue_t *q)
Definition: pqueue.c:172
FemuExtCtrlOps ext_ops
nvme到各模式ssd接口
Definition: nvme.h:1220
void pqueue_free(pqueue_t *q)
Definition: pqueue.c:62
#define NVME_CAP_SET_AMS(cap, val)
Definition: nvme.h:107
void pqueue_print(pqueue_t *q, FILE *out, pqueue_print_entry_f print)
Definition: pqueue.c:221
uint8_t nlbaf
Definition: nvme.h:868
#define NVME_CAP_SET_MPSMAX(cap, val)
Definition: nvme.h:121
uint32_t reg_size
Definition: nvme.h:1231
char * serial
Definition: nvme.h:1276
static bool BBSSD(FemuCtrl *n)
Definition: nvme.h:1381
uint8_t mpsmin
Definition: nvme.h:1254
unsigned long * uncorrectable
Definition: nvme.h:1070
void pqueue_change_priority(pqueue_t *q, pqueue_pri_t new_pri, void *d)
Definition: pqueue.c:147
int pqueue_remove(pqueue_t *q, void *d)
Definition: pqueue.c:160
uint32_t cmbsz
Definition: nvme.h:52
uint8_t vwc
Definition: nvme.h:1247
uint16_t page_bits
Definition: nvme.h:1225
uint32_t tail
Definition: nvme.h:1041
static void femu_register_types(void)
Definition: femu.c:706
NvmeRequest ** aer_reqs
Definition: nvme.h:1278
static void nvme_check_size(void)
Definition: nvme.h:939
uint32_t write_atomicity
Definition: nvme.h:800
#define NVME_ID_NS_MC_EXTENDED(mc)
Definition: nvme.h:922
size_t step
Definition: pqueue.h:58
uint32_t cc
Definition: nvme.h:44
#define NVME_CTRL_SQES_MIN(sqes)
Definition: nvme.h:786
uint32_t arbitration
Definition: nvme.h:792
@ NVME_CSTS_FAILED
Definition: nvme.h:184
#define femu_debug(fmt,...)
Definition: nvme.h:1507
uint8_t cqr
Definition: nvme.h:1243
static int nvme_start_ctrl(FemuCtrl *n)
Definition: femu.c:44
uint16_t vid
Definition: nvme.h:1265
@ NVME_SUCCESS
Definition: nvme.h:526
void pqueue_dump(pqueue_t *q, FILE *out, pqueue_print_entry_f print)
Definition: pqueue.c:196
NvmeBar bar
Definition: nvme.h:1188
uint32_t num_poller
nvme poller个数(前提是multupoller_enabled开启)
Definition: nvme.h:1337
unsigned long * util
Definition: nvme.h:1069
unsigned long long pqueue_pri_t
Definition: pqueue.h:39
uint16_t sqe_size
Definition: nvme.h:1228
#define NVME_MAX_NUM_NAMESPACES
Definition: nvme.h:84
@ OCSSD12
Definition: nvme.h:1367
@ NVME_LPA_NS_SMART
Definition: nvme.h:781
uint32_t csts
Definition: nvme.h:46
QemuThread * poller
Definition: nvme.h:1272
void(* exit)(struct FemuCtrl *)
Definition: nvme.h:1172
#define NVME_CAP_MPSMIN(cap)
Definition: nvme.h:100
uint64_t dbs_addr_hva
Definition: nvme.h:1293
uint16_t npdg
Definition: nvme.h:887
uint8_t db_stride
Definition: nvme.h:1236
#define NVME_CAP_SET_CQR(cap, val)
Definition: nvme.h:105
uint8_t max_sqes
Definition: nvme.h:1244
uint64_t dbs_addr
Definition: nvme.h:1291
uint32_t size
Definition: nvme.h:1044
static void nvme_process_db_admin(FemuCtrl *n, hwaddr addr, int val)
Definition: femu.c:146
NvmeFeatureVal features
Definition: nvme.h:1284
@ DPS_FIRST_EIGHT
Definition: nvme.h:936
uint32_t temp_thresh
Definition: nvme.h:794
uint16_t dma_read_prp(FemuCtrl *n, uint8_t *ptr, uint32_t len, uint64_t prp1, uint64_t prp2)
Definition: dma.c:137
size_t size
Definition: pqueue.h:56
int nvme_clear_virq(FemuCtrl *n)
Definition: intr.c:246
uint64_t start_block
Definition: nvme.h:1074
@ NVME_OACS_DBBUF
Definition: nvme.h:764
@ NVME_DNR
Definition: nvme.h:581
@ OCSSD20
Definition: nvme.h:1368
int nvme_check_cqid(FemuCtrl *n, uint16_t cqid)
Definition: nvme-util.c:14
uint32_t intms
Definition: nvme.h:42
#define NVME_ID_NS_DPC_LAST_EIGHT(dpc)
Definition: nvme.h:923
static int nvme_register_extensions(FemuCtrl *n)
注册NOSSD/BBSSD/ZNSSD/OCSSD
Definition: femu.c:499
void(* pqueue_set_pos_f)(void *a, size_t pos)
Definition: pqueue.h:48
@ NVME_ONCS_WRITE_UNCORR
Definition: nvme.h:769
@ NVME_CSI_NVM
Definition: nvme.h:124
struct FemuCtrl FemuCtrl
femu相关控制参数和数据成员
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
static Property femu_props[]
Definition: femu.c:615
uint32_t async_config
Definition: nvme.h:801
uint64_t ncap
Definition: nvme.h:865
uint32_t size
Definition: rte_ring.h:136
struct FemuCtrl * ctrl
Definition: nvme.h:1066
NvmeSQueue admin_sq
sq队列(admin)
Definition: nvme.h:1282
static const TypeInfo femu_info
Definition: femu.c:695
pqueue_get_pos_f getpos
Definition: pqueue.h:62
uint8_t intc
Definition: nvme.h:1258
int nvme_register_ocssd12(FemuCtrl *n)
Definition: oc12.c:1084
size_t avail
Definition: pqueue.h:57
NvmeIdNs id_ns
Definition: nvme.h:1067
uint64_t cap
Definition: nvme.h:40
static const MemoryRegionOps nvme_cmb_ops
Definition: femu.c:266
pqueue_cmp_pri_f cmppri
Definition: pqueue.h:59
#define NVME_ID_NS_DPC_FIRST_EIGHT(dpc)
Definition: nvme.h:924
uint8_t mdts
Definition: nvme.h:1242
time_t start_time
Definition: nvme.h:1222
#define NVME_CAP_SET_MPSMIN(cap, val)
Definition: nvme.h:119
int completed
Definition: nvme.h:1323
bool * should_isr
是否中断通知上层来取cq
Definition: nvme.h:1329
int pqueue_insert(pqueue_t *q, void *d)
Definition: pqueue.c:122
static void nvme_init_cmb(FemuCtrl *n)
Definition: femu.c:455
void nvme_addr_read(FemuCtrl *n, hwaddr addr, void *buf, int size)
Definition: dma.c:3
@ NVME_ONCS_WRITE_ZEROS
Definition: nvme.h:771
int femu_mode
Definition: dram.h:21
#define NVME_CAP_SET_TO(cap, val)
Definition: nvme.h:109
#define NVME_CAP_SET_MQES(cap, val)
Definition: nvme.h:103
uint8_t extended
Definition: nvme.h:1252
@ NVME_CAP_CSS_CSI_SUPP
Definition: nvme.h:130
uint64_t db_addr
Definition: nvme.h:1052
uint64_t acq
Definition: nvme.h:50
uint64_t eis_addr
Definition: nvme.h:1292
@ DPS_TYPE_MASK
Definition: nvme.h:935
static void nvme_init_ctrl(FemuCtrl *n)
Definition: femu.c:381
#define NVME_CAP_SET_NSSRS(cap, val)
Definition: nvme.h:113
uint16_t cqe_size
Definition: nvme.h:1227
uint8_t meta
Definition: nvme.h:1246
uint32_t num_io_queues
sq(cq)个数
Definition: nvme.h:1233
static bool OCSSD(FemuCtrl *n)
Definition: nvme.h:1376
void nvme_free_sq(NvmeSQueue *sq, FemuCtrl *n)
Definition: nvme-util.c:152
#define NVME_CAP_SET_DSTRD(cap, val)
Definition: nvme.h:111
uint8_t max_cqes
Definition: nvme.h:1245
uint64_t asq
Definition: nvme.h:49
uint8_t aerl
Definition: nvme.h:1237
#define NVME_CC_SHN(cc)
Definition: nvme.h:158
uint32_t max_q_ents
Definition: nvme.h:1234
uint16_t temperature
Definition: nvme.h:1223
int nvme_register_bbssd(FemuCtrl *n)
注册blackbox相关函数
Definition: bb.c:145
void nvme_addr_write(FemuCtrl *n, hwaddr addr, void *buf, int size)
Definition: dma.c:13
uint64_t ns_size
Definition: nvme.h:1235
uint8_t femu_mode
Definition: nvme.h:1296
uint32_t head
Definition: nvme.h:1040
void(* pqueue_set_pri_f)(void *a, pqueue_pri_t pri)
Definition: pqueue.h:43
#define NVME_CC_IOCQES(cc)
Definition: nvme.h:160
#define FEMU(obj)
Definition: nvme.h:1093
NvmeIdCtrl id_ctrl
Definition: nvme.h:1285
int nvme_register_znssd(FemuCtrl *n)
Definition: zns.c:1312
uint8_t subnqn[256]
Definition: nvme.h:753
static void femu_realize(PCIDevice *pci_dev, Error **errp)
femu初始化,分配空间
Definition: femu.c:530
uint64_t eis_addr_hva
Definition: nvme.h:1294
void nvme_isr_notify_admin(void *opaque)
通知上层admin命令已完成
Definition: intr.c:192
static bool NOSSD(FemuCtrl *n)
Definition: nvme.h:1386
void femu_ring_free(struct rte_ring *ring)
Definition: rte_ring.c:213
uint8_t dps
Definition: nvme.h:1250
uint8_t mc
Definition: nvme.h:1248
@ NVME_ONCS_COMPARE
Definition: nvme.h:768
uint8_t intc_thresh
Definition: nvme.h:1259
@ NVME_OACS_FORMAT
Definition: nvme.h:761
void ** d
Definition: pqueue.h:64
@ NVME_ONCS_DSM
Definition: nvme.h:770
pqueue_pri_t(* pqueue_get_pri_f)(void *a)
Definition: pqueue.h:42
uint8_t nsfeat
Definition: nvme.h:867
pqueue_t ** pq
pqueue,暂存req的队列
Definition: nvme.h:1328
NvmeCQueue ** cq
cq队列列表(io)
Definition: nvme.h:1281
uint8_t sqes
Definition: nvme.h:737
uint64_t nsze
Definition: nvme.h:864
int nvme_register_nossd(FemuCtrl *n)
Definition: nop.c:29
uint8_t dlfeat
Definition: nvme.h:876
#define NVME_CAP_SET_CSS(cap, val)
Definition: nvme.h:115
static int nvme_init_namespace(FemuCtrl *n, NvmeNamespace *ns, Error **errp)
Definition: femu.c:341
static uint64_t nvme_mmio_read(void *opaque, hwaddr addr, unsigned size)
Definition: femu.c:133
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
MemoryRegion iomem
Definition: nvme.h:1186
static uint64_t nvme_cmb_read(void *opaque, hwaddr addr, unsigned size)
Definition: femu.c:256
uint8_t csi
Definition: nvme.h:1203
uint32_t memsz
Definition: nvme.h:1298
@ NVME_CSTS_READY
Definition: nvme.h:183
static void nvme_init_pci(FemuCtrl *n)
Definition: femu.c:467
uint32_t cmbloc
Definition: nvme.h:51
#define NVME_CTRL_SQES_MAX(sqes)
Definition: nvme.h:787
void nvme_process_sq_admin(void *opaque)
处理admin命令的sq队列
Definition: nvme-admin.c:1036
uint8_t mc
Definition: nvme.h:870
void free_dram_backend(SsdDramBackend *b)
Definition: dram.c:29
uint8_t intc_time
Definition: nvme.h:1260
uint16_t ms
Definition: nvme.h:856
uint32_t intmc
Definition: nvme.h:43
#define NVME_MAX_STRIDE
Definition: nvme.h:83
size_t(* pqueue_get_pos_f)(void *a)
Definition: pqueue.h:47
NvmeLBAF lbaf[16]
Definition: nvme.h:893
#define NVME_CTRL_CQES_MAX(cqes)
Definition: nvme.h:789
static void nvme_cmb_write(void *opaque, hwaddr addr, uint64_t data, unsigned size)
Definition: femu.c:249
uint8_t lver
femu模式,包括blackbox,ocssd,...
Definition: nvme.h:1297
uint8_t temp_warn_issued
Definition: nvme.h:1262
static void nvme_write_bar(FemuCtrl *n, hwaddr offset, uint64_t data, unsigned size)
Definition: femu.c:81
static void nvme_mmio_write(void *opaque, hwaddr addr, uint64_t data, unsigned size)
Definition: femu.c:237
NvmeCQueue admin_cq
cq队列(admin)
Definition: nvme.h:1283
static void nvme_process_db_io(FemuCtrl *n, hwaddr addr, int val)
Definition: femu.c:186
uint16_t oncs
Definition: nvme.h:1230
uint32_t * int_vector_config
Definition: nvme.h:799
uint8_t dpc
Definition: nvme.h:871
#define NVME_CTRL_CQES_MIN(cqes)
Definition: nvme.h:788
uint16_t oacs
Definition: nvme.h:1229
#define NVME_MIN_CQUEUE_ES
Definition: nvme.h:86
struct rte_ring ** to_ftl
生产者:nvme poller;消费者:ftl
Definition: nvme.h:1326
@ NVME_CSTS_SHST_COMPLETE
Definition: nvme.h:187
uint16_t nvme_map_prp(QEMUSGList *qsg, QEMUIOVector *iov, uint64_t prp1, uint64_t prp2, uint32_t len, FemuCtrl *n)
Definition: dma.c:23
@ MLC
Definition: nand.h:85
void * pqueue_peek(pqueue_t *q)
Definition: pqueue.c:186
static int nvme_check_constraints(FemuCtrl *n)
Definition: femu.c:286
static bool ZNSSD(FemuCtrl *n)
Definition: nvme.h:1391
@ NVME_Q_PRIO_HIGH
Definition: nvme.h:401
#define NVME_ID_NS_DPC_TYPE_MASK
Definition: nvme.h:928
uint64_t size
Definition: nvme.h:1072
int nvme_register_ocssd20(FemuCtrl *n)
Definition: oc20.c:1363
@ NVME_CAP_CSS_ADMIN_ONLY
Definition: nvme.h:131
@ NVME_LPA_EXTENDED
Definition: nvme.h:783
uint8_t flbas
Definition: nvme.h:869
#define NVME_AQA_ACQS(aqa)
Definition: nvme.h:207
static void nvme_ns_init_identify(FemuCtrl *n, NvmeIdNs *id_ns)
Definition: femu.c:317
#define NVME_MIN_SQUEUE_ES
Definition: nvme.h:87
#define NVME_MAX_QS
Definition: nvme.h:81
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
struct rte_ring ** to_poller
生产者:ftl;消费者:nvme poller
Definition: nvme.h:1327
static const VMStateDescription femu_vmstate
Definition: femu.c:666
uint8_t lbads
Definition: nvme.h:857
void(* init)(struct FemuCtrl *, Error **)
Definition: nvme.h:1171
static int nvme_init_namespaces(FemuCtrl *n, Error **errp)
Definition: femu.c:362
int pqueue_is_valid(pqueue_t *q)
Definition: pqueue.c:258
static const MemoryRegionOps nvme_mmio_ops
Definition: femu.c:276
#define NVME_MAX_QUEUE_ES
Definition: nvme.h:85
uint32_t num_namespaces
Definition: nvme.h:1232
uint32_t int_coalescing
Definition: nvme.h:798
uint32_t tail
Definition: nvme.h:1016
uint16_t max_prp_ents
Definition: nvme.h:1226
SsdDramBackend * mbe
femu后端内存(实际数据)
Definition: nvme.h:1322
@ NVME_LPA_CSE
Definition: nvme.h:782
pqueue_set_pri_f setpri
Definition: pqueue.h:61
#define NVME_CC_EN(cc)
Definition: nvme.h:154
int nvme_check_sqid(FemuCtrl *n, uint16_t sqid)
Definition: nvme-util.c:9
#define NVME_CAP_MPSMAX(cap)
Definition: nvme.h:101
PCIDevice parent_obj
Definition: nvme.h:1185
#define NVME_AQA_ASQS(aqa)
Definition: nvme.h:206
MemoryRegion ctrl_mem
Definition: nvme.h:1187
#define NVME_ID_NS_MC_SEPARATE(mc)
Definition: nvme.h:921
uint8_t nlbaf
Definition: nvme.h:1251
uint32_t aqa
Definition: nvme.h:48
uint32_t size
Definition: nvme.h:1017
uint32_t sw_prog_marker
Definition: nvme.h:802
pqueue_set_pos_f setpos
Definition: pqueue.h:63
uint8_t dps
Definition: nvme.h:872
int(* start_ctrl)(struct FemuCtrl *)
Definition: nvme.h:1174
#define NVME_CMBSZ_GETSIZE(cmbsz)
Definition: nvme.h:269
size_t pqueue_size(pqueue_t *q)
Definition: pqueue.c:68
#define NVME_SPEC_VER
Definition: femu.c:6
#define NVME_TEMPERATURE
Definition: nvme.h:89
NvmeNamespace * namespaces
Definition: nvme.h:1279
uint16_t did
Definition: nvme.h:1266
static uint64_t ns_blks(NvmeNamespace *ns, uint8_t lba_idx)
Definition: nvme.h:1457
uint32_t volatile_wc
Definition: nvme.h:796
NvmeErrorLog * elpes
Definition: nvme.h:1277
uint8_t dpc
Definition: nvme.h:1249
bool dataplane_started
Definition: nvme.h:1273
void nvme_free_cq(NvmeCQueue *cq, FemuCtrl *n)
Definition: nvme-util.c:282
uint8_t lba_index
Definition: nvme.h:1253
uint32_t num_io_queues
Definition: nvme.h:797
static void femu_class_init(ObjectClass *oc, void *data)
femu启动
Definition: femu.c:677
pqueue_get_pri_f getpri
Definition: pqueue.h:60
int init_dram_backend(SsdDramBackend **mbe, int64_t nbytes)
Definition: dram.c:13
#define NVME_CC_IOSQES(cc)
Definition: nvme.h:159
uint64_t ns_blks
Definition: nvme.h:1073
uint16_t page_size
Definition: nvme.h:1224
uint32_t power_mgmt
Definition: nvme.h:793
@ FEMU_NOSSD_MODE
Definition: nvme.h:1360
@ NVME_INVALID_FIELD
Definition: nvme.h:528
static void nvme_destroy_poller(FemuCtrl *n)
Definition: femu.c:571
#define NVME_ID_NS_FLBAS_INDEX(flbas)
Definition: nvme.h:920
uint8_t acl
Definition: nvme.h:1238
#define NVME_CC_MPS(cc)
Definition: nvme.h:156
uint8_t * cmbuf
Definition: nvme.h:1270
uint32_t err_rec
Definition: nvme.h:795
void(* pqueue_print_entry_f)(FILE *out, void *a)
Definition: pqueue.h:51
uint32_t vs
Definition: nvme.h:41
static void femu_exit(PCIDevice *pci_dev)
Definition: femu.c:588