Vincent Whitchurch 5aa608348f mic: vop: Fix broken virtqueues
VOP is broken in mainline since commit 1ce9e6055fa0a9043 ("virtio_ring:
introduce packed ring support"); attempting to use the virtqueues leads
to various kernel crashes.  I'm testing it with my not-yet-merged
loopback patches, but even the in-tree MIC hardware cannot work.

The problem is not in the referenced commit per se, but is due to the
following hack in vop_find_vq() which depends on the layout of private
structures in other source files, which that commit happened to change:

  /*
   * To reassign the used ring here we are directly accessing
   * struct vring_virtqueue which is a private data structure
   * in virtio_ring.c. At the minimum, a BUILD_BUG_ON() in
   * vring_new_virtqueue() would ensure that
   *  (&vq->vring == (struct vring *) (&vq->vq + 1));
   */
  vr = (struct vring *)(vq + 1);
  vr->used = used;

Fix vop by using __vring_new_virtqueue() to create the needed vring
layout from the start, instead of attempting to patch in the used ring
later.  __vring_new_virtqueue() was added way back in commit
2a2d1382fe9dcc ("virtio: Add improved queue allocation API") in order to
address mic's usecase, according to the commit message.

Fixes: 1ce9e6055fa0 ("virtio_ring: introduce packed ring support")
Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-01-30 15:42:26 +01:00
..
2019-01-26 15:03:43 -08:00
2019-01-19 07:17:19 +12:00
2019-01-20 09:12:50 +12:00
2018-12-31 17:32:35 -08:00
2018-12-29 08:20:44 -07:00
2019-01-25 13:03:34 -10:00
2018-12-27 10:43:24 -08:00
2019-01-05 11:28:39 -08:00
2019-01-09 19:20:31 -05:00
2019-01-11 00:15:04 +01:00
2019-01-15 06:24:36 +12:00
2019-01-18 17:17:20 +12:00
2019-01-22 07:27:17 +13:00
2019-01-18 23:32:29 +01:00
2019-01-05 11:30:37 -08:00
2018-12-28 16:52:18 -08:00
2019-01-15 06:24:36 +12:00
2019-01-30 15:42:26 +01:00
2019-01-25 13:07:03 -10:00
2019-01-25 15:32:28 -08:00
2019-01-26 12:42:41 -08:00
2019-01-19 07:26:16 +12:00
2019-01-05 11:23:17 -08:00
2019-01-25 12:57:09 -10:00
2018-12-29 13:03:29 -08:00
2018-12-24 12:06:56 +01:00
2019-01-01 13:24:31 -08:00
2019-01-26 15:03:43 -08:00
2019-01-22 20:54:00 -05:00
2018-12-31 13:06:30 -08:00
2018-12-28 20:54:57 -08:00
2019-01-18 12:58:20 +01:00
2019-01-25 12:58:40 -10:00
2018-12-29 13:40:29 -08:00