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 updates from Michael Tsirkin:
 "Several new features here:

   - virtio-net is finally supported in vduse

   - virtio (balloon and mem) interaction with suspend is improved

   - vhost-scsi now handles signals better/faster

  And fixes, cleanups all over the place"

* tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost: (48 commits)
  virtio-pci: Check if is_avq is NULL
  virtio: delete vq in vp_find_vqs_msix() when request_irq() fails
  MAINTAINERS: add Eugenio Pérez as reviewer
  vhost-vdpa: Remove usage of the deprecated ida_simple_xx() API
  vp_vdpa: don't allocate unused msix vectors
  sound: virtio: drop owner assignment
  fuse: virtio: drop owner assignment
  scsi: virtio: drop owner assignment
  rpmsg: virtio: drop owner assignment
  nvdimm: virtio_pmem: drop owner assignment
  wifi: mac80211_hwsim: drop owner assignment
  vsock/virtio: drop owner assignment
  net: 9p: virtio: drop owner assignment
  net: virtio: drop owner assignment
  net: caif: virtio: drop owner assignment
  misc: nsm: drop owner assignment
  iommu: virtio: drop owner assignment
  drm/virtio: drop owner assignment
  gpio: virtio: drop owner assignment
  firmware: arm_scmi: virtio: drop owner assignment
  ...
  • Loading branch information
torvalds committed May 23, 2024
2 parents c760b37 + c8fae27 commit 2ef32ad
Show file tree
Hide file tree
Showing 40 changed files with 353 additions and 175 deletions.
10 changes: 8 additions & 2 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -10654,8 +10654,10 @@ F: include/net/nl802154.h
F: net/ieee802154/
F: net/mac802154/

IFCVF VIRTIO DATA PATH ACCELERATOR
R: Zhu Lingshan <[email protected]>
Intel VIRTIO DATA PATH ACCELERATOR
M: Zhu Lingshan <[email protected]>
L: [email protected]
S: Supported
F: drivers/vdpa/ifcvf/

IFE PROTOCOL
Expand Down Expand Up @@ -23746,6 +23748,7 @@ M: "Michael S. Tsirkin" <[email protected]>
M: Jason Wang <[email protected]>
R: Paolo Bonzini <[email protected]>
R: Stefan Hajnoczi <[email protected]>
R: Eugenio Pérez <[email protected]>
L: [email protected]
S: Maintained
F: drivers/block/virtio_blk.c
Expand All @@ -23764,6 +23767,7 @@ VIRTIO CORE AND NET DRIVERS
M: "Michael S. Tsirkin" <[email protected]>
M: Jason Wang <[email protected]>
R: Xuan Zhuo <[email protected]>
R: Eugenio Pérez <[email protected]>
L: [email protected]
S: Maintained
F: Documentation/ABI/testing/sysfs-bus-vdpa
Expand Down Expand Up @@ -23805,6 +23809,7 @@ VIRTIO FILE SYSTEM
M: Vivek Goyal <[email protected]>
M: Stefan Hajnoczi <[email protected]>
M: Miklos Szeredi <[email protected]>
R: Eugenio Pérez <[email protected]>
L: [email protected]
L: [email protected]
S: Supported
Expand Down Expand Up @@ -23838,6 +23843,7 @@ F: include/uapi/linux/virtio_gpu.h
VIRTIO HOST (VHOST)
M: "Michael S. Tsirkin" <[email protected]>
M: Jason Wang <[email protected]>
R: Eugenio Pérez <[email protected]>
L: [email protected]
L: [email protected]
L: [email protected]
Expand Down
1 change: 0 additions & 1 deletion arch/um/drivers/virt-pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,6 @@ MODULE_DEVICE_TABLE(virtio, id_table);

