Skip to content

Commit

Permalink
Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/gi…
Browse files Browse the repository at this point in the history
…t/mst/vhost

Pull virtio fixes and cleanups from Michael Tsirkin:

 - Some bug fixes

 - Cleanup a couple of issues that surfaced meanwhile

 - Disable vhost on ARM with OABI for now - to be fixed fully later in
   the cycle or in the next release.

* tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost: (24 commits)
  vhost: disable for OABI
  virtio: drop vringh.h dependency
  virtio_blk: add a missing include
  virtio-balloon: Avoid using the word 'report' when referring to free page hinting
  virtio-balloon: make virtballoon_free_page_report() static
  vdpa: fix comment of vdpa_register_device()
  vdpa: make vhost, virtio depend on menu
  vdpa: allow a 32 bit vq alignment
  drm/virtio: fix up for include file changes
  remoteproc: pull in slab.h
  rpmsg: pull in slab.h
  virtio_input: pull in slab.h
  remoteproc: pull in slab.h
  virtio-rng: pull in slab.h
  virtgpu: pull in uaccess.h
  tools/virtio: make asm/barrier.h self contained
  tools/virtio: define aligned attribute
  virtio/test: fix up after IOTLB changes
  vhost: Create accessors for virtqueues private_data
  vdpasim: Return status in vdpasim_get_status
  ...
  • Loading branch information
Linus Torvalds committed Apr 21, 2020
2 parents b61f7ff + d085eb8 commit 189522d
Show file tree
Hide file tree
Showing 33 changed files with 128 additions and 75 deletions.
1 change: 1 addition & 0 deletions drivers/block/virtio_blk.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <linux/blk-mq.h>
#include <linux/blk-mq-virtio.h>
#include <linux/numa.h>
#include <uapi/linux/virtio_ring.h>

#define PART_BITS 4
#define VQ_NAME_LEN 16
Expand Down
1 change: 1 addition & 0 deletions drivers/char/hw_random/virtio-rng.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <linux/virtio.h>
#include <linux/virtio_rng.h>
#include <linux/module.h>
#include <linux/slab.h>

static DEFINE_IDA(rng_index_ida);

Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/virtio/virtgpu_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

#include <linux/file.h>
#include <linux/sync_file.h>
#include <linux/uaccess.h>

#include <drm/drm_file.h>
#include <drm/virtgpu_drm.h>
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/virtio/virtgpu_kms.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

#include <linux/virtio.h>
#include <linux/virtio_config.h>
#include <linux/virtio_ring.h>

#include <drm/drm_file.h>

Expand Down
2 changes: 1 addition & 1 deletion drivers/misc/mic/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ config MIC_COSM

config VOP
tristate "VOP Driver"
depends on VOP_BUS
depends on VOP_BUS && VHOST_DPN
select VHOST_RING
select VIRTIO
help
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/caif/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ config CAIF_HSI

config CAIF_VIRTIO
tristate "CAIF virtio transport driver"
depends on CAIF && HAS_DMA
depends on CAIF && HAS_DMA && VHOST_DPN
select VHOST_RING
select VIRTIO
select GENERIC_ALLOCATOR
Expand Down
1 change: 1 addition & 0 deletions drivers/remoteproc/remoteproc_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

#include <linux/remoteproc.h>
#include <linux/slab.h>

#include "remoteproc_internal.h"

Expand Down
1 change: 1 addition & 0 deletions drivers/remoteproc/stm32_rproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <linux/regmap.h>
#include <linux/remoteproc.h>
#include <linux/reset.h>
#include <linux/slab.h>
#include <linux/workqueue.h>

#include "remoteproc_internal.h"
Expand Down
1 change: 1 addition & 0 deletions drivers/rpmsg/mtk_rpmsg.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <linux/platform_device.h>
#include <linux/remoteproc.h>
#include <linux/rpmsg/mtk_rpmsg.h>
#include <linux/slab.h>
#include <linux/workqueue.h>

#include "rpmsg_internal.h"
Expand Down
18 changes: 6 additions & 12 deletions drivers/vdpa/Kconfig
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
# SPDX-License-Identifier: GPL-2.0-only
config VDPA
tristate
menuconfig VDPA
tristate "vDPA drivers"
help
Enable this module to support vDPA device that uses a
datapath which complies with virtio specifications with
vendor specific control path.

menuconfig VDPA_MENU
bool "VDPA drivers"
default n

if VDPA_MENU
if VDPA

config VDPA_SIM
tristate "vDPA device simulator"
depends on RUNTIME_TESTING_MENU
select VDPA
depends on RUNTIME_TESTING_MENU && HAS_DMA && VHOST_DPN
select VHOST_RING
default n
help
Expand All @@ -24,14 +19,13 @@ config VDPA_SIM
development of vDPA.

config IFCVF
tristate "Intel IFC VF VDPA driver"
tristate "Intel IFC VF vDPA driver"
depends on PCI_MSI
select VDPA
default n
help
This kernel module can drive Intel IFC VF NIC to offload
virtio dataplane traffic to hardware.
To compile this driver as a module, choose M here: the module will
be called ifcvf.

