FEMU  原版 master 7e238cc
FEMU: Accurate, Scalable and Extensible NVMe SSD Emulator (FAST'18)
zns.h
浏览该文件的文档.
1 #ifndef __FEMU_ZNS_H
2 #define __FEMU_ZNS_H
3 
4 #include "../nvme.h"
5 
6 typedef struct QEMU_PACKED NvmeZonedResult {
7  uint64_t slba;
9 
10 typedef struct NvmeIdCtrlZoned {
11  uint8_t zasl;
12  uint8_t rsvd1[4095];
14 
20 };
21 
22 typedef struct QEMU_PACKED NvmeZoneReportHeader {
23  uint64_t nr_zones;
24  uint8_t rsvd[56];
26 
30 };
31 
41 };
42 
46 };
47 
56 };
57 
58 typedef struct QEMU_PACKED NvmeZoneDescr {
59  uint8_t zt;
60  uint8_t zs;
61  uint8_t za;
62  uint8_t rsvd3[5];
63  uint64_t zcap;
64  uint64_t zslba;
65  uint64_t wp;
66  uint8_t rsvd32[32];
68 
69 typedef enum NvmeZoneState {
79 
80 #define NVME_SET_CSI(vec, csi) (vec |= (uint8_t)(1 << (csi)))
81 
82 typedef struct QEMU_PACKED NvmeLBAFE {
83  uint64_t zsze;
84  uint8_t zdes;
85  uint8_t rsvd9[7];
86 } NvmeLBAFE;
87 
88 typedef struct QEMU_PACKED NvmeIdNsZoned {
89  uint16_t zoc;
90  uint16_t ozcs;
91  uint32_t mar;
92  uint32_t mor;
93  uint32_t rrl;
94  uint32_t frl;
95  uint8_t rsvd20[2796];
96  NvmeLBAFE lbafe[16];
97  uint8_t rsvd3072[768];
98  uint8_t vs[256];
100 
101 typedef struct NvmeZone {
103  uint64_t w_ptr;
104  QTAILQ_ENTRY(NvmeZone) entry;
105 } NvmeZone;
106 
107 typedef struct NvmeNamespaceParams {
108  uint32_t nsid;
109  QemuUUID uuid;
110 
111  bool zoned;
113  uint64_t zone_size_bs;
114  uint64_t zone_cap_bs;
116  uint32_t max_open_zones;
119 
120 static inline uint32_t zns_nsid(NvmeNamespace *ns)
121 {
122  if (ns) {
123  return ns->id;
124  }
125 
126  return -1;
127 }
128 
129 static inline NvmeLBAF *zns_ns_lbaf(NvmeNamespace *ns)
130 {
131  NvmeIdNs *id_ns = &ns->id_ns;
132  return &id_ns->lbaf[NVME_ID_NS_FLBAS_INDEX(id_ns->flbas)];
133 }
134 
135 static inline uint8_t zns_ns_lbads(NvmeNamespace *ns)
136 {
137  /* NvmeLBAF */
138  return zns_ns_lbaf(ns)->lbads;
139 }
140 
141 /* calculate the number of LBAs that the namespace can accomodate */
142 static inline uint64_t zns_ns_nlbas(NvmeNamespace *ns)
143 {
144  return ns->size >> zns_ns_lbads(ns);
145 }
146 
147 /* convert an LBA to the equivalent in bytes */
148 static inline size_t zns_l2b(NvmeNamespace *ns, uint64_t lba)
149 {
150  return lba << zns_ns_lbads(ns);
151 }
152 
154 {
155  return zone->d.zs >> 4;
156 }
157 
158 static inline void zns_set_zone_state(NvmeZone *zone, NvmeZoneState state)
159 {
160  zone->d.zs = state << 4;
161 }
162 
163 static inline uint64_t zns_zone_rd_boundary(NvmeNamespace *ns, NvmeZone *zone)
164 {
165  return zone->d.zslba + ns->ctrl->zone_size;
166 }
167 
168 static inline uint64_t zns_zone_wr_boundary(NvmeZone *zone)
169 {
170  return zone->d.zslba + zone->d.zcap;
171 }
172 
173 static inline bool zns_wp_is_valid(NvmeZone *zone)
174 {
175  uint8_t st = zns_get_zone_state(zone);
176 
177  return st != NVME_ZONE_STATE_FULL &&
180 }
181 
182 static inline uint8_t *zns_get_zd_extension(NvmeNamespace *ns, uint32_t zone_idx)
183 {
184  return &ns->ctrl->zd_extensions[zone_idx * ns->ctrl->zd_extension_size];
185 }
186 
187 static inline void zns_aor_inc_open(NvmeNamespace *ns)
188 {
189  FemuCtrl *n = ns->ctrl;
190  assert(n->nr_open_zones >= 0);
191  if (n->max_open_zones) {
192  n->nr_open_zones++;
193  assert(n->nr_open_zones <= n->max_open_zones);
194  }
195 }
196 
197 static inline void zns_aor_dec_open(NvmeNamespace *ns)
198 {
199  FemuCtrl *n = ns->ctrl;
200  if (n->max_open_zones) {
201  assert(n->nr_open_zones > 0);
202  n->nr_open_zones--;
203  }
204  assert(n->nr_open_zones >= 0);
205 }
206 
207 static inline void zns_aor_inc_active(NvmeNamespace *ns)
208 {
209  FemuCtrl *n = ns->ctrl;
210  assert(n->nr_active_zones >= 0);
211  if (n->max_active_zones) {
212  n->nr_active_zones++;
213  assert(n->nr_active_zones <= n->max_active_zones);
214  }
215 }
216 
217 static inline void zns_aor_dec_active(NvmeNamespace *ns)
218 {
219  FemuCtrl *n = ns->ctrl;
220  if (n->max_active_zones) {
221  assert(n->nr_active_zones > 0);
222  n->nr_active_zones--;
223  assert(n->nr_active_zones >= n->nr_open_zones);
224  }
225  assert(n->nr_active_zones >= 0);
226 }
227 
229 void zns_ns_cleanup(NvmeNamespace *ns);
230 
231 #endif
dma_write_prp
uint16_t dma_write_prp(FemuCtrl *n, uint8_t *ptr, uint32_t len, uint64_t prp1, uint64_t prp2)
Definition: dma.c:112
NVME_ZONE_REPORT_EXPLICITLY_OPEN
@ NVME_ZONE_REPORT_EXPLICITLY_OPEN
Definition: zns.h:36
NvmeCmd
Definition: nvme.h:296
NvmeCmd::cdw11
uint32_t cdw11
Definition: nvme.h:307
zns_set_zd_ext
static uint16_t zns_set_zd_ext(NvmeNamespace *ns, NvmeZone *zone)
Definition: zns.c:631
NvmeZoneProcessingMask
NvmeZoneProcessingMask
Definition: zns.c:525
NvmeRequest::cmd
NvmeCmd cmd
Definition: nvme.h:981
NVME_CMD_ZONE_MGMT_SEND
@ NVME_CMD_ZONE_MGMT_SEND
Definition: nvme.h:346
NvmeZoneDescr::za
uint8_t za
Definition: zns.h:61
NVME_LBA_RANGE
@ NVME_LBA_RANGE
Definition: nvme.h:540
zns_init_zoned_state
static void zns_init_zoned_state(NvmeNamespace *ns)
Definition: zns.c:84
NvmeIdNsZoned::mar
uint32_t mar
Definition: zns.h:91
NvmeIdNs::nuse
uint64_t nuse
Definition: nvme.h:866
FemuCtrl::zone_capacity
uint64_t zone_capacity
Definition: nvme.h:1212
FemuCtrl::zone_size_bs
uint64_t zone_size_bs
Definition: nvme.h:1196
NvmeNamespace::id
uint32_t id
Definition: nvme.h:1071
zns_finalize_zoned_write
static void zns_finalize_zoned_write(NvmeNamespace *ns, NvmeRequest *req, bool failed)
Definition: zns.c:435
nvme_check_mdts
static uint16_t nvme_check_mdts(FemuCtrl *n, size_t len)
Definition: nvme.h:1488
zns_zone_reset_ctx::req
NvmeRequest * req
Definition: zns.c:498
FemuCtrl
femu相关控制参数和数据成员
Definition: nvme.h:1184
zns_get_zone_by_slba
static NvmeZone * zns_get_zone_by_slba(NvmeNamespace *ns, uint64_t slba)
Definition: zns.c:15
zns_set_ctrl_str
static void zns_set_ctrl_str(FemuCtrl *n)
Definition: zns.c:1240
FemuCtrl::ext_ops
FemuExtCtrlOps ext_ops
nvme到各模式ssd接口
Definition: nvme.h:1220
NVME_ZONE_REPORT_FULL
@ NVME_ZONE_REPORT_FULL
Definition: zns.h:38
NvmeIdNs
Definition: nvme.h:863
zns_do_write
static uint16_t zns_do_write(FemuCtrl *n, NvmeRequest *req, bool append, bool wrz)
Definition: zns.c:1036
zns_io_cmd
static uint16_t zns_io_cmd(FemuCtrl *n, NvmeNamespace *ns, NvmeCmd *cmd, NvmeRequest *req)
Definition: zns.c:1221
zns_ns_nlbas
static uint64_t zns_ns_nlbas(NvmeNamespace *ns)
Definition: zns.h:142
NvmeIdNsZoned::lbafe
NvmeLBAFE lbafe[16]
Definition: zns.h:96
unlikely
#define unlikely(x)
Definition: rte_branch_prediction.h:38
NvmeRequest::qsg
QEMUSGList qsg
dma用
Definition: nvme.h:984
zns_zoned_ns_shutdown
static void zns_zoned_ns_shutdown(NvmeNamespace *ns)
Definition: zns.c:182
NvmeIdNsZoned
struct QEMU_PACKED NvmeIdNsZoned NvmeIdNsZoned
NVME_ZONE_INVALID_WRITE
@ NVME_ZONE_INVALID_WRITE
Definition: nvme.h:567
FemuCtrl::zasl_bs
uint32_t zasl_bs
Definition: nvme.h:1192
zns_advance_zone_wp
static uint64_t zns_advance_zone_wp(NvmeNamespace *ns, NvmeZone *zone, uint32_t nlb)
Definition: zns.c:474
NVME_ZONE_ACTION_OPEN
@ NVME_ZONE_ACTION_OPEN
Definition: zns.h:52
FemuExtCtrlOps
struct FemuExtCtrlOps FemuExtCtrlOps
扩展操作接口,具体实现在各模式ssd中
FemuCtrl::zd_extensions
uint8_t * zd_extensions
Definition: nvme.h:1214
NvmeZone
Definition: zns.h:101
zns_check_zone_state_for_write
static uint16_t zns_check_zone_state_for_write(NvmeZone *zone)
Definition: zns.c:289
zns_l2b
static size_t zns_l2b(NvmeNamespace *ns, uint64_t lba)
Definition: zns.h:148
NvmeNamespaceParams
Definition: zns.h:107
NvmeNamespaceParams
struct NvmeNamespaceParams NvmeNamespaceParams
FemuCtrl::zasl
uint8_t zasl
Definition: nvme.h:1193
NVME_ZONE_OFFLINE
@ NVME_ZONE_OFFLINE
Definition: nvme.h:566
NvmeZoneState
NvmeZoneState
Definition: zns.h:69
zns_aio_zone_reset_cb
static void zns_aio_zone_reset_cb(NvmeRequest *req, NvmeZone *zone)
Definition: zns.c:502
backend_rw
int backend_rw(SsdDramBackend *b, QEMUSGList *qsg, uint64_t *lbal, bool is_write)
Definition: dram.c:37
lba
uint64_t lba
Definition: oc12.h:2
NvmeCmd::cdw13
uint32_t cdw13
Definition: nvme.h:309
NvmeRequest::status
uint16_t status
Definition: nvme.h:971
op_handler_t
uint16_t(* op_handler_t)(NvmeNamespace *, NvmeZone *, NvmeZoneState, NvmeRequest *)
Definition: zns.c:522
NVME_CSI_ZONED
@ NVME_CSI_ZONED
Definition: nvme.h:125
zns_finish_zone
static uint16_t zns_finish_zone(NvmeNamespace *ns, NvmeZone *zone, NvmeZoneState state, NvmeRequest *req)
Definition: zns.c:578
NVME_ZONE_STATE_FULL
@ NVME_ZONE_STATE_FULL
Definition: zns.h:76
NVME_SUCCESS
@ NVME_SUCCESS
Definition: nvme.h:526
zns_reset_zone
static uint16_t zns_reset_zone(NvmeNamespace *ns, NvmeZone *zone, NvmeZoneState state, NvmeRequest *req)
Definition: zns.c:598
NVME_ZONE_STATE_EMPTY
@ NVME_ZONE_STATE_EMPTY
Definition: zns.h:71
zns_ns_cleanup
void zns_ns_cleanup(NvmeNamespace *ns)
Definition: zns.c:216
NvmeRwCmd::slba
uint64_t slba
Definition: nvme.h:430
NVME_ERR_REC_DULBE
#define NVME_ERR_REC_DULBE(err_rec)
Definition: nvme.h:813
FemuCtrl::zone_size_log2
uint32_t zone_size_log2
Definition: nvme.h:1213
NVME_ZONE_TYPE_RESERVED
@ NVME_ZONE_TYPE_RESERVED
Definition: zns.h:44
NVME_ZONE_STATE_OFFLINE
@ NVME_ZONE_STATE_OFFLINE
Definition: zns.h:77
NvmeIdNs::npdg
uint16_t npdg
Definition: nvme.h:887
NvmeIdCtrlZoned
Definition: zns.h:10
NVME_ZONE_ACTION_RSD
@ NVME_ZONE_ACTION_RSD
Definition: zns.h:49
NvmeIdNsZoned::rrl
uint32_t rrl
Definition: zns.h:93
FemuCtrl::features
NvmeFeatureVal features
Definition: nvme.h:1284
NVME_PROC_READ_ONLY_ZONES
@ NVME_PROC_READ_ONLY_ZONES
Definition: zns.c:529
dma_read_prp
uint16_t dma_read_prp(FemuCtrl *n, uint8_t *ptr, uint32_t len, uint64_t prp1, uint64_t prp2)
Definition: dma.c:137
NvmeNamespace
Definition: nvme.h:1065
NVME_CMD_WRITE
@ NVME_CMD_WRITE
Definition: nvme.h:340
zns_zone_mgmt_send
static uint16_t zns_zone_mgmt_send(FemuCtrl *n, NvmeRequest *req)
Definition: zns.c:769
NVME_ZONE_ACTION_SET_ZD_EXT
@ NVME_ZONE_ACTION_SET_ZD_EXT
Definition: zns.h:55
NVME_DNR
@ NVME_DNR
Definition: nvme.h:581
NvmeZoneDescr::zt
uint8_t zt
Definition: zns.h:59
zns_set_zone_state
static void zns_set_zone_state(NvmeZone *zone, NvmeZoneState state)
Definition: zns.h:158
NvmeNamespaceParams::zd_extension_size
uint32_t zd_extension_size
Definition: zns.h:117
NvmeZoneDescr::zs
uint8_t zs
Definition: zns.h:60
NvmeZone::QTAILQ_ENTRY
QTAILQ_ENTRY(NvmeZone) entry
zns_zone_reset_ctx
Definition: zns.c:497
zns_ns_shutdown
void zns_ns_shutdown(NvmeNamespace *ns)
Definition: zns.c:208
NVME_CSI_NVM
@ NVME_CSI_NVM
Definition: nvme.h:124
NVME_ZA_FINISH_RECOMMENDED
@ NVME_ZA_FINISH_RECOMMENDED
Definition: zns.h:17
zns_init_zone_geometry
static int zns_init_zone_geometry(NvmeNamespace *ns, Error **errp)
Definition: zns.c:24
FemuCtrl::nr_active_zones
int32_t nr_active_zones
Definition: nvme.h:1216
NvmeRequest::iov
QEMUIOVector iov
Definition: nvme.h:985
zns_init
static void zns_init(FemuCtrl *n, Error **errp)
Definition: zns.c:1290
NVME_PROC_OPENED_ZONES
@ NVME_PROC_OPENED_ZONES
Definition: zns.c:527
NVME_CMD_ZONE_MGMT_RECV
@ NVME_CMD_ZONE_MGMT_RECV
Definition: nvme.h:347
NVME_ZONE_REPORT_IMPLICITLY_OPEN
@ NVME_ZONE_REPORT_IMPLICITLY_OPEN
Definition: zns.h:35
NvmeIdNs::ncap
uint64_t ncap
Definition: nvme.h:865
NvmeNamespace::ctrl
struct FemuCtrl * ctrl
Definition: nvme.h:1066
NvmeZoneType
NvmeZoneType
Definition: zns.h:43
NVME_ZONE_STATE_RESERVED
@ NVME_ZONE_STATE_RESERVED
Definition: zns.h:70
NvmeIdCtrlZoned::rsvd1
uint8_t rsvd1[4095]
Definition: zns.h:12
NvmeNamespace::id_ns
NvmeIdNs id_ns
Definition: nvme.h:1067
zns_aor_dec_open
static void zns_aor_dec_open(NvmeNamespace *ns)
Definition: zns.h:197
NvmeNamespaceParams::cross_zone_read
bool cross_zone_read
Definition: zns.h:112
NvmeIdNsZoned::zoc
uint16_t zoc
Definition: zns.h:89
zns_wp_is_valid
static bool zns_wp_is_valid(NvmeZone *zone)
Definition: zns.h:173
NVME_ZONE_STATE_EXPLICITLY_OPEN
@ NVME_ZONE_STATE_EXPLICITLY_OPEN
Definition: zns.h:73
NvmeRequest::ns
struct NvmeNamespace * ns
Definition: nvme.h:970
nvme_set_ctrl_name
void nvme_set_ctrl_name(FemuCtrl *n, const char *mn, const char *sn, int *dev_id)
Definition: nvme-util.c:294
nvme_csi_has_nvm_support
static bool nvme_csi_has_nvm_support(NvmeNamespace *ns)
Definition: zns.c:999
NvmeIdNsZoned::frl
uint32_t frl
Definition: zns.h:94
NvmeZoneAttr
NvmeZoneAttr
Definition: zns.h:15
NVME_ZONE_REPORT_READ_ONLY
@ NVME_ZONE_REPORT_READ_ONLY
Definition: zns.h:39
NvmeNamespaceParams::zone_size_bs
uint64_t zone_size_bs
Definition: zns.h:113
FemuCtrl::mdts
uint8_t mdts
Definition: nvme.h:1242
NvmeIdCtrlZoned
struct NvmeIdCtrlZoned NvmeIdCtrlZoned
NvmeZoneDescr::wp
uint64_t wp
Definition: zns.h:65
zns_do_zone_op
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
NVME_DEFAULT_MAX_AZ_SIZE
#define NVME_DEFAULT_MAX_AZ_SIZE
Definition: zns.c:5
zns_write
static uint16_t zns_write(FemuCtrl *n, NvmeNamespace *ns, NvmeCmd *cmd, NvmeRequest *req)
Definition: zns.c:1165
zns_assign_zone_state
static void zns_assign_zone_state(NvmeNamespace *ns, NvmeZone *zone, NvmeZoneState state)
Definition: zns.c:226
NvmeNamespaceParams::zoned
bool zoned
Definition: zns.h:111
NvmeNamespaceParams::zone_cap_bs
uint64_t zone_cap_bs
Definition: zns.h:114
nvme_register_znssd
int nvme_register_znssd(FemuCtrl *n)
Definition: zns.c:1312
zns_check_zone_read
static uint16_t zns_check_zone_read(NvmeNamespace *ns, uint64_t slba, uint32_t nlb)
Definition: zns.c:369
zns_get_mgmt_zone_slba_idx
static uint16_t zns_get_mgmt_zone_slba_idx(FemuCtrl *n, NvmeCmd *c, uint64_t *slba, uint32_t *zone_idx)
Definition: zns.c:746
zns_ns_shutdown
void zns_ns_shutdown(NvmeNamespace *ns)
Definition: zns.c:208
NvmeZoneReportHeader
struct QEMU_PACKED NvmeZoneReportHeader NvmeZoneReportHeader
NvmeCmd::cdw12
uint32_t cdw12
Definition: nvme.h:308
NvmeZone::w_ptr
uint64_t w_ptr
Definition: zns.h:103
zns_map_dptr
static uint16_t zns_map_dptr(FemuCtrl *n, size_t len, NvmeRequest *req)
Definition: zns.c:1021
zns_close_zone
static uint16_t zns_close_zone(NvmeNamespace *ns, NvmeZone *zone, NvmeZoneState state, NvmeRequest *req)
Definition: zns.c:563
NVME_ZONE_REPORT_EMPTY
@ NVME_ZONE_REPORT_EMPTY
Definition: zns.h:34
NVME_ZONE_ACTION_CLOSE
@ NVME_ZONE_ACTION_CLOSE
Definition: zns.h:50
NVME_ZONE_ACTION_FINISH
@ NVME_ZONE_ACTION_FINISH
Definition: zns.h:51
NvmeRwCmd
Definition: nvme.h:421
FemuCtrl::zone_size
uint64_t zone_size
Definition: nvme.h:1211
NVME_ZA_RESET_RECOMMENDED
@ NVME_ZA_RESET_RECOMMENDED
Definition: zns.h:18
zns_read
static uint16_t zns_read(FemuCtrl *n, NvmeNamespace *ns, NvmeCmd *cmd, NvmeRequest *req)
Definition: zns.c:1116
zns_aor_check
static int zns_aor_check(NvmeNamespace *ns, uint32_t act, uint32_t opn)
Definition: zns.c:274
NVME_ZONE_BOUNDARY_ERROR
@ NVME_ZONE_BOUNDARY_ERROR
Definition: nvme.h:563
zns_zone_wr_boundary
static uint64_t zns_zone_wr_boundary(NvmeZone *zone)
Definition: zns.h:168
zns_admin_cmd
static uint16_t zns_admin_cmd(FemuCtrl *n, NvmeCmd *cmd)
Definition: zns.c:1098
NvmeRequest::opaque
void * opaque
Definition: nvme.h:996
NVME_ZONE_ACTION_OFFLINE
@ NVME_ZONE_ACTION_OFFLINE
Definition: zns.h:54
NVME_ZA_ZD_EXT_VALID
@ NVME_ZA_ZD_EXT_VALID
Definition: zns.h:19
NvmeRequest::is_write
uint16_t is_write
是否为写操作
Definition: nvme.h:973
zns_zone_reset_ctx::zone
NvmeZone * zone
Definition: zns.c:499
zns_zone_matches_filter
static bool zns_zone_matches_filter(uint32_t zafs, NvmeZone *zl)
Definition: zns.c:865
zns_aor_inc_active
static void zns_aor_inc_active(NvmeNamespace *ns)
Definition: zns.h:207
FemuCtrl::max_active_zones
uint32_t max_active_zones
Definition: nvme.h:1198
NVME_PROC_CURRENT_ZONE
@ NVME_PROC_CURRENT_ZONE
Definition: zns.c:526
NvmeLBAFE::zsze
uint64_t zsze
Definition: zns.h:83
zns_get_zd_extension
static uint8_t * zns_get_zd_extension(NvmeNamespace *ns, uint32_t zone_idx)
Definition: zns.h:182
zns_check_zone_state_for_read
static uint16_t zns_check_zone_state_for_read(NvmeZone *zone)
Definition: zns.c:346
NVME_ZONE_TOO_MANY_ACTIVE
@ NVME_ZONE_TOO_MANY_ACTIVE
Definition: nvme.h:568
zns_ns_lbaf
static NvmeLBAF * zns_ns_lbaf(NvmeNamespace *ns)
Definition: zns.h:129
FemuCtrl::max_open_zones
uint32_t max_open_zones
Definition: nvme.h:1199
NVME_DEFAULT_ZONE_SIZE
#define NVME_DEFAULT_ZONE_SIZE
Definition: zns.c:4
NvmeZoneReportType
NvmeZoneReportType
Definition: zns.h:32
NVME_NO_COMPLETE
@ NVME_NO_COMPLETE
Definition: nvme.h:582
NvmeIdNsZoned
Definition: zns.h:88
state
uint32_t state
Definition: oc12.h:2
NvmeZonedResult
struct QEMU_PACKED NvmeZonedResult NvmeZonedResult
zns_aor_inc_open
static void zns_aor_inc_open(NvmeNamespace *ns)
Definition: zns.h:187
NvmeLBAFE::zdes
uint8_t zdes
Definition: zns.h:84
NvmeCmd::dptr
NvmeCmdDptr dptr
Definition: nvme.h:305
NVME_INVALID_OPCODE
@ NVME_INVALID_OPCODE
Definition: nvme.h:527
NVME_ZONE_ACTION_RESET
@ NVME_ZONE_ACTION_RESET
Definition: zns.h:53
NVME_PROC_CLOSED_ZONES
@ NVME_PROC_CLOSED_ZONES
Definition: zns.c:528
NvmeIdNs::nsfeat
uint8_t nsfeat
Definition: nvme.h:867
NVME_PROC_FULL_ZONES
@ NVME_PROC_FULL_ZONES
Definition: zns.c:530
NvmeIdNs::nsze
uint64_t nsze
Definition: nvme.h:864
NvmeIdCtrlZoned::zasl
uint8_t zasl
Definition: zns.h:11
zns_check_bounds
static uint16_t zns_check_bounds(NvmeNamespace *ns, uint64_t slba, uint32_t nlb)
Definition: zns.c:1009
zns_ns_cleanup
void zns_ns_cleanup(NvmeNamespace *ns)
Definition: zns.c:216
zns_init_zone_identify
static void zns_init_zone_identify(FemuCtrl *n, NvmeNamespace *ns, int lba_index)
Definition: zns.c:123
zns_aor_dec_active
static void zns_aor_dec_active(NvmeNamespace *ns)
Definition: zns.h:217
FemuCtrl::csi
uint8_t csi
Definition: nvme.h:1203
NvmeNamespaceParams::max_active_zones
uint32_t max_active_zones
Definition: zns.h:115
NvmeCmdDptr::prp1
uint64_t prp1
Definition: nvme.h:283
NvmeIdNsZoned::mor
uint32_t mor
Definition: zns.h:92
zns_open_zone
static uint16_t zns_open_zone(NvmeNamespace *ns, NvmeZone *zone, NvmeZoneState state, NvmeRequest *req)
Definition: zns.c:533
rsvd
uint64_t rsvd
Definition: oc12.h:3
NvmeIdNsZoned::ozcs
uint16_t ozcs
Definition: zns.h:90
NVME_ZONE_REPORT_OFFLINE
@ NVME_ZONE_REPORT_OFFLINE
Definition: zns.h:40
NvmeIdNs::lbaf
NvmeLBAF lbaf[16]
Definition: nvme.h:893
zns.h
NvmeCmd::cdw10
uint32_t cdw10
Definition: nvme.h:306
NvmeCmd::opcode
uint16_t opcode
Definition: nvme.h:297
NVME_ZONE_FULL
@ NVME_ZONE_FULL
Definition: nvme.h:564
NvmeNamespaceParams::max_open_zones
uint32_t max_open_zones
Definition: zns.h:116
zns_get_zone_state
static NvmeZoneState zns_get_zone_state(NvmeZone *zone)
Definition: zns.h:153
zns_nsid
static uint32_t zns_nsid(NvmeNamespace *ns)
Definition: zns.h:120
FemuCtrl::id_ns_zoned
NvmeIdNsZoned * id_ns_zoned
Definition: nvme.h:1204
zns_zone_rd_boundary
static uint64_t zns_zone_rd_boundary(NvmeNamespace *ns, NvmeZone *zone)
Definition: zns.h:163
NvmeCmd::psdt
uint16_t psdt
Definition: nvme.h:300
zns_check_zone_write
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
@ NVME_ZONE_REPORT_CLOSED
Definition: zns.h:37
nvme_map_prp
uint16_t nvme_map_prp(QEMUSGList *qsg, QEMUIOVector *iov, uint64_t prp1, uint64_t prp2, uint32_t len, FemuCtrl *n)
Definition: dma.c:23
FemuCtrl::zone_array
NvmeZone * zone_array
Definition: nvme.h:1205
NVME_ZONE_READ_ONLY
@ NVME_ZONE_READ_ONLY
Definition: nvme.h:565
NvmeZoneDescr
struct QEMU_PACKED NvmeZoneDescr NvmeZoneDescr
zns_clear_zone
static void zns_clear_zone(NvmeNamespace *ns, NvmeZone *zone)
Definition: zns.c:163
NvmeZoneReportHeader::nr_zones
uint64_t nr_zones
Definition: zns.h:23
NVME_ZONE_REPORT_ALL
@ NVME_ZONE_REPORT_ALL
Definition: zns.h:33
NvmeZonedResult
Definition: zns.h:6
zns_auto_open_zone
static uint16_t zns_auto_open_zone(NvmeNamespace *ns, NvmeZone *zone)
Definition: zns.c:419
NvmeZoneReportHeader
Definition: zns.h:22
NvmeNamespace::size
uint64_t size
Definition: nvme.h:1072
zns_zone_mgmt_recv
static uint16_t zns_zone_mgmt_recv(FemuCtrl *n, NvmeRequest *req)
Definition: zns.c:891
NvmeRequest::cqe
NvmeCqe cqe
Definition: nvme.h:982
NvmeLBAFE
Definition: zns.h:82
NvmeIdNs::flbas
uint8_t flbas
Definition: nvme.h:869
NVME_ZONE_INVAL_TRANSITION
@ NVME_ZONE_INVAL_TRANSITION
Definition: nvme.h:570
NVME_ZONE_REPORT
@ NVME_ZONE_REPORT
Definition: zns.h:28
NvmeNamespaceParams::uuid
QemuUUID uuid
Definition: zns.h:109
zns_auto_transition_zone
static void zns_auto_transition_zone(NvmeNamespace *ns)
Definition: zns.c:402
NvmeZonedResult::slba
uint64_t slba
Definition: zns.h:7
FemuCtrl::cross_zone_read
bool cross_zone_read
Definition: nvme.h:1195
NvmeLBAF::lbads
uint8_t lbads
Definition: nvme.h:857
NvmeNamespaceParams::nsid
uint32_t nsid
Definition: zns.h:108
NVME_ZONE_REPORT_EXTENDED
@ NVME_ZONE_REPORT_EXTENDED
Definition: zns.h:29
NvmeLBAFE
struct QEMU_PACKED NvmeLBAFE NvmeLBAFE
NVME_CMD_ZONE_APPEND
@ NVME_CMD_ZONE_APPEND
Definition: nvme.h:348
NvmeZoneReceiveAction
NvmeZoneReceiveAction
Definition: zns.h:27
FemuCtrl::mbe
SsdDramBackend * mbe
femu后端内存(实际数据)
Definition: nvme.h:1322
NVME_ZONE_STATE_CLOSED
@ NVME_ZONE_STATE_CLOSED
Definition: zns.h:74
NVME_ZONE_TYPE_SEQ_WRITE
@ NVME_ZONE_TYPE_SEQ_WRITE
Definition: zns.h:45
NvmeZoneDescr::zcap
uint64_t zcap
Definition: zns.h:63
FemuExtCtrlOps::state
void * state
Definition: nvme.h:1170
NVME_PSDT_PRP
@ NVME_PSDT_PRP
Definition: nvme.h:291
NVME_ZA_FINISHED_BY_CTLR
@ NVME_ZA_FINISHED_BY_CTLR
Definition: zns.h:16
FemuCtrl::parent_obj
PCIDevice parent_obj
Definition: nvme.h:1185
NVME_CMD_READ
@ NVME_CMD_READ
Definition: nvme.h:341
NVME_ZONE_STATE_READ_ONLY
@ NVME_ZONE_STATE_READ_ONLY
Definition: zns.h:75
FemuCtrl::zd_extension_size
uint32_t zd_extension_size
Definition: nvme.h:1200
NvmeZoneDescr
Definition: zns.h:58
zns_offline_zone
static uint16_t zns_offline_zone(NvmeNamespace *ns, NvmeZone *zone, NvmeZoneState state, NvmeRequest *req)
Definition: zns.c:618
NvmeZoneSendAction
NvmeZoneSendAction
Definition: zns.h:48
FemuCtrl::nr_open_zones
int32_t nr_open_zones
Definition: nvme.h:1215
NvmeCmdDptr::prp2
uint64_t prp2
Definition: nvme.h:284
FemuCtrl::zoned
bool zoned
Definition: nvme.h:1194
FemuCtrl::namespaces
NvmeNamespace * namespaces
Definition: nvme.h:1279
NvmeZone
struct NvmeZone NvmeZone
NvmeRwCmd::nlb
uint16_t nlb
Definition: nvme.h:431
NVME_ZONE_STATE_IMPLICITLY_OPEN
@ NVME_ZONE_STATE_IMPLICITLY_OPEN
Definition: zns.h:72
zns_exit
static void zns_exit(FemuCtrl *n)
Definition: zns.c:1305
NVME_ZONE_TOO_MANY_OPEN
@ NVME_ZONE_TOO_MANY_OPEN
Definition: nvme.h:569
zns_bulk_proc_zone
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
zns_init_zone_cap
static int zns_init_zone_cap(FemuCtrl *n)
Definition: zns.c:1258
FemuCtrl::num_zones
uint32_t num_zones
Definition: nvme.h:1210
NvmeRequest
Definition: nvme.h:967
FemuCtrl::lba_index
uint8_t lba_index
Definition: nvme.h:1253
NvmeZoneDescr::zslba
uint64_t zslba
Definition: zns.h:64
NvmeLBAF
Definition: nvme.h:855
FemuCtrl::page_size
uint16_t page_size
Definition: nvme.h:1224
NvmeZone::d
NvmeZoneDescr d
Definition: zns.h:102
zns_check_dulbe
static uint16_t zns_check_dulbe(NvmeNamespace *ns, uint64_t slba, uint32_t nlb)
Definition: zns.c:1111
zns_set_ctrl
static void zns_set_ctrl(FemuCtrl *n)
Definition: zns.c:1249
zns_start_ctrl
static int zns_start_ctrl(FemuCtrl *n)
Definition: zns.c:1272
NVME_INVALID_FIELD
@ NVME_INVALID_FIELD
Definition: nvme.h:528
NVME_ID_NS_FLBAS_INDEX
#define NVME_ID_NS_FLBAS_INDEX(flbas)
Definition: nvme.h:920
FemuCtrl::zone_cap_bs
bool zone_cap_bs
Definition: nvme.h:1197
zns_ns_lbads
static uint8_t zns_ns_lbads(NvmeNamespace *ns)
Definition: zns.h:135
NvmeFeatureVal::err_rec
uint32_t err_rec
Definition: nvme.h:795
zns_zone_append
static uint16_t zns_zone_append(FemuCtrl *n, NvmeRequest *req)
Definition: zns.c:1106
femu_err
#define femu_err(fmt,...)
Definition: nvme.h:1511
zns_zone_idx
static uint32_t zns_zone_idx(NvmeNamespace *ns, uint64_t slba)
Definition: zns.c:7