vdpa_sim_blk: add support for VIRTIO_BLK_T_FLUSH

The simulator behaves like a ramdisk, so we don't have to do
anything when a VIRTIO_BLK_T_FLUSH request is received, but it
could be useful to test driver behavior.

Let's expose the VIRTIO_BLK_F_FLUSH feature to inform the driver
that we support the flush command.

Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Message-Id: <20220811083632.77525-4-sgarzare@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
Stefano Garzarella 2022-08-11 10:36:31 +02:00 committed by Michael S. Tsirkin
parent ac926e1b46
commit 518083d2f5
1 changed files with 5 additions and 0 deletions

View File

@ -25,6 +25,7 @@
#define DRV_LICENSE "GPL v2" #define DRV_LICENSE "GPL v2"
#define VDPASIM_BLK_FEATURES (VDPASIM_FEATURES | \ #define VDPASIM_BLK_FEATURES (VDPASIM_FEATURES | \
(1ULL << VIRTIO_BLK_F_FLUSH) | \
(1ULL << VIRTIO_BLK_F_SIZE_MAX) | \ (1ULL << VIRTIO_BLK_F_SIZE_MAX) | \
(1ULL << VIRTIO_BLK_F_SEG_MAX) | \ (1ULL << VIRTIO_BLK_F_SEG_MAX) | \
(1ULL << VIRTIO_BLK_F_BLK_SIZE) | \ (1ULL << VIRTIO_BLK_F_BLK_SIZE) | \
@ -188,6 +189,10 @@ static bool vdpasim_blk_handle_req(struct vdpasim *vdpasim,
pushed += bytes; pushed += bytes;
break; break;
case VIRTIO_BLK_T_FLUSH:
/* nothing to do */
break;
default: default:
dev_dbg(&vdpasim->vdpa.dev, dev_dbg(&vdpasim->vdpa.dev,
"Unsupported request type %d\n", type); "Unsupported request type %d\n", type);