FEMU
原版 master 7e238cc
FEMU: Accurate, Scalable and Extensible NVMe SSD Emulator (FAST'18)
|
|
浏览该文件的文档.
80 #define NVME_SET_CSI(vec, csi) (vec |= (uint8_t)(1 << (csi)))
97 uint8_t rsvd3072[768];
155 return zone->
d.
zs >> 4;
uint16_t dma_write_prp(FemuCtrl *n, uint8_t *ptr, uint32_t len, uint64_t prp1, uint64_t prp2)
Definition: dma.c:112
@ NVME_ZONE_REPORT_EXPLICITLY_OPEN
Definition: zns.h:36
uint32_t cdw11
Definition: nvme.h:307
static uint16_t zns_set_zd_ext(NvmeNamespace *ns, NvmeZone *zone)
Definition: zns.c:631
NvmeZoneProcessingMask
Definition: zns.c:525
NvmeCmd cmd
Definition: nvme.h:981
@ NVME_CMD_ZONE_MGMT_SEND
Definition: nvme.h:346
uint8_t za
Definition: zns.h:61
@ NVME_LBA_RANGE
Definition: nvme.h:540
static void zns_init_zoned_state(NvmeNamespace *ns)
Definition: zns.c:84
uint32_t mar
Definition: zns.h:91
uint64_t nuse
Definition: nvme.h:866
uint64_t zone_capacity
Definition: nvme.h:1212
uint64_t zone_size_bs
Definition: nvme.h:1196
uint32_t id
Definition: nvme.h:1071
static void zns_finalize_zoned_write(NvmeNamespace *ns, NvmeRequest *req, bool failed)
Definition: zns.c:435
static uint16_t nvme_check_mdts(FemuCtrl *n, size_t len)
Definition: nvme.h:1488
NvmeRequest * req
Definition: zns.c:498
femu相关控制参数和数据成员
Definition: nvme.h:1184
static NvmeZone * zns_get_zone_by_slba(NvmeNamespace *ns, uint64_t slba)
Definition: zns.c:15
static void zns_set_ctrl_str(FemuCtrl *n)
Definition: zns.c:1240
FemuExtCtrlOps ext_ops
nvme到各模式ssd接口
Definition: nvme.h:1220
@ NVME_ZONE_REPORT_FULL
Definition: zns.h:38
static uint16_t zns_do_write(FemuCtrl *n, NvmeRequest *req, bool append, bool wrz)
Definition: zns.c:1036
static uint16_t zns_io_cmd(FemuCtrl *n, NvmeNamespace *ns, NvmeCmd *cmd, NvmeRequest *req)
Definition: zns.c:1221
static uint64_t zns_ns_nlbas(NvmeNamespace *ns)
Definition: zns.h:142
NvmeLBAFE lbafe[16]
Definition: zns.h:96
#define unlikely(x)
Definition: rte_branch_prediction.h:38
QEMUSGList qsg
dma用
Definition: nvme.h:984
static void zns_zoned_ns_shutdown(NvmeNamespace *ns)
Definition: zns.c:182
struct QEMU_PACKED NvmeIdNsZoned NvmeIdNsZoned
@ NVME_ZONE_INVALID_WRITE
Definition: nvme.h:567
uint32_t zasl_bs
Definition: nvme.h:1192
static uint64_t zns_advance_zone_wp(NvmeNamespace *ns, NvmeZone *zone, uint32_t nlb)
Definition: zns.c:474
@ NVME_ZONE_ACTION_OPEN
Definition: zns.h:52
struct FemuExtCtrlOps FemuExtCtrlOps
扩展操作接口,具体实现在各模式ssd中
uint8_t * zd_extensions
Definition: nvme.h:1214
static uint16_t zns_check_zone_state_for_write(NvmeZone *zone)
Definition: zns.c:289
static size_t zns_l2b(NvmeNamespace *ns, uint64_t lba)
Definition: zns.h:148
struct NvmeNamespaceParams NvmeNamespaceParams
uint8_t zasl
Definition: nvme.h:1193
@ NVME_ZONE_OFFLINE
Definition: nvme.h:566
NvmeZoneState
Definition: zns.h:69
static void zns_aio_zone_reset_cb(NvmeRequest *req, NvmeZone *zone)
Definition: zns.c:502
int backend_rw(SsdDramBackend *b, QEMUSGList *qsg, uint64_t *lbal, bool is_write)
Definition: dram.c:37
uint64_t lba
Definition: oc12.h:2
uint32_t cdw13
Definition: nvme.h:309
uint16_t status
Definition: nvme.h:971
uint16_t(* op_handler_t)(NvmeNamespace *, NvmeZone *, NvmeZoneState, NvmeRequest *)
Definition: zns.c:522
@ NVME_CSI_ZONED
Definition: nvme.h:125
static uint16_t zns_finish_zone(NvmeNamespace *ns, NvmeZone *zone, NvmeZoneState state, NvmeRequest *req)
Definition: zns.c:578
@ NVME_ZONE_STATE_FULL
Definition: zns.h:76
@ NVME_SUCCESS
Definition: nvme.h:526
static uint16_t zns_reset_zone(NvmeNamespace *ns, NvmeZone *zone, NvmeZoneState state, NvmeRequest *req)
Definition: zns.c:598
@ NVME_ZONE_STATE_EMPTY
Definition: zns.h:71
void zns_ns_cleanup(NvmeNamespace *ns)
Definition: zns.c:216
uint64_t slba
Definition: nvme.h:430
#define NVME_ERR_REC_DULBE(err_rec)
Definition: nvme.h:813
uint32_t zone_size_log2
Definition: nvme.h:1213
@ NVME_ZONE_TYPE_RESERVED
Definition: zns.h:44
@ NVME_ZONE_STATE_OFFLINE
Definition: zns.h:77
uint16_t npdg
Definition: nvme.h:887
@ NVME_ZONE_ACTION_RSD
Definition: zns.h:49
uint32_t rrl
Definition: zns.h:93
NvmeFeatureVal features
Definition: nvme.h:1284
@ NVME_PROC_READ_ONLY_ZONES
Definition: zns.c:529
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
Definition: nvme.h:340
static uint16_t zns_zone_mgmt_send(FemuCtrl *n, NvmeRequest *req)
Definition: zns.c:769
@ NVME_ZONE_ACTION_SET_ZD_EXT
Definition: zns.h:55
@ NVME_DNR
Definition: nvme.h:581
uint8_t zt
Definition: zns.h:59
static void zns_set_zone_state(NvmeZone *zone, NvmeZoneState state)
Definition: zns.h:158
uint32_t zd_extension_size
Definition: zns.h:117
uint8_t zs
Definition: zns.h:60
QTAILQ_ENTRY(NvmeZone) entry
void zns_ns_shutdown(NvmeNamespace *ns)
Definition: zns.c:208
@ NVME_CSI_NVM
Definition: nvme.h:124
@ NVME_ZA_FINISH_RECOMMENDED
Definition: zns.h:17
static int zns_init_zone_geometry(NvmeNamespace *ns, Error **errp)
Definition: zns.c:24
int32_t nr_active_zones
Definition: nvme.h:1216
QEMUIOVector iov
Definition: nvme.h:985
static void zns_init(FemuCtrl *n, Error **errp)
Definition: zns.c:1290
@ NVME_PROC_OPENED_ZONES
Definition: zns.c:527
@ NVME_CMD_ZONE_MGMT_RECV
Definition: nvme.h:347
@ NVME_ZONE_REPORT_IMPLICITLY_OPEN
Definition: zns.h:35
uint64_t ncap
Definition: nvme.h:865
struct FemuCtrl * ctrl
Definition: nvme.h:1066
NvmeZoneType
Definition: zns.h:43
@ NVME_ZONE_STATE_RESERVED
Definition: zns.h:70
uint8_t rsvd1[4095]
Definition: zns.h:12
NvmeIdNs id_ns
Definition: nvme.h:1067
static void zns_aor_dec_open(NvmeNamespace *ns)
Definition: zns.h:197
bool cross_zone_read
Definition: zns.h:112
uint16_t zoc
Definition: zns.h:89
static bool zns_wp_is_valid(NvmeZone *zone)
Definition: zns.h:173
@ NVME_ZONE_STATE_EXPLICITLY_OPEN
Definition: zns.h:73
struct NvmeNamespace * ns
Definition: nvme.h:970
void nvme_set_ctrl_name(FemuCtrl *n, const char *mn, const char *sn, int *dev_id)
Definition: nvme-util.c:294
static bool nvme_csi_has_nvm_support(NvmeNamespace *ns)
Definition: zns.c:999
uint32_t frl
Definition: zns.h:94
NvmeZoneAttr
Definition: zns.h:15
@ NVME_ZONE_REPORT_READ_ONLY
Definition: zns.h:39
uint64_t zone_size_bs
Definition: zns.h:113
uint8_t mdts
Definition: nvme.h:1242
struct NvmeIdCtrlZoned NvmeIdCtrlZoned
uint64_t wp
Definition: zns.h:65
static uint16_t zns_do_zone_op(NvmeNamespace *ns, NvmeZone *zone, enum NvmeZoneProcessingMask proc_mask, op_handler_t op_hndlr, NvmeRequest *req)
Definition: zns.c:683
#define NVME_DEFAULT_MAX_AZ_SIZE
Definition: zns.c:5
static uint16_t zns_write(FemuCtrl *n, NvmeNamespace *ns, NvmeCmd *cmd, NvmeRequest *req)
Definition: zns.c:1165
static void zns_assign_zone_state(NvmeNamespace *ns, NvmeZone *zone, NvmeZoneState state)
Definition: zns.c:226
bool zoned
Definition: zns.h:111
uint64_t zone_cap_bs
Definition: zns.h:114
int nvme_register_znssd(FemuCtrl *n)
Definition: zns.c:1312
static uint16_t zns_check_zone_read(NvmeNamespace *ns, uint64_t slba, uint32_t nlb)
Definition: zns.c:369
static uint16_t zns_get_mgmt_zone_slba_idx(FemuCtrl *n, NvmeCmd *c, uint64_t *slba, uint32_t *zone_idx)
Definition: zns.c:746
void zns_ns_shutdown(NvmeNamespace *ns)
Definition: zns.c:208
struct QEMU_PACKED NvmeZoneReportHeader NvmeZoneReportHeader
uint32_t cdw12
Definition: nvme.h:308
uint64_t w_ptr
Definition: zns.h:103
static uint16_t zns_map_dptr(FemuCtrl *n, size_t len, NvmeRequest *req)
Definition: zns.c:1021
static uint16_t zns_close_zone(NvmeNamespace *ns, NvmeZone *zone, NvmeZoneState state, NvmeRequest *req)
Definition: zns.c:563
@ NVME_ZONE_REPORT_EMPTY
Definition: zns.h:34
@ NVME_ZONE_ACTION_CLOSE
Definition: zns.h:50
@ NVME_ZONE_ACTION_FINISH
Definition: zns.h:51
uint64_t zone_size
Definition: nvme.h:1211
@ NVME_ZA_RESET_RECOMMENDED
Definition: zns.h:18
static uint16_t zns_read(FemuCtrl *n, NvmeNamespace *ns, NvmeCmd *cmd, NvmeRequest *req)
Definition: zns.c:1116
static int zns_aor_check(NvmeNamespace *ns, uint32_t act, uint32_t opn)
Definition: zns.c:274
@ NVME_ZONE_BOUNDARY_ERROR
Definition: nvme.h:563
static uint64_t zns_zone_wr_boundary(NvmeZone *zone)
Definition: zns.h:168
static uint16_t zns_admin_cmd(FemuCtrl *n, NvmeCmd *cmd)
Definition: zns.c:1098
void * opaque
Definition: nvme.h:996
@ NVME_ZONE_ACTION_OFFLINE
Definition: zns.h:54
@ NVME_ZA_ZD_EXT_VALID
Definition: zns.h:19
uint16_t is_write
是否为写操作
Definition: nvme.h:973
NvmeZone * zone
Definition: zns.c:499
static bool zns_zone_matches_filter(uint32_t zafs, NvmeZone *zl)
Definition: zns.c:865
static void zns_aor_inc_active(NvmeNamespace *ns)
Definition: zns.h:207
uint32_t max_active_zones
Definition: nvme.h:1198
@ NVME_PROC_CURRENT_ZONE
Definition: zns.c:526
uint64_t zsze
Definition: zns.h:83
static uint8_t * zns_get_zd_extension(NvmeNamespace *ns, uint32_t zone_idx)
Definition: zns.h:182
static uint16_t zns_check_zone_state_for_read(NvmeZone *zone)
Definition: zns.c:346
@ NVME_ZONE_TOO_MANY_ACTIVE
Definition: nvme.h:568
static NvmeLBAF * zns_ns_lbaf(NvmeNamespace *ns)
Definition: zns.h:129
uint32_t max_open_zones
Definition: nvme.h:1199
#define NVME_DEFAULT_ZONE_SIZE
Definition: zns.c:4
NvmeZoneReportType
Definition: zns.h:32
@ NVME_NO_COMPLETE
Definition: nvme.h:582
uint32_t state
Definition: oc12.h:2
struct QEMU_PACKED NvmeZonedResult NvmeZonedResult
static void zns_aor_inc_open(NvmeNamespace *ns)
Definition: zns.h:187
uint8_t zdes
Definition: zns.h:84
NvmeCmdDptr dptr
Definition: nvme.h:305
@ NVME_INVALID_OPCODE
Definition: nvme.h:527
@ NVME_ZONE_ACTION_RESET
Definition: zns.h:53
@ NVME_PROC_CLOSED_ZONES
Definition: zns.c:528
uint8_t nsfeat
Definition: nvme.h:867
@ NVME_PROC_FULL_ZONES
Definition: zns.c:530
uint64_t nsze
Definition: nvme.h:864
uint8_t zasl
Definition: zns.h:11
static uint16_t zns_check_bounds(NvmeNamespace *ns, uint64_t slba, uint32_t nlb)
Definition: zns.c:1009
void zns_ns_cleanup(NvmeNamespace *ns)
Definition: zns.c:216
static void zns_init_zone_identify(FemuCtrl *n, NvmeNamespace *ns, int lba_index)
Definition: zns.c:123
static void zns_aor_dec_active(NvmeNamespace *ns)
Definition: zns.h:217
uint8_t csi
Definition: nvme.h:1203
uint32_t max_active_zones
Definition: zns.h:115
uint64_t prp1
Definition: nvme.h:283
uint32_t mor
Definition: zns.h:92
static uint16_t zns_open_zone(NvmeNamespace *ns, NvmeZone *zone, NvmeZoneState state, NvmeRequest *req)
Definition: zns.c:533
uint64_t rsvd
Definition: oc12.h:3
uint16_t ozcs
Definition: zns.h:90
@ NVME_ZONE_REPORT_OFFLINE
Definition: zns.h:40
NvmeLBAF lbaf[16]
Definition: nvme.h:893
uint32_t cdw10
Definition: nvme.h:306
uint16_t opcode
Definition: nvme.h:297
@ NVME_ZONE_FULL
Definition: nvme.h:564
uint32_t max_open_zones
Definition: zns.h:116
static NvmeZoneState zns_get_zone_state(NvmeZone *zone)
Definition: zns.h:153
static uint32_t zns_nsid(NvmeNamespace *ns)
Definition: zns.h:120
NvmeIdNsZoned * id_ns_zoned
Definition: nvme.h:1204
static uint64_t zns_zone_rd_boundary(NvmeNamespace *ns, NvmeZone *zone)
Definition: zns.h:163
uint16_t psdt
Definition: nvme.h:300
static uint16_t zns_check_zone_write(FemuCtrl *n, NvmeNamespace *ns, NvmeZone *zone, uint64_t slba, uint32_t nlb, bool append)
Definition: zns.c:316
@ NVME_ZONE_REPORT_CLOSED
Definition: zns.h:37
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
struct QEMU_PACKED NvmeZoneDescr NvmeZoneDescr
static void zns_clear_zone(NvmeNamespace *ns, NvmeZone *zone)
Definition: zns.c:163
@ NVME_ZONE_REPORT_ALL
Definition: zns.h:33
static uint16_t zns_auto_open_zone(NvmeNamespace *ns, NvmeZone *zone)
Definition: zns.c:419
uint64_t size
Definition: nvme.h:1072
static uint16_t zns_zone_mgmt_recv(FemuCtrl *n, NvmeRequest *req)
Definition: zns.c:891
NvmeCqe cqe
Definition: nvme.h:982
uint8_t flbas
Definition: nvme.h:869
@ NVME_ZONE_INVAL_TRANSITION
Definition: nvme.h:570
@ NVME_ZONE_REPORT
Definition: zns.h:28
QemuUUID uuid
Definition: zns.h:109
static void zns_auto_transition_zone(NvmeNamespace *ns)
Definition: zns.c:402
uint64_t slba
Definition: zns.h:7
bool cross_zone_read
Definition: nvme.h:1195
uint8_t lbads
Definition: nvme.h:857
uint32_t nsid
Definition: zns.h:108
@ NVME_ZONE_REPORT_EXTENDED
Definition: zns.h:29
struct QEMU_PACKED NvmeLBAFE NvmeLBAFE
@ NVME_CMD_ZONE_APPEND
Definition: nvme.h:348
NvmeZoneReceiveAction
Definition: zns.h:27
SsdDramBackend * mbe
femu后端内存(实际数据)
Definition: nvme.h:1322
@ NVME_ZONE_STATE_CLOSED
Definition: zns.h:74
@ NVME_ZONE_TYPE_SEQ_WRITE
Definition: zns.h:45
uint64_t zcap
Definition: zns.h:63
void * state
Definition: nvme.h:1170
@ NVME_PSDT_PRP
Definition: nvme.h:291
@ NVME_ZA_FINISHED_BY_CTLR
Definition: zns.h:16
PCIDevice parent_obj
Definition: nvme.h:1185
@ NVME_CMD_READ
Definition: nvme.h:341
@ NVME_ZONE_STATE_READ_ONLY
Definition: zns.h:75
uint32_t zd_extension_size
Definition: nvme.h:1200
static uint16_t zns_offline_zone(NvmeNamespace *ns, NvmeZone *zone, NvmeZoneState state, NvmeRequest *req)
Definition: zns.c:618
NvmeZoneSendAction
Definition: zns.h:48
int32_t nr_open_zones
Definition: nvme.h:1215
uint64_t prp2
Definition: nvme.h:284
bool zoned
Definition: nvme.h:1194
NvmeNamespace * namespaces
Definition: nvme.h:1279
uint16_t nlb
Definition: nvme.h:431
@ NVME_ZONE_STATE_IMPLICITLY_OPEN
Definition: zns.h:72
static void zns_exit(FemuCtrl *n)
Definition: zns.c:1305
@ NVME_ZONE_TOO_MANY_OPEN
Definition: nvme.h:569
static uint16_t zns_bulk_proc_zone(NvmeNamespace *ns, NvmeZone *zone, enum NvmeZoneProcessingMask proc_mask, op_handler_t op_hndlr, NvmeRequest *req)
Definition: zns.c:650
static int zns_init_zone_cap(FemuCtrl *n)
Definition: zns.c:1258
uint32_t num_zones
Definition: nvme.h:1210
uint8_t lba_index
Definition: nvme.h:1253
uint64_t zslba
Definition: zns.h:64
uint16_t page_size
Definition: nvme.h:1224
NvmeZoneDescr d
Definition: zns.h:102
static uint16_t zns_check_dulbe(NvmeNamespace *ns, uint64_t slba, uint32_t nlb)
Definition: zns.c:1111
static void zns_set_ctrl(FemuCtrl *n)
Definition: zns.c:1249
static int zns_start_ctrl(FemuCtrl *n)
Definition: zns.c:1272
@ NVME_INVALID_FIELD
Definition: nvme.h:528
#define NVME_ID_NS_FLBAS_INDEX(flbas)
Definition: nvme.h:920
bool zone_cap_bs
Definition: nvme.h:1197
static uint8_t zns_ns_lbads(NvmeNamespace *ns)
Definition: zns.h:135
uint32_t err_rec
Definition: nvme.h:795
static uint16_t zns_zone_append(FemuCtrl *n, NvmeRequest *req)
Definition: zns.c:1106
#define femu_err(fmt,...)
Definition: nvme.h:1511
static uint32_t zns_zone_idx(NvmeNamespace *ns, uint64_t slba)
Definition: zns.c:7