endif # VDPA_MENU
endif # VDPA
2 changes: 0 additions & 2 deletions drivers/vdpa/ifcvf/ifcvf_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,12 +301,10 @@ int ifcvf_set_vq_state(struct ifcvf_hw *hw, u16 qid, u64 num)

static int ifcvf_hw_enable(struct ifcvf_hw *hw)
{
struct ifcvf_lm_cfg __iomem *ifcvf_lm;
struct virtio_pci_common_cfg __iomem *cfg;
struct ifcvf_adapter *ifcvf;
u32 i;

ifcvf_lm = (struct ifcvf_lm_cfg __iomem *)hw->lm_cfg;
ifcvf = vf_to_adapter(hw);
cfg = hw->common_cfg;
ifc_iowrite16(IFCVF_MSI_CONFIG_OFF, &cfg->msix_config);
Expand Down
4 changes: 1 addition & 3 deletions drivers/vdpa/ifcvf/ifcvf_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,9 @@ static irqreturn_t ifcvf_intr_handler(int irq, void *arg)
static int ifcvf_start_datapath(void *private)
{
struct ifcvf_hw *vf = ifcvf_private_to_vf(private);
struct ifcvf_adapter *ifcvf;
u8 status;
int ret;

ifcvf = vf_to_adapter(vf);
vf->nr_vring = IFCVF_MAX_QUEUE_PAIRS * 2;
ret = ifcvf_start_hw(vf);
if (ret < 0) {
Expand Down Expand Up @@ -228,7 +226,7 @@ static u32 ifcvf_vdpa_get_vendor_id(struct vdpa_device *vdpa_dev)
return IFCVF_SUBSYS_VENDOR_ID;
}

static u16 ifcvf_vdpa_get_vq_align(struct vdpa_device *vdpa_dev)
static u32 ifcvf_vdpa_get_vq_align(struct vdpa_device *vdpa_dev)
{
return IFCVF_QUEUE_ALIGNMENT;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/vdpa/vdpa.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ EXPORT_SYMBOL_GPL(__vdpa_alloc_device);

/**
* vdpa_register_device - register a vDPA device
* Callers must have a succeed call of vdpa_init_device() before.
* Callers must have a succeed call of vdpa_alloc_device() before.
* @vdev: the vdpa device to be registered to vDPA bus
*
* Returns an error when fail to add to vDPA bus
Expand Down
4 changes: 2 additions & 2 deletions drivers/vdpa/vdpa_sim/vdpa_sim.c
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ static u64 vdpasim_get_vq_state(struct vdpa_device *vdpa, u16 idx)
return vrh->last_avail_idx;
}

static u16 vdpasim_get_vq_align(struct vdpa_device *vdpa)
static u32 vdpasim_get_vq_align(struct vdpa_device *vdpa)
{
return VDPASIM_QUEUE_ALIGN;
}
Expand Down Expand Up @@ -488,7 +488,7 @@ static u8 vdpasim_get_status(struct vdpa_device *vdpa)
status = vdpasim->status;
spin_unlock(&vdpasim->lock);

return vdpasim->status;
return status;
}

static void vdpasim_set_status(struct vdpa_device *vdpa, u8 status)
Expand Down
21 changes: 16 additions & 5 deletions drivers/vhost/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ config VHOST_IOTLB
tristate
help
Generic IOTLB implementation for vhost and vringh.
This option is selected by any driver which needs to support
an IOMMU in software.

config VHOST_RING
tristate
Expand All @@ -11,6 +13,15 @@ config VHOST_RING
This option is selected by any driver which needs to access
the host side of a virtio ring.

config VHOST_DPN
bool
depends on !ARM || AEABI
default y
help
Anything selecting VHOST or VHOST_RING must depend on VHOST_DPN.
This excludes the deprecated ARM ABI since that forces a 4 byte
alignment on all structs - incompatible with virtio spec requirements.

config VHOST
tristate
select VHOST_IOTLB
Expand All @@ -26,7 +37,7 @@ if VHOST_MENU

config VHOST_NET
tristate "Host kernel accelerator for virtio net"
depends on NET && EVENTFD && (TUN || !TUN) && (TAP || !TAP)
depends on NET && EVENTFD && (TUN || !TUN) && (TAP || !TAP) && VHOST_DPN
select VHOST
---help---
This kernel module can be loaded in host kernel to accelerate
Expand All @@ -38,7 +49,7 @@ config VHOST_NET

config VHOST_SCSI
tristate "VHOST_SCSI TCM fabric driver"
depends on TARGET_CORE && EVENTFD
depends on TARGET_CORE && EVENTFD && VHOST_DPN
select VHOST
default n
---help---
Expand All @@ -47,7 +58,7 @@ config VHOST_SCSI

config VHOST_VSOCK
tristate "vhost virtio-vsock driver"
depends on VSOCKETS && EVENTFD
depends on VSOCKETS && EVENTFD && VHOST_DPN
select VHOST
select VIRTIO_VSOCKETS_COMMON
default n
Expand All @@ -61,9 +72,9 @@ config VHOST_VSOCK

config VHOST_VDPA
tristate "Vhost driver for vDPA-based backend"
depends on EVENTFD
depends on EVENTFD && VHOST_DPN
select VHOST
select VDPA
depends on VDPA
help
This kernel module can be loaded in host kernel to accelerate
guest virtio devices with the vDPA-based backends.
Expand Down
28 changes: 15 additions & 13 deletions drivers/vhost/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ static void vhost_net_disable_vq(struct vhost_net *n,
struct vhost_net_virtqueue *nvq =
container_of(vq, struct vhost_net_virtqueue, vq);
struct vhost_poll *poll = n->poll + (nvq - n->vqs);
if (!vq->private_data)
if (!vhost_vq_get_backend(vq))
return;
vhost_poll_stop(poll);
}
Expand All @@ -437,7 +437,7 @@ static int vhost_net_enable_vq(struct vhost_net *n,
struct vhost_poll *poll = n->poll + (nvq - n->vqs);
struct socket *sock;

sock = vq->private_data;
sock = vhost_vq_get_backend(vq);
if (!sock)
return 0;

Expand Down Expand Up @@ -524,7 +524,7 @@ static void vhost_net_busy_poll(struct vhost_net *net,
return;

vhost_disable_notify(&net->dev, vq);
sock = rvq->private_data;
sock = vhost_vq_get_backend(rvq);

busyloop_timeout = poll_rx ? rvq->busyloop_timeout:
tvq->busyloop_timeout;
Expand Down Expand Up @@ -570,8 +570,10 @@ static int vhost_net_tx_get_vq_desc(struct vhost_net *net,

if (r == tvq->num && tvq->busyloop_timeout) {
/* Flush batched packets first */
if (!vhost_sock_zcopy(tvq->private_data))
vhost_tx_batch(net, tnvq, tvq->private_data, msghdr);
if (!vhost_sock_zcopy(vhost_vq_get_backend(tvq)))
vhost_tx_batch(net, tnvq,
vhost_vq_get_backend(tvq),
msghdr);

vhost_net_busy_poll(net, rvq, tvq, busyloop_intr, false);

Expand Down Expand Up @@ -685,7 +687,7 @@ static int vhost_net_build_xdp(struct vhost_net_virtqueue *nvq,
struct vhost_virtqueue *vq = &nvq->vq;
struct vhost_net *net = container_of(vq->dev, struct vhost_net,
dev);
struct socket *sock = vq->private_data;
struct socket *sock = vhost_vq_get_backend(vq);
struct page_frag *alloc_frag = &net->page_frag;
struct virtio_net_hdr *gso;
struct xdp_buff *xdp = &nvq->xdp[nvq->batched_xdp];
Expand Down Expand Up @@ -952,7 +954,7 @@ static void handle_tx(struct vhost_net *net)
struct socket *sock;

mutex_lock_nested(&vq->mutex, VHOST_NET_VQ_TX);
sock = vq->private_data;
sock = vhost_vq_get_backend(vq);
if (!sock)
goto out;

Expand Down Expand Up @@ -1121,7 +1123,7 @@ static void handle_rx(struct vhost_net *net)
int recv_pkts = 0;

mutex_lock_nested(&vq->mutex, VHOST_NET_VQ_RX);
sock = vq->private_data;
sock = vhost_vq_get_backend(vq);
if (!sock)
goto out;

Expand Down Expand Up @@ -1345,9 +1347,9 @@ static struct socket *vhost_net_stop_vq(struct vhost_net *n,
container_of(vq, struct vhost_net_virtqueue, vq);

mutex_lock(&vq->mutex);
sock = vq->private_data;
sock = vhost_vq_get_backend(vq);
vhost_net_disable_vq(n, vq);
vq->private_data = NULL;
vhost_vq_set_backend(vq, NULL);
vhost_net_buf_unproduce(nvq);
nvq->rx_ring = NULL;
mutex_unlock(&vq->mutex);
Expand Down Expand Up @@ -1521,7 +1523,7 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
}

/* start polling new socket */
oldsock = vq->private_data;
oldsock = vhost_vq_get_backend(vq);
if (sock != oldsock) {
ubufs = vhost_net_ubuf_alloc(vq,
sock && vhost_sock_zcopy(sock));
Expand All @@ -1531,7 +1533,7 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
}

vhost_net_disable_vq(n, vq);
vq->private_data = sock;
vhost_vq_set_backend(vq, sock);
vhost_net_buf_unproduce(nvq);
r = vhost_vq_init_access(vq);
if (r)
Expand Down Expand Up @@ -1568,7 +1570,7 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
return 0;

err_used:
vq->private_data = oldsock;
vhost_vq_set_backend(vq, oldsock);
vhost_net_enable_vq(n, vq);
if (ubufs)
vhost_net_ubuf_put_wait_and_free(ubufs);
Expand Down
Loading

0 comments on commit 189522d

Please sign in to comment.