All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/10] vDPA: allow userspace query virito-block device
@ 2024-02-18 18:55 Zhu Lingshan
  2024-02-18 18:55 ` [PATCH 01/10] vDPA: report virtio-block capacity to user space Zhu Lingshan
                   ` (11 more replies)
  0 siblings, 12 replies; 34+ messages in thread
From: Zhu Lingshan @ 2024-02-18 18:55 UTC (permalink / raw)
  To: jasowang, mst; +Cc: virtualization, Zhu Lingshan

This series allows the user space applications query vDPA virtio-block
device inforamtion.

testing on vdpa_sim_blk, iproute2 output:
sudo ./vdpa/vdpa dev config show -jp vdpa_blk0
{
    "config": {
        "vdpa_blk0": {
            "capacity": 262144,
            "segment size": 4096,
            "block size": 512,
            "max segments in a request": 32,
            "num of queues": 1,
            "logical blocks per physical block (log2)": 0,
            "offset of first aligned logical block": 0,
            "minimum io size": 1,
            "optimal io size": 1,
            "maximum discard sectors for a segment": 4294967295,
            "max discard segments in a command": 1,
            "discard sector alignment": 512,
            "max write zeros sectors in a segment": 4294967295,
            "max write zero segments": 1,
            "read only": false,
            "flush command support": true
        }
    }
}

Please help review

Thanks
Zhu Lingshan

Zhu Lingshan (10):
  vDPA: report virtio-block capacity to user space
  vDPA: report virtio-block max segment size to user space
  vDPA: report virtio-block block-size to user space
  vDPA: report virtio-block max segments in a request to user space
  vDPA: report virtio-block MQ info to user space
  vDPA: report virtio-block topology info to user space
  vDPA: report virtio-block discarding configuration to user space
  vDPA: report virtio-block write zeroes configuration to user space
  vDPA: report virtio-block read-only info to user space
  vDPA: report virtio-blk flush info to user space

 drivers/vdpa/vdpa.c       | 212 ++++++++++++++++++++++++++++++++++++++
 include/linux/vdpa.h      |   1 +
 include/uapi/linux/vdpa.h |  17 +++
 3 files changed, 230 insertions(+)

-- 
2.39.3


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH 01/10] vDPA: report virtio-block capacity to user space
  2024-02-18 18:55 [PATCH 00/10] vDPA: allow userspace query virito-block device Zhu Lingshan
@ 2024-02-18 18:55 ` Zhu Lingshan
  2024-03-19 16:43   ` Stefano Garzarella
  2024-02-18 18:55 ` [PATCH 02/10] vDPA: report virtio-block max segment size " Zhu Lingshan
                   ` (10 subsequent siblings)
  11 siblings, 1 reply; 34+ messages in thread
From: Zhu Lingshan @ 2024-02-18 18:55 UTC (permalink / raw)
  To: jasowang, mst; +Cc: virtualization, Zhu Lingshan

This commit allows userspace to query capacity of
a virtio-block device.

Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
---
 drivers/vdpa/vdpa.c       | 35 +++++++++++++++++++++++++++++++++++
 include/linux/vdpa.h      |  1 +
 include/uapi/linux/vdpa.h |  2 ++
 3 files changed, 38 insertions(+)

diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
index d0695680b282..d5ccb618de2b 100644
--- a/drivers/vdpa/vdpa.c
+++ b/drivers/vdpa/vdpa.c
@@ -944,6 +944,38 @@ static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *ms
 	return vdpa_dev_net_mq_config_fill(msg, features_device, &config);
 }
 
+static int
+vdpa_dev_blk_capacity_config_fill(struct sk_buff *msg,
+				  const struct virtio_blk_config *config)
+{
+	u64 val_u64;
+
+	val_u64 = __virtio64_to_cpu(true, config->capacity);
+
+	return nla_put_u64_64bit(msg, VDPA_ATTR_DEV_BLK_CFG_CAPACITY,
+				 val_u64, VDPA_ATTR_PAD);
+}
+
+static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
+				    struct sk_buff *msg)
+{
+	struct virtio_blk_config config = {};
+	u64 features_device;
+
+	vdev->config->get_config(vdev, 0, &config, sizeof(config));
+
+	features_device = vdev->config->get_device_features(vdev);
+
+	if (nla_put_u64_64bit(msg, VDPA_ATTR_DEV_FEATURES, features_device,
+			      VDPA_ATTR_PAD))
+		return -EMSGSIZE;
+
+	if (vdpa_dev_blk_capacity_config_fill(msg, &config))
+		return -EMSGSIZE;
+
+	return 0;
+}
+
 static int
 vdpa_dev_config_fill(struct vdpa_device *vdev, struct sk_buff *msg, u32 portid, u32 seq,
 		     int flags, struct netlink_ext_ack *extack)
@@ -988,6 +1020,9 @@ vdpa_dev_config_fill(struct vdpa_device *vdev, struct sk_buff *msg, u32 portid,
 	case VIRTIO_ID_NET:
 		err = vdpa_dev_net_config_fill(vdev, msg);
 		break;
+	case VIRTIO_ID_BLOCK:
+		err = vdpa_dev_blk_config_fill(vdev, msg);
+		break;
 	default:
 		err = -EOPNOTSUPP;
 		break;
diff --git a/include/linux/vdpa.h b/include/linux/vdpa.h
index db15ac07f8a6..a184aa6538cb 100644
--- a/include/linux/vdpa.h
+++ b/include/linux/vdpa.h
@@ -7,6 +7,7 @@
 #include <linux/interrupt.h>
 #include <linux/vhost_iotlb.h>
 #include <linux/virtio_net.h>
+#include <linux/virtio_blk.h>
 #include <linux/if_ether.h>
 
 /**
diff --git a/include/uapi/linux/vdpa.h b/include/uapi/linux/vdpa.h
index 54b649ab0f22..1bf69226cb96 100644
--- a/include/uapi/linux/vdpa.h
+++ b/include/uapi/linux/vdpa.h
@@ -56,6 +56,8 @@ enum vdpa_attr {
 	/* virtio features that are provisioned to the vDPA device */
 	VDPA_ATTR_DEV_FEATURES,                 /* u64 */
 
+	VDPA_ATTR_DEV_BLK_CFG_CAPACITY,		/* u64 */
+
 	/* new attributes must be added above here */
 	VDPA_ATTR_MAX,
 };