static struct virtio_driver um_pci_virtio_driver = {
.driver.name = "virtio-pci",
.driver.owner = THIS_MODULE,
.id_table = id_table,
.probe = um_pci_virtio_probe,
.remove = um_pci_virtio_remove,
Expand Down
1 change: 0 additions & 1 deletion drivers/block/virtio_blk.c
Original file line number Diff line number Diff line change
Expand Up @@ -1658,7 +1658,6 @@ static struct virtio_driver virtio_blk = {
.feature_table_legacy = features_legacy,
.feature_table_size_legacy = ARRAY_SIZE(features_legacy),
.driver.name = KBUILD_MODNAME,
.driver.owner = THIS_MODULE,
.id_table = id_table,
.probe = virtblk_probe,
.remove = virtblk_remove,
Expand Down
1 change: 0 additions & 1 deletion drivers/bluetooth/virtio_bt.c
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,6 @@ static const unsigned int virtbt_features[] = {

static struct virtio_driver virtbt_driver = {
.driver.name = KBUILD_MODNAME,
.driver.owner = THIS_MODULE,
.feature_table = virtbt_features,
.feature_table_size = ARRAY_SIZE(virtbt_features),
.id_table = virtbt_table,
Expand Down
1 change: 0 additions & 1 deletion drivers/char/hw_random/virtio-rng.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ static const struct virtio_device_id id_table[] = {

static struct virtio_driver virtio_rng_driver = {
.driver.name = KBUILD_MODNAME,
.driver.owner = THIS_MODULE,
.id_table = id_table,
.probe = virtrng_probe,
.remove = virtrng_remove,
Expand Down
2 changes: 0 additions & 2 deletions drivers/char/virtio_console.c
Original file line number Diff line number Diff line change
Expand Up @@ -2173,7 +2173,6 @@ static struct virtio_driver virtio_console = {
.feature_table = features,
.feature_table_size = ARRAY_SIZE(features),
.driver.name = KBUILD_MODNAME,
.driver.owner = THIS_MODULE,
.id_table = id_table,
.probe = virtcons_probe,
.remove = virtcons_remove,
Expand All @@ -2188,7 +2187,6 @@ static struct virtio_driver virtio_rproc_serial = {
.feature_table = rproc_serial_features,
.feature_table_size = ARRAY_SIZE(rproc_serial_features),
.driver.name = "virtio_rproc_serial",
.driver.owner = THIS_MODULE,
.id_table = rproc_serial_id_table,
.probe = virtcons_probe,
.remove = virtcons_remove,
Expand Down
1 change: 0 additions & 1 deletion drivers/crypto/virtio/virtio_crypto_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,6 @@ static const struct virtio_device_id id_table[] = {

static struct virtio_driver virtio_crypto_driver = {
.driver.name = KBUILD_MODNAME,
.driver.owner = THIS_MODULE,
.feature_table = features,
.feature_table_size = ARRAY_SIZE(features),
.id_table = id_table,
Expand Down
1 change: 0 additions & 1 deletion drivers/firmware/arm_scmi/virtio.c
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,6 @@ static const struct virtio_device_id id_table[] = {

static struct virtio_driver virtio_scmi_driver = {
.driver.name = "scmi-virtio",
.driver.owner = THIS_MODULE,
.feature_table = features,
.feature_table_size = ARRAY_SIZE(features),
.id_table = id_table,
Expand Down
1 change: 0 additions & 1 deletion drivers/gpio/gpio-virtio.c
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,6 @@ static struct virtio_driver virtio_gpio_driver = {
.remove = virtio_gpio_remove,
.driver = {
.name = KBUILD_MODNAME,
.owner = THIS_MODULE,
},
};
module_virtio_driver(virtio_gpio_driver);
Expand Down
1 change: 0 additions & 1 deletion drivers/gpu/drm/virtio/virtgpu_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ static struct virtio_driver virtio_gpu_driver = {
.feature_table = features,
.feature_table_size = ARRAY_SIZE(features),
.driver.name = KBUILD_MODNAME,
.driver.owner = THIS_MODULE,
.id_table = id_table,
.probe = virtio_gpu_probe,
.remove = virtio_gpu_remove,
Expand Down
1 change: 0 additions & 1 deletion drivers/iommu/virtio-iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1251,7 +1251,6 @@ MODULE_DEVICE_TABLE(virtio, id_table);

static struct virtio_driver virtio_iommu_drv = {
.driver.name = KBUILD_MODNAME,
.driver.owner = THIS_MODULE,
.id_table = id_table,
.feature_table = features,
.feature_table_size = ARRAY_SIZE(features),
Expand Down
1 change: 0 additions & 1 deletion drivers/misc/nsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,6 @@ static struct virtio_driver virtio_nsm_driver = {
.feature_table_legacy = 0,
.feature_table_size_legacy = 0,
.driver.name = KBUILD_MODNAME,
.driver.owner = THIS_MODULE,
.id_table = id_table,
.probe = nsm_device_probe,
.remove = nsm_device_remove,
Expand Down
1 change: 0 additions & 1 deletion drivers/net/caif/caif_virtio.c
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,6 @@ static struct virtio_driver caif_virtio_driver = {
.feature_table = features,
.feature_table_size = ARRAY_SIZE(features),
.driver.name = KBUILD_MODNAME,
.driver.owner = THIS_MODULE,
.id_table = id_table,
.probe = cfv_probe,
.remove = cfv_remove,
Expand Down
1 change: 0 additions & 1 deletion drivers/net/virtio_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -6039,7 +6039,6 @@ static struct virtio_driver virtio_net_driver = {
.feature_table_legacy = features_legacy,
.feature_table_size_legacy = ARRAY_SIZE(features_legacy),
.driver.name = KBUILD_MODNAME,
.driver.owner = THIS_MODULE,
.id_table = id_table,
.validate = virtnet_validate,
.probe = virtnet_probe,
Expand Down
1 change: 0 additions & 1 deletion drivers/net/wireless/virtual/mac80211_hwsim.c
Original file line number Diff line number Diff line change
Expand Up @@ -6678,7 +6678,6 @@ MODULE_DEVICE_TABLE(virtio, id_table);

static struct virtio_driver virtio_hwsim = {
.driver.name = KBUILD_MODNAME,
.driver.owner = THIS_MODULE,
.id_table = id_table,
.probe = hwsim_virtio_probe,
.remove = hwsim_virtio_remove,
Expand Down
1 change: 0 additions & 1 deletion drivers/nvdimm/virtio_pmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ static struct virtio_driver virtio_pmem_driver = {
.feature_table = features,
.feature_table_size = ARRAY_SIZE(features),
.driver.name = KBUILD_MODNAME,
.driver.owner = THIS_MODULE,
.id_table = id_table,
.validate = virtio_pmem_validate,
.probe = virtio_pmem_probe,
Expand Down
1 change: 0 additions & 1 deletion drivers/rpmsg/virtio_rpmsg_bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -1053,7 +1053,6 @@ static struct virtio_driver virtio_ipc_driver = {
.feature_table = features,
.feature_table_size = ARRAY_SIZE(features),
.driver.name = KBUILD_MODNAME,
.driver.owner = THIS_MODULE,
.id_table = id_table,
.probe = rpmsg_probe,
.remove = rpmsg_remove,
Expand Down
1 change: 0 additions & 1 deletion drivers/scsi/virtio_scsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1052,7 +1052,6 @@ static struct virtio_driver virtio_scsi_driver = {
.feature_table = features,
.feature_table_size = ARRAY_SIZE(features),
.driver.name = KBUILD_MODNAME,
.driver.owner = THIS_MODULE,
.id_table = id_table,
.probe = virtscsi_probe,
#ifdef CONFIG_PM_SLEEP
Expand Down
2 changes: 1 addition & 1 deletion drivers/vdpa/vdpa.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ static ssize_t driver_override_show(struct device *dev,
ssize_t len;

device_lock(dev);
len = snprintf(buf, PAGE_SIZE, "%s\n", vdev->driver_override);
len = sysfs_emit(buf, "%s\n", vdev->driver_override);
device_unlock(dev);

return len;
Expand Down
24 changes: 20 additions & 4 deletions drivers/vdpa/vdpa_user/vduse_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*
*/

#include "linux/virtio_net.h"
#include <linux/init.h>
#include <linux/module.h>
#include <linux/cdev.h>
Expand All @@ -28,6 +29,7 @@
#include <uapi/linux/virtio_config.h>
#include <uapi/linux/virtio_ids.h>
#include <uapi/linux/virtio_blk.h>
#include <uapi/linux/virtio_ring.h>
#include <linux/mod_devicetable.h>

#include "iova_domain.h"
Expand Down Expand Up @@ -141,6 +143,7 @@ static struct workqueue_struct *vduse_irq_bound_wq;

static u32 allowed_device_id[] = {
VIRTIO_ID_BLOCK,
VIRTIO_ID_NET,
};

static inline struct vduse_dev *vdpa_to_vduse(struct vdpa_device *vdpa)
Expand Down Expand Up @@ -1705,13 +1708,21 @@ static bool device_is_allowed(u32 device_id)
return false;
}

static bool features_is_valid(u64 features)
static bool features_is_valid(struct vduse_dev_config *config)
{
if (!(features & (1ULL << VIRTIO_F_ACCESS_PLATFORM)))
if (!(config->features & BIT_ULL(VIRTIO_F_ACCESS_PLATFORM)))
return false;

/* Now we only support read-only configuration space */
if (features & (1ULL << VIRTIO_BLK_F_CONFIG_WCE))
if ((config->device_id == VIRTIO_ID_BLOCK) &&
(config->features & BIT_ULL(VIRTIO_BLK_F_CONFIG_WCE)))
return false;
else if ((config->device_id == VIRTIO_ID_NET) &&
(config->features & BIT_ULL(VIRTIO_NET_F_CTRL_VQ)))
return false;

if ((config->device_id == VIRTIO_ID_NET) &&
!(config->features & BIT_ULL(VIRTIO_F_VERSION_1)))
return false;

return true;
Expand All @@ -1738,7 +1749,7 @@ static bool vduse_validate_config(struct vduse_dev_config *config)
if (!device_is_allowed(config->device_id))
return false;

if (!features_is_valid(config->features))
if (!features_is_valid(config))
return false;

return true;
Expand Down Expand Up @@ -1821,6 +1832,10 @@ static int vduse_create_dev(struct vduse_dev_config *config,
int ret;
struct vduse_dev *dev;

ret = -EPERM;
if ((config->device_id == VIRTIO_ID_NET) && !capable(CAP_NET_ADMIN))
goto err;

ret = -EEXIST;
if (vduse_find_dev(config->name))
goto err;
Expand Down Expand Up @@ -2064,6 +2079,7 @@ static const struct vdpa_mgmtdev_ops vdpa_dev_mgmtdev_ops = {

static struct virtio_device_id id_table[] = {
{ VIRTIO_ID_BLOCK, VIRTIO_DEV_ANY_ID },
{ VIRTIO_ID_NET, VIRTIO_DEV_ANY_ID },
{ 0 },
};

Expand Down
27 changes: 20 additions & 7 deletions drivers/vdpa/virtio_pci/vp_vdpa.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,13 @@ static int vp_vdpa_request_irq(struct vp_vdpa *vp_vdpa)
struct pci_dev *pdev = mdev->pci_dev;
int i, ret, irq;
int queues = vp_vdpa->queues;
int vectors = queues + 1;
int vectors = 1;
int msix_vec = 0;

for (i = 0; i < queues; i++) {
if (vp_vdpa->vring[i].cb.callback)
vectors++;
}

ret = pci_alloc_irq_vectors(pdev, vectors, vectors, PCI_IRQ_MSIX);
if (ret != vectors) {
Expand All @@ -173,9 +179,12 @@ static int vp_vdpa_request_irq(struct vp_vdpa *vp_vdpa)
vp_vdpa->vectors = vectors;

for (i = 0; i < queues; i++) {
if (!vp_vdpa->vring[i].cb.callback)
continue;

snprintf(vp_vdpa->vring[i].msix_name, VP_VDPA_NAME_SIZE,
"vp-vdpa[%s]-%d\n", pci_name(pdev), i);
irq = pci_irq_vector(pdev, i);
irq = pci_irq_vector(pdev, msix_vec);
ret = devm_request_irq(&pdev->dev, irq,
vp_vdpa_vq_handler,
0, vp_vdpa->vring[i].msix_name,
Expand All @@ -185,21 +194,22 @@ static int vp_vdpa_request_irq(struct vp_vdpa *vp_vdpa)
"vp_vdpa: fail to request irq for vq %d\n", i);
goto err;
}
vp_modern_queue_vector(mdev, i, i);
vp_modern_queue_vector(mdev, i, msix_vec);
vp_vdpa->vring[i].irq = irq;
msix_vec++;
}

snprintf(vp_vdpa->msix_name, VP_VDPA_NAME_SIZE, "vp-vdpa[%s]-config\n",
pci_name(pdev));
irq = pci_irq_vector(pdev, queues);
irq = pci_irq_vector(pdev, msix_vec);
ret = devm_request_irq(&pdev->dev, irq, vp_vdpa_config_handler, 0,
vp_vdpa->msix_name, vp_vdpa);
if (ret) {
dev_err(&pdev->dev,
"vp_vdpa: fail to request irq for vq %d\n", i);
"vp_vdpa: fail to request irq for config: %d\n", ret);
goto err;
}
vp_modern_config_vector(mdev, queues);
vp_modern_config_vector(mdev, msix_vec);
vp_vdpa->config_irq = irq;

return 0;
Expand All @@ -216,7 +226,10 @@ static void vp_vdpa_set_status(struct vdpa_device *vdpa, u8 status)

if (status & VIRTIO_CONFIG_S_DRIVER_OK &&
!(s & VIRTIO_CONFIG_S_DRIVER_OK)) {
vp_vdpa_request_irq(vp_vdpa);
if (vp_vdpa_request_irq(vp_vdpa)) {
WARN_ON(1);
return;
}
}

vp_modern_set_status(mdev, status);
Expand Down
Loading

0 comments on commit 2ef32ad

Please sign in to comment.