Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 25 Feb 2021 20:21:08 +0000 (12:21 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 25 Feb 2021 20:21:08 +0000 (12:21 -0800)
Pull virtio updates from Michael Tsirkin:

 - new vdpa features to allow creation and deletion of new devices

 - virtio-blk support per-device queue depth

 - fixes, cleanups all over the place

* tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost: (31 commits)
  virtio-input: add multi-touch support
  virtio_mmio: fix one typo
  vdpa/mlx5: fix param validation in mlx5_vdpa_get_config()
  virtio_net: Fix fall-through warnings for Clang
  virtio_input: Prevent EV_MSC/MSC_TIMESTAMP loop storm for MT.
  virtio-blk: support per-device queue depth
  virtio_vdpa: don't warn when fail to disable vq
  virtio-pci: introduce modern device module
  virito-pci-modern: rename map_capability() to vp_modern_map_capability()
  virtio-pci-modern: introduce helper to get notification offset
  virtio-pci-modern: introduce helper for getting queue nums
  virtio-pci-modern: introduce helper for setting/geting queue size
  virtio-pci-modern: introduce helper to set/get queue_enable
  virtio-pci-modern: introduce vp_modern_queue_address()
  virtio-pci-modern: introduce vp_modern_set_queue_vector()
  virtio-pci-modern: introduce vp_modern_generation()
  virtio-pci-modern: introduce helpers for setting and getting features
  virtio-pci-modern: introduce helpers for setting and getting status
  virtio-pci-modern: introduce helper to set config vector
  virtio-pci-modern: introduce vp_modern_remove()
  ...

1  2 
drivers/block/virtio_blk.c
drivers/net/virtio_net.c

@@@ -320,7 -320,7 +320,7 @@@ static int virtblk_get_id(struct gendis
        if (err)
                goto out;
  
 -      blk_execute_rq(vblk->disk->queue, vblk->disk, req, false);
 +      blk_execute_rq(vblk->disk, req, false);
        err = blk_status_to_errno(virtblk_result(blk_mq_rq_to_pdu(req)));
  out:
        blk_put_request(req);
@@@ -705,6 -705,7 +705,7 @@@ static int virtblk_probe(struct virtio_
        u32 v, blk_size, max_size, sg_elems, opt_io_size;
        u16 min_io_size;
        u8 physical_block_exp, alignment_offset;
+       unsigned int queue_depth;
  
        if (!vdev->config->get) {
                dev_err(&vdev->dev, "%s failure: config access disabled\n",
        }
  
        /* Default queue sizing is to fill the ring. */
-       if (!virtblk_queue_depth) {
-               virtblk_queue_depth = vblk->vqs[0].vq->num_free;
+       if (likely(!virtblk_queue_depth)) {
+               queue_depth = vblk->vqs[0].vq->num_free;
                /* ... but without indirect descs, we use 2 descs per req */
                if (!virtio_has_feature(vdev, VIRTIO_RING_F_INDIRECT_DESC))
-                       virtblk_queue_depth /= 2;
+                       queue_depth /= 2;
+       } else {
+               queue_depth = virtblk_queue_depth;
        }
  
        memset(&vblk->tag_set, 0, sizeof(vblk->tag_set));
        vblk->tag_set.ops = &virtio_mq_ops;
-       vblk->tag_set.queue_depth = virtblk_queue_depth;
+       vblk->tag_set.queue_depth = queue_depth;
        vblk->tag_set.numa_node = NUMA_NO_NODE;
        vblk->tag_set.flags = BLK_MQ_F_SHOULD_MERGE;
        vblk->tag_set.cmd_size =
diff --combined drivers/net/virtio_net.c
@@@ -689,9 -689,12 +689,9 @@@ static struct sk_buff *receive_small(st
                        page = xdp_page;
                }
  
 -              xdp.data_hard_start = buf + VIRTNET_RX_PAD + vi->hdr_len;
 -              xdp.data = xdp.data_hard_start + xdp_headroom;
 -              xdp.data_end = xdp.data + len;
 -              xdp.data_meta = xdp.data;
 -              xdp.rxq = &rq->xdp_rxq;
 -              xdp.frame_sz = buflen;
 +              xdp_init_buff(&xdp, buflen, &rq->xdp_rxq);
 +              xdp_prepare_buff(&xdp, buf + VIRTNET_RX_PAD + vi->hdr_len,
 +                               xdp_headroom, len, true);
                orig_data = xdp.data;
                act = bpf_prog_run_xdp(xdp_prog, &xdp);
                stats->xdp_packets++;
                        fallthrough;
                case XDP_ABORTED:
                        trace_xdp_exception(vi->dev, xdp_prog, act);
+                       goto err_xdp;
                case XDP_DROP:
                        goto err_xdp;
                }
@@@ -856,9 -860,12 +857,9 @@@ static struct sk_buff *receive_mergeabl
                 * the descriptor on if we get an XDP_TX return code.
                 */
                data = page_address(xdp_page) + offset;
 -              xdp.data_hard_start = data - VIRTIO_XDP_HEADROOM + vi->hdr_len;
 -              xdp.data = data + vi->hdr_len;
 -              xdp.data_end = xdp.data + (len - vi->hdr_len);
 -              xdp.data_meta = xdp.data;
 -              xdp.rxq = &rq->xdp_rxq;
 -              xdp.frame_sz = frame_sz - vi->hdr_len;
 +              xdp_init_buff(&xdp, frame_sz - vi->hdr_len, &rq->xdp_rxq);
 +              xdp_prepare_buff(&xdp, data - VIRTIO_XDP_HEADROOM + vi->hdr_len,
 +                               VIRTIO_XDP_HEADROOM, len - vi->hdr_len, true);
  
                act = bpf_prog_run_xdp(xdp_prog, &xdp);
                stats->xdp_packets++;