[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZGNcZHUAC21S+uSK@corigine.com>
Date: Tue, 16 May 2023 12:35:16 +0200
From: Simon Horman <simon.horman@...igine.com>
To: Shannon Nelson <shannon.nelson@....com>
Cc: jasowang@...hat.com, mst@...hat.com,
virtualization@...ts.linux-foundation.org, brett.creeley@....com,
netdev@...r.kernel.org, drivers@...sando.io
Subject: Re: [PATCH v6 virtio 09/11] pds_vdpa: add support for vdpa and
vdpamgmt interfaces
On Mon, May 15, 2023 at 07:55:19PM -0700, Shannon Nelson wrote:
> This is the vDPA device support, where we advertise that we can
> support the virtio queues and deal with the configuration work
> through the pds_core's adminq.
>
> Signed-off-by: Shannon Nelson <shannon.nelson@....com>
> Acked-by: Jason Wang <jasowang@...hat.com>
...
> @@ -21,12 +479,156 @@ static struct virtio_device_id pds_vdpa_id_table[] = {
> static int pds_vdpa_dev_add(struct vdpa_mgmt_dev *mdev, const char *name,
> const struct vdpa_dev_set_config *add_config)
> {
> - return -EOPNOTSUPP;
> + struct pds_vdpa_aux *vdpa_aux;
> + struct pds_vdpa_device *pdsv;
> + struct vdpa_mgmt_dev *mgmt;
> + u16 fw_max_vqs, vq_pairs;
> + struct device *dma_dev;
> + struct pci_dev *pdev;
> + struct device *dev;
> + u8 mac[ETH_ALEN];
> + int err;
> + int i;
> +
> + vdpa_aux = container_of(mdev, struct pds_vdpa_aux, vdpa_mdev);
> + dev = &vdpa_aux->padev->aux_dev.dev;
> + mgmt = &vdpa_aux->vdpa_mdev;
> +
> + if (vdpa_aux->pdsv) {
> + dev_warn(dev, "Multiple vDPA devices on a VF is not supported.\n");
> + return -EOPNOTSUPP;
> + }
> +
> + pdsv = vdpa_alloc_device(struct pds_vdpa_device, vdpa_dev,
> + dev, &pds_vdpa_ops, 1, 1, name, false);
> + if (IS_ERR(pdsv)) {
> + dev_err(dev, "Failed to allocate vDPA structure: %pe\n", pdsv);
> + return PTR_ERR(pdsv);
> + }
> +
> + vdpa_aux->pdsv = pdsv;
> + pdsv->vdpa_aux = vdpa_aux;
> +
> + pdev = vdpa_aux->padev->vf_pdev;
> + dma_dev = &pdev->dev;
> + pdsv->vdpa_dev.dma_dev = dma_dev;
> +
> + pdsv->supported_features = mgmt->supported_features;
> +
> + if (add_config->mask & BIT_ULL(VDPA_ATTR_DEV_FEATURES)) {
> + u64 unsupp_features =
> + add_config->device_features & ~mgmt->supported_features;
> +
> + if (unsupp_features) {
> + dev_err(dev, "Unsupported features: %#llx\n", unsupp_features);
> + goto err_unmap;
Hi Shannon,
clang-16 W=1 reports that
err_unmap will return err
but err is uninitialised here.
> + }
> +
> + pdsv->supported_features = add_config->device_features;
> + }
...
> +err_unmap:
> + put_device(&pdsv->vdpa_dev.dev);
> + vdpa_aux->pdsv = NULL;
> + return err;
> }
...
Powered by blists - more mailing lists