From: Dmitry Fomichev <Dmitry.Fomichev@wdc.com>
To: "faithilikerun@gmail.com" <faithilikerun@gmail.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: "hreitz@redhat.com" <hreitz@redhat.com>,
"hare@suse.de" <hare@suse.de>,
"stefanha@redhat.com" <stefanha@redhat.com>,
"qemu-block@nongnu.org" <qemu-block@nongnu.org>,
"kwolf@redhat.com" <kwolf@redhat.com>,
"raphael.norwitz@nutanix.com" <raphael.norwitz@nutanix.com>,
"mst@redhat.com" <mst@redhat.com>,
"damien.lemoal@opensource.wdc.com"
<damien.lemoal@opensource.wdc.com>
Subject: Re: [RFC v3 1/2] include: update virtio_blk headers from Linux 5.19-rc2+
Date: Mon, 17 Oct 2022 00:53:36 +0000 [thread overview]
Message-ID: <e5ee5de51ec437cc97b71ad2a7e2a969e21cbcce.camel@wdc.com> (raw)
In-Reply-To: <20221016150506.172675-2-faithilikerun@gmail.com>
On Sun, 2022-10-16 at 23:05 +0800, Sam Li wrote:
> Use scripts/update-linux-headers.sh to update virtio-blk headers
> from Dmitry's "virtio-blk:add support for zoned block devices"
> linux patch. There is a link for more information:
> https://github.com/dmitry-fomichev/virtblk-zbd
>
> Signed-off-by: Sam Li <faithilikerun@gmail.com>
> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
> Signed-off-by: Sam Li <faithilikerun@gmail.com>
the duplicate sign-off is not needed. With this,
Reviewed-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
> ---
> include/standard-headers/linux/virtio_blk.h | 109 ++++++++++++++++++++
> 1 file changed, 109 insertions(+)
>
> diff --git a/include/standard-headers/linux/virtio_blk.h b/include/standard-
> headers/linux/virtio_blk.h
> index 2dcc90826a..490bd21c76 100644
> --- a/include/standard-headers/linux/virtio_blk.h
> +++ b/include/standard-headers/linux/virtio_blk.h
> @@ -40,6 +40,7 @@
> #define VIRTIO_BLK_F_MQ 12 /* support more than one vq */
> #define VIRTIO_BLK_F_DISCARD 13 /* DISCARD is supported */
> #define VIRTIO_BLK_F_WRITE_ZEROES 14 /* WRITE ZEROES is supported */
> +#define VIRTIO_BLK_F_ZONED 17 /* Zoned block device */
>
> /* Legacy feature bits */
> #ifndef VIRTIO_BLK_NO_LEGACY
> @@ -119,6 +120,20 @@ struct virtio_blk_config {
> uint8_t write_zeroes_may_unmap;
>
> uint8_t unused1[3];
> +
> + /* Secure erase fields that are defined in the virtio spec */
> + uint8_t sec_erase[12];
> +
> + /* Zoned block device characteristics (if VIRTIO_BLK_F_ZONED) */
> + struct virtio_blk_zoned_characteristics {
> + __virtio32 zone_sectors;
> + __virtio32 max_open_zones;
> + __virtio32 max_active_zones;
> + __virtio32 max_append_sectors;
> + __virtio32 write_granularity;
> + uint8_t model;
> + uint8_t unused2[3];
> + } zoned;
> } QEMU_PACKED;
>
> /*
> @@ -153,6 +168,27 @@ struct virtio_blk_config {
> /* Write zeroes command */
> #define VIRTIO_BLK_T_WRITE_ZEROES 13
>
> +/* Zone append command */
> +#define VIRTIO_BLK_T_ZONE_APPEND 15
> +
> +/* Report zones command */
> +#define VIRTIO_BLK_T_ZONE_REPORT 16
> +
> +/* Open zone command */
> +#define VIRTIO_BLK_T_ZONE_OPEN 18
> +
> +/* Close zone command */
> +#define VIRTIO_BLK_T_ZONE_CLOSE 20
> +
> +/* Finish zone command */
> +#define VIRTIO_BLK_T_ZONE_FINISH 22
> +
> +/* Reset zone command */
> +#define VIRTIO_BLK_T_ZONE_RESET 24
> +
> +/* Reset All zones command */
> +#define VIRTIO_BLK_T_ZONE_RESET_ALL 26
> +
> #ifndef VIRTIO_BLK_NO_LEGACY
> /* Barrier before this op. */
> #define VIRTIO_BLK_T_BARRIER 0x80000000
> @@ -172,6 +208,72 @@ struct virtio_blk_outhdr {
> __virtio64 sector;
> };
>
> +/*
> + * Supported zoned device models.
> + */
> +
> +/* Regular block device */
> +#define VIRTIO_BLK_Z_NONE 0
> +/* Host-managed zoned device */
> +#define VIRTIO_BLK_Z_HM 1
> +/* Host-aware zoned device */
> +#define VIRTIO_BLK_Z_HA 2
> +
> +/*
> + * Zone descriptor. A part of VIRTIO_BLK_T_ZONE_REPORT command reply.
> + */
> +struct virtio_blk_zone_descriptor {
> + /* Zone capacity */
> + __virtio64 z_cap;
> + /* The starting sector of the zone */
> + __virtio64 z_start;
> + /* Zone write pointer position in sectors */
> + __virtio64 z_wp;
> + /* Zone type */
> + uint8_t z_type;
> + /* Zone state */
> + uint8_t z_state;
> + uint8_t reserved[38];
> +};
> +
> +struct virtio_blk_zone_report {
> + __virtio64 nr_zones;
> + uint8_t reserved[56];
> + struct virtio_blk_zone_descriptor zones[];
> +};
> +
> +/*
> + * Supported zone types.
> + */
> +
> +/* Conventional zone */
> +#define VIRTIO_BLK_ZT_CONV 1
> +/* Sequential Write Required zone */
> +#define VIRTIO_BLK_ZT_SWR 2
> +/* Sequential Write Preferred zone */
> +#define VIRTIO_BLK_ZT_SWP 3
> +
> +/*
> + * Zone states that are available for zones of all types.
> + */
> +
> +/* Not a write pointer (conventional zones only) */
> +#define VIRTIO_BLK_ZS_NOT_WP 0
> +/* Empty */
> +#define VIRTIO_BLK_ZS_EMPTY 1
> +/* Implicitly Open */
> +#define VIRTIO_BLK_ZS_IOPEN 2
> +/* Explicitly Open */
> +#define VIRTIO_BLK_ZS_EOPEN 3
> +/* Closed */
> +#define VIRTIO_BLK_ZS_CLOSED 4
> +/* Read-Only */
> +#define VIRTIO_BLK_ZS_RDONLY 13
> +/* Full */
> +#define VIRTIO_BLK_ZS_FULL 14
> +/* Offline */
> +#define VIRTIO_BLK_ZS_OFFLINE 15
> +
> /* Unmap this range (only valid for write zeroes command) */
> #define VIRTIO_BLK_WRITE_ZEROES_FLAG_UNMAP 0x00000001
>
> @@ -198,4 +300,11 @@ struct virtio_scsi_inhdr {
> #define VIRTIO_BLK_S_OK 0
> #define VIRTIO_BLK_S_IOERR 1
> #define VIRTIO_BLK_S_UNSUPP 2
> +
> +/* Error codes that are specific to zoned block devices */
> +#define VIRTIO_BLK_S_ZONE_INVALID_CMD 3
> +#define VIRTIO_BLK_S_ZONE_UNALIGNED_WP 4
> +#define VIRTIO_BLK_S_ZONE_OPEN_RESOURCE 5
> +#define VIRTIO_BLK_S_ZONE_ACTIVE_RESOURCE 6
> +
> #endif /* _LINUX_VIRTIO_BLK_H */
next prev parent reply other threads:[~2022-10-17 0:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-16 15:05 [RFC v3 0/2] Add zoned storage emulation to virtio-blk driver Sam Li
2022-10-16 15:05 ` [RFC v3 1/2] include: update virtio_blk headers from Linux 5.19-rc2+ Sam Li
2022-10-17 0:53 ` Dmitry Fomichev [this message]
2022-10-17 2:12 ` Damien Le Moal
2022-10-16 15:05 ` [RFC v3 2/2] virtio-blk: add zoned storage emulation for zoned devices Sam Li
2022-10-17 0:59 ` Dmitry Fomichev
2022-10-18 8:56 ` Sam Li
2022-10-23 2:08 ` Dmitry Fomichev
2022-10-23 3:01 ` Sam Li
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=e5ee5de51ec437cc97b71ad2a7e2a969e21cbcce.camel@wdc.com \
--to=dmitry.fomichev@wdc.com \
--cc=damien.lemoal@opensource.wdc.com \
--cc=faithilikerun@gmail.com \
--cc=hare@suse.de \
--cc=hreitz@redhat.com \
--cc=kwolf@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=raphael.norwitz@nutanix.com \
--cc=stefanha@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).