-- 
2.39.3


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 02/10] vDPA: report virtio-block max segment size to user space
  2024-02-18 18:55 [PATCH 00/10] vDPA: allow userspace query virito-block device Zhu Lingshan
  2024-02-18 18:55 ` [PATCH 01/10] vDPA: report virtio-block capacity to user space Zhu Lingshan
@ 2024-02-18 18:55 ` Zhu Lingshan
  2024-03-19 16:04   ` Stefano Garzarella
  2024-02-18 18:55 ` [PATCH 03/10] vDPA: report virtio-block block-size " Zhu Lingshan
                   ` (9 subsequent siblings)
  11 siblings, 1 reply; 34+ messages in thread
From: Zhu Lingshan @ 2024-02-18 18:55 UTC (permalink / raw)
  To: jasowang, mst; +Cc: virtualization, Zhu Lingshan

This commit allows reporting the max size of any
single segment of virtio-block devices to user space.

Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
---
 drivers/vdpa/vdpa.c       | 17 +++++++++++++++++
 include/uapi/linux/vdpa.h |  1 +
 2 files changed, 18 insertions(+)

diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
index d5ccb618de2b..ee1472d32b0d 100644
--- a/drivers/vdpa/vdpa.c
+++ b/drivers/vdpa/vdpa.c
@@ -956,6 +956,20 @@ vdpa_dev_blk_capacity_config_fill(struct sk_buff *msg,
 				 val_u64, VDPA_ATTR_PAD);
 }
 
+static int
+vdpa_dev_blk_seg_size_config_fill(struct sk_buff *msg, u64 features,
+				  const struct virtio_blk_config *config)
+{
+	u32 val_u32;
+
+	if ((features & BIT_ULL(VIRTIO_BLK_F_SIZE_MAX)) == 0)
+		return 0;
+
+	val_u32 = __virtio32_to_cpu(true, config->size_max);
+
+	return nla_put_u32(msg, VDPA_ATTR_DEV_BLK_CFG_SEG_SIZE, val_u32);
+}
+
 static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
 				    struct sk_buff *msg)
 {
@@ -973,6 +987,9 @@ static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
 	if (vdpa_dev_blk_capacity_config_fill(msg, &config))
 		return -EMSGSIZE;
 
+	if (vdpa_dev_blk_seg_size_config_fill(msg, features_device, &config))
+		return -EMSGSIZE;
+
 	return 0;
 }
 
diff --git a/include/uapi/linux/vdpa.h b/include/uapi/linux/vdpa.h
index 1bf69226cb96..586bce3c906a 100644
--- a/include/uapi/linux/vdpa.h
+++ b/include/uapi/linux/vdpa.h
@@ -57,6 +57,7 @@ enum vdpa_attr {
 	VDPA_ATTR_DEV_FEATURES,                 /* u64 */
 
 	VDPA_ATTR_DEV_BLK_CFG_CAPACITY,		/* u64 */
+	VDPA_ATTR_DEV_BLK_CFG_SEG_SIZE,		/* u32 */
 
 	/* new attributes must be added above here */
 	VDPA_ATTR_MAX,
-- 
2.39.3


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 03/10] vDPA: report virtio-block block-size to user space
  2024-02-18 18:55 [PATCH 00/10] vDPA: allow userspace query virito-block device Zhu Lingshan
  2024-02-18 18:55 ` [PATCH 01/10] vDPA: report virtio-block capacity to user space Zhu Lingshan
  2024-02-18 18:55 ` [PATCH 02/10] vDPA: report virtio-block max segment size " Zhu Lingshan
@ 2024-02-18 18:55 ` Zhu Lingshan
  2024-03-19 16:43   ` Stefano Garzarella
  2024-02-18 18:56 ` [PATCH 04/10] vDPA: report virtio-block max segments in a request " Zhu Lingshan
                   ` (8 subsequent siblings)
  11 siblings, 1 reply; 34+ messages in thread
From: Zhu Lingshan @ 2024-02-18 18:55 UTC (permalink / raw)
  To: jasowang, mst; +Cc: virtualization, Zhu Lingshan

This commit allows reporting the block size of a
virtio-block device to user space.

Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
---
 drivers/vdpa/vdpa.c       | 18 ++++++++++++++++++
 include/uapi/linux/vdpa.h |  1 +
 2 files changed, 19 insertions(+)

diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
index ee1472d32b0d..cc8f41d24c9c 100644
--- a/drivers/vdpa/vdpa.c
+++ b/drivers/vdpa/vdpa.c
@@ -970,6 +970,21 @@ vdpa_dev_blk_seg_size_config_fill(struct sk_buff *msg, u64 features,
 	return nla_put_u32(msg, VDPA_ATTR_DEV_BLK_CFG_SEG_SIZE, val_u32);
 }
 
+/* fill the block size*/
+static int
+vdpa_dev_blk_block_size_config_fill(struct sk_buff *msg, u64 features,
+				    const struct virtio_blk_config *config)
+{
+	u32 val_u32;
+
+	if ((features & BIT_ULL(VIRTIO_BLK_F_BLK_SIZE)) == 0)
+		return 0;
+
+	val_u32 = __virtio32_to_cpu(true, config->blk_size);
+
+	return nla_put_u32(msg, VDPA_ATTR_DEV_BLK_CFG_BLK_SIZE, val_u32);
+}
+
 static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
 				    struct sk_buff *msg)
 {
@@ -990,6 +1005,9 @@ static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
 	if (vdpa_dev_blk_seg_size_config_fill(msg, features_device, &config))
 		return -EMSGSIZE;
 
+	if (vdpa_dev_blk_block_size_config_fill(msg, features_device, &config))
+		return -EMSGSIZE;
+
 	return 0;
 }
 
diff --git a/include/uapi/linux/vdpa.h b/include/uapi/linux/vdpa.h
index 586bce3c906a..f3baf7ea7d6d 100644
--- a/include/uapi/linux/vdpa.h
+++ b/include/uapi/linux/vdpa.h
@@ -58,6 +58,7 @@ enum vdpa_attr {
 
 	VDPA_ATTR_DEV_BLK_CFG_CAPACITY,		/* u64 */
 	VDPA_ATTR_DEV_BLK_CFG_SEG_SIZE,		/* u32 */
+	VDPA_ATTR_DEV_BLK_CFG_BLK_SIZE,		/* u32 */
 
 	/* new attributes must be added above here */
 	VDPA_ATTR_MAX,
-- 
2.39.3


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 04/10] vDPA: report virtio-block max segments in a request to user space
  2024-02-18 18:55 [PATCH 00/10] vDPA: allow userspace query virito-block device Zhu Lingshan
                   ` (2 preceding siblings ...)
  2024-02-18 18:55 ` [PATCH 03/10] vDPA: report virtio-block block-size " Zhu Lingshan
@ 2024-02-18 18:56 ` Zhu Lingshan
  2024-03-19 16:43   ` Stefano Garzarella
  2024-02-18 18:56 ` [PATCH 05/10] vDPA: report virtio-block MQ info " Zhu Lingshan
                   ` (7 subsequent siblings)
  11 siblings, 1 reply; 34+ messages in thread
From: Zhu Lingshan @ 2024-02-18 18:56 UTC (permalink / raw)
  To: jasowang, mst; +Cc: virtualization, Zhu Lingshan

This commit allows vDPA reporting the maximum number of
segments in a request of virtio-block devices to
user space.

Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
---
 drivers/vdpa/vdpa.c       | 17 +++++++++++++++++
 include/uapi/linux/vdpa.h |  1 +
 2 files changed, 18 insertions(+)

diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
index cc8f41d24c9c..8d00e9976aba 100644
--- a/drivers/vdpa/vdpa.c
+++ b/drivers/vdpa/vdpa.c
@@ -985,6 +985,20 @@ vdpa_dev_blk_block_size_config_fill(struct sk_buff *msg, u64 features,
 	return nla_put_u32(msg, VDPA_ATTR_DEV_BLK_CFG_BLK_SIZE, val_u32);
 }
 
+static int
+vdpa_dev_blk_seg_max_config_fill(struct sk_buff *msg, u64 features,
+				 const struct virtio_blk_config *config)
+{
+	u32 val_u32;
+
+	if ((features & BIT_ULL(VIRTIO_BLK_F_SEG_MAX)) == 0)
+		return 0;
+
+	val_u32 = __virtio32_to_cpu(true, config->seg_max);
+
+	return nla_put_u32(msg, VDPA_ATTR_DEV_BLK_CFG_SEG_MAX, val_u32);
+}
+
 static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
 				    struct sk_buff *msg)
 {
@@ -1008,6 +1022,9 @@ static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
 	if (vdpa_dev_blk_block_size_config_fill(msg, features_device, &config))
 		return -EMSGSIZE;
 
+	if (vdpa_dev_blk_seg_max_config_fill(msg, features_device, &config))
+		return -EMSGSIZE;
+
 	return 0;
 }
 
diff --git a/include/uapi/linux/vdpa.h b/include/uapi/linux/vdpa.h
index f3baf7ea7d6d..2dc92fca2052 100644
--- a/include/uapi/linux/vdpa.h
+++ b/include/uapi/linux/vdpa.h
@@ -59,6 +59,7 @@ enum vdpa_attr {
 	VDPA_ATTR_DEV_BLK_CFG_CAPACITY,		/* u64 */
 	VDPA_ATTR_DEV_BLK_CFG_SEG_SIZE,		/* u32 */
 	VDPA_ATTR_DEV_BLK_CFG_BLK_SIZE,		/* u32 */
+	VDPA_ATTR_DEV_BLK_CFG_SEG_MAX,		/* u32 */
 
 	/* new attributes must be added above here */
 	VDPA_ATTR_MAX,
-- 
2.39.3


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 05/10] vDPA: report virtio-block MQ info to user space
  2024-02-18 18:55 [PATCH 00/10] vDPA: allow userspace query virito-block device Zhu Lingshan
                   ` (3 preceding siblings ...)
  2024-02-18 18:56 ` [PATCH 04/10] vDPA: report virtio-block max segments in a request " Zhu Lingshan
@ 2024-02-18 18:56 ` Zhu Lingshan
  2024-03-19 16:44   ` Stefano Garzarella
  2024-02-18 18:56 ` [PATCH 06/10] vDPA: report virtio-block topology " Zhu Lingshan
                   ` (6 subsequent siblings)
  11 siblings, 1 reply; 34+ messages in thread
From: Zhu Lingshan @ 2024-02-18 18:56 UTC (permalink / raw)
  To: jasowang, mst; +Cc: virtualization, Zhu Lingshan

This commits allows vDPA reporting virtio-block multi-queue
configuration to user sapce.

Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
---
 drivers/vdpa/vdpa.c       | 16 ++++++++++++++++
 include/uapi/linux/vdpa.h |  1 +
 2 files changed, 17 insertions(+)

diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
index 8d00e9976aba..26e8768b869a 100644
--- a/drivers/vdpa/vdpa.c
+++ b/drivers/vdpa/vdpa.c
@@ -999,6 +999,19 @@ vdpa_dev_blk_seg_max_config_fill(struct sk_buff *msg, u64 features,
 	return nla_put_u32(msg, VDPA_ATTR_DEV_BLK_CFG_SEG_MAX, val_u32);
 }
 
+static int vdpa_dev_blk_mq_config_fill(struct sk_buff *msg, u64 features,
+				       const struct virtio_blk_config *config)
+{
+	u16 val_u16;
+
+	if ((features & BIT_ULL(VIRTIO_BLK_F_MQ)) == 0)
+		return 0;
+
+	val_u16 = __virtio16_to_cpu(true, config->num_queues);
+
+	return nla_put_u16(msg, VDPA_ATTR_DEV_BLK_CFG_NUM_QUEUES, val_u16);
+}
+
 static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
 				    struct sk_buff *msg)
 {
@@ -1025,6 +1038,9 @@ static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
 	if (vdpa_dev_blk_seg_max_config_fill(msg, features_device, &config))
 		return -EMSGSIZE;
 
+	if (vdpa_dev_blk_mq_config_fill(msg, features_device, &config))
+		return -EMSGSIZE;
+
 	return 0;
 }
 
diff --git a/include/uapi/linux/vdpa.h b/include/uapi/linux/vdpa.h
index 2dc92fca2052..3c8e3c87a864 100644
--- a/include/uapi/linux/vdpa.h
+++ b/include/uapi/linux/vdpa.h
@@ -60,6 +60,7 @@ enum vdpa_attr {
 	VDPA_ATTR_DEV_BLK_CFG_SEG_SIZE,		/* u32 */
 	VDPA_ATTR_DEV_BLK_CFG_BLK_SIZE,		/* u32 */
 	VDPA_ATTR_DEV_BLK_CFG_SEG_MAX,		/* u32 */
+	VDPA_ATTR_DEV_BLK_CFG_NUM_QUEUES,	/* u16 */
 
 	/* new attributes must be added above here */
 	VDPA_ATTR_MAX,
-- 
2.39.3


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 06/10] vDPA: report virtio-block topology info to user space
  2024-02-18 18:55 [PATCH 00/10] vDPA: allow userspace query virito-block device Zhu Lingshan
                   ` (4 preceding siblings ...)
  2024-02-18 18:56 ` [PATCH 05/10] vDPA: report virtio-block MQ info " Zhu Lingshan
@ 2024-02-18 18:56 ` Zhu Lingshan
  2024-03-19 16:44   ` Stefano Garzarella
  2024-02-18 18:56 ` [PATCH 07/10] vDPA: report virtio-block discarding configuration " Zhu Lingshan
                   ` (5 subsequent siblings)
  11 siblings, 1 reply; 34+ messages in thread
From: Zhu Lingshan @ 2024-02-18 18:56 UTC (permalink / raw)
  To: jasowang, mst; +Cc: virtualization, Zhu Lingshan

This commit allows vDPA reporting topology information of
virtio-blk devices to user space, includes:
1) the number of logical blocks per physical block
2) offset of first aligned logical block
3) suggested minimum I/O size in blocks
4) optimal (suggested maximum) I/O size in blocks

Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
---
 drivers/vdpa/vdpa.c       | 32 ++++++++++++++++++++++++++++++++
 include/uapi/linux/vdpa.h |  4 ++++
 2 files changed, 36 insertions(+)

diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
index 26e8768b869a..dfd9aa5779dc 100644
--- a/drivers/vdpa/vdpa.c
+++ b/drivers/vdpa/vdpa.c
@@ -1012,6 +1012,35 @@ static int vdpa_dev_blk_mq_config_fill(struct sk_buff *msg, u64 features,
 	return nla_put_u16(msg, VDPA_ATTR_DEV_BLK_CFG_NUM_QUEUES, val_u16);
 }
 
+static int vdpa_dev_blk_topology_config_fill(struct sk_buff *msg, u64 features,
+				       const struct virtio_blk_config *config)
+{
+	u16 min_io_size;
+	u32 opt_io_size;
+
+	if ((features & BIT_ULL(VIRTIO_BLK_F_TOPOLOGY)) == 0)
+		return 0;
+
+	min_io_size = __virtio16_to_cpu(true, config->min_io_size);
+	opt_io_size = __virtio32_to_cpu(true, config->opt_io_size);
+
+	if (nla_put_u8(msg, VDPA_ATTR_DEV_BLK_CFG_PHY_BLK_EXP,
+	    config->physical_block_exp))
+		return -EMSGSIZE;
+
+	if (nla_put_u8(msg, VDPA_ATTR_DEV_BLK_CFG_ALIGN_OFFSET,
+	    config->alignment_offset))
+		return -EMSGSIZE;
+
+	if (nla_put_u16(msg, VDPA_ATTR_DEV_BLK_CFG_MIN_IO_SIZE, min_io_size))
+		return -EMSGSIZE;
+
+	if (nla_put_u32(msg, VDPA_ATTR_DEV_BLK_CFG_OPT_IO_SIZE, opt_io_size))
+		return -EMSGSIZE;
+
+	return 0;
+}
+
 static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
 				    struct sk_buff *msg)
 {
@@ -1041,6 +1070,9 @@ static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
 	if (vdpa_dev_blk_mq_config_fill(msg, features_device, &config))
 		return -EMSGSIZE;
 
+	if (vdpa_dev_blk_topology_config_fill(msg, features_device, &config))
+		return -EMSGSIZE;
+
 	return 0;
 }
 
diff --git a/include/uapi/linux/vdpa.h b/include/uapi/linux/vdpa.h
index 3c8e3c87a864..5cc70614c97a 100644
--- a/include/uapi/linux/vdpa.h
+++ b/include/uapi/linux/vdpa.h
@@ -61,6 +61,10 @@ enum vdpa_attr {
 	VDPA_ATTR_DEV_BLK_CFG_BLK_SIZE,		/* u32 */
 	VDPA_ATTR_DEV_BLK_CFG_SEG_MAX,		/* u32 */
 	VDPA_ATTR_DEV_BLK_CFG_NUM_QUEUES,	/* u16 */
+	VDPA_ATTR_DEV_BLK_CFG_PHY_BLK_EXP,	/* u8 */
+	VDPA_ATTR_DEV_BLK_CFG_ALIGN_OFFSET,	/* u8 */
+	VDPA_ATTR_DEV_BLK_CFG_MIN_IO_SIZE,	/* u16 */
+	VDPA_ATTR_DEV_BLK_CFG_OPT_IO_SIZE,	/* u32 */
 
 	/* new attributes must be added above here */
 	VDPA_ATTR_MAX,
-- 
2.39.3


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 07/10] vDPA: report virtio-block discarding configuration to user space
  2024-02-18 18:55 [PATCH 00/10] vDPA: allow userspace query virito-block device Zhu Lingshan
                   ` (5 preceding siblings ...)
  2024-02-18 18:56 ` [PATCH 06/10] vDPA: report virtio-block topology " Zhu Lingshan
@ 2024-02-18 18:56 ` Zhu Lingshan
  2024-03-19 16:44   ` Stefano Garzarella
  2024-02-18 18:56 ` [PATCH 08/10] vDPA: report virtio-block write zeroes " Zhu Lingshan
                   ` (4 subsequent siblings)
  11 siblings, 1 reply; 34+ messages in thread
From: Zhu Lingshan @ 2024-02-18 18:56 UTC (permalink / raw)
  To: jasowang, mst; +Cc: virtualization, Zhu Lingshan

This commit reports virtio-blk discarding configuration
to user space,includes:
1) the maximum discard sectors
2) maximum number of discard segments for the block driver to use
3) the alignment for splitting a discarding request

Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
---
 drivers/vdpa/vdpa.c       | 26 ++++++++++++++++++++++++++
 include/uapi/linux/vdpa.h |  3 +++
 2 files changed, 29 insertions(+)

diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
index dfd9aa5779dc..bf3fa90908a7 100644
--- a/drivers/vdpa/vdpa.c
+++ b/drivers/vdpa/vdpa.c
@@ -1041,6 +1041,29 @@ static int vdpa_dev_blk_topology_config_fill(struct sk_buff *msg, u64 features,
 	return 0;
 }
 
+static int vdpa_dev_blk_discard_config_fill(struct sk_buff *msg, u64 features,
+				       const struct virtio_blk_config *config)
+{
+	u32 val_u32;
+
+	if ((features & BIT_ULL(VIRTIO_BLK_F_DISCARD)) == 0)
+		return 0;
+
+	val_u32 = __virtio32_to_cpu(true, config->max_discard_sectors);
+	if (nla_put_u32(msg, VDPA_ATTR_DEV_BLK_CFG_MAX_DISCARD_SEC, val_u32))
+		return -EMSGSIZE;
+
+	val_u32 = __virtio32_to_cpu(true, config->max_discard_seg);
+	if (nla_put_u32(msg, VDPA_ATTR_DEV_BLK_CFG_MAX_DISCARD_SEG, val_u32))
+		return -EMSGSIZE;
+
+	val_u32 = __virtio32_to_cpu(true, config->discard_sector_alignment);
+	if (nla_put_u32(msg, VDPA_ATTR_DEV_BLK_CFG_DISCARD_SEC_ALIGN, val_u32))
+		return -EMSGSIZE;
+
+	return 0;
+}
+
 static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
 				    struct sk_buff *msg)
 {
@@ -1073,6 +1096,9 @@ static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
 	if (vdpa_dev_blk_topology_config_fill(msg, features_device, &config))
 		return -EMSGSIZE;
 
+	if (vdpa_dev_blk_discard_config_fill(msg, features_device, &config))
+		return -EMSGSIZE;
+
 	return 0;
 }
 
diff --git a/include/uapi/linux/vdpa.h b/include/uapi/linux/vdpa.h
index 5cc70614c97a..30887931a220 100644
--- a/include/uapi/linux/vdpa.h
+++ b/include/uapi/linux/vdpa.h
@@ -65,6 +65,9 @@ enum vdpa_attr {
 	VDPA_ATTR_DEV_BLK_CFG_ALIGN_OFFSET,	/* u8 */
 	VDPA_ATTR_DEV_BLK_CFG_MIN_IO_SIZE,	/* u16 */
 	VDPA_ATTR_DEV_BLK_CFG_OPT_IO_SIZE,	/* u32 */
+	VDPA_ATTR_DEV_BLK_CFG_MAX_DISCARD_SEC,	/* u32 */
+	VDPA_ATTR_DEV_BLK_CFG_MAX_DISCARD_SEG,	/* u32 */
+	VDPA_ATTR_DEV_BLK_CFG_DISCARD_SEC_ALIGN,/* u32 */
 
 	/* new attributes must be added above here */
 	VDPA_ATTR_MAX,
-- 
2.39.3


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 08/10] vDPA: report virtio-block write zeroes configuration to user space
  2024-02-18 18:55 [PATCH 00/10] vDPA: allow userspace query virito-block device Zhu Lingshan
                   ` (6 preceding siblings ...)
  2024-02-18 18:56 ` [PATCH 07/10] vDPA: report virtio-block discarding configuration " Zhu Lingshan
@ 2024-02-18 18:56 ` Zhu Lingshan
  2024-03-19 16:36   ` Stefano Garzarella
  2024-02-18 18:56 ` [PATCH 09/10] vDPA: report virtio-block read-only info " Zhu Lingshan
                   ` (3 subsequent siblings)
  11 siblings, 1 reply; 34+ messages in thread
From: Zhu Lingshan @ 2024-02-18 18:56 UTC (permalink / raw)
  To: jasowang, mst; +Cc: virtualization, Zhu Lingshan

This commits reports write zeroes configuration of
virtio-block devices to user space, includes:
1)maximum write zeroes sectors size
2)maximum write zeroes segment number

Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
---
 drivers/vdpa/vdpa.c       | 23 +++++++++++++++++++++++
 include/uapi/linux/vdpa.h |  2 ++
 2 files changed, 25 insertions(+)

diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
index bf3fa90908a7..adbcbc7b18b2 100644
--- a/drivers/vdpa/vdpa.c
+++ b/drivers/vdpa/vdpa.c
@@ -1064,6 +1064,26 @@ static int vdpa_dev_blk_discard_config_fill(struct sk_buff *msg, u64 features,
 	return 0;
 }
 
+static int
+vdpa_dev_blk_write_zeroes_config_fill(struct sk_buff *msg, u64 features,
+				     const struct virtio_blk_config *config)
+{
+	u32 val_u32;
+
+	if ((features & BIT_ULL(VIRTIO_BLK_F_WRITE_ZEROES)) == 0)
+		return 0;
+
+	val_u32 = __virtio32_to_cpu(true, config->max_write_zeroes_sectors);
+	if (nla_put_u32(msg, VDPA_ATTR_DEV_BLK_CFG_MAX_WRITE_ZEROES_SEC, val_u32))
+		return -EMSGSIZE;
+
+	val_u32 = __virtio32_to_cpu(true, config->max_write_zeroes_seg);
+	if (nla_put_u32(msg, VDPA_ATTR_DEV_BLK_CFG_MAX_WRITE_ZEROES_SEG, val_u32))
+		return -EMSGSIZE;
+
+	return 0;
+}
+
 static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
 				    struct sk_buff *msg)
 {
@@ -1099,6 +1119,9 @@ static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
 	if (vdpa_dev_blk_discard_config_fill(msg, features_device, &config))
 		return -EMSGSIZE;
 
+	if (vdpa_dev_blk_write_zeroes_config_fill(msg, features_device, &config))
+		return -EMSGSIZE;
+
 	return 0;
 }
 
diff --git a/include/uapi/linux/vdpa.h b/include/uapi/linux/vdpa.h
index 30887931a220..797d5708492f 100644
--- a/include/uapi/linux/vdpa.h
+++ b/include/uapi/linux/vdpa.h
@@ -68,6 +68,8 @@ enum vdpa_attr {
 	VDPA_ATTR_DEV_BLK_CFG_MAX_DISCARD_SEC,	/* u32 */
 	VDPA_ATTR_DEV_BLK_CFG_MAX_DISCARD_SEG,	/* u32 */
 	VDPA_ATTR_DEV_BLK_CFG_DISCARD_SEC_ALIGN,/* u32 */
+	VDPA_ATTR_DEV_BLK_CFG_MAX_WRITE_ZEROES_SEC,	/* u32 */
+	VDPA_ATTR_DEV_BLK_CFG_MAX_WRITE_ZEROES_SEG,	/* u32 */
 
 	/* new attributes must be added above here */
 	VDPA_ATTR_MAX,
-- 
2.39.3


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 09/10] vDPA: report virtio-block read-only info to user space
  2024-02-18 18:55 [PATCH 00/10] vDPA: allow userspace query virito-block device Zhu Lingshan
                   ` (7 preceding siblings ...)
  2024-02-18 18:56 ` [PATCH 08/10] vDPA: report virtio-block write zeroes " Zhu Lingshan
@ 2024-02-18 18:56 ` Zhu Lingshan
  2024-03-19 16:40   ` Stefano Garzarella
  2024-02-18 18:56 ` [PATCH 10/10] vDPA: report virtio-blk flush " Zhu Lingshan
                   ` (2 subsequent siblings)
  11 siblings, 1 reply; 34+ messages in thread
From: Zhu Lingshan @ 2024-02-18 18:56 UTC (permalink / raw)
  To: jasowang, mst; +Cc: virtualization, Zhu Lingshan

This commit report read-only information of
virtio-blk devices to user space.

Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
---
 drivers/vdpa/vdpa.c       | 14 ++++++++++++++
 include/uapi/linux/vdpa.h |  1 +
 2 files changed, 15 insertions(+)

diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
index adbcbc7b18b2..d6fd3cadc44f 100644
--- a/drivers/vdpa/vdpa.c
+++ b/drivers/vdpa/vdpa.c
@@ -1084,6 +1084,17 @@ vdpa_dev_blk_write_zeroes_config_fill(struct sk_buff *msg, u64 features,
 	return 0;
 }
 
+static int vdpa_dev_blk_ro_config_fill(struct sk_buff *msg, u64 features)
+{
+	u8 ro;
+
+	ro = ((features & BIT_ULL(VIRTIO_BLK_F_RO)) == 0) ? 0 : 1;
+	if (nla_put_u8(msg, VDPA_ATTR_DEV_BLK_CFG_READ_ONLY, ro))
+		return -EMSGSIZE;
+
+	return 0;
+}
+
 static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
 				    struct sk_buff *msg)
 {
@@ -1122,6 +1133,9 @@ static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
 	if (vdpa_dev_blk_write_zeroes_config_fill(msg, features_device, &config))
 		return -EMSGSIZE;
 
+	if (vdpa_dev_blk_ro_config_fill(msg, features_device))
+		return -EMSGSIZE;
+
 	return 0;
 }
 
diff --git a/include/uapi/linux/vdpa.h b/include/uapi/linux/vdpa.h
index 797d5708492f..4be8e3a15874 100644
--- a/include/uapi/linux/vdpa.h
+++ b/include/uapi/linux/vdpa.h
@@ -70,6 +70,7 @@ enum vdpa_attr {
 	VDPA_ATTR_DEV_BLK_CFG_DISCARD_SEC_ALIGN,/* u32 */
 	VDPA_ATTR_DEV_BLK_CFG_MAX_WRITE_ZEROES_SEC,	/* u32 */
 	VDPA_ATTR_DEV_BLK_CFG_MAX_WRITE_ZEROES_SEG,	/* u32 */
+	VDPA_ATTR_DEV_BLK_CFG_READ_ONLY,		/* u8 */
 
 	/* new attributes must be added above here */
 	VDPA_ATTR_MAX,
-- 
2.39.3


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH 10/10] vDPA: report virtio-blk flush info to user space
  2024-02-18 18:55 [PATCH 00/10] vDPA: allow userspace query virito-block device Zhu Lingshan
                   ` (8 preceding siblings ...)
  2024-02-18 18:56 ` [PATCH 09/10] vDPA: report virtio-block read-only info " Zhu Lingshan
@ 2024-02-18 18:56 ` Zhu Lingshan
  2024-03-19 16:42   ` Stefano Garzarella
  2024-03-19  6:39 ` [PATCH 00/10] vDPA: allow userspace query virito-block device Michael S. Tsirkin
  2024-03-19 16:49 ` Stefano Garzarella
  11 siblings, 1 reply; 34+ messages in thread
From: Zhu Lingshan @ 2024-02-18 18:56 UTC (permalink / raw)
  To: jasowang, mst; +Cc: virtualization, Zhu Lingshan

This commit reports whether a virtio-blk device
support cache flush command to user space

Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
---
 drivers/vdpa/vdpa.c       | 14 ++++++++++++++
 include/uapi/linux/vdpa.h |  1 +
 2 files changed, 15 insertions(+)

diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
index d6fd3cadc44f..95e1440dbfaa 100644
--- a/drivers/vdpa/vdpa.c
+++ b/drivers/vdpa/vdpa.c
@@ -1095,6 +1095,17 @@ static int vdpa_dev_blk_ro_config_fill(struct sk_buff *msg, u64 features)
 	return 0;
 }
 
+static int vdpa_dev_blk_flush_config_fill(struct sk_buff *msg, u64 features)
+{
+	u8 flush;
+
+	flush = ((features & BIT_ULL(VIRTIO_BLK_F_FLUSH)) == 0) ? 0 : 1;
+	if (nla_put_u8(msg, VDPA_ATTR_DEV_BLK_CFG_FLUSH, flush))
+		return -EMSGSIZE;
+
+	return 0;
+}
+
 static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
 				    struct sk_buff *msg)
 {
@@ -1136,6 +1147,9 @@ static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
 	if (vdpa_dev_blk_ro_config_fill(msg, features_device))
 		return -EMSGSIZE;
 
+	if (vdpa_dev_blk_flush_config_fill(msg, features_device))
+		return -EMSGSIZE;
+
 	return 0;
 }
 
diff --git a/include/uapi/linux/vdpa.h b/include/uapi/linux/vdpa.h
index 4be8e3a15874..43c51698195c 100644
--- a/include/uapi/linux/vdpa.h
+++ b/include/uapi/linux/vdpa.h
@@ -71,6 +71,7 @@ enum vdpa_attr {
 	VDPA_ATTR_DEV_BLK_CFG_MAX_WRITE_ZEROES_SEC,	/* u32 */
 	VDPA_ATTR_DEV_BLK_CFG_MAX_WRITE_ZEROES_SEG,	/* u32 */
 	VDPA_ATTR_DEV_BLK_CFG_READ_ONLY,		/* u8 */
+	VDPA_ATTR_DEV_BLK_CFG_FLUSH,		/* u8 */
 
 	/* new attributes must be added above here */
 	VDPA_ATTR_MAX,
-- 
2.39.3


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* Re: [PATCH 00/10] vDPA: allow userspace query virito-block device
  2024-02-18 18:55 [PATCH 00/10] vDPA: allow userspace query virito-block device Zhu Lingshan
                   ` (9 preceding siblings ...)
  2024-02-18 18:56 ` [PATCH 10/10] vDPA: report virtio-blk flush " Zhu Lingshan
@ 2024-03-19  6:39 ` Michael S. Tsirkin
  2024-03-20  3:30   ` Jason Wang
  2024-03-19 16:49 ` Stefano Garzarella
  11 siblings, 1 reply; 34+ messages in thread
