Commit 16bb86b5 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull virtio updates from Michael Tsirkin:
 "A bunch of new drivers including vdpa support for block and
  virtio-vdpa.

  Beginning of vq kick (aka doorbell) mapping support.

  Misc fixes"

* tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost: (40 commits)
  virtio_pci_modern: correct sparse tags for notify
  virtio_pci_modern: __force cast the notify mapping
  vDPA/ifcvf: get_config_size should return dev specific config size
  vDPA/ifcvf: enable Intel C5000X-PL virtio-block for vDPA
  vDPA/ifcvf: deduce VIRTIO device ID when probe
  vdpa_sim_blk: add support for vdpa management tool
  vdpa_sim_blk: handle VIRTIO_BLK_T_GET_ID
  vdpa_sim_blk: implement ramdisk behaviour
  vdpa: add vdpa simulator for block device
  vhost/vdpa: Remove the restriction that only supports virtio-net devices
  vhost/vdpa: use get_config_size callback in vhost_vdpa_config_validate()
  vdpa: add get_config_size callback in vdpa_config_ops
  vdpa_sim: cleanup kiovs in vdpasim_free()
  vringh: add vringh_kiov_length() helper
  vringh: implement vringh_kiov_advance()
  vringh: explain more about cleaning riov and wiov
  vringh: reset kiov 'consumed' field in __vringh_iov()
  vringh: add 'iotlb_lock' to synchronize iotlb accesses
  vdpa_sim: use iova module to allocate IOVA addresses
  vDPA/ifcvf: deduce VIRTIO device ID from pdev ids
  ...
parents 57151b50 d7bce85a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ obj-$(CONFIG_DMADEVICES) += dma/
obj-y				+= soc/

obj-$(CONFIG_VIRTIO)		+= virtio/
obj-$(CONFIG_VIRTIO_PCI_LIB)	+= virtio/
obj-$(CONFIG_VDPA)		+= vdpa/
obj-$(CONFIG_XEN)		+= xen/

+7 −3
Original line number Diff line number Diff line
@@ -2870,9 +2870,13 @@ static int virtnet_alloc_queues(struct virtnet_info *vi)
{
	int i;

	if (vi->has_cvq) {
		vi->ctrl = kzalloc(sizeof(*vi->ctrl), GFP_KERNEL);
		if (!vi->ctrl)
			goto err_ctrl;
	} else {
		vi->ctrl = NULL;
	}
	vi->sq = kcalloc(vi->max_queue_pairs, sizeof(*vi->sq), GFP_KERNEL);
	if (!vi->sq)
		goto err_sq;
+15 −0
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ config VDPA_SIM
	depends on RUNTIME_TESTING_MENU && HAS_DMA
	select DMA_OPS
	select VHOST_RING
	select IOMMU_IOVA
	help
	  Enable this module to support vDPA device simulators. These devices
	  are used for testing, prototyping and development of vDPA.
@@ -25,6 +26,13 @@ config VDPA_SIM_NET
	help
	  vDPA networking device simulator which loops TX traffic back to RX.

config VDPA_SIM_BLOCK
	tristate "vDPA simulator for block device"
	depends on VDPA_SIM
	help
	  vDPA block device simulator which terminates IO request in a
	  memory buffer.

config IFCVF
	tristate "Intel IFC VF vDPA driver"
	depends on PCI_MSI
@@ -52,4 +60,11 @@ config MLX5_VDPA_NET
	  be executed by the hardware. It also supports a variety of stateless
	  offloads depending on the actual device used and firmware version.

config VP_VDPA
	tristate "Virtio PCI bridge vDPA driver"
	select VIRTIO_PCI_LIB
	depends on PCI_MSI
	help
	  This kernel module bridges virtio PCI device to vDPA bus.

endif # VDPA
+1 −0
Original line number Diff line number Diff line
@@ -3,3 +3,4 @@ obj-$(CONFIG_VDPA) += vdpa.o
obj-$(CONFIG_VDPA_SIM) += vdpa_sim/
obj-$(CONFIG_IFCVF)    += ifcvf/
obj-$(CONFIG_MLX5_VDPA) += mlx5/
obj-$(CONFIG_VP_VDPA)    += virtio_pci/
+22 −2
Original line number Diff line number Diff line
@@ -202,10 +202,11 @@ static void ifcvf_add_status(struct ifcvf_hw *hw, u8 status)
	ifcvf_get_status(hw);
}

u64 ifcvf_get_features(struct ifcvf_hw *hw)
u64 ifcvf_get_hw_features(struct ifcvf_hw *hw)
{
	struct virtio_pci_common_cfg __iomem *cfg = hw->common_cfg;
	u32 features_lo, features_hi;
	u64 features;

	ifc_iowrite32(0, &cfg->device_feature_select);
	features_lo = ifc_ioread32(&cfg->device_feature);
@@ -213,7 +214,26 @@ u64 ifcvf_get_features(struct ifcvf_hw *hw)
	ifc_iowrite32(1, &cfg->device_feature_select);
	features_hi = ifc_ioread32(&cfg->device_feature);

	return ((u64)features_hi << 32) | features_lo;
	features = ((u64)features_hi << 32) | features_lo;

	return features;
}

u64 ifcvf_get_features(struct ifcvf_hw *hw)
{
	return hw->hw_features;
}

int ifcvf_verify_min_features(struct ifcvf_hw *hw, u64 features)
{
	struct ifcvf_adapter *ifcvf = vf_to_adapter(hw);

	if (!(features & BIT_ULL(VIRTIO_F_ACCESS_PLATFORM)) && features) {
		IFCVF_ERR(ifcvf->pdev, "VIRTIO_F_ACCESS_PLATFORM is not negotiated\n");
		return -EINVAL;
	}

	return 0;
}

void ifcvf_read_net_config(struct ifcvf_hw *hw, u64 offset,
Loading