qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] hw/nvme: i/o cmd set independent namespace data structure


From: Klaus Jensen
Subject: Re: [PATCH] hw/nvme: i/o cmd set independent namespace data structure
Date: Tue, 24 Sep 2024 07:59:08 +0200

On Sep 20 05:51, Arun Kumar wrote:
> add support for i/o command set independent namespace data
> structure(cns=8h and cns=1fh)
> 
> Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
> Signed-off-by: Arun Kumar <arun.kka@samsung.com>
> ---
>  hw/nvme/ctrl.c       | 37 +++++++++++++++++++++++++++++++++++++
>  hw/nvme/trace-events |  1 +
>  include/block/nvme.h | 17 +++++++++++++++++
>  3 files changed, 55 insertions(+)
> 
> diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
> index 127c3d2383..73af48591d 100644
> --- a/hw/nvme/ctrl.c
> +++ b/hw/nvme/ctrl.c
> @@ -5498,6 +5498,39 @@ 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);
> +    NvmeIdNsIndependent id;
> +
> +    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);
> +        }
> +    }
> +
> +    id = (NvmeIdNsIndependent) {
> +        .nmic = ns->params.shared ? NVME_NMIC_NS_SHARED : 0x0,
> +        .nstat = 0x1,

Since the NSTAT and NMIC fields recently got some acronyms for the bits,
something like

  enum NvmeIdNsInd {
      NVME_ID_NS_IND_NMIC_SHRNS = 0x1,
      NVME_ID_NS_IND_NSTAT_NRDY = 0x1,
  };

would be nice to add to include/block/nvme.h and use here.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]