From: Michael S. Tsirkin @ 2024-03-19  6:39 UTC (permalink / raw)
  To: Zhu Lingshan; +Cc: jasowang, virtualization

On Mon, Feb 19, 2024 at 02:55:56AM +0800, Zhu Lingshan wrote:
> This series allows the user space applications query vDPA virtio-block
> device inforamtion.
> 
> testing on vdpa_sim_blk, iproute2 output:
> sudo ./vdpa/vdpa dev config show -jp vdpa_blk0
> {
>     "config": {
>         "vdpa_blk0": {
>             "capacity": 262144,
>             "segment size": 4096,
>             "block size": 512,
>             "max segments in a request": 32,
>             "num of queues": 1,
>             "logical blocks per physical block (log2)": 0,
>             "offset of first aligned logical block": 0,
>             "minimum io size": 1,
>             "optimal io size": 1,
>             "maximum discard sectors for a segment": 4294967295,
>             "max discard segments in a command": 1,
>             "discard sector alignment": 512,
>             "max write zeros sectors in a segment": 4294967295,
>             "max write zero segments": 1,
>             "read only": false,
>             "flush command support": true
>         }
>     }
> }
> 
> Please help review
> 
> Thanks
> Zhu Lingshan

It's been in my tree for a while so it will be in the next pull,
but going forward Jason I'd like to know what kind of
timeline do you have in mind for reviewing vdpa patches?

> Zhu Lingshan (10):
>   vDPA: report virtio-block capacity to user space
>   vDPA: report virtio-block max segment size to user space
>   vDPA: report virtio-block block-size to user space
>   vDPA: report virtio-block max segments in a request to user space
>   vDPA: report virtio-block MQ info to user space
>   vDPA: report virtio-block topology info to user space
>   vDPA: report virtio-block discarding configuration to user space
>   vDPA: report virtio-block write zeroes configuration to user space
>   vDPA: report virtio-block read-only info to user space
>   vDPA: report virtio-blk flush info to user space
> 
>  drivers/vdpa/vdpa.c       | 212 ++++++++++++++++++++++++++++++++++++++
>  include/linux/vdpa.h      |   1 +
>  include/uapi/linux/vdpa.h |  17 +++
>  3 files changed, 230 insertions(+)
> 
> -- 
> 2.39.3


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 02/10] vDPA: report virtio-block max segment size to user space
  2024-02-18 18:55 ` [PATCH 02/10] vDPA: report virtio-block max segment size " Zhu Lingshan
@ 2024-03-19 16:04   ` Stefano Garzarella
  2024-03-29 14:48     ` Zhu, Lingshan
  0 siblings, 1 reply; 34+ messages in thread
From: Stefano Garzarella @ 2024-03-19 16:04 UTC (permalink / raw)
  To: Zhu Lingshan; +Cc: jasowang, mst, virtualization

On Mon, Feb 19, 2024 at 02:55:58AM +0800, Zhu Lingshan wrote:
>This commit allows reporting the max size of any
>single segment of virtio-block devices to user space.
>
>Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
>---
> drivers/vdpa/vdpa.c       | 17 +++++++++++++++++
> include/uapi/linux/vdpa.h |  1 +
> 2 files changed, 18 insertions(+)
>
>diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
>index d5ccb618de2b..ee1472d32b0d 100644
>--- a/drivers/vdpa/vdpa.c
>+++ b/drivers/vdpa/vdpa.c
>@@ -956,6 +956,20 @@ vdpa_dev_blk_capacity_config_fill(struct sk_buff *msg,
> 				 val_u64, VDPA_ATTR_PAD);
> }
>
>+static int
>+vdpa_dev_blk_seg_size_config_fill(struct sk_buff *msg, u64 features,
>+				  const struct virtio_blk_config *config)
>+{
>+	u32 val_u32;
>+
>+	if ((features & BIT_ULL(VIRTIO_BLK_F_SIZE_MAX)) == 0)
>+		return 0;
>+
>+	val_u32 = __virtio32_to_cpu(true, config->size_max);
>+
>+	return nla_put_u32(msg, VDPA_ATTR_DEV_BLK_CFG_SEG_SIZE, val_u32);

Should we call this VDPA_ATTR_DEV_BLK_CFG_SIZE_MAX ?

>+}
>+
> static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
> 				    struct sk_buff *msg)
> {
>@@ -973,6 +987,9 @@ static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
> 	if (vdpa_dev_blk_capacity_config_fill(msg, &config))
> 		return -EMSGSIZE;
>
>+	if (vdpa_dev_blk_seg_size_config_fill(msg, features_device, &config))
>+		return -EMSGSIZE;
>+
> 	return 0;
> }
>
>diff --git a/include/uapi/linux/vdpa.h b/include/uapi/linux/vdpa.h
>index 1bf69226cb96..586bce3c906a 100644
>--- a/include/uapi/linux/vdpa.h
>+++ b/include/uapi/linux/vdpa.h
>@@ -57,6 +57,7 @@ enum vdpa_attr {
> 	VDPA_ATTR_DEV_FEATURES,                 /* u64 */
>
> 	VDPA_ATTR_DEV_BLK_CFG_CAPACITY,		/* u64 */
>+	VDPA_ATTR_DEV_BLK_CFG_SEG_SIZE,		/* u32 */
>
> 	/* new attributes must be added above here */
> 	VDPA_ATTR_MAX,
>-- 
>2.39.3
>
>


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 08/10] vDPA: report virtio-block write zeroes configuration to user space
  2024-02-18 18:56 ` [PATCH 08/10] vDPA: report virtio-block write zeroes " Zhu Lingshan
@ 2024-03-19 16:36   ` Stefano Garzarella
  2024-03-19 17:02     ` Michael S. Tsirkin
  0 siblings, 1 reply; 34+ messages in thread
