Skip to content

Commit

Permalink
vdpa_sim_blk: handle VIRTIO_BLK_T_GET_ID
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
stefano-garzarella authored and mstsirkin committed May 3, 2021
1 parent 7d189f6 commit e6fa605
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions drivers/vdpa/vdpa_sim/vdpa_sim_blk.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#define VDPASIM_BLK_VQ_NUM 1

static struct vdpasim *vdpasim_blk_dev;
static char vdpasim_blk_id[VIRTIO_BLK_ID_BYTES] = "vdpa_blk_sim";

static bool vdpasim_blk_check_range(u64 start_sector, size_t range_size)
{
Expand Down Expand Up @@ -153,6 +154,20 @@ static bool vdpasim_blk_handle_req(struct vdpasim *vdpasim,
}
break;

case VIRTIO_BLK_T_GET_ID:
bytes = vringh_iov_push_iotlb(&vq->vring, &vq->in_iov,
vdpasim_blk_id,
VIRTIO_BLK_ID_BYTES);
if (bytes < 0) {
dev_err(&vdpasim->vdpa.dev,
"vringh_iov_push_iotlb() error: %zd\n", bytes);
status = VIRTIO_BLK_S_IOERR;
break;
}

pushed += bytes;
break;

default:
dev_warn(&vdpasim->vdpa.dev,
"Unsupported request type %d\n", type);
Expand Down

0 comments on commit e6fa605

Please sign in to comment.