Skip to content

Commit e6fa605

Browse files
stefano-garzarellamstsirkin
authored andcommitted
vdpa_sim_blk: handle VIRTIO_BLK_T_GET_ID
Handle VIRTIO_BLK_T_GET_ID request, always answering the "vdpa_blk_sim" string. Acked-by: Jason Wang <[email protected]> Reviewed-by: Stefan Hajnoczi <[email protected]> Signed-off-by: Stefano Garzarella <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Michael S. Tsirkin <[email protected]>
1 parent 7d189f6 commit e6fa605

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

drivers/vdpa/vdpa_sim/vdpa_sim_blk.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#define VDPASIM_BLK_VQ_NUM 1
3939

4040
static struct vdpasim *vdpasim_blk_dev;
41+
static char vdpasim_blk_id[VIRTIO_BLK_ID_BYTES] = "vdpa_blk_sim";
4142

4243
static bool vdpasim_blk_check_range(u64 start_sector, size_t range_size)
4344
{
@@ -153,6 +154,20 @@ static bool vdpasim_blk_handle_req(struct vdpasim *vdpasim,
153154
}
154155
break;
155156

157+
case VIRTIO_BLK_T_GET_ID:
158+
bytes = vringh_iov_push_iotlb(&vq->vring, &vq->in_iov,
159+
vdpasim_blk_id,
160+
VIRTIO_BLK_ID_BYTES);
161+
if (bytes < 0) {
162+
dev_err(&vdpasim->vdpa.dev,
163+
"vringh_iov_push_iotlb() error: %zd\n", bytes);
164+
status = VIRTIO_BLK_S_IOERR;
165+
break;
166+
}
167+
168+
pushed += bytes;
169+
break;
170+
156171
default:
157172
dev_warn(&vdpasim->vdpa.dev,
158173
"Unsupported request type %d\n", type);

0 commit comments

Comments
 (0)