From: Stefano Garzarella @ 2024-03-19 16:36 UTC (permalink / raw)
  To: Zhu Lingshan; +Cc: jasowang, mst, virtualization

On Mon, Feb 19, 2024 at 02:56:04AM +0800, Zhu Lingshan wrote:
>This commits reports write zeroes configuration of
>virtio-block devices to user space, includes:
>1)maximum write zeroes sectors size
>2)maximum write zeroes segment number
>
>Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
>---
> drivers/vdpa/vdpa.c       | 23 +++++++++++++++++++++++
> include/uapi/linux/vdpa.h |  2 ++
> 2 files changed, 25 insertions(+)
>
>diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
>index bf3fa90908a7..adbcbc7b18b2 100644
>--- a/drivers/vdpa/vdpa.c
>+++ b/drivers/vdpa/vdpa.c
>@@ -1064,6 +1064,26 @@ static int vdpa_dev_blk_discard_config_fill(struct sk_buff *msg, u64 features,
> 	return 0;
> }
>
>+static int
>+vdpa_dev_blk_write_zeroes_config_fill(struct sk_buff *msg, u64 features,
>+				     const struct virtio_blk_config *config)
>+{
>+	u32 val_u32;
>+
>+	if ((features & BIT_ULL(VIRTIO_BLK_F_WRITE_ZEROES)) == 0)
>+		return 0;
>+
>+	val_u32 = __virtio32_to_cpu(true, config->max_write_zeroes_sectors);
>+	if (nla_put_u32(msg, VDPA_ATTR_DEV_BLK_CFG_MAX_WRITE_ZEROES_SEC, val_u32))
>+		return -EMSGSIZE;
>+
>+	val_u32 = __virtio32_to_cpu(true, config->max_write_zeroes_seg);
>+	if (nla_put_u32(msg, VDPA_ATTR_DEV_BLK_CFG_MAX_WRITE_ZEROES_SEG, val_u32))
>+		return -EMSGSIZE;

Should we cover also `config->write_zeroes_may_unmap` ?

>+
>+	return 0;
>+}
>+
> static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
> 				    struct sk_buff *msg)
> {
>@@ -1099,6 +1119,9 @@ static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
> 	if (vdpa_dev_blk_discard_config_fill(msg, features_device, &config))
> 		return -EMSGSIZE;
>
>+	if (vdpa_dev_blk_write_zeroes_config_fill(msg, features_device, &config))
>+		return -EMSGSIZE;
>+
> 	return 0;
> }
>
>diff --git a/include/uapi/linux/vdpa.h b/include/uapi/linux/vdpa.h
>index 30887931a220..797d5708492f 100644
>--- a/include/uapi/linux/vdpa.h
>+++ b/include/uapi/linux/vdpa.h
>@@ -68,6 +68,8 @@ enum vdpa_attr {
> 	VDPA_ATTR_DEV_BLK_CFG_MAX_DISCARD_SEC,	/* u32 */
> 	VDPA_ATTR_DEV_BLK_CFG_MAX_DISCARD_SEG,	/* u32 */
> 	VDPA_ATTR_DEV_BLK_CFG_DISCARD_SEC_ALIGN,/* u32 */
>+	VDPA_ATTR_DEV_BLK_CFG_MAX_WRITE_ZEROES_SEC,	/* u32 */
>+	VDPA_ATTR_DEV_BLK_CFG_MAX_WRITE_ZEROES_SEG,	/* u32 */
>
> 	/* new attributes must be added above here */
> 	VDPA_ATTR_MAX,
>-- 
>2.39.3
>
>


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 09/10] vDPA: report virtio-block read-only info to user space
  2024-02-18 18:56 ` [PATCH 09/10] vDPA: report virtio-block read-only info " Zhu Lingshan
@ 2024-03-19 16:40   ` Stefano Garzarella
  2024-04-09  8:37     ` Zhu, Lingshan
  0 siblings, 1 reply; 34+ messages in thread
From: Stefano Garzarella @ 2024-03-19 16:40 UTC (permalink / raw)
  To: Zhu Lingshan; +Cc: jasowang, mst, virtualization

On Mon, Feb 19, 2024 at 02:56:05AM +0800, Zhu Lingshan wrote:
>This commit report read-only information of
>virtio-blk devices to user space.
>
>Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
>---
> drivers/vdpa/vdpa.c       | 14 ++++++++++++++
> include/uapi/linux/vdpa.h |  1 +
> 2 files changed, 15 insertions(+)
>
>diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
>index adbcbc7b18b2..d6fd3cadc44f 100644
>--- a/drivers/vdpa/vdpa.c
>+++ b/drivers/vdpa/vdpa.c
>@@ -1084,6 +1084,17 @@ vdpa_dev_blk_write_zeroes_config_fill(struct sk_buff *msg, u64 features,
> 	return 0;
> }
>
>+static int vdpa_dev_blk_ro_config_fill(struct sk_buff *msg, u64 features)
>+{
>+	u8 ro;
>+
>+	ro = ((features & BIT_ULL(VIRTIO_BLK_F_RO)) == 0) ? 0 : 1;
>+	if (nla_put_u8(msg, VDPA_ATTR_DEV_BLK_CFG_READ_ONLY, ro))

This is not really related to the config space, what about renaming it
to VDPA_ATTR_DEV_BLK_READ_ONLY ?

Also the type, maybe better to use "flag" and set it through
`nla_put_flag()`.

Not a strong opinion on that, it just seems a little more consistent to
me.

Thanks,
Stefano

>+		return -EMSGSIZE;
>+
>+	return 0;
>+}
>+
> static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
> 				    struct sk_buff *msg)
> {
>@@ -1122,6 +1133,9 @@ static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
> 	if (vdpa_dev_blk_write_zeroes_config_fill(msg, features_device, &config))
> 		return -EMSGSIZE;
>
>+	if (vdpa_dev_blk_ro_config_fill(msg, features_device))
>+		return -EMSGSIZE;
>+
> 	return 0;
> }
>
>diff --git a/include/uapi/linux/vdpa.h b/include/uapi/linux/vdpa.h
>index 797d5708492f..4be8e3a15874 100644
>--- a/include/uapi/linux/vdpa.h
>+++ b/include/uapi/linux/vdpa.h
>@@ -70,6 +70,7 @@ enum vdpa_attr {
> 	VDPA_ATTR_DEV_BLK_CFG_DISCARD_SEC_ALIGN,/* u32 */
> 	VDPA_ATTR_DEV_BLK_CFG_MAX_WRITE_ZEROES_SEC,	/* u32 */
> 	VDPA_ATTR_DEV_BLK_CFG_MAX_WRITE_ZEROES_SEG,	/* u32 */
>+	VDPA_ATTR_DEV_BLK_CFG_READ_ONLY,		/* u8 */
>
> 	/* new attributes must be added above here */
> 	VDPA_ATTR_MAX,
>-- 
>2.39.3
>
>


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 10/10] vDPA: report virtio-blk flush info to user space
  2024-02-18 18:56 ` [PATCH 10/10] vDPA: report virtio-blk flush " Zhu Lingshan
@ 2024-03-19 16:42   ` Stefano Garzarella
  0 siblings, 0 replies; 34+ messages in thread
From: Stefano Garzarella @ 2024-03-19 16:42 UTC (permalink / raw)
  To: Zhu Lingshan; +Cc: jasowang, mst, virtualization

On Mon, Feb 19, 2024 at 02:56:06AM +0800, Zhu Lingshan wrote:
>This commit reports whether a virtio-blk device
>support cache flush command to user space
>
>Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
>---
> drivers/vdpa/vdpa.c       | 14 ++++++++++++++
> include/uapi/linux/vdpa.h |  1 +
> 2 files changed, 15 insertions(+)
>
>diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
>index d6fd3cadc44f..95e1440dbfaa 100644
>--- a/drivers/vdpa/vdpa.c
>+++ b/drivers/vdpa/vdpa.c
>@@ -1095,6 +1095,17 @@ static int vdpa_dev_blk_ro_config_fill(struct sk_buff *msg, u64 features)
> 	return 0;
> }
>
>+static int vdpa_dev_blk_flush_config_fill(struct sk_buff *msg, u64 features)
>+{
>+	u8 flush;
>+
>+	flush = ((features & BIT_ULL(VIRTIO_BLK_F_FLUSH)) == 0) ? 0 : 1;
>+	if (nla_put_u8(msg, VDPA_ATTR_DEV_BLK_CFG_FLUSH, flush))
>+		return -EMSGSIZE;

Ditto about name (VDPA_ATTR_DEV_BLK_FLUSH) and type (flag).

Thanks,
Stefano

>+
>+	return 0;
>+}
>+
> static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
> 				    struct sk_buff *msg)
> {
>@@ -1136,6 +1147,9 @@ static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
> 	if (vdpa_dev_blk_ro_config_fill(msg, features_device))
> 		return -EMSGSIZE;
>
>+	if (vdpa_dev_blk_flush_config_fill(msg, features_device))
>+		return -EMSGSIZE;
>+
> 	return 0;
> }
>
>diff --git a/include/uapi/linux/vdpa.h b/include/uapi/linux/vdpa.h
>index 4be8e3a15874..43c51698195c 100644
>--- a/include/uapi/linux/vdpa.h
>+++ b/include/uapi/linux/vdpa.h
>@@ -71,6 +71,7 @@ enum vdpa_attr {
> 	VDPA_ATTR_DEV_BLK_CFG_MAX_WRITE_ZEROES_SEC,	/* u32 */
> 	VDPA_ATTR_DEV_BLK_CFG_MAX_WRITE_ZEROES_SEG,	/* u32 */
> 	VDPA_ATTR_DEV_BLK_CFG_READ_ONLY,		/* u8 */
>+	VDPA_ATTR_DEV_BLK_CFG_FLUSH,		/* u8 */
>
> 	/* new attributes must be added above here */
> 	VDPA_ATTR_MAX,
>-- 
>2.39.3
>
>


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 01/10] vDPA: report virtio-block capacity to user space
  2024-02-18 18:55 ` [PATCH 01/10] vDPA: report virtio-block capacity to user space Zhu Lingshan
@ 2024-03-19 16:43   ` Stefano Garzarella
  0 siblings, 0 replies; 34+ messages in thread
From: Stefano Garzarella @ 2024-03-19 16:43 UTC (permalink / raw)
  To: Zhu Lingshan; +Cc: jasowang, mst, virtualization

On Mon, Feb 19, 2024 at 02:55:57AM +0800, Zhu Lingshan wrote:
>This commit allows userspace to query capacity of
>a virtio-block device.
>
>Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
>---
> drivers/vdpa/vdpa.c       | 35 +++++++++++++++++++++++++++++++++++
> include/linux/vdpa.h      |  1 +
> include/uapi/linux/vdpa.h |  2 ++
> 3 files changed, 38 insertions(+)

Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>

>
>diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
>index d0695680b282..d5ccb618de2b 100644
>--- a/drivers/vdpa/vdpa.c
>+++ b/drivers/vdpa/vdpa.c
>@@ -944,6 +944,38 @@ static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *ms
> 	return vdpa_dev_net_mq_config_fill(msg, features_device, &config);
> }
>
>+static int
>+vdpa_dev_blk_capacity_config_fill(struct sk_buff *msg,
>+				  const struct virtio_blk_config *config)
>+{
>+	u64 val_u64;
>+
>+	val_u64 = __virtio64_to_cpu(true, config->capacity);
>+
>+	return nla_put_u64_64bit(msg, VDPA_ATTR_DEV_BLK_CFG_CAPACITY,
>+				 val_u64, VDPA_ATTR_PAD);
>+}
>+
>+static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
>+				    struct sk_buff *msg)
>+{
>+	struct virtio_blk_config config = {};
>+	u64 features_device;
>+
>+	vdev->config->get_config(vdev, 0, &config, sizeof(config));
>+
>+	features_device = vdev->config->get_device_features(vdev);
>+
>+	if (nla_put_u64_64bit(msg, VDPA_ATTR_DEV_FEATURES, features_device,
>+			      VDPA_ATTR_PAD))
>+		return -EMSGSIZE;
>+
>+	if (vdpa_dev_blk_capacity_config_fill(msg, &config))
>+		return -EMSGSIZE;
>+
>+	return 0;
>+}
>+
> static int
> vdpa_dev_config_fill(struct vdpa_device *vdev, struct sk_buff *msg, u32 portid, u32 seq,
> 		     int flags, struct netlink_ext_ack *extack)
>@@ -988,6 +1020,9 @@ vdpa_dev_config_fill(struct vdpa_device *vdev, struct sk_buff *msg, u32 portid,
> 	case VIRTIO_ID_NET:
> 		err = vdpa_dev_net_config_fill(vdev, msg);
> 		break;
>+	case VIRTIO_ID_BLOCK:
>+		err = vdpa_dev_blk_config_fill(vdev, msg);
>+		break;
> 	default:
> 		err = -EOPNOTSUPP;
> 		break;
>diff --git a/include/linux/vdpa.h b/include/linux/vdpa.h
>index db15ac07f8a6..a184aa6538cb 100644
>--- a/include/linux/vdpa.h
>+++ b/include/linux/vdpa.h
>@@ -7,6 +7,7 @@
> #include <linux/interrupt.h>
> #include <linux/vhost_iotlb.h>
> #include <linux/virtio_net.h>
>+#include <linux/virtio_blk.h>
> #include <linux/if_ether.h>
>
> /**
>diff --git a/include/uapi/linux/vdpa.h b/include/uapi/linux/vdpa.h
>index 54b649ab0f22..1bf69226cb96 100644
>--- a/include/uapi/linux/vdpa.h
>+++ b/include/uapi/linux/vdpa.h
>@@ -56,6 +56,8 @@ enum vdpa_attr {
> 	/* virtio features that are provisioned to the vDPA device */
> 	VDPA_ATTR_DEV_FEATURES,                 /* u64 */
>
>+	VDPA_ATTR_DEV_BLK_CFG_CAPACITY,		/* u64 */
>+
> 	/* new attributes must be added above here */
> 	VDPA_ATTR_MAX,
> };
>-- 
>2.39.3
>
>


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 03/10] vDPA: report virtio-block block-size to user space
  2024-02-18 18:55 ` [PATCH 03/10] vDPA: report virtio-block block-size " Zhu Lingshan
