Commit 0d16cc43 authored by Jason Wang's avatar Jason Wang Committed by Michael S. Tsirkin
Browse files

vdpa: introduce map ops



Virtio core allows the transport to provide device or transport
specific mapping functions. This patch adds this support to vDPA. We
can simply do this by allowing the vDPA parent to register a
virtio_map_ops.

Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
Message-Id: <20250924070045.10361-2-jasowang@redhat.com>
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Reviewed-by: default avatarEugenio Pérez <eperezma@redhat.com>
parent 58aca3db
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -478,7 +478,8 @@ static int eni_vdpa_probe(struct pci_dev *pdev, const struct pci_device_id *id)
		return ret;

	eni_vdpa = vdpa_alloc_device(struct eni_vdpa, vdpa,
				     dev, &eni_vdpa_ops, 1, 1, NULL, false);
				     dev, &eni_vdpa_ops, NULL,
				     1, 1, NULL, false);
	if (IS_ERR(eni_vdpa)) {
		ENI_ERR(pdev, "failed to allocate vDPA structure\n");
		return PTR_ERR(eni_vdpa);
+2 −1
Original line number Diff line number Diff line
@@ -705,7 +705,8 @@ static int ifcvf_vdpa_dev_add(struct vdpa_mgmt_dev *mdev, const char *name,
	vf = &ifcvf_mgmt_dev->vf;
	pdev = vf->pdev;
	adapter = vdpa_alloc_device(struct ifcvf_adapter, vdpa,
				    &pdev->dev, &ifc_vdpa_ops, 1, 1, NULL, false);
				    &pdev->dev, &ifc_vdpa_ops,
				    NULL, 1, 1, NULL, false);
	if (IS_ERR(adapter)) {
		IFCVF_ERR(pdev, "Failed to allocate vDPA structure");
		return PTR_ERR(adapter);
+1 −1
Original line number Diff line number Diff line
@@ -3882,7 +3882,7 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name,
	}

	ndev = vdpa_alloc_device(struct mlx5_vdpa_net, mvdev.vdev, mdev->device, &mgtdev->vdpa_ops,
				 MLX5_VDPA_NUMVQ_GROUPS, MLX5_VDPA_NUM_AS, name, false);
				 NULL, MLX5_VDPA_NUMVQ_GROUPS, MLX5_VDPA_NUM_AS, name, false);
	if (IS_ERR(ndev))
		return PTR_ERR(ndev);

+2 −2
Original line number Diff line number Diff line
@@ -508,8 +508,8 @@ static int octep_vdpa_dev_add(struct vdpa_mgmt_dev *mdev, const char *name,
	u64 device_features;
	int ret;

	oct_vdpa = vdpa_alloc_device(struct octep_vdpa, vdpa, &pdev->dev, &octep_vdpa_ops, 1, 1,
				     NULL, false);
	oct_vdpa = vdpa_alloc_device(struct octep_vdpa, vdpa, &pdev->dev, &octep_vdpa_ops,
				     NULL, 1, 1, NULL, false);
	if (IS_ERR(oct_vdpa)) {
		dev_err(&pdev->dev, "Failed to allocate vDPA structure for octep vdpa device");
		return PTR_ERR(oct_vdpa);
+2 −1
Original line number Diff line number Diff line
@@ -632,7 +632,8 @@ static int pds_vdpa_dev_add(struct vdpa_mgmt_dev *mdev, const char *name,
	}

	pdsv = vdpa_alloc_device(struct pds_vdpa_device, vdpa_dev,
				 dev, &pds_vdpa_ops, 1, 1, name, false);
				 dev, &pds_vdpa_ops, NULL,
				 1, 1, name, false);
	if (IS_ERR(pdsv)) {
		dev_err(dev, "Failed to allocate vDPA structure: %pe\n", pdsv);
		return PTR_ERR(pdsv);
Loading