FEMU
原版 master 7e238cc
FEMU: Accurate, Scalable and Extensible NVMe SSD Emulator (FAST'18)
|
|
浏览该文件的文档.
4 #define MAX_SUPPORTED_PAGES_PER_BLOCK (512)
9 #define SLC_PAGE_READ_LATENCY_NS (40000)
10 #define SLC_PAGE_WRITE_LATENCY_NS (800000)
11 #define SLC_BLOCK_ERASE_LATENCY_NS (2000000)
12 #define SLC_CHNL_PAGE_TRANSFER_LATENCY_NS (20000)
19 #define MLC_LOWER_PAGE_READ_LATENCY_NS (48000)
20 #define MLC_UPPER_PAGE_READ_LATENCY_NS (64000)
21 #define MLC_LOWER_PAGE_WRITE_LATENCY_NS (850000)
22 #define MLC_UPPER_PAGE_WRITE_LATENCY_NS (2300000)
23 #define MLC_CHNL_PAGE_TRANSFER_LATENCY_NS (52433)
24 #define MLC_BLOCK_ERASE_LATENCY_NS (3000000)
32 #define TLC_LOWER_PAGE_READ_LATENCY_NS (56500)
33 #define TLC_CENTER_PAGE_READ_LATENCY_NS (77500)
34 #define TLC_UPPER_PAGE_READ_LATENCY_NS (106000)
36 #define TLC_LOWER_PAGE_WRITE_LATENCY_NS (820500)
37 #define TLC_CENTER_PAGE_WRITE_LATENCY_NS (2225000)
38 #define TLC_UPPER_PAGE_WRITE_LATENCY_NS (5734000)
40 #define TLC_CHNL_PAGE_TRANSFER_LATENCY_NS (52433)
41 #define TLC_BLOCK_ERASE_LATENCY_NS (3000000)
54 #define QLC_LOWER_PAGE_READ_LATENCY_NS (TLC_LOWER_PAGE_READ_LATENCY_NS * 1.05)
55 #define QLC_CENTER_LOWER_PAGE_READ_LATENCY_NS (TLC_CENTER_PAGE_READ_LATENCY_NS * 1.1)
56 #define QLC_CENTER_UPPER_PAGE_READ_LATENCY_NS (TLC_UPPER_PAGE_READ_LATENCY_NS * 1.2)
57 #define QLC_UPPER_PAGE_READ_LATENCY_NS (TLC_UPPER_PAGE_READ_LATENCY_NS * 1.6)
59 #define QLC_LOWER_PAGE_WRITE_LATENCY_NS (TLC_LOWER_PAGE_WRITE_LATENCY_NS * 1.05)
60 #define QLC_CENTER_LOWER_PAGE_WRITE_LATENCY_NS (TLC_CENTER_PAGE_WRITE_LATENCY_NS * 1.1)
61 #define QLC_CENTER_UPPER_PAGE_WRITE_LATENCY_NS (TLC_UPPER_PAGE_WRITE_LATENCY_NS * 1.2)
62 #define QLC_UPPER_PAGE_WRITE_LATENCY_NS (TLC_UPPER_PAGE_WRITE_LATENCY_NS * 1.6)
64 #define QLC_CHNL_PAGE_TRANSFER_LATENCY_NS (52433)
65 #define QLC_BLOCK_ERASE_LATENCY_NS (3000000)
113 #define PPA_CH(ln, ppa) ((ppa & ln->ppaf.ch_mask) >> ln->ppaf.ch_offset)
114 #define PPA_LUN(ln, ppa) ((ppa & ln->ppaf.lun_mask) >> ln->ppaf.lun_offset)
115 #define PPA_PLN(ln, ppa) ((ppa & ln->ppaf.pln_mask) >> ln->ppaf.pln_offset)
116 #define PPA_BLK(ln, ppa) ((ppa & ln->ppaf.blk_mask) >> ln->ppaf.blk_offset)
117 #define PPA_PG(ln, ppa) ((ppa & ln->ppaf.pg_mask) >> ln->ppaf.pg_offset)
118 #define PPA_SEC(ln, ppa) ((ppa & ln->ppaf.sec_mask) >> ln->ppaf.sec_offset)
128 switch (flash_type) {
#define MLC_UPPER_PAGE_READ_LATENCY_NS
Definition: nand.h:20
@ MAX_FLASH_TYPE
Definition: nand.h:89
void nvme_isr_notify_io(void *opaque)
中断通知上层取cq
Definition: intr.c:202
int64_t page_wr_lat[MAX_FLASH_TYPE]
Definition: nand.h:108
int(* pqueue_cmp_pri_f)(pqueue_pri_t next, pqueue_pri_t curr)
Definition: pqueue.h:44
#define __IS_MC
Definition: rte_ring.h:164
static int nvme_set_guest_notifier(FemuCtrl *n, EventNotifier *notifier, uint32_t qid)
Definition: intr.c:46
#define POWEROF2(x)
Definition: rte_ring.c:84
@ FEMU_RING_TYPE_MP_MC
Definition: rte_ring.h:1124
int64_t chnl_pg_xfer_lat[MAX_FLASH_TYPE]
Definition: nand.h:100
femu相关控制参数和数据成员
Definition: nvme.h:1184
static void set_pri(void *d, pqueue_pri_t pri)
Definition: pqueue.c:216
#define RTE_RING_SZ_MASK
Definition: rte_ring.h:158
uint32_t vector
Definition: nvme.h:1043
int64_t blk_er_lat
Definition: nand.h:109
int nvme_setup_virq(FemuCtrl *n, NvmeCQueue *cq)
Definition: intr.c:216
#define __IS_SP
Definition: rte_ring.h:161
#define MAX_SUPPORTED_PAGES_PER_BLOCK
Definition: nand.h:4
uint16_t cqid
Definition: nvme.h:1038
@ TLC_CENTER_PAGE
Definition: nand.h:74
static void init_tlc_page_pairing(FemuCtrl *n)
Definition: nand.c:30
size_t pqueue_size(pqueue_t *q)
Definition: pqueue.c:68
@ QLC
Definition: nand.h:87
#define SLC_PAGE_WRITE_LATENCY_NS
Definition: nand.h:10
struct rte_ring * femu_ring_create(enum femu_ring_type type, size_t count)
Definition: rte_ring.c:187
static int subtree_is_valid(pqueue_t *q, int pos)
Definition: pqueue.c:239
size_t step
Definition: pqueue.h:58
char name[RTE_NAMESIZE]
Definition: rte_ring.h:133
@ SLC
Definition: nand.h:84
static unsigned rte_ring_count(const struct rte_ring *r)
Definition: rte_ring.h:862
#define femu_debug(fmt,...)
Definition: nvme.h:1507
static uint8_t get_page_type(int flash_type, int pg)
Definition: nand.h:126
#define QLC_CENTER_LOWER_PAGE_WRITE_LATENCY_NS
Definition: nand.h:60
NvmeBar bar
Definition: nvme.h:1188
int pqueue_is_valid(pqueue_t *q)
Definition: pqueue.c:258
static int64_t get_blk_erase_latency(int flash_type)
Definition: nand.h:152
unsigned long long pqueue_pri_t
Definition: pqueue.h:39
size_t femu_ring_enqueue(struct rte_ring *ring, void **objs, size_t count)
Definition: rte_ring.c:223
static void init_mlc_page_pairing(FemuCtrl *n)
Definition: nand.c:7
static __rte_always_inline unsigned int rte_ring_enqueue_bulk(struct rte_ring *r, void *const *obj_table, unsigned int n, unsigned int *free_space)
Definition: rte_ring.h:650
static int64_t get_page_read_latency(int flash_type, int page_type)
Definition: nand.h:142
void rte_ring_free(struct rte_ring *r)
Definition: rte_ring.c:164
static int slc_tbl[MAX_SUPPORTED_PAGES_PER_BLOCK]
Definition: nand.h:121
size_t size
Definition: pqueue.h:56
static void nvme_vector_poll(PCIDevice *dev, unsigned int vector_start, unsigned int vector_end)
Definition: intr.c:133
int nvme_clear_virq(FemuCtrl *n)
Definition: intr.c:246
@ FEMU_RING_TYPE_MP_SC
Definition: rte_ring.h:1123
#define TLC_UPPER_PAGE_WRITE_LATENCY_NS
Definition: nand.h:38
void rte_ring_dump(FILE *f, const struct rte_ring *r)
Definition: rte_ring.c:173
FlashType
Definition: nand.h:83
uint32_t intms
Definition: nvme.h:42
void pqueue_free(pqueue_t *q)
Definition: pqueue.c:62
int rte_ring_init(struct rte_ring *r, const char *name, unsigned count, unsigned flags)
Definition: rte_ring.c:99
void pqueue_print(pqueue_t *q, FILE *out, pqueue_print_entry_f print)
Definition: pqueue.c:221
void(* pqueue_set_pos_f)(void *a, size_t pos)
Definition: pqueue.h:48
void * pqueue_peek(pqueue_t *q)
Definition: pqueue.c:186
int64_t pg_rd_lat[MAX_FLASH_TYPE][MAX_FLASH_TYPE]
Definition: nand.h:97
uint32_t size
Definition: rte_ring.h:136
#define QLC_UPPER_PAGE_WRITE_LATENCY_NS
Definition: nand.h:62
pqueue_get_pos_f getpos
Definition: pqueue.h:62
uint8_t flash_type
Definition: nand.h:106
static __rte_always_inline unsigned rte_ring_dequeue_burst(struct rte_ring *r, void **obj_table, unsigned int n, unsigned int *available)
Definition: rte_ring.h:1113
size_t avail
Definition: pqueue.h:57
#define left(i)
Definition: pqueue.c:33
pqueue_cmp_pri_f cmppri
Definition: pqueue.h:59
struct rte_ring * rte_ring_create(const char *name, unsigned count, unsigned flags)
Definition: rte_ring.c:132
static int nvme_vector_unmask(PCIDevice *dev, unsigned vector, MSIMessage msg)
Definition: intr.c:73
static void nvme_isr_notify_legacy(void *opaque)
传统的中断通知方式
Definition: intr.c:166
#define MLC_BLOCK_ERASE_LATENCY_NS
Definition: nand.h:24
#define RTE_RING_MZ_PREFIX
Definition: rte_ring.h:104
@ QLC_LOWER_CENTER_PAGE
Definition: nand.h:78
static size_t maxchild(pqueue_t *q, size_t i)
Definition: pqueue.c:91
#define QLC_LOWER_PAGE_READ_LATENCY_NS
Definition: nand.h:54
#define TLC_UPPER_PAGE_READ_LATENCY_NS
Definition: nand.h:34
#define TLC_CHNL_PAGE_TRANSFER_LATENCY_NS
Definition: nand.h:40
Definition: rte_ring.h:127
static int mlc_tbl[MAX_SUPPORTED_PAGES_PER_BLOCK]
Definition: nand.h:122
@ QLC_LOWER_PAGE
Definition: nand.h:77
static void set_pos(void *d, size_t val)
Definition: pqueue.c:211
#define MLC_LOWER_PAGE_READ_LATENCY_NS
Definition: nand.h:19
void femu_ring_free(struct rte_ring *ring)
Definition: rte_ring.c:213
@ SLC_PAGE
Definition: nand.h:68
#define QLC_BLOCK_ERASE_LATENCY_NS
Definition: nand.h:65
size_t femu_ring_count(struct rte_ring *ring)
Definition: rte_ring.c:218
volatile uint32_t head
Definition: rte_ring.h:112
static void percolate_down(pqueue_t *q, size_t i)
Definition: pqueue.c:105
static int tlc_tbl[MAX_SUPPORTED_PAGES_PER_BLOCK]
Definition: nand.h:123
@ FEMU_RING_TYPE_SP_SC
Definition: rte_ring.h:1122
#define SLC_PAGE_READ_LATENCY_NS
Definition: nand.h:9
static void init_qlc_page_pairing(FemuCtrl *n)
Definition: nand.c:56
bool vector_poll_started
Definition: nvme.h:1274
int64_t pg_wr_lat[MAX_FLASH_TYPE][MAX_FLASH_TYPE]
Definition: nand.h:98
@ MLC_UPPER_PAGE
Definition: nand.h:71
struct NandFlashTiming NandFlashTiming
uint32_t num_io_queues
sq(cq)个数
Definition: nvme.h:1233
#define __IS_MP
Definition: rte_ring.h:162
struct rte_ring_headtail cons
Definition: rte_ring.h:144
#define RING_F_SC_DEQ
Definition: rte_ring.h:148
int init_nand_flash(void *opaque)
Definition: nand.c:148
#define QLC_CENTER_UPPER_PAGE_READ_LATENCY_NS
Definition: nand.h:56
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
ssize_t rte_ring_get_memsize(unsigned count)
Definition: rte_ring.c:87
#define __IS_SC
Definition: rte_ring.h:163
int32_t virq
Definition: nvme.h:1042
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
void(* pqueue_set_pri_f)(void *a, pqueue_pri_t pri)
Definition: pqueue.h:43
#define RTE_NAMESIZE
Definition: rte_ring.h:116
#define SLC_BLOCK_ERASE_LATENCY_NS
Definition: nand.h:11
int init_nand_flash(void *opaque)
Definition: nand.c:148
void nvme_isr_notify_admin(void *opaque)
通知上层admin命令已完成
Definition: intr.c:192
#define QLC_CHNL_PAGE_TRANSFER_LATENCY_NS
Definition: nand.h:64
#define QLC_UPPER_PAGE_READ_LATENCY_NS
Definition: nand.h:57
static unsigned rte_ring_free_count(const struct rte_ring *r)
Definition: rte_ring.h:879
static void init_nand_flash_timing(FemuCtrl *n)
Definition: nand.c:85
void ** d
Definition: pqueue.h:64
#define parent(i)
Definition: pqueue.c:35
pqueue_pri_t(* pqueue_get_pri_f)(void *a)
Definition: pqueue.h:42
void pqueue_dump(pqueue_t *q, FILE *out, pqueue_print_entry_f print)
Definition: pqueue.c:196
#define TLC_LOWER_PAGE_WRITE_LATENCY_NS
Definition: nand.h:36
NvmeCQueue ** cq
cq队列列表(io)
Definition: nvme.h:1281
@ TLC_UPPER_PAGE
Definition: nand.h:75
static void nvme_clear_guest_notifier(FemuCtrl *n)
Definition: intr.c:52
#define MLC_LOWER_PAGE_WRITE_LATENCY_NS
Definition: nand.h:21
@ TLC_LOWER_PAGE
Definition: nand.h:73
uint16_t irq_enabled
irq 中断用
Definition: nvme.h:1039
uint32_t capacity
Definition: rte_ring.h:138
#define QLC_CENTER_LOWER_PAGE_READ_LATENCY_NS
Definition: nand.h:55
int flags
Definition: rte_ring.h:134
#define QLC_LOWER_PAGE_WRITE_LATENCY_NS
Definition: nand.h:59
size_t(* pqueue_get_pos_f)(void *a)
Definition: pqueue.h:47
EventNotifier guest_notifier
Definition: nvme.h:1048
int64_t blk_er_lat[MAX_FLASH_TYPE]
Definition: nand.h:99
static void nvme_remove_kvm_msi_virq(NvmeCQueue *cq)
Definition: intr.c:39
size_t femu_ring_dequeue(struct rte_ring *ring, void **objs, size_t count)
Definition: rte_ring.c:228
struct FemuCtrl * ctrl
Definition: nvme.h:1035
@ MLC
Definition: nand.h:85
static int nvme_add_kvm_msi_virq(FemuCtrl *n, NvmeCQueue *cq)
Definition: intr.c:9
#define RING_F_SP_ENQ
Definition: rte_ring.h:147
static int64_t get_page_write_latency(int flash_type, int page_type)
Definition: nand.h:147
int64_t page_rd_lat[MAX_FLASH_TYPE]
Definition: nand.h:107
#define right(i)
Definition: pqueue.c:34
femu_ring_type
Definition: rte_ring.h:1121
int64_t chnl_pg_xfer_lat
Definition: nand.h:110
@ MLC_LOWER_PAGE
Definition: nand.h:70
@ TLC
Definition: nand.h:86
#define TLC_BLOCK_ERASE_LATENCY_NS
Definition: nand.h:41
#define TLC_LOWER_PAGE_READ_LATENCY_NS
Definition: nand.h:32
pqueue_set_pri_f setpri
Definition: pqueue.h:61
#define MLC_CHNL_PAGE_TRANSFER_LATENCY_NS
Definition: nand.h:23
void * pqueue_pop(pqueue_t *q)
Definition: pqueue.c:172
@ QLC_UPPER_CENTER_PAGE
Definition: nand.h:79
int pqueue_insert(pqueue_t *q, void *d)
Definition: pqueue.c:122
volatile uint32_t tail
Definition: rte_ring.h:113
PCIDevice parent_obj
Definition: nvme.h:1185
#define SLC_CHNL_PAGE_TRANSFER_LATENCY_NS
Definition: nand.h:12
#define RING_F_EXACT_SZ
Definition: rte_ring.h:157
pqueue_set_pos_f setpos
Definition: pqueue.h:63
uint32_t mask
Definition: rte_ring.h:137
#define MLC_UPPER_PAGE_WRITE_LATENCY_NS
Definition: nand.h:22
static struct NandFlashTiming nand_flash_timing
Definition: nand.h:103
#define QLC_CENTER_UPPER_PAGE_WRITE_LATENCY_NS
Definition: nand.h:61
static uint32_t rte_align32pow2(uint32_t x)
Definition: rte_ring.h:167
struct rte_ring_headtail prod
Definition: rte_ring.h:141
pqueue_get_pri_f getpri
Definition: pqueue.h:60
@ PLC
Definition: nand.h:88
static void nvme_vector_mask(PCIDevice *dev, unsigned vector)
Definition: intr.c:109
static int qlc_tbl[MAX_SUPPORTED_PAGES_PER_BLOCK]
Definition: nand.h:124
@ QLC_UPPER_PAGE
Definition: nand.h:80
uint32_t single
Definition: rte_ring.h:114
#define TLC_CENTER_PAGE_READ_LATENCY_NS
Definition: nand.h:33
#define TLC_CENTER_PAGE_WRITE_LATENCY_NS
Definition: nand.h:37
static void bubble_up(pqueue_t *q, size_t i)
Definition: pqueue.c:74
#define femu_err(fmt,...)
Definition: nvme.h:1511
void(* pqueue_print_entry_f)(FILE *out, void *a)
Definition: pqueue.h:51