@ 2024-03-19 16:43   ` Stefano Garzarella
  0 siblings, 0 replies; 34+ messages in thread
From: Stefano Garzarella @ 2024-03-19 16:43 UTC (permalink / raw)
  To: Zhu Lingshan; +Cc: jasowang, mst, virtualization

On Mon, Feb 19, 2024 at 02:55:59AM +0800, Zhu Lingshan wrote:
>This commit allows reporting the block size of a
>virtio-block device to user space.
>
>Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
>---
> drivers/vdpa/vdpa.c       | 18 ++++++++++++++++++
> include/uapi/linux/vdpa.h |  1 +
> 2 files changed, 19 insertions(+)

Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>

>
>diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
>index ee1472d32b0d..cc8f41d24c9c 100644
>--- a/drivers/vdpa/vdpa.c
>+++ b/drivers/vdpa/vdpa.c
>@@ -970,6 +970,21 @@ vdpa_dev_blk_seg_size_config_fill(struct sk_buff *msg, u64 features,
> 	return nla_put_u32(msg, VDPA_ATTR_DEV_BLK_CFG_SEG_SIZE, val_u32);
> }
>
>+/* fill the block size*/
>+static int
>+vdpa_dev_blk_block_size_config_fill(struct sk_buff *msg, u64 features,
>+				    const struct virtio_blk_config *config)
>+{
>+	u32 val_u32;
>+
>+	if ((features & BIT_ULL(VIRTIO_BLK_F_BLK_SIZE)) == 0)
>+		return 0;
>+
>+	val_u32 = __virtio32_to_cpu(true, config->blk_size);
>+
>+	return nla_put_u32(msg, VDPA_ATTR_DEV_BLK_CFG_BLK_SIZE, val_u32);
>+}
>+
> static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
> 				    struct sk_buff *msg)
> {
>@@ -990,6 +1005,9 @@ static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
> 	if (vdpa_dev_blk_seg_size_config_fill(msg, features_device, &config))
> 		return -EMSGSIZE;
>
>+	if (vdpa_dev_blk_block_size_config_fill(msg, features_device, &config))
>+		return -EMSGSIZE;
>+
> 	return 0;
> }
>
>diff --git a/include/uapi/linux/vdpa.h b/include/uapi/linux/vdpa.h
>index 586bce3c906a..f3baf7ea7d6d 100644
>--- a/include/uapi/linux/vdpa.h
>+++ b/include/uapi/linux/vdpa.h
>@@ -58,6 +58,7 @@ enum vdpa_attr {
>
> 	VDPA_ATTR_DEV_BLK_CFG_CAPACITY,		/* u64 */
> 	VDPA_ATTR_DEV_BLK_CFG_SEG_SIZE,		/* u32 */
>+	VDPA_ATTR_DEV_BLK_CFG_BLK_SIZE,		/* u32 */
>
> 	/* new attributes must be added above here */
> 	VDPA_ATTR_MAX,
>-- 
>2.39.3
>
>


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 04/10] vDPA: report virtio-block max segments in a request to user space
  2024-02-18 18:56 ` [PATCH 04/10] vDPA: report virtio-block max segments in a request " Zhu Lingshan
@ 2024-03-19 16:43   ` Stefano Garzarella
  0 siblings, 0 replies; 34+ messages in thread
From: Stefano Garzarella @ 2024-03-19 16:43 UTC (permalink / raw)
  To: Zhu Lingshan; +Cc: jasowang, mst, virtualization

On Mon, Feb 19, 2024 at 02:56:00AM +0800, Zhu Lingshan wrote:
>This commit allows vDPA reporting the maximum number of
>segments in a request of virtio-block devices to
>user space.
>
>Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
>---
> drivers/vdpa/vdpa.c       | 17 +++++++++++++++++
> include/uapi/linux/vdpa.h |  1 +
> 2 files changed, 18 insertions(+)

Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>

>
>diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
>index cc8f41d24c9c..8d00e9976aba 100644
>--- a/drivers/vdpa/vdpa.c
>+++ b/drivers/vdpa/vdpa.c
>@@ -985,6 +985,20 @@ vdpa_dev_blk_block_size_config_fill(struct sk_buff *msg, u64 features,
> 	return nla_put_u32(msg, VDPA_ATTR_DEV_BLK_CFG_BLK_SIZE, val_u32);
> }
>
>+static int
>+vdpa_dev_blk_seg_max_config_fill(struct sk_buff *msg, u64 features,
>+				 const struct virtio_blk_config *config)
>+{
>+	u32 val_u32;
>+
>+	if ((features & BIT_ULL(VIRTIO_BLK_F_SEG_MAX)) == 0)
>+		return 0;
>+
>+	val_u32 = __virtio32_to_cpu(true, config->seg_max);
>+
>+	return nla_put_u32(msg, VDPA_ATTR_DEV_BLK_CFG_SEG_MAX, val_u32);
>+}
>+
> static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
> 				    struct sk_buff *msg)
> {
>@@ -1008,6 +1022,9 @@ static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
> 	if (vdpa_dev_blk_block_size_config_fill(msg, features_device, &config))
> 		return -EMSGSIZE;
>
>+	if (vdpa_dev_blk_seg_max_config_fill(msg, features_device, &config))
>+		return -EMSGSIZE;
>+
> 	return 0;
> }
>
>diff --git a/include/uapi/linux/vdpa.h b/include/uapi/linux/vdpa.h
>index f3baf7ea7d6d..2dc92fca2052 100644
>--- a/include/uapi/linux/vdpa.h
>+++ b/include/uapi/linux/vdpa.h
>@@ -59,6 +59,7 @@ enum vdpa_attr {
> 	VDPA_ATTR_DEV_BLK_CFG_CAPACITY,		/* u64 */
> 	VDPA_ATTR_DEV_BLK_CFG_SEG_SIZE,		/* u32 */
> 	VDPA_ATTR_DEV_BLK_CFG_BLK_SIZE,		/* u32 */
>+	VDPA_ATTR_DEV_BLK_CFG_SEG_MAX,		/* u32 */
>
> 	/* new attributes must be added above here */
> 	VDPA_ATTR_MAX,
>-- 
>2.39.3
>
>


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 05/10] vDPA: report virtio-block MQ info to user space
  2024-02-18 18:56 ` [PATCH 05/10] vDPA: report virtio-block MQ info " Zhu Lingshan
@ 2024-03-19 16:44   ` Stefano Garzarella
  0 siblings, 0 replies; 34+ messages in thread
From: Stefano Garzarella @ 2024-03-19 16:44 UTC (permalink / raw)
  To: Zhu Lingshan; +Cc: jasowang, mst, virtualization

On Mon, Feb 19, 2024 at 02:56:01AM +0800, Zhu Lingshan wrote:
>This commits allows vDPA reporting virtio-block multi-queue
>configuration to user sapce.
>
>Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
>---
> drivers/vdpa/vdpa.c       | 16 ++++++++++++++++
> include/uapi/linux/vdpa.h |  1 +
> 2 files changed, 17 insertions(+)

Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>

>
>diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
>index 8d00e9976aba..26e8768b869a 100644
>--- a/drivers/vdpa/vdpa.c
>+++ b/drivers/vdpa/vdpa.c
>@@ -999,6 +999,19 @@ vdpa_dev_blk_seg_max_config_fill(struct sk_buff *msg, u64 features,
> 	return nla_put_u32(msg, VDPA_ATTR_DEV_BLK_CFG_SEG_MAX, val_u32);
> }
>
>+static int vdpa_dev_blk_mq_config_fill(struct sk_buff *msg, u64 features,
>+				       const struct virtio_blk_config *config)
>+{
>+	u16 val_u16;
>+
>+	if ((features & BIT_ULL(VIRTIO_BLK_F_MQ)) == 0)
>+		return 0;
>+
>+	val_u16 = __virtio16_to_cpu(true, config->num_queues);
>+
>+	return nla_put_u16(msg, VDPA_ATTR_DEV_BLK_CFG_NUM_QUEUES, val_u16);
>+}
>+
> static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
> 				    struct sk_buff *msg)
> {
>@@ -1025,6 +1038,9 @@ static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
> 	if (vdpa_dev_blk_seg_max_config_fill(msg, features_device, &config))
> 		return -EMSGSIZE;
>
>+	if (vdpa_dev_blk_mq_config_fill(msg, features_device, &config))
>+		return -EMSGSIZE;
>+
> 	return 0;
> }
>
>diff --git a/include/uapi/linux/vdpa.h b/include/uapi/linux/vdpa.h
>index 2dc92fca2052..3c8e3c87a864 100644
>--- a/include/uapi/linux/vdpa.h
>+++ b/include/uapi/linux/vdpa.h
>@@ -60,6 +60,7 @@ enum vdpa_attr {
> 	VDPA_ATTR_DEV_BLK_CFG_SEG_SIZE,		/* u32 */
> 	VDPA_ATTR_DEV_BLK_CFG_BLK_SIZE,		/* u32 */
> 	VDPA_ATTR_DEV_BLK_CFG_SEG_MAX,		/* u32 */
>+	VDPA_ATTR_DEV_BLK_CFG_NUM_QUEUES,	/* u16 */
>
> 	/* new attributes must be added above here */
> 	VDPA_ATTR_MAX,
>-- 
>2.39.3
>
>


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 06/10] vDPA: report virtio-block topology info to user space
  2024-02-18 18:56 ` [PATCH 06/10] vDPA: report virtio-block topology " Zhu Lingshan
@ 2024-03-19 16:44   ` Stefano Garzarella
  0 siblings, 0 replies; 34+ messages in thread
From: Stefano Garzarella @ 2024-03-19 16:44 UTC (permalink / raw)
  To: Zhu Lingshan; +Cc: jasowang, mst, virtualization

On Mon, Feb 19, 2024 at 02:56:02AM +0800, Zhu Lingshan wrote:
>This commit allows vDPA reporting topology information of
>virtio-blk devices to user space, includes:
>1) the number of logical blocks per physical block
>2) offset of first aligned logical block
>3) suggested minimum I/O size in blocks
>4) optimal (suggested maximum) I/O size in blocks
>
>Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
>---
> drivers/vdpa/vdpa.c       | 32 ++++++++++++++++++++++++++++++++
> include/uapi/linux/vdpa.h |  4 ++++
> 2 files changed, 36 insertions(+)

Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>

>
>diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
>index 26e8768b869a..dfd9aa5779dc 100644
>--- a/drivers/vdpa/vdpa.c
>+++ b/drivers/vdpa/vdpa.c
>@@ -1012,6 +1012,35 @@ static int vdpa_dev_blk_mq_config_fill(struct sk_buff *msg, u64 features,
> 	return nla_put_u16(msg, VDPA_ATTR_DEV_BLK_CFG_NUM_QUEUES, val_u16);
> }
>
>+static int vdpa_dev_blk_topology_config_fill(struct sk_buff *msg, u64 features,
>+				       const struct virtio_blk_config *config)
>+{
>+	u16 min_io_size;
>+	u32 opt_io_size;
>+
>+	if ((features & BIT_ULL(VIRTIO_BLK_F_TOPOLOGY)) == 0)
>+		return 0;
>+
>+	min_io_size = __virtio16_to_cpu(true, config->min_io_size);
>+	opt_io_size = __virtio32_to_cpu(true, config->opt_io_size);
>+
>+	if (nla_put_u8(msg, VDPA_ATTR_DEV_BLK_CFG_PHY_BLK_EXP,
>+	    config->physical_block_exp))
>+		return -EMSGSIZE;
>+
>+	if (nla_put_u8(msg, VDPA_ATTR_DEV_BLK_CFG_ALIGN_OFFSET,
>+	    config->alignment_offset))
>+		return -EMSGSIZE;
>+
>+	if (nla_put_u16(msg, VDPA_ATTR_DEV_BLK_CFG_MIN_IO_SIZE, min_io_size))
>+		return -EMSGSIZE;
>+
>+	if (nla_put_u32(msg, VDPA_ATTR_DEV_BLK_CFG_OPT_IO_SIZE, opt_io_size))
>+		return -EMSGSIZE;
>+
>+	return 0;
>+}
>+
> static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
> 				    struct sk_buff *msg)
> {
>@@ -1041,6 +1070,9 @@ static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
> 	if (vdpa_dev_blk_mq_config_fill(msg, features_device, &config))
> 		return -EMSGSIZE;
>
>+	if (vdpa_dev_blk_topology_config_fill(msg, features_device, &config))
>+		return -EMSGSIZE;
>+
> 	return 0;
> }
>
>diff --git a/include/uapi/linux/vdpa.h b/include/uapi/linux/vdpa.h
>index 3c8e3c87a864..5cc70614c97a 100644
>--- a/include/uapi/linux/vdpa.h
>+++ b/include/uapi/linux/vdpa.h
>@@ -61,6 +61,10 @@ enum vdpa_attr {
> 	VDPA_ATTR_DEV_BLK_CFG_BLK_SIZE,		/* u32 */
> 	VDPA_ATTR_DEV_BLK_CFG_SEG_MAX,		/* u32 */
> 	VDPA_ATTR_DEV_BLK_CFG_NUM_QUEUES,	/* u16 */
>+	VDPA_ATTR_DEV_BLK_CFG_PHY_BLK_EXP,	/* u8 */
>+	VDPA_ATTR_DEV_BLK_CFG_ALIGN_OFFSET,	/* u8 */
>+	VDPA_ATTR_DEV_BLK_CFG_MIN_IO_SIZE,	/* u16 */
>+	VDPA_ATTR_DEV_BLK_CFG_OPT_IO_SIZE,	/* u32 */
>
> 	/* new attributes must be added above here */
> 	VDPA_ATTR_MAX,
>-- 
>2.39.3
>
>


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 07/10] vDPA: report virtio-block discarding configuration to user space
  2024-02-18 18:56 ` [PATCH 07/10] vDPA: report virtio-block discarding configuration " Zhu Lingshan
@ 2024-03-19 16:44   ` Stefano Garzarella
  0 siblings, 0 replies; 34+ messages in thread
From: Stefano Garzarella @ 2024-03-19 16:44 UTC (permalink / raw)
  To: Zhu Lingshan; +Cc: jasowang, mst, virtualization

On Mon, Feb 19, 2024 at 02:56:03AM +0800, Zhu Lingshan wrote:
>This commit reports virtio-blk discarding configuration
>to user space,includes:
>1) the maximum discard sectors
>2) maximum number of discard segments for the block driver to use
>3) the alignment for splitting a discarding request
>
>Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
>---
> drivers/vdpa/vdpa.c       | 26 ++++++++++++++++++++++++++
> include/uapi/linux/vdpa.h |  3 +++
> 2 files changed, 29 insertions(+)

Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>

>
>diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
>index dfd9aa5779dc..bf3fa90908a7 100644
>--- a/drivers/vdpa/vdpa.c
>+++ b/drivers/vdpa/vdpa.c
>@@ -1041,6 +1041,29 @@ static int vdpa_dev_blk_topology_config_fill(struct sk_buff *msg, u64 features,
> 	return 0;
> }
>
>+static int vdpa_dev_blk_discard_config_fill(struct sk_buff *msg, u64 features,
>+				       const struct virtio_blk_config *config)
>+{
>+	u32 val_u32;
>+
>+	if ((features & BIT_ULL(VIRTIO_BLK_F_DISCARD)) == 0)
>+		return 0;
>+
>+	val_u32 = __virtio32_to_cpu(true, config->max_discard_sectors);
>+	if (nla_put_u32(msg, VDPA_ATTR_DEV_BLK_CFG_MAX_DISCARD_SEC, val_u32))
>+		return -EMSGSIZE;
>+
>+	val_u32 = __virtio32_to_cpu(true, config->max_discard_seg);
>+	if (nla_put_u32(msg, VDPA_ATTR_DEV_BLK_CFG_MAX_DISCARD_SEG, val_u32))
>+		return -EMSGSIZE;
>+
>+	val_u32 = __virtio32_to_cpu(true, config->discard_sector_alignment);
>+	if (nla_put_u32(msg, VDPA_ATTR_DEV_BLK_CFG_DISCARD_SEC_ALIGN, val_u32))
>+		return -EMSGSIZE;
>+
>+	return 0;
>+}
>+
> static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
> 				    struct sk_buff *msg)
> {
>@@ -1073,6 +1096,9 @@ static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
> 	if (vdpa_dev_blk_topology_config_fill(msg, features_device, &config))
> 		return -EMSGSIZE;
>
>+	if (vdpa_dev_blk_discard_config_fill(msg, features_device, &config))
>+		return -EMSGSIZE;
>+
> 	return 0;
> }
>
>diff --git a/include/uapi/linux/vdpa.h b/include/uapi/linux/vdpa.h
>index 5cc70614c97a..30887931a220 100644
>--- a/include/uapi/linux/vdpa.h
>+++ b/include/uapi/linux/vdpa.h
>@@ -65,6 +65,9 @@ enum vdpa_attr {
> 	VDPA_ATTR_DEV_BLK_CFG_ALIGN_OFFSET,	/* u8 */
> 	VDPA_ATTR_DEV_BLK_CFG_MIN_IO_SIZE,	/* u16 */
> 	VDPA_ATTR_DEV_BLK_CFG_OPT_IO_SIZE,	/* u32 */
>+	VDPA_ATTR_DEV_BLK_CFG_MAX_DISCARD_SEC,	/* u32 */
>+	VDPA_ATTR_DEV_BLK_CFG_MAX_DISCARD_SEG,	/* u32 */
>+	VDPA_ATTR_DEV_BLK_CFG_DISCARD_SEC_ALIGN,/* u32 */
>
> 	/* new attributes must be added above here */
> 	VDPA_ATTR_MAX,
>-- 
>2.39.3
>
>


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 00/10] vDPA: allow userspace query virito-block device
  2024-02-18 18:55 [PATCH 00/10] vDPA: allow userspace query virito-block device Zhu Lingshan
                   ` (10 preceding siblings ...)
  2024-03-19  6:39 ` [PATCH 00/10] vDPA: allow userspace query virito-block device Michael S. Tsirkin
@ 2024-03-19 16:49 ` Stefano Garzarella
  2024-03-20 10:31   ` Zhu, Lingshan
  11 siblings, 1 reply; 34+ messages in thread
From: Stefano Garzarella @ 2024-03-19 16:49 UTC (permalink / raw)
  To: Zhu Lingshan; +Cc: jasowang, mst, virtualization

On Mon, Feb 19, 2024 at 02:55:56AM +0800, Zhu Lingshan wrote:
>This series allows the user space applications query vDPA virtio-block
>device inforamtion.
>
>testing on vdpa_sim_blk, iproute2 output:
>sudo ./vdpa/vdpa dev config show -jp vdpa_blk0
>{
>    "config": {
>        "vdpa_blk0": {
>            "capacity": 262144,
>            "segment size": 4096,
>            "block size": 512,
>            "max segments in a request": 32,
>            "num of queues": 1,
>            "logical blocks per physical block (log2)": 0,
>            "offset of first aligned logical block": 0,
>            "minimum io size": 1,
>            "optimal io size": 1,
>            "maximum discard sectors for a segment": 4294967295,
>            "max discard segments in a command": 1,
>            "discard sector alignment": 512,
>            "max write zeros sectors in a segment": 4294967295,
>            "max write zero segments": 1,
>            "read only": false,
>            "flush command support": true
>        }
>    }
>}
>
>Please help review

Thanks for this series, and sorry for the deleay.
I left some comments in the patch, about the virtio-blk config space
there are some missing fields:
- virtio_blk_geometry fields
- writeback field
- *secure_erase* fields
- virtio_blk_zoned_characteristics fields

Do you plan to add them later?

Thanks,
Stefano


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 08/10] vDPA: report virtio-block write zeroes configuration to user space
  2024-03-19 16:36   ` Stefano Garzarella
@ 2024-03-19 17:02     ` Michael S. Tsirkin
  2024-03-19 17:08       ` Stefano Garzarella
  0 siblings, 1 reply; 34+ messages in thread
From: Michael S. Tsirkin @ 2024-03-19 17:02 UTC (permalink / raw)
  To: Stefano Garzarella; +Cc: Zhu Lingshan, jasowang, virtualization

On Tue, Mar 19, 2024 at 05:36:01PM +0100, Stefano Garzarella wrote:
> On Mon, Feb 19, 2024 at 02:56:04AM +0800, Zhu Lingshan wrote:
> > This commits reports write zeroes configuration of
> > virtio-block devices to user space, includes:
> > 1)maximum write zeroes sectors size
> > 2)maximum write zeroes segment number
> > 
> > Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
> > ---
> > drivers/vdpa/vdpa.c       | 23 +++++++++++++++++++++++
> > include/uapi/linux/vdpa.h |  2 ++
> > 2 files changed, 25 insertions(+)
> > 
> > diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
> > index bf3fa90908a7..adbcbc7b18b2 100644
> > --- a/drivers/vdpa/vdpa.c
> > +++ b/drivers/vdpa/vdpa.c
> > @@ -1064,6 +1064,26 @@ static int vdpa_dev_blk_discard_config_fill(struct sk_buff *msg, u64 features,
> > 	return 0;
> > }
> > 
> > +static int
> > +vdpa_dev_blk_write_zeroes_config_fill(struct sk_buff *msg, u64 features,
> > +				     const struct virtio_blk_config *config)
> > +{
> > +	u32 val_u32;
> > +
> > +	if ((features & BIT_ULL(VIRTIO_BLK_F_WRITE_ZEROES)) == 0)
> > +		return 0;
> > +
> > +	val_u32 = __virtio32_to_cpu(true, config->max_write_zeroes_sectors);
> > +	if (nla_put_u32(msg, VDPA_ATTR_DEV_BLK_CFG_MAX_WRITE_ZEROES_SEC, val_u32))
> > +		return -EMSGSIZE;
> > +
> > +	val_u32 = __virtio32_to_cpu(true, config->max_write_zeroes_seg);
> > +	if (nla_put_u32(msg, VDPA_ATTR_DEV_BLK_CFG_MAX_WRITE_ZEROES_SEG, val_u32))
> > +		return -EMSGSIZE;
> 
> Should we cover also `config->write_zeroes_may_unmap` ?


This review came too late I applied the patch. Generally
if I don't see any response in about
a week I assume there is not interest.
> > +
> > +	return 0;
> > +}
> > +
> > static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
> > 				    struct sk_buff *msg)
> > {
> > @@ -1099,6 +1119,9 @@ static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
> > 	if (vdpa_dev_blk_discard_config_fill(msg, features_device, &config))
> > 		return -EMSGSIZE;
> > 
> > +	if (vdpa_dev_blk_write_zeroes_config_fill(msg, features_device, &config))
> > +		return -EMSGSIZE;
> > +
> > 	return 0;
> > }
> > 
> > diff --git a/include/uapi/linux/vdpa.h b/include/uapi/linux/vdpa.h
> > index 30887931a220..797d5708492f 100644
> > --- a/include/uapi/linux/vdpa.h
> > +++ b/include/uapi/linux/vdpa.h
> > @@ -68,6 +68,8 @@ enum vdpa_attr {
> > 	VDPA_ATTR_DEV_BLK_CFG_MAX_DISCARD_SEC,	/* u32 */
> > 	VDPA_ATTR_DEV_BLK_CFG_MAX_DISCARD_SEG,	/* u32 */
> > 	VDPA_ATTR_DEV_BLK_CFG_DISCARD_SEC_ALIGN,/* u32 */
> > +	VDPA_ATTR_DEV_BLK_CFG_MAX_WRITE_ZEROES_SEC,	/* u32 */
> > +	VDPA_ATTR_DEV_BLK_CFG_MAX_WRITE_ZEROES_SEG,	/* u32 */
> > 
> > 	/* new attributes must be added above here */
> > 	VDPA_ATTR_MAX,
> > -- 
> > 2.39.3
> > 
> > 


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 08/10] vDPA: report virtio-block write zeroes configuration to user space
  2024-03-19 17:02     ` Michael S. Tsirkin
@ 2024-03-19 17:08       ` Stefano Garzarella
  2024-03-19 17:57         ` Michael S. Tsirkin
  0 siblings, 1 reply; 34+ messages in thread
From: Stefano Garzarella @ 2024-03-19 17:08 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: Zhu Lingshan, jasowang, virtualization

On Tue, Mar 19, 2024 at 01:02:21PM -0400, Michael S. Tsirkin wrote:
>On Tue, Mar 19, 2024 at 05:36:01PM +0100, Stefano Garzarella wrote:
>> On Mon, Feb 19, 2024 at 02:56:04AM +0800, Zhu Lingshan wrote:
>> > This commits reports write zeroes configuration of
>> > virtio-block devices to user space, includes:
>> > 1)maximum write zeroes sectors size
>> > 2)maximum write zeroes segment number
>> >
>> > Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
>> > ---
>> > drivers/vdpa/vdpa.c       | 23 +++++++++++++++++++++++
>> > include/uapi/linux/vdpa.h |  2 ++
>> > 2 files changed, 25 insertions(+)
>> >
>> > diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
>> > index bf3fa90908a7..adbcbc7b18b2 100644
>> > --- a/drivers/vdpa/vdpa.c
>> > +++ b/drivers/vdpa/vdpa.c
>> > @@ -1064,6 +1064,26 @@ static int vdpa_dev_blk_discard_config_fill(struct sk_buff *msg, u64 features,
>> > 	return 0;
>> > }
>> >
>> > +static int
>> > +vdpa_dev_blk_write_zeroes_config_fill(struct sk_buff *msg, u64 features,
>> > +				     const struct virtio_blk_config *config)
>> > +{
>> > +	u32 val_u32;
>> > +
>> > +	if ((features & BIT_ULL(VIRTIO_BLK_F_WRITE_ZEROES)) == 0)
>> > +		return 0;
>> > +
>> > +	val_u32 = __virtio32_to_cpu(true, config->max_write_zeroes_sectors);
>> > +	if (nla_put_u32(msg, VDPA_ATTR_DEV_BLK_CFG_MAX_WRITE_ZEROES_SEC, val_u32))
>> > +		return -EMSGSIZE;
>> > +
>> > +	val_u32 = __virtio32_to_cpu(true, config->max_write_zeroes_seg);
>> > +	if (nla_put_u32(msg, VDPA_ATTR_DEV_BLK_CFG_MAX_WRITE_ZEROES_SEG, val_u32))
>> > +		return -EMSGSIZE;
>>
>> Should we cover also `config->write_zeroes_may_unmap` ?
>
>
>This review came too late I applied the patch. Generally
>if I don't see any response in about
>a week I assume there is not interest.

Ooops, sorry about that! I should add me as a reviewer for vDPA
otherwise lately it's hard for me to monitor patches :-(

BTW, some comments can be resolved with later patches if you think it
makes sense to resolve them.

Thanks,
Stefano


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 08/10] vDPA: report virtio-block write zeroes configuration to user space
  2024-03-19 17:08       ` Stefano Garzarella
@ 2024-03-19 17:57         ` Michael S. Tsirkin
  0 siblings, 0 replies; 34+ messages in thread
From: Michael S. Tsirkin @ 2024-03-19 17:57 UTC (permalink / raw)
  To: Stefano Garzarella; +Cc: Zhu Lingshan, jasowang, virtualization

On Tue, Mar 19, 2024 at 06:08:13PM +0100, Stefano Garzarella wrote:
> On Tue, Mar 19, 2024 at 01:02:21PM -0400, Michael S. Tsirkin wrote:
> > On Tue, Mar 19, 2024 at 05:36:01PM +0100, Stefano Garzarella wrote:
> > > On Mon, Feb 19, 2024 at 02:56:04AM +0800, Zhu Lingshan wrote:
> > > > This commits reports write zeroes configuration of
> > > > virtio-block devices to user space, includes:
> > > > 1)maximum write zeroes sectors size
> > > > 2)maximum write zeroes segment number
> > > >
> > > > Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
> > > > ---
> > > > drivers/vdpa/vdpa.c       | 23 +++++++++++++++++++++++
> > > > include/uapi/linux/vdpa.h |  2 ++
> > > > 2 files changed, 25 insertions(+)
> > > >
> > > > diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
> > > > index bf3fa90908a7..adbcbc7b18b2 100644
> > > > --- a/drivers/vdpa/vdpa.c
> > > > +++ b/drivers/vdpa/vdpa.c
> > > > @@ -1064,6 +1064,26 @@ static int vdpa_dev_blk_discard_config_fill(struct sk_buff *msg, u64 features,
> > > > 	return 0;
> > > > }
> > > >
> > > > +static int
> > > > +vdpa_dev_blk_write_zeroes_config_fill(struct sk_buff *msg, u64 features,
> > > > +				     const struct virtio_blk_config *config)
> > > > +{
> > > > +	u32 val_u32;
> > > > +
> > > > +	if ((features & BIT_ULL(VIRTIO_BLK_F_WRITE_ZEROES)) == 0)
> > > > +		return 0;
> > > > +
> > > > +	val_u32 = __virtio32_to_cpu(true, config->max_write_zeroes_sectors);
> > > > +	if (nla_put_u32(msg, VDPA_ATTR_DEV_BLK_CFG_MAX_WRITE_ZEROES_SEC, val_u32))
> > > > +		return -EMSGSIZE;
> > > > +
> > > > +	val_u32 = __virtio32_to_cpu(true, config->max_write_zeroes_seg);
> > > > +	if (nla_put_u32(msg, VDPA_ATTR_DEV_BLK_CFG_MAX_WRITE_ZEROES_SEG, val_u32))
> > > > +		return -EMSGSIZE;
> > > 
> > > Should we cover also `config->write_zeroes_may_unmap` ?
> > 
> > 
> > This review came too late I applied the patch. Generally
> > if I don't see any response in about
> > a week I assume there is not interest.
> 
> Ooops, sorry about that! I should add me as a reviewer for vDPA
> otherwise lately it's hard for me to monitor patches :-(
> 
> BTW, some comments can be resolved with later patches if you think it
> makes sense to resolve them.
> 
> Thanks,
> Stefano

Sure. Once the pressure to merge the patch is gone not everyone
will bother though, it might be easier for you to send the patch on top.

-- 
MST


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 00/10] vDPA: allow userspace query virito-block device
  2024-03-19  6:39 ` [PATCH 00/10] vDPA: allow userspace query virito-block device Michael S. Tsirkin
@ 2024-03-20  3:30   ` Jason Wang
  2024-03-20  7:00     ` Michael S. Tsirkin
  0 siblings, 1 reply; 34+ messages in thread
From: Jason Wang @ 2024-03-20  3:30 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: Zhu Lingshan, virtualization

On Tue, Mar 19, 2024 at 2:40 PM Michael S. Tsirkin <mst@redhat.com> wrote:
>
> On Mon, Feb 19, 2024 at 02:55:56AM +0800, Zhu Lingshan wrote:
> > This series allows the user space applications query vDPA virtio-block
> > device inforamtion.
> >
> > testing on vdpa_sim_blk, iproute2 output:
> > sudo ./vdpa/vdpa dev config show -jp vdpa_blk0
> > {
> >     "config": {
> >         "vdpa_blk0": {
> >             "capacity": 262144,
> >             "segment size": 4096,
> >             "block size": 512,
> >             "max segments in a request": 32,
> >             "num of queues": 1,
> >             "logical blocks per physical block (log2)": 0,
> >             "offset of first aligned logical block": 0,
> >             "minimum io size": 1,
> >             "optimal io size": 1,
> >             "maximum discard sectors for a segment": 4294967295,
> >             "max discard segments in a command": 1,
> >             "discard sector alignment": 512,
> >             "max write zeros sectors in a segment": 4294967295,
> >             "max write zero segments": 1,
> >             "read only": false,
> >             "flush command support": true
> >         }
> >     }
> > }
> >
> > Please help review
> >
> > Thanks
> > Zhu Lingshan
>
> It's been in my tree for a while so it will be in the next pull,
> but going forward Jason I'd like to know what kind of
> timeline do you have in mind for reviewing vdpa patches?

I think there are some misunderstandings here.

I usually try my best to offer a review.

This series was posted during my vacation, and when I came back after
the vacation it was merged into your tree. I'd expect you are fine
with the patches.

If that doesn't work, maybe we can start to do something like:

vDPA patches needs my ack before it can be merged

Does it work?

Thanks

>
> > Zhu Lingshan (10):
> >   vDPA: report virtio-block capacity to user space
> >   vDPA: report virtio-block max segment size to user space
> >   vDPA: report virtio-block block-size to user space
> >   vDPA: report virtio-block max segments in a request to user space
> >   vDPA: report virtio-block MQ info to user space
> >   vDPA: report virtio-block topology info to user space
> >   vDPA: report virtio-block discarding configuration to user space
> >   vDPA: report virtio-block write zeroes configuration to user space
> >   vDPA: report virtio-block read-only info to user space
> >   vDPA: report virtio-blk flush info to user space
> >
> >  drivers/vdpa/vdpa.c       | 212 ++++++++++++++++++++++++++++++++++++++
> >  include/linux/vdpa.h      |   1 +
> >  include/uapi/linux/vdpa.h |  17 +++
> >  3 files changed, 230 insertions(+)
> >
> > --
> > 2.39.3
>


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 00/10] vDPA: allow userspace query virito-block device
  2024-03-20  3:30   ` Jason Wang
@ 2024-03-20  7:00     ` Michael S. Tsirkin
  0 siblings, 0 replies; 34+ messages in thread
From: Michael S. Tsirkin @ 2024-03-20  7:00 UTC (permalink / raw)
  To: Jason Wang; +Cc: Zhu Lingshan, virtualization

On Wed, Mar 20, 2024 at 11:30:57AM +0800, Jason Wang wrote:
> On Tue, Mar 19, 2024 at 2:40 PM Michael S. Tsirkin <mst@redhat.com> wrote:
> >
> > On Mon, Feb 19, 2024 at 02:55:56AM +0800, Zhu Lingshan wrote:
> > > This series allows the user space applications query vDPA virtio-block
> > > device inforamtion.
> > >
> > > testing on vdpa_sim_blk, iproute2 output:
> > > sudo ./vdpa/vdpa dev config show -jp vdpa_blk0
> > > {
> > >     "config": {
> > >         "vdpa_blk0": {
> > >             "capacity": 262144,
> > >             "segment size": 4096,
> > >             "block size": 512,
> > >             "max segments in a request": 32,
> > >             "num of queues": 1,
> > >             "logical blocks per physical block (log2)": 0,
> > >             "offset of first aligned logical block": 0,
> > >             "minimum io size": 1,
> > >             "optimal io size": 1,
> > >             "maximum discard sectors for a segment": 4294967295,
> > >             "max discard segments in a command": 1,
> > >             "discard sector alignment": 512,
> > >             "max write zeros sectors in a segment": 4294967295,
> > >             "max write zero segments": 1,
> > >             "read only": false,
> > >             "flush command support": true
> > >         }
> > >     }
> > > }
> > >
> > > Please help review
> > >
> > > Thanks
> > > Zhu Lingshan
> >
> > It's been in my tree for a while so it will be in the next pull,
> > but going forward Jason I'd like to know what kind of
> > timeline do you have in mind for reviewing vdpa patches?
> 
> I think there are some misunderstandings here.
> 
> I usually try my best to offer a review.
> 
> This series was posted during my vacation, and when I came back after
> the vacation it was merged into your tree. I'd expect you are fine
> with the patches.

Yes.

> If that doesn't work, maybe we can start to do something like:
> 
> vDPA patches needs my ack before it can be merged
> 
> Does it work?
> 
> Thanks

We have redundancy in review, it's not a problem by itself.
If you are going on an extended vacation, it's a good idea
to make this fact public so people know whether to expect your review.

> >
> > > Zhu Lingshan (10):
> > >   vDPA: report virtio-block capacity to user space
> > >   vDPA: report virtio-block max segment size to user space
> > >   vDPA: report virtio-block block-size to user space
> > >   vDPA: report virtio-block max segments in a request to user space
> > >   vDPA: report virtio-block MQ info to user space
> > >   vDPA: report virtio-block topology info to user space
> > >   vDPA: report virtio-block discarding configuration to user space
> > >   vDPA: report virtio-block write zeroes configuration to user space
> > >   vDPA: report virtio-block read-only info to user space
> > >   vDPA: report virtio-blk flush info to user space
> > >
> > >  drivers/vdpa/vdpa.c       | 212 ++++++++++++++++++++++++++++++++++++++
> > >  include/linux/vdpa.h      |   1 +
> > >  include/uapi/linux/vdpa.h |  17 +++
> > >  3 files changed, 230 insertions(+)
> > >
> > > --
> > > 2.39.3
> >


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 00/10] vDPA: allow userspace query virito-block device
  2024-03-19 16:49 ` Stefano Garzarella
@ 2024-03-20 10:31   ` Zhu, Lingshan
  2024-03-20 10:53     ` Stefano Garzarella
  0 siblings, 1 reply; 34+ messages in thread
From: Zhu, Lingshan @ 2024-03-20 10:31 UTC (permalink / raw)
  To: Stefano Garzarella; +Cc: jasowang, mst, virtualization



On 3/20/2024 12:49 AM, Stefano Garzarella wrote:
> On Mon, Feb 19, 2024 at 02:55:56AM +0800, Zhu Lingshan wrote:
>> This series allows the user space applications query vDPA virtio-block
>> device inforamtion.
>>
>> testing on vdpa_sim_blk, iproute2 output:
>> sudo ./vdpa/vdpa dev config show -jp vdpa_blk0
>> {
>>    "config": {
>>        "vdpa_blk0": {
>>            "capacity": 262144,
>>            "segment size": 4096,
>>            "block size": 512,
>>            "max segments in a request": 32,
>>            "num of queues": 1,
>>            "logical blocks per physical block (log2)": 0,
>>            "offset of first aligned logical block": 0,
>>            "minimum io size": 1,
>>            "optimal io size": 1,
>>            "maximum discard sectors for a segment": 4294967295,
>>            "max discard segments in a command": 1,
>>            "discard sector alignment": 512,
>>            "max write zeros sectors in a segment": 4294967295,
>>            "max write zero segments": 1,
>>            "read only": false,
>>            "flush command support": true
>>        }
>>    }
>> }
>>
>> Please help review
>
> Thanks for this series, and sorry for the deleay.
> I left some comments in the patch, about the virtio-blk config space
> there are some missing fields:
> - virtio_blk_geometry fields
> - writeback field
> - *secure_erase* fields
> - virtio_blk_zoned_characteristics fields
>
> Do you plan to add them later?
Yes, I will work on them and will send another series which
also addressing your comments for this series

Thanks
Zhu Lingshan
>
> Thanks,
> Stefano
>
>


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 00/10] vDPA: allow userspace query virito-block device
  2024-03-20 10:31   ` Zhu, Lingshan
@ 2024-03-20 10:53     ` Stefano Garzarella
  0 siblings, 0 replies; 34+ messages in thread
From: Stefano Garzarella @ 2024-03-20 10:53 UTC (permalink / raw)
  To: Zhu, Lingshan; +Cc: jasowang, mst, virtualization

On Wed, Mar 20, 2024 at 06:31:43PM +0800, Zhu, Lingshan wrote:
>
>
>On 3/20/2024 12:49 AM, Stefano Garzarella wrote:
>>On Mon, Feb 19, 2024 at 02:55:56AM +0800, Zhu Lingshan wrote:
>>>This series allows the user space applications query vDPA virtio-block
>>>device inforamtion.
>>>
>>>testing on vdpa_sim_blk, iproute2 output:
>>>sudo ./vdpa/vdpa dev config show -jp vdpa_blk0
>>>{
>>>   "config": {
>>>       "vdpa_blk0": {
>>>           "capacity": 262144,
>>>           "segment size": 4096,
>>>           "block size": 512,
>>>           "max segments in a request": 32,
>>>           "num of queues": 1,
>>>           "logical blocks per physical block (log2)": 0,
>>>           "offset of first aligned logical block": 0,
>>>           "minimum io size": 1,
>>>           "optimal io size": 1,
>>>           "maximum discard sectors for a segment": 4294967295,
>>>           "max discard segments in a command": 1,
>>>           "discard sector alignment": 512,
>>>           "max write zeros sectors in a segment": 4294967295,
>>>           "max write zero segments": 1,
>>>           "read only": false,
>>>           "flush command support": true
>>>       }
>>>   }
>>>}
>>>
>>>Please help review
>>
>>Thanks for this series, and sorry for the deleay.
>>I left some comments in the patch, about the virtio-blk config space
>>there are some missing fields:
>>- virtio_blk_geometry fields
>>- writeback field
>>- *secure_erase* fields
>>- virtio_blk_zoned_characteristics fields
>>
>>Do you plan to add them later?
>Yes, I will work on them and will send another series which
>also addressing your comments for this series

Great, thanks for that!

Please put me in CC in the next series.

Stefano


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 02/10] vDPA: report virtio-block max segment size to user space
  2024-03-19 16:04   ` Stefano Garzarella
@ 2024-03-29 14:48     ` Zhu, Lingshan
  2024-03-31 20:03       ` Michael S. Tsirkin
  0 siblings, 1 reply; 34+ messages in thread
From: Zhu, Lingshan @ 2024-03-29 14:48 UTC (permalink / raw)
  To: Stefano Garzarella; +Cc: jasowang, mst, virtualization



On 3/20/2024 12:04 AM, Stefano Garzarella wrote:
> On Mon, Feb 19, 2024 at 02:55:58AM +0800, Zhu Lingshan wrote:
>> This commit allows reporting the max size of any
>> single segment of virtio-block devices to user space.
>>
>> Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
>> ---
>> drivers/vdpa/vdpa.c       | 17 +++++++++++++++++
>> include/uapi/linux/vdpa.h |  1 +
>> 2 files changed, 18 insertions(+)
>>
>> diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
>> index d5ccb618de2b..ee1472d32b0d 100644
>> --- a/drivers/vdpa/vdpa.c
>> +++ b/drivers/vdpa/vdpa.c
>> @@ -956,6 +956,20 @@ vdpa_dev_blk_capacity_config_fill(struct sk_buff 
>> *msg,
>>                  val_u64, VDPA_ATTR_PAD);
>> }
>>
>> +static int
>> +vdpa_dev_blk_seg_size_config_fill(struct sk_buff *msg, u64 features,
>> +                  const struct virtio_blk_config *config)
>> +{
>> +    u32 val_u32;
>> +
>> +    if ((features & BIT_ULL(VIRTIO_BLK_F_SIZE_MAX)) == 0)
>> +        return 0;
>> +
>> +    val_u32 = __virtio32_to_cpu(true, config->size_max);
>> +
>> +    return nla_put_u32(msg, VDPA_ATTR_DEV_BLK_CFG_SEG_SIZE, val_u32);
>
> Should we call this VDPA_ATTR_DEV_BLK_CFG_SIZE_MAX ?
I have tried this before, but this macro is too long causing a odd 
format in the header file.

I can change this since you point this out. This is uapi means we should 
merge the
fix during the RC release before 6.9 official.

@MST, does the process work for you?
>
>> +}
>> +
>> static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
>>                     struct sk_buff *msg)
>> {
>> @@ -973,6 +987,9 @@ static int vdpa_dev_blk_config_fill(struct 
>> vdpa_device *vdev,
>>     if (vdpa_dev_blk_capacity_config_fill(msg, &config))
>>         return -EMSGSIZE;
>>
>> +    if (vdpa_dev_blk_seg_size_config_fill(msg, features_device, 
>> &config))
>> +        return -EMSGSIZE;
>> +
>>     return 0;
>> }
>>
>> diff --git a/include/uapi/linux/vdpa.h b/include/uapi/linux/vdpa.h
>> index 1bf69226cb96..586bce3c906a 100644
>> --- a/include/uapi/linux/vdpa.h
>> +++ b/include/uapi/linux/vdpa.h
>> @@ -57,6 +57,7 @@ enum vdpa_attr {
>>     VDPA_ATTR_DEV_FEATURES,                 /* u64 */
>>
>>     VDPA_ATTR_DEV_BLK_CFG_CAPACITY,        /* u64 */
>> +    VDPA_ATTR_DEV_BLK_CFG_SEG_SIZE,        /* u32 */
>>
>>     /* new attributes must be added above here */
>>     VDPA_ATTR_MAX,
>> -- 
>> 2.39.3
>>
>>
>
>


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 02/10] vDPA: report virtio-block max segment size to user space
  2024-03-29 14:48     ` Zhu, Lingshan
@ 2024-03-31 20:03       ` Michael S. Tsirkin
  0 siblings, 0 replies; 34+ messages in thread
From: Michael S. Tsirkin @ 2024-03-31 20:03 UTC (permalink / raw)
  To: Zhu, Lingshan; +Cc: Stefano Garzarella, jasowang, virtualization

On Fri, Mar 29, 2024 at 10:48:25PM +0800, Zhu, Lingshan wrote:
> 
> 
> On 3/20/2024 12:04 AM, Stefano Garzarella wrote:
> > On Mon, Feb 19, 2024 at 02:55:58AM +0800, Zhu Lingshan wrote:
> > > This commit allows reporting the max size of any
> > > single segment of virtio-block devices to user space.
> > > 
> > > Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
> > > ---
> > > drivers/vdpa/vdpa.c       | 17 +++++++++++++++++
> > > include/uapi/linux/vdpa.h |  1 +
> > > 2 files changed, 18 insertions(+)
> > > 
> > > diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
> > > index d5ccb618de2b..ee1472d32b0d 100644
> > > --- a/drivers/vdpa/vdpa.c
> > > +++ b/drivers/vdpa/vdpa.c
> > > @@ -956,6 +956,20 @@ vdpa_dev_blk_capacity_config_fill(struct
> > > sk_buff *msg,
> > >                  val_u64, VDPA_ATTR_PAD);
> > > }
> > > 
> > > +static int
> > > +vdpa_dev_blk_seg_size_config_fill(struct sk_buff *msg, u64 features,
> > > +                  const struct virtio_blk_config *config)
> > > +{
> > > +    u32 val_u32;
> > > +
> > > +    if ((features & BIT_ULL(VIRTIO_BLK_F_SIZE_MAX)) == 0)
> > > +        return 0;
> > > +
> > > +    val_u32 = __virtio32_to_cpu(true, config->size_max);
> > > +
> > > +    return nla_put_u32(msg, VDPA_ATTR_DEV_BLK_CFG_SEG_SIZE, val_u32);
> > 
> > Should we call this VDPA_ATTR_DEV_BLK_CFG_SIZE_MAX ?
> I have tried this before, but this macro is too long causing a odd format in
> the header file.
> 
> I can change this since you point this out. This is uapi means we should
> merge the
> fix during the RC release before 6.9 official.
> 
> @MST, does the process work for you?


I'm fine applying a fixup patch. Yes it's preferable to make changed
before the release.

> > 
> > > +}
> > > +
> > > static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
> > >                     struct sk_buff *msg)
> > > {
> > > @@ -973,6 +987,9 @@ static int vdpa_dev_blk_config_fill(struct
> > > vdpa_device *vdev,
> > >     if (vdpa_dev_blk_capacity_config_fill(msg, &config))
> > >         return -EMSGSIZE;
> > > 
> > > +    if (vdpa_dev_blk_seg_size_config_fill(msg, features_device,
> > > &config))
> > > +        return -EMSGSIZE;
> > > +
> > >     return 0;
> > > }
> > > 
> > > diff --git a/include/uapi/linux/vdpa.h b/include/uapi/linux/vdpa.h
> > > index 1bf69226cb96..586bce3c906a 100644
> > > --- a/include/uapi/linux/vdpa.h
> > > +++ b/include/uapi/linux/vdpa.h
> > > @@ -57,6 +57,7 @@ enum vdpa_attr {
> > >     VDPA_ATTR_DEV_FEATURES,                 /* u64 */
> > > 
> > >     VDPA_ATTR_DEV_BLK_CFG_CAPACITY,        /* u64 */
> > > +    VDPA_ATTR_DEV_BLK_CFG_SEG_SIZE,        /* u32 */
> > > 
> > >     /* new attributes must be added above here */
> > >     VDPA_ATTR_MAX,
> > > -- 
> > > 2.39.3
> > > 
> > > 
> > 
> > 


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 09/10] vDPA: report virtio-block read-only info to user space
  2024-03-19 16:40   ` Stefano Garzarella
@ 2024-04-09  8:37     ` Zhu, Lingshan
  2024-05-03 12:18       ` Stefano Garzarella
  0 siblings, 1 reply; 34+ messages in thread
From: Zhu, Lingshan @ 2024-04-09  8:37 UTC (permalink / raw)
  To: Stefano Garzarella; +Cc: jasowang, mst, virtualization



On 3/20/2024 12:40 AM, Stefano Garzarella wrote:
> On Mon, Feb 19, 2024 at 02:56:05AM +0800, Zhu Lingshan wrote:
>> This commit report read-only information of
>> virtio-blk devices to user space.
>>
>> Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
>> ---
>> drivers/vdpa/vdpa.c       | 14 ++++++++++++++
>> include/uapi/linux/vdpa.h |  1 +
>> 2 files changed, 15 insertions(+)
>>
>> diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
>> index adbcbc7b18b2..d6fd3cadc44f 100644
>> --- a/drivers/vdpa/vdpa.c
>> +++ b/drivers/vdpa/vdpa.c
>> @@ -1084,6 +1084,17 @@ vdpa_dev_blk_write_zeroes_config_fill(struct 
>> sk_buff *msg, u64 features,
>>     return 0;
>> }
>>
>> +static int vdpa_dev_blk_ro_config_fill(struct sk_buff *msg, u64 
>> features)
>> +{
>> +    u8 ro;
>> +
>> +    ro = ((features & BIT_ULL(VIRTIO_BLK_F_RO)) == 0) ? 0 : 1;
>> +    if (nla_put_u8(msg, VDPA_ATTR_DEV_BLK_CFG_READ_ONLY, ro))
>
> This is not really related to the config space, what about renaming it
> to VDPA_ATTR_DEV_BLK_READ_ONLY ?
>
> Also the type, maybe better to use "flag" and set it through
> `nla_put_flag()`.
Hi Stefano,

I am implementing this change.
In my humble opinion, maybe using a boolean(the u8 above) is better?
Because using the flag means we conditionally put a "0" into the 
attribution,
or the attribution does not exist, this is still a bool logic but
a little vague.

Thanks
Lingshan
>
> Not a strong opinion on that, it just seems a little more consistent to
> me.
>
> Thanks,
> Stefano
>
>> +        return -EMSGSIZE;
>> +
>> +    return 0;
>> +}
>> +
>> static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
>>                     struct sk_buff *msg)
>> {
>> @@ -1122,6 +1133,9 @@ static int vdpa_dev_blk_config_fill(struct 
>> vdpa_device *vdev,
>>     if (vdpa_dev_blk_write_zeroes_config_fill(msg, features_device, 
>> &config))
>>         return -EMSGSIZE;
>>
>> +    if (vdpa_dev_blk_ro_config_fill(msg, features_device))
>> +        return -EMSGSIZE;
>> +
>>     return 0;
>> }
>>
>> diff --git a/include/uapi/linux/vdpa.h b/include/uapi/linux/vdpa.h
>> index 797d5708492f..4be8e3a15874 100644
>> --- a/include/uapi/linux/vdpa.h
>> +++ b/include/uapi/linux/vdpa.h
>> @@ -70,6 +70,7 @@ enum vdpa_attr {
>>     VDPA_ATTR_DEV_BLK_CFG_DISCARD_SEC_ALIGN,/* u32 */
>>     VDPA_ATTR_DEV_BLK_CFG_MAX_WRITE_ZEROES_SEC,    /* u32 */
>>     VDPA_ATTR_DEV_BLK_CFG_MAX_WRITE_ZEROES_SEG,    /* u32 */
>> +    VDPA_ATTR_DEV_BLK_CFG_READ_ONLY,        /* u8 */
>>
>>     /* new attributes must be added above here */
>>     VDPA_ATTR_MAX,
>> -- 
>> 2.39.3
>>
>>
>
>


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH 09/10] vDPA: report virtio-block read-only info to user space
  2024-04-09  8:37     ` Zhu, Lingshan
@ 2024-05-03 12:18       ` Stefano Garzarella
  0 siblings, 0 replies; 34+ messages in thread
From: Stefano Garzarella @ 2024-05-03 12:18 UTC (permalink / raw)
  To: Zhu, Lingshan; +Cc: jasowang, mst, virtualization

On Tue, Apr 09, 2024 at 04:37:18PM GMT, Zhu, Lingshan wrote:
>
>
>On 3/20/2024 12:40 AM, Stefano Garzarella wrote:
>>On Mon, Feb 19, 2024 at 02:56:05AM +0800, Zhu Lingshan wrote:
>>>This commit report read-only information of
>>>virtio-blk devices to user space.
>>>
>>>Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
>>>---
>>>drivers/vdpa/vdpa.c       | 14 ++++++++++++++
>>>include/uapi/linux/vdpa.h |  1 +
>>>2 files changed, 15 insertions(+)
>>>
>>>diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
>>>index adbcbc7b18b2..d6fd3cadc44f 100644
>>>--- a/drivers/vdpa/vdpa.c
>>>+++ b/drivers/vdpa/vdpa.c
>>>@@ -1084,6 +1084,17 @@ 
>>>vdpa_dev_blk_write_zeroes_config_fill(struct sk_buff *msg, u64 
>>>features,
>>>    return 0;
>>>}
>>>
>>>+static int vdpa_dev_blk_ro_config_fill(struct sk_buff *msg, u64 
>>>features)
>>>+{
>>>+    u8 ro;
>>>+
>>>+    ro = ((features & BIT_ULL(VIRTIO_BLK_F_RO)) == 0) ? 0 : 1;
>>>+    if (nla_put_u8(msg, VDPA_ATTR_DEV_BLK_CFG_READ_ONLY, ro))
>>
>>This is not really related to the config space, what about renaming it
>>to VDPA_ATTR_DEV_BLK_READ_ONLY ?
>>
>>Also the type, maybe better to use "flag" and set it through
>>`nla_put_flag()`.
>Hi Stefano,
>
>I am implementing this change.
>In my humble opinion, maybe using a boolean(the u8 above) is better?

If boolean is available, I agree that could be better.
I did just a fast search when I commented.

BTW, sorry for the late reply, I was on PTO.

Stefano

>Because using the flag means we conditionally put a "0" into the 
>attribution,
>or the attribution does not exist, this is still a bool logic but
>a little vague.
>
>Thanks
>Lingshan
>>
>>Not a strong opinion on that, it just seems a little more consistent to
>>me.
>>
>>Thanks,
>>Stefano
>>
>>>+        return -EMSGSIZE;
>>>+
>>>+    return 0;
>>>+}
>>>+
>>>static int vdpa_dev_blk_config_fill(struct vdpa_device *vdev,
>>>                    struct sk_buff *msg)
>>>{
>>>@@ -1122,6 +1133,9 @@ static int vdpa_dev_blk_config_fill(struct 
>>>vdpa_device *vdev,
>>>    if (vdpa_dev_blk_write_zeroes_config_fill(msg, 
>>>features_device, &config))
>>>        return -EMSGSIZE;
>>>
>>>+    if (vdpa_dev_blk_ro_config_fill(msg, features_device))
>>>+        return -EMSGSIZE;
>>>+
>>>    return 0;
>>>}
>>>
>>>diff --git a/include/uapi/linux/vdpa.h b/include/uapi/linux/vdpa.h
>>>index 797d5708492f..4be8e3a15874 100644
>>>--- a/include/uapi/linux/vdpa.h
>>>+++ b/include/uapi/linux/vdpa.h
>>>@@ -70,6 +70,7 @@ enum vdpa_attr {
>>>    VDPA_ATTR_DEV_BLK_CFG_DISCARD_SEC_ALIGN,/* u32 */
>>>    VDPA_ATTR_DEV_BLK_CFG_MAX_WRITE_ZEROES_SEC,    /* u32 */
>>>    VDPA_ATTR_DEV_BLK_CFG_MAX_WRITE_ZEROES_SEG,    /* u32 */
>>>+    VDPA_ATTR_DEV_BLK_CFG_READ_ONLY,        /* u8 */
>>>
>>>    /* new attributes must be added above here */
>>>    VDPA_ATTR_MAX,
>>>-- 
>>>2.39.3
>>>
>>>
>>
>>
>


^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2024-05-03 12:18 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-18 18:55 [PATCH 00/10] vDPA: allow userspace query virito-block device Zhu Lingshan
2024-02-18 18:55 ` [PATCH 01/10] vDPA: report virtio-block capacity to user space Zhu Lingshan
2024-03-19 16:43   ` Stefano Garzarella
2024-02-18 18:55 ` [PATCH 02/10] vDPA: report virtio-block max segment size " Zhu Lingshan
2024-03-19 16:04   ` Stefano Garzarella
2024-03-29 14:48     ` Zhu, Lingshan
2024-03-31 20:03       ` Michael S. Tsirkin
2024-02-18 18:55 ` [PATCH 03/10] vDPA: report virtio-block block-size " Zhu Lingshan
2024-03-19 16:43   ` Stefano Garzarella
2024-02-18 18:56 ` [PATCH 04/10] vDPA: report virtio-block max segments in a request " Zhu Lingshan
2024-03-19 16:43   ` Stefano Garzarella
2024-02-18 18:56 ` [PATCH 05/10] vDPA: report virtio-block MQ info " Zhu Lingshan
2024-03-19 16:44   ` Stefano Garzarella
2024-02-18 18:56 ` [PATCH 06/10] vDPA: report virtio-block topology " Zhu Lingshan
2024-03-19 16:44   ` Stefano Garzarella
2024-02-18 18:56 ` [PATCH 07/10] vDPA: report virtio-block discarding configuration " Zhu Lingshan
2024-03-19 16:44   ` Stefano Garzarella
2024-02-18 18:56 ` [PATCH 08/10] vDPA: report virtio-block write zeroes " Zhu Lingshan
2024-03-19 16:36   ` Stefano Garzarella
2024-03-19 17:02     ` Michael S. Tsirkin
2024-03-19 17:08       ` Stefano Garzarella
2024-03-19 17:57         ` Michael S. Tsirkin
2024-02-18 18:56 ` [PATCH 09/10] vDPA: report virtio-block read-only info " Zhu Lingshan
2024-03-19 16:40   ` Stefano Garzarella
2024-04-09  8:37     ` Zhu, Lingshan
2024-05-03 12:18       ` Stefano Garzarella
2024-02-18 18:56 ` [PATCH 10/10] vDPA: report virtio-blk flush " Zhu Lingshan
2024-03-19 16:42   ` Stefano Garzarella
2024-03-19  6:39 ` [PATCH 00/10] vDPA: allow userspace query virito-block device Michael S. Tsirkin
2024-03-20  3:30   ` Jason Wang
2024-03-20  7:00     ` Michael S. Tsirkin
2024-03-19 16:49 ` Stefano Garzarella
2024-03-20 10:31   ` Zhu, Lingshan
2024-03-20 10:53     ` Stefano Garzarella

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.