All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: kwolf@redhat.com
Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org, hreitz@redhat.com,
	fam@euphon.net, ronniesahlberg@gmail.com, pbonzini@redhat.com,
	pl@dlhnet.de, kbusch@kernel.org, its@irrelevant.dk,
	foss@defmacro.it, philmd@linaro.org, pizhenwei@bytedance.com,
	Changqi Lu <luchangqi.123@bytedance.com>
Subject: Re: [PATCH v6 08/10] hw/nvme: enable ONCS and rescap function
Date: Thu, 4 Jul 2024 20:20:31 +0200	[thread overview]
Message-ID: <20240704182031.GG2529519@fedora.redhat.com> (raw)
In-Reply-To: <20240613071327.2498953-9-luchangqi.123@bytedance.com>

[-- Attachment #1: Type: text/plain, Size: 2398 bytes --]

On Thu, Jun 13, 2024 at 03:13:25PM +0800, Changqi Lu wrote:
> This commit enables ONCS to support the reservation
> function at the controller level. Also enables rescap
> function in the namespace by detecting the supported reservation
> function in the backend driver.
> 
> Signed-off-by: Changqi Lu <luchangqi.123@bytedance.com>
> Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
> ---
>  hw/nvme/ctrl.c | 3 ++-
>  hw/nvme/ns.c   | 5 +++++
>  2 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
> index 127c3d2383..182307a48b 100644
> --- a/hw/nvme/ctrl.c
> +++ b/hw/nvme/ctrl.c
> @@ -8248,7 +8248,8 @@ static void nvme_init_ctrl(NvmeCtrl *n, PCIDevice *pci_dev)
>      id->nn = cpu_to_le32(NVME_MAX_NAMESPACES);
>      id->oncs = cpu_to_le16(NVME_ONCS_WRITE_ZEROES | NVME_ONCS_TIMESTAMP |
>                             NVME_ONCS_FEATURES | NVME_ONCS_DSM |
> -                           NVME_ONCS_COMPARE | NVME_ONCS_COPY);
> +                           NVME_ONCS_COMPARE | NVME_ONCS_COPY |
> +                           NVME_ONCS_RESRVATIONS);

RESRVATIONS -> RESERVATIONS typo?

>  
>      /*
>       * NOTE: If this device ever supports a command set that does NOT use 0x0
> diff --git a/hw/nvme/ns.c b/hw/nvme/ns.c
> index ea8db175db..320c9bf658 100644
> --- a/hw/nvme/ns.c
> +++ b/hw/nvme/ns.c
> @@ -20,6 +20,7 @@
>  #include "qemu/bitops.h"
>  #include "sysemu/sysemu.h"
>  #include "sysemu/block-backend.h"
> +#include "block/block_int.h"
>  
>  #include "nvme.h"
>  #include "trace.h"
> @@ -33,6 +34,7 @@ void nvme_ns_init_format(NvmeNamespace *ns)
>      BlockDriverInfo bdi;
>      int npdg, ret;
>      int64_t nlbas;
> +    uint8_t blk_pr_cap;
>  
>      ns->lbaf = id_ns->lbaf[NVME_ID_NS_FLBAS_INDEX(id_ns->flbas)];
>      ns->lbasz = 1 << ns->lbaf.ds;
> @@ -55,6 +57,9 @@ void nvme_ns_init_format(NvmeNamespace *ns)
>      }
>  
>      id_ns->npda = id_ns->npdg = npdg - 1;
> +
> +    blk_pr_cap = blk_bs(ns->blkconf.blk)->file->bs->bl.pr_cap;

Kevin: This unprotected block graph access and the assumption that
->file->bs exists could be problematic. What is the best practice for
making this code safe and defensive?

> +    id_ns->rescap = block_pr_cap_to_nvme(blk_pr_cap);
>  }
>  
>  static int nvme_ns_init(NvmeNamespace *ns, Error **errp)
> -- 
> 2.20.1
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2024-07-04 19:28 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-13  7:13 [PATCH v6 00/10] Support persistent reservation operations Changqi Lu
2024-06-13  7:13 ` [PATCH v6 01/10] block: add persistent reservation in/out api Changqi Lu
2024-06-26 20:05   ` Stefan Hajnoczi
2024-06-13  7:13 ` [PATCH v6 02/10] block/raw: add persistent reservation in/out driver Changqi Lu
2024-06-26 20:46   ` Stefan Hajnoczi
2024-06-13  7:13 ` [PATCH v6 03/10] scsi/constant: add persistent reservation in/out protocol constants Changqi Lu
2024-06-26 20:53   ` Stefan Hajnoczi
2024-06-13  7:13 ` [PATCH v6 04/10] scsi/util: add helper functions for persistent reservation types conversion Changqi Lu
2024-06-26 20:55   ` Stefan Hajnoczi
2024-06-13  7:13 ` [PATCH v6 05/10] hw/scsi: add persistent reservation in/out api for scsi device Changqi Lu
2024-07-04 16:46   ` Stefan Hajnoczi
2024-07-04 18:28   ` Stefan Hajnoczi
2024-06-13  7:13 ` [PATCH v6 06/10] block/nvme: add reservation command protocol constants Changqi Lu
2024-07-04 17:51   ` Stefan Hajnoczi
2024-06-13  7:13 ` [PATCH v6 07/10] hw/nvme: add helper functions for converting reservation types Changqi Lu
2024-06-13  7:13 ` [PATCH v6 08/10] hw/nvme: enable ONCS and rescap function Changqi Lu
2024-07-04 18:20   ` Stefan Hajnoczi [this message]
2024-07-05 10:22     ` Stefan Hajnoczi
2024-06-13  7:13 ` [PATCH v6 09/10] hw/nvme: add reservation protocal command Changqi Lu
2024-07-04 18:31   ` Stefan Hajnoczi
2024-06-13  7:13 ` [PATCH v6 10/10] block/iscsi: add persistent reservation in/out driver Changqi Lu
2024-07-04 19:24   ` Stefan Hajnoczi
2024-06-19  2:49 ` PING: [PATCH v6 00/10] Support persistent reservation operations 卢长奇
     [not found] ` <3c9b7bb9-cb69-49c4-b7cf-5503baeee09d@bytedance.com>
2024-06-26 11:39   ` 卢长奇
2024-06-27  2:54 ` 卢长奇
     [not found] ` <8e6a16e7-21df-40ec-93d7-1b41fd0f50a4@bytedance.com>
2024-07-04  3:27   ` 卢长奇

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240704182031.GG2529519@fedora.redhat.com \
    --to=stefanha@redhat.com \
    --cc=fam@euphon.net \
    --cc=foss@defmacro.it \
    --cc=hreitz@redhat.com \
    --cc=its@irrelevant.dk \
    --cc=kbusch@kernel.org \
    --cc=kwolf@redhat.com \
    --cc=luchangqi.123@bytedance.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@linaro.org \
    --cc=pizhenwei@bytedance.com \
    --cc=pl@dlhnet.de \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=ronniesahlberg@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.