Skip to content

Commit 7a53e17

Browse files
committed
Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
Pull virtio updates from Michael Tsirkin: - A huge patchset supporting vq resize using the new vq reset capability - Features, fixes, and cleanups all over the place * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost: (88 commits) vdpa/mlx5: Fix possible uninitialized return value vdpa_sim_blk: add support for discard and write-zeroes vdpa_sim_blk: add support for VIRTIO_BLK_T_FLUSH vdpa_sim_blk: make vdpasim_blk_check_range usable by other requests vdpa_sim_blk: check if sector is 0 for commands other than read or write vdpa_sim: Implement suspend vdpa op vhost-vdpa: uAPI to suspend the device vhost-vdpa: introduce SUSPEND backend feature bit vdpa: Add suspend operation virtio-blk: Avoid use-after-free on suspend/resume virtio_vdpa: support the arg sizes of find_vqs() vhost-vdpa: Call ida_simple_remove() when failed vDPA: fix 'cast to restricted le16' warnings in vdpa.c vDPA: !FEATURES_OK should not block querying device config space vDPA/ifcvf: support userspace to query features and MQ of a management device vDPA/ifcvf: get_config_size should return a value no greater than dev implementation vhost scsi: Allow user to control num virtqueues vhost-scsi: Fix max number of virtqueues vdpa/mlx5: Support different address spaces for control and data vdpa/mlx5: Implement susupend virtqueue callback ...
2 parents 999324f + 93e530d commit 7a53e17

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+2148
-533
lines changed

Documentation/devicetree/bindings/virtio/mmio.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ properties:
3333
description: Required for devices making accesses thru an IOMMU.
3434
maxItems: 1
3535

36+
wakeup-source:
37+
type: boolean
38+
description: Required for setting irq of a virtio_mmio device as wakeup source.
39+
3640
required:
3741
- compatible
3842
- reg

arch/um/drivers/virtio_uml.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -958,6 +958,7 @@ static struct virtqueue *vu_setup_vq(struct virtio_device *vdev,
958958
goto error_create;
959959
}
960960
vq->priv = info;
961+
vq->num_max = num;
961962
num = virtqueue_get_vring_size(vq);
962963

963964
if (vu_dev->protocol_features &
@@ -1010,7 +1011,7 @@ static struct virtqueue *vu_setup_vq(struct virtio_device *vdev,
10101011

10111012
static int vu_find_vqs(struct virtio_device *vdev, unsigned nvqs,
10121013
struct virtqueue *vqs[], vq_callback_t *callbacks[],
1013-
const char * const names[], const bool *ctx,
1014+
const char * const names[], u32 sizes[], const bool *ctx,
10141015
struct irq_affinity *desc)
10151016
{
10161017
struct virtio_uml_device *vu_dev = to_virtio_uml_device(vdev);

drivers/block/virtio_blk.c

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,14 @@ static inline blk_status_t virtblk_result(struct virtblk_req *vbr)
101101
}
102102
}
103103

104+
static inline struct virtio_blk_vq *get_virtio_blk_vq(struct blk_mq_hw_ctx *hctx)
105+
{
106+
struct virtio_blk *vblk = hctx->queue->queuedata;
107+
struct virtio_blk_vq *vq = &vblk->vqs[hctx->queue_num];
108+
109+
return vq;
110+
}
111+
104112
static int virtblk_add_req(struct virtqueue *vq, struct virtblk_req *vbr)
105113
{
106114
struct scatterlist hdr, status, *sgs[3];
@@ -416,7 +424,7 @@ static void virtio_queue_rqs(struct request **rqlist)
416424
struct request *requeue_list = NULL;
417425

418426
rq_list_for_each_safe(rqlist, req, next) {
419-
struct virtio_blk_vq *vq = req->mq_hctx->driver_data;
427+
struct virtio_blk_vq *vq = get_virtio_blk_vq(req->mq_hctx);
420428
bool kick;
421429

422430
if (!virtblk_prep_rq_batch(req)) {
@@ -837,7 +845,7 @@ static void virtblk_complete_batch(struct io_comp_batch *iob)
837845
static int virtblk_poll(struct blk_mq_hw_ctx *hctx, struct io_comp_batch *iob)
838846
{
839847
struct virtio_blk *vblk = hctx->queue->queuedata;
840-
struct virtio_blk_vq *vq = hctx->driver_data;
848+
struct virtio_blk_vq *vq = get_virtio_blk_vq(hctx);
841849
struct virtblk_req *vbr;
842850
unsigned long flags;
843851
unsigned int len;
@@ -862,22 +870,10 @@ static int virtblk_poll(struct blk_mq_hw_ctx *hctx, struct io_comp_batch *iob)
862870
return found;
863871
}
864872

865-
static int virtblk_init_hctx(struct blk_mq_hw_ctx *hctx, void *data,
866-
unsigned int hctx_idx)
867-
{
868-
struct virtio_blk *vblk = data;
869-
struct virtio_blk_vq *vq = &vblk->vqs[hctx_idx];
870-
871-
WARN_ON(vblk->tag_set.tags[hctx_idx] != hctx->tags);
872-
hctx->driver_data = vq;
873-
return 0;
874-
}
875-
876873
static const struct blk_mq_ops virtio_mq_ops = {
877874
.queue_rq = virtio_queue_rq,
878875
.queue_rqs = virtio_queue_rqs,
879876
.commit_rqs = virtio_commit_rqs,
880-
.init_hctx = virtblk_init_hctx,
881877
.complete = virtblk_request_done,
882878
.map_queues = virtblk_map_queues,
883879
.poll = virtblk_poll,

0 commit comments

Comments
 (0)