mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 16:53:55 -06:00
hw/nvme: i/o cmd set independent namespace data structure
Add support for the I/O Command Set Independent Namespace Data Structure (CNS 8h and 1fh). Signed-off-by: Arun Kumar <arun.kka@samsung.com> Reviewed-by: Klaus Jensen <k.jensen@samsung.com> Link: https://lore.kernel.org/r/20240925004407.3521406-1-arun.kka@samsung.com Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
This commit is contained in:
parent
daaf51001a
commit
79e490058f
5 changed files with 59 additions and 3 deletions
|
@ -5692,6 +5692,33 @@ static uint16_t nvme_identify_sec_ctrl_list(NvmeCtrl *n, NvmeRequest *req)
|
|||
return nvme_c2h(n, (uint8_t *)&list, sizeof(list), req);
|
||||
}
|
||||
|
||||
static uint16_t nvme_identify_ns_ind(NvmeCtrl *n, NvmeRequest *req, bool alloc)
|
||||
{
|
||||
NvmeNamespace *ns;
|
||||
NvmeIdentify *c = (NvmeIdentify *)&req->cmd;
|
||||
uint32_t nsid = le32_to_cpu(c->nsid);
|
||||
|
||||
trace_pci_nvme_identify_ns_ind(nsid);
|
||||
|
||||
if (!nvme_nsid_valid(n, nsid) || nsid == NVME_NSID_BROADCAST) {
|
||||
return NVME_INVALID_NSID | NVME_DNR;
|
||||
}
|
||||
|
||||
ns = nvme_ns(n, nsid);
|
||||
if (unlikely(!ns)) {
|
||||
if (alloc) {
|
||||
ns = nvme_subsys_ns(n->subsys, nsid);
|
||||
if (!ns) {
|
||||
return nvme_rpt_empty_id_struct(n, req);
|
||||
}
|
||||
} else {
|
||||
return nvme_rpt_empty_id_struct(n, req);
|
||||
}
|
||||
}
|
||||
|
||||
return nvme_c2h(n, (uint8_t *)&ns->id_ns_ind, sizeof(NvmeIdNsInd), req);
|
||||
}
|
||||
|
||||
static uint16_t nvme_identify_ns_csi(NvmeCtrl *n, NvmeRequest *req,
|
||||
bool active)
|
||||
{
|
||||
|
@ -5946,6 +5973,10 @@ static uint16_t nvme_identify(NvmeCtrl *n, NvmeRequest *req)
|
|||
return nvme_identify_sec_ctrl_list(n, req);
|
||||
case NVME_ID_CNS_CS_NS:
|
||||
return nvme_identify_ns_csi(n, req, true);
|
||||
case NVME_ID_CNS_CS_IND_NS:
|
||||
return nvme_identify_ns_ind(n, req, false);
|
||||
case NVME_ID_CNS_CS_IND_NS_ALLOCATED:
|
||||
return nvme_identify_ns_ind(n, req, true);
|
||||
case NVME_ID_CNS_CS_NS_PRESENT:
|
||||
return nvme_identify_ns_csi(n, req, false);
|
||||
case NVME_ID_CNS_CTRL:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue