diff mbox series

[RFC,v3,1/2] include: update virtio_blk headers from Linux 5.19-rc2+

Message ID 20221016150506.172675-2-faithilikerun@gmail.com
State New
Headers show
Series Add zoned storage emulation to virtio-blk driver | expand

Commit Message

Sam Li Oct. 16, 2022, 3:05 p.m. UTC
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>
---
 include/standard-headers/linux/virtio_blk.h | 109 ++++++++++++++++++++
 1 file changed, 109 insertions(+)

Comments

Dmitry Fomichev Oct. 17, 2022, 12:53 a.m. UTC | #1
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 */
Damien Le Moal Oct. 17, 2022, 2:12 a.m. UTC | #2
On 10/17/22 09:53, Dmitry Fomichev wrote:
> 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>

The mention of the linux kernel version should be removed from the patch
title as the changes are not included in any upstream kernel yet.

> 
>> ---
>>  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 */
>
diff mbox series

Patch

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 */