Lines Matching +full:- +full:runs

2  * QEMU NVM Express Subsystem: nvme-subsys
19 NvmeSubsystem *subsys = n->subsys; in nvme_subsys_reserve_cntlids()
20 NvmeSecCtrlEntry *list = n->sec_ctrl_list; in nvme_subsys_reserve_cntlids()
24 for (i = start; i < ARRAY_SIZE(subsys->ctrls) && cnt < num; i++) { in nvme_subsys_reserve_cntlids()
25 if (!subsys->ctrls[i]) { in nvme_subsys_reserve_cntlids()
27 sctrl->scid = cpu_to_le16(i); in nvme_subsys_reserve_cntlids()
28 subsys->ctrls[i] = SUBSYS_SLOT_RSVD; in nvme_subsys_reserve_cntlids()
38 NvmeSubsystem *subsys = n->subsys; in nvme_subsys_unreserve_cntlids()
39 NvmeSecCtrlEntry *list = n->sec_ctrl_list; in nvme_subsys_unreserve_cntlids()
43 for (i = 0; i < n->params.sriov_max_vfs; i++) { in nvme_subsys_unreserve_cntlids()
45 cntlid = le16_to_cpu(sctrl->scid); in nvme_subsys_unreserve_cntlids()
48 assert(subsys->ctrls[cntlid] == SUBSYS_SLOT_RSVD); in nvme_subsys_unreserve_cntlids()
49 subsys->ctrls[cntlid] = NULL; in nvme_subsys_unreserve_cntlids()
50 sctrl->scid = 0; in nvme_subsys_unreserve_cntlids()
57 NvmeSubsystem *subsys = n->subsys; in nvme_subsys_register_ctrl()
59 int cntlid, nsid, num_rsvd, num_vfs = n->params.sriov_max_vfs; in nvme_subsys_register_ctrl()
61 if (pci_is_vf(&n->parent_obj)) { in nvme_subsys_register_ctrl()
62 cntlid = le16_to_cpu(sctrl->scid); in nvme_subsys_register_ctrl()
64 n->sec_ctrl_list = g_new0(NvmeSecCtrlEntry, num_vfs); in nvme_subsys_register_ctrl()
66 for (cntlid = 0; cntlid < ARRAY_SIZE(subsys->ctrls); cntlid++) { in nvme_subsys_register_ctrl()
67 if (!subsys->ctrls[cntlid]) { in nvme_subsys_register_ctrl()
72 if (cntlid == ARRAY_SIZE(subsys->ctrls)) { in nvme_subsys_register_ctrl()
74 return -1; in nvme_subsys_register_ctrl()
82 return -1; in nvme_subsys_register_ctrl()
86 if (!subsys->serial) { in nvme_subsys_register_ctrl()
87 subsys->serial = g_strdup(n->params.serial); in nvme_subsys_register_ctrl()
88 } else if (strcmp(subsys->serial, n->params.serial)) { in nvme_subsys_register_ctrl()
90 return -1; in nvme_subsys_register_ctrl()
93 subsys->ctrls[cntlid] = n; in nvme_subsys_register_ctrl()
95 for (nsid = 1; nsid < ARRAY_SIZE(subsys->namespaces); nsid++) { in nvme_subsys_register_ctrl()
96 NvmeNamespace *ns = subsys->namespaces[nsid]; in nvme_subsys_register_ctrl()
97 if (ns && ns->params.shared && !ns->params.detached) { in nvme_subsys_register_ctrl()
107 if (pci_is_vf(&n->parent_obj)) { in nvme_subsys_unregister_ctrl()
108 subsys->ctrls[n->cntlid] = SUBSYS_SLOT_RSVD; in nvme_subsys_unregister_ctrl()
110 subsys->ctrls[n->cntlid] = NULL; in nvme_subsys_unregister_ctrl()
114 n->cntlid = -1; in nvme_subsys_unregister_ctrl()
147 NvmeEnduranceGroup *endgrp = &subsys->endgrp; in nvme_subsys_setup_fdp()
149 if (!subsys->params.fdp.runs) { in nvme_subsys_setup_fdp()
150 error_setg(errp, "fdp.runs must be non-zero"); in nvme_subsys_setup_fdp()
154 endgrp->fdp.runs = subsys->params.fdp.runs; in nvme_subsys_setup_fdp()
156 if (!subsys->params.fdp.nrg) { in nvme_subsys_setup_fdp()
157 error_setg(errp, "fdp.nrg must be non-zero"); in nvme_subsys_setup_fdp()
161 endgrp->fdp.nrg = subsys->params.fdp.nrg; in nvme_subsys_setup_fdp()
163 if (!subsys->params.fdp.nruh || in nvme_subsys_setup_fdp()
164 subsys->params.fdp.nruh > NVME_FDP_MAXPIDS) { in nvme_subsys_setup_fdp()
165 error_setg(errp, "fdp.nruh must be non-zero and less than %u", in nvme_subsys_setup_fdp()
170 endgrp->fdp.nruh = subsys->params.fdp.nruh; in nvme_subsys_setup_fdp()
172 if (!nvme_calc_rgif(endgrp->fdp.nruh, endgrp->fdp.nrg, &endgrp->fdp.rgif)) { in nvme_subsys_setup_fdp()
175 endgrp->fdp.nruh, endgrp->fdp.nrg); in nvme_subsys_setup_fdp()
179 endgrp->fdp.ruhs = g_new(NvmeRuHandle, endgrp->fdp.nruh); in nvme_subsys_setup_fdp()
181 for (uint16_t ruhid = 0; ruhid < endgrp->fdp.nruh; ruhid++) { in nvme_subsys_setup_fdp()
182 endgrp->fdp.ruhs[ruhid] = (NvmeRuHandle) { in nvme_subsys_setup_fdp()
187 endgrp->fdp.ruhs[ruhid].rus = g_new(NvmeReclaimUnit, endgrp->fdp.nrg); in nvme_subsys_setup_fdp()
190 endgrp->fdp.enabled = true; in nvme_subsys_setup_fdp()
197 const char *nqn = subsys->params.nqn ? in nvme_subsys_setup()
198 subsys->params.nqn : subsys->parent_obj.id; in nvme_subsys_setup()
200 snprintf((char *)subsys->subnqn, sizeof(subsys->subnqn), in nvme_subsys_setup()
201 "nqn.2019-08.org.qemu:%s", nqn); in nvme_subsys_setup()
203 if (subsys->params.fdp.enabled && !nvme_subsys_setup_fdp(subsys, errp)) { in nvme_subsys_setup()
214 qbus_init(&subsys->bus, sizeof(NvmeBus), TYPE_NVME_BUS, dev, dev->id); in nvme_subsys_realize()
222 DEFINE_PROP_SIZE("fdp.runs", NvmeSubsystem, params.fdp.runs,
233 set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); in nvme_subsys_class_init()
235 dc->realize = nvme_subsys_realize; in nvme_subsys_class_init()
236 dc->desc = "Virtual NVMe subsystem"; in nvme_subsys_class_init()
237 dc->hotpluggable = false; in nvme_subsys_class_init()