diff mbox series

[v6,virtio,11/11] pds_vdpa: pds_vdps.rst and Kconfig

Message ID 20230516025521.43352-12-shannon.nelson@amd.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series pds_vdpa driver | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Nelson, Shannon May 16, 2023, 2:55 a.m. UTC
Add the documentation and Kconfig entry for pds_vdpa driver.

Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>
---
 .../device_drivers/ethernet/amd/pds_vdpa.rst  | 85 +++++++++++++++++++
 .../device_drivers/ethernet/index.rst         |  1 +
 MAINTAINERS                                   |  4 +
 drivers/vdpa/Kconfig                          | 10 +++
 4 files changed, 100 insertions(+)
 create mode 100644 Documentation/networking/device_drivers/ethernet/amd/pds_vdpa.rst

Comments

Jason Wang May 16, 2023, 3:29 a.m. UTC | #1
On Tue, May 16, 2023 at 10:56 AM Shannon Nelson <shannon.nelson@amd.com> wrote:
>
> Add the documentation and Kconfig entry for pds_vdpa driver.
>
> Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>

Acked-by: Jason Wang <jasowang@redhat.com>

Thanks

> ---
>  .../device_drivers/ethernet/amd/pds_vdpa.rst  | 85 +++++++++++++++++++
>  .../device_drivers/ethernet/index.rst         |  1 +
>  MAINTAINERS                                   |  4 +
>  drivers/vdpa/Kconfig                          | 10 +++
>  4 files changed, 100 insertions(+)
>  create mode 100644 Documentation/networking/device_drivers/ethernet/amd/pds_vdpa.rst
>
> diff --git a/Documentation/networking/device_drivers/ethernet/amd/pds_vdpa.rst b/Documentation/networking/device_drivers/ethernet/amd/pds_vdpa.rst
> new file mode 100644
> index 000000000000..587927d3de92
> --- /dev/null
> +++ b/Documentation/networking/device_drivers/ethernet/amd/pds_vdpa.rst
> @@ -0,0 +1,85 @@
> +.. SPDX-License-Identifier: GPL-2.0+
> +.. note: can be edited and viewed with /usr/bin/formiko-vim
> +
> +==========================================================
> +PCI vDPA driver for the AMD/Pensando(R) DSC adapter family
> +==========================================================
> +
> +AMD/Pensando vDPA VF Device Driver
> +
> +Copyright(c) 2023 Advanced Micro Devices, Inc
> +
> +Overview
> +========
> +
> +The ``pds_vdpa`` driver is an auxiliary bus driver that supplies
> +a vDPA device for use by the virtio network stack.  It is used with
> +the Pensando Virtual Function devices that offer vDPA and virtio queue
> +services.  It depends on the ``pds_core`` driver and hardware for the PF
> +and VF PCI handling as well as for device configuration services.
> +
> +Using the device
> +================
> +
> +The ``pds_vdpa`` device is enabled via multiple configuration steps and
> +depends on the ``pds_core`` driver to create and enable SR-IOV Virtual
> +Function devices.  After the VFs are enabled, we enable the vDPA service
> +in the ``pds_core`` device to create the auxiliary devices used by pds_vdpa.
> +
> +Example steps:
> +
> +.. code-block:: bash
> +
> +  #!/bin/bash
> +
> +  modprobe pds_core
> +  modprobe vdpa
> +  modprobe pds_vdpa
> +
> +  PF_BDF=`ls /sys/module/pds_core/drivers/pci\:pds_core/*/sriov_numvfs | awk -F / '{print $7}'`
> +
> +  # Enable vDPA VF auxiliary device(s) in the PF
> +  devlink dev param set pci/$PF_BDF name enable_vnet cmode runtime value true
> +
> +  # Create a VF for vDPA use
> +  echo 1 > /sys/bus/pci/drivers/pds_core/$PF_BDF/sriov_numvfs
> +
> +  # Find the vDPA services/devices available
> +  PDS_VDPA_MGMT=`vdpa mgmtdev show | grep vDPA | head -1 | cut -d: -f1`
> +
> +  # Create a vDPA device for use in virtio network configurations
> +  vdpa dev add name vdpa1 mgmtdev $PDS_VDPA_MGMT mac 00:11:22:33:44:55
> +
> +  # Set up an ethernet interface on the vdpa device
> +  modprobe virtio_vdpa
> +
> +
> +
> +Enabling the driver
> +===================
> +
> +The driver is enabled via the standard kernel configuration system,
> +using the make command::
> +
> +  make oldconfig/menuconfig/etc.
> +
> +The driver is located in the menu structure at:
> +
> +  -> Device Drivers
> +    -> Network device support (NETDEVICES [=y])
> +      -> Ethernet driver support
> +        -> Pensando devices
> +          -> Pensando Ethernet PDS_VDPA Support
> +
> +Support
> +=======
> +
> +For general Linux networking support, please use the netdev mailing
> +list, which is monitored by Pensando personnel::
> +
> +  netdev@vger.kernel.org
> +
> +For more specific support needs, please use the Pensando driver support
> +email::
> +
> +  drivers@pensando.io
> diff --git a/Documentation/networking/device_drivers/ethernet/index.rst b/Documentation/networking/device_drivers/ethernet/index.rst
> index 417ca514a4d0..94ecb67c0885 100644
> --- a/Documentation/networking/device_drivers/ethernet/index.rst
> +++ b/Documentation/networking/device_drivers/ethernet/index.rst
> @@ -15,6 +15,7 @@ Contents:
>     amazon/ena
>     altera/altera_tse
>     amd/pds_core
> +   amd/pds_vdpa
>     aquantia/atlantic
>     chelsio/cxgb
>     cirrus/cs89x0
> diff --git a/MAINTAINERS b/MAINTAINERS
> index e2fd64c2ebdc..c3f509eeaf1d 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -22296,6 +22296,10 @@ F:     include/linux/vringh.h
>  F:     include/uapi/linux/virtio_*.h
>  F:     tools/virtio/
>
> +PDS DSC VIRTIO DATA PATH ACCELERATOR
> +R:     Shannon Nelson <shannon.nelson@amd.com>
> +F:     drivers/vdpa/pds/
> +
>  VIRTIO CRYPTO DRIVER
>  M:     Gonglei <arei.gonglei@huawei.com>
>  L:     virtualization@lists.linux-foundation.org
> diff --git a/drivers/vdpa/Kconfig b/drivers/vdpa/Kconfig
> index cd6ad92f3f05..656c1cb541de 100644
> --- a/drivers/vdpa/Kconfig
> +++ b/drivers/vdpa/Kconfig
> @@ -116,4 +116,14 @@ config ALIBABA_ENI_VDPA
>           This driver includes a HW monitor device that
>           reads health values from the DPU.
>
> +config PDS_VDPA
> +       tristate "vDPA driver for AMD/Pensando DSC devices"
> +       select VIRTIO_PCI_LIB
> +       depends on PCI_MSI
> +       depends on PDS_CORE
> +       help
> +         vDPA network driver for AMD/Pensando's PDS Core devices.
> +         With this driver, the VirtIO dataplane can be
> +         offloaded to an AMD/Pensando DSC device.
> +
>  endif # VDPA
> --
> 2.17.1
>
kernel test robot May 17, 2023, 2:24 a.m. UTC | #2
Hi Shannon,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linus/master]
[also build test WARNING on v6.4-rc2 next-20230516]
[cannot apply to mst-vhost/linux-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Shannon-Nelson/virtio-allow-caller-to-override-device-id-in-vp_modern/20230516-110049
base:   linus/master
patch link:    https://lore.kernel.org/r/20230516025521.43352-12-shannon.nelson%40amd.com
patch subject: [PATCH v6 virtio 11/11] pds_vdpa: pds_vdps.rst and Kconfig
config: arm64-allmodconfig
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project b0fb98227c90adf2536c9ad644a74d5e92961111)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm64 cross compiling tool for clang build
        # apt-get install binutils-aarch64-linux-gnu
        # https://github.com/intel-lab-lkp/linux/commit/4942556344e0c7cdf4719dfbd0e17c0f2b620b30
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Shannon-Nelson/virtio-allow-caller-to-override-device-id-in-vp_modern/20230516-110049
        git checkout 4942556344e0c7cdf4719dfbd0e17c0f2b620b30
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/acpi/ drivers/infiniband/sw/rxe/ drivers/staging/media/deprecated/atmel/ drivers/vdpa/pds/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202305171042.aJUkaxnH-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/vdpa/pds/vdpa_dev.c:568:7: warning: variable 'err' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
                   if (unsupp_features) {
                       ^~~~~~~~~~~~~~~
   drivers/vdpa/pds/vdpa_dev.c:669:9: note: uninitialized use occurs here
           return err;
                  ^~~
   drivers/vdpa/pds/vdpa_dev.c:568:3: note: remove the 'if' if its condition is always false
                   if (unsupp_features) {
                   ^~~~~~~~~~~~~~~~~~~~~~
   drivers/vdpa/pds/vdpa_dev.c:536:9: note: initialize the variable 'err' to silence this warning
           int err;
                  ^
                   = 0
   1 warning generated.


vim +568 drivers/vdpa/pds/vdpa_dev.c

8b05d813374db7 Shannon Nelson 2023-05-15  524  
8b05d813374db7 Shannon Nelson 2023-05-15  525  static int pds_vdpa_dev_add(struct vdpa_mgmt_dev *mdev, const char *name,
8b05d813374db7 Shannon Nelson 2023-05-15  526  			    const struct vdpa_dev_set_config *add_config)
8b05d813374db7 Shannon Nelson 2023-05-15  527  {
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  528  	struct pds_vdpa_aux *vdpa_aux;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  529  	struct pds_vdpa_device *pdsv;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  530  	struct vdpa_mgmt_dev *mgmt;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  531  	u16 fw_max_vqs, vq_pairs;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  532  	struct device *dma_dev;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  533  	struct pci_dev *pdev;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  534  	struct device *dev;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  535  	u8 mac[ETH_ALEN];
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  536  	int err;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  537  	int i;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  538  
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  539  	vdpa_aux = container_of(mdev, struct pds_vdpa_aux, vdpa_mdev);
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  540  	dev = &vdpa_aux->padev->aux_dev.dev;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  541  	mgmt = &vdpa_aux->vdpa_mdev;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  542  
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  543  	if (vdpa_aux->pdsv) {
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  544  		dev_warn(dev, "Multiple vDPA devices on a VF is not supported.\n");
8b05d813374db7 Shannon Nelson 2023-05-15  545  		return -EOPNOTSUPP;
8b05d813374db7 Shannon Nelson 2023-05-15  546  	}
8b05d813374db7 Shannon Nelson 2023-05-15  547  
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  548  	pdsv = vdpa_alloc_device(struct pds_vdpa_device, vdpa_dev,
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  549  				 dev, &pds_vdpa_ops, 1, 1, name, false);
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  550  	if (IS_ERR(pdsv)) {
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  551  		dev_err(dev, "Failed to allocate vDPA structure: %pe\n", pdsv);
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  552  		return PTR_ERR(pdsv);
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  553  	}
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  554  
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  555  	vdpa_aux->pdsv = pdsv;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  556  	pdsv->vdpa_aux = vdpa_aux;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  557  
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  558  	pdev = vdpa_aux->padev->vf_pdev;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  559  	dma_dev = &pdev->dev;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  560  	pdsv->vdpa_dev.dma_dev = dma_dev;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  561  
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  562  	pdsv->supported_features = mgmt->supported_features;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  563  
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  564  	if (add_config->mask & BIT_ULL(VDPA_ATTR_DEV_FEATURES)) {
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  565  		u64 unsupp_features =
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  566  			add_config->device_features & ~mgmt->supported_features;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  567  
c4cc9ee57a0c5b Shannon Nelson 2023-05-15 @568  		if (unsupp_features) {
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  569  			dev_err(dev, "Unsupported features: %#llx\n", unsupp_features);
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  570  			goto err_unmap;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  571  		}
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  572  
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  573  		pdsv->supported_features = add_config->device_features;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  574  	}
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  575  
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  576  	err = pds_vdpa_cmd_reset(pdsv);
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  577  	if (err) {
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  578  		dev_err(dev, "Failed to reset hw: %pe\n", ERR_PTR(err));
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  579  		goto err_unmap;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  580  	}
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  581  
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  582  	err = pds_vdpa_init_hw(pdsv);
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  583  	if (err) {
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  584  		dev_err(dev, "Failed to init hw: %pe\n", ERR_PTR(err));
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  585  		goto err_unmap;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  586  	}
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  587  
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  588  	fw_max_vqs = le16_to_cpu(pdsv->vdpa_aux->ident.max_vqs);
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  589  	vq_pairs = fw_max_vqs / 2;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  590  
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  591  	/* Make sure we have the queues being requested */
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  592  	if (add_config->mask & (1 << VDPA_ATTR_DEV_NET_CFG_MAX_VQP))
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  593  		vq_pairs = add_config->net.max_vq_pairs;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  594  
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  595  	pdsv->num_vqs = 2 * vq_pairs;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  596  	if (pdsv->supported_features & BIT_ULL(VIRTIO_NET_F_CTRL_VQ))
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  597  		pdsv->num_vqs++;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  598  
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  599  	if (pdsv->num_vqs > fw_max_vqs) {
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  600  		dev_err(dev, "%s: queue count requested %u greater than max %u\n",
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  601  			__func__, pdsv->num_vqs, fw_max_vqs);
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  602  		err = -ENOSPC;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  603  		goto err_unmap;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  604  	}
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  605  
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  606  	if (pdsv->num_vqs != fw_max_vqs) {
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  607  		err = pds_vdpa_cmd_set_max_vq_pairs(pdsv, vq_pairs);
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  608  		if (err) {
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  609  			dev_err(dev, "Failed to set max_vq_pairs: %pe\n",
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  610  				ERR_PTR(err));
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  611  			goto err_unmap;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  612  		}
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  613  	}
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  614  
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  615  	/* Set a mac, either from the user config if provided
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  616  	 * or set a random mac if default is 00:..:00
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  617  	 */
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  618  	if (add_config->mask & BIT_ULL(VDPA_ATTR_DEV_NET_CFG_MACADDR)) {
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  619  		ether_addr_copy(mac, add_config->net.mac);
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  620  		pds_vdpa_cmd_set_mac(pdsv, mac);
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  621  	} else {
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  622  		struct virtio_net_config __iomem *vc;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  623  
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  624  		vc = pdsv->vdpa_aux->vd_mdev.device;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  625  		memcpy_fromio(mac, vc->mac, sizeof(mac));
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  626  		if (is_zero_ether_addr(mac)) {
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  627  			eth_random_addr(mac);
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  628  			dev_info(dev, "setting random mac %pM\n", mac);
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  629  			pds_vdpa_cmd_set_mac(pdsv, mac);
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  630  		}
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  631  	}
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  632  
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  633  	for (i = 0; i < pdsv->num_vqs; i++) {
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  634  		pdsv->vqs[i].qid = i;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  635  		pdsv->vqs[i].pdsv = pdsv;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  636  		pdsv->vqs[i].irq = VIRTIO_MSI_NO_VECTOR;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  637  		pdsv->vqs[i].notify = vp_modern_map_vq_notify(&pdsv->vdpa_aux->vd_mdev,
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  638  							      i, &pdsv->vqs[i].notify_pa);
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  639  	}
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  640  
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  641  	pdsv->vdpa_dev.mdev = &vdpa_aux->vdpa_mdev;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  642  
10cd19d8803330 Shannon Nelson 2023-05-15  643  	err = pds_vdpa_register_event_handler(pdsv);
10cd19d8803330 Shannon Nelson 2023-05-15  644  	if (err) {
10cd19d8803330 Shannon Nelson 2023-05-15  645  		dev_err(dev, "Failed to register for PDS events: %pe\n", ERR_PTR(err));
10cd19d8803330 Shannon Nelson 2023-05-15  646  		goto err_unmap;
10cd19d8803330 Shannon Nelson 2023-05-15  647  	}
10cd19d8803330 Shannon Nelson 2023-05-15  648  
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  649  	/* We use the _vdpa_register_device() call rather than the
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  650  	 * vdpa_register_device() to avoid a deadlock because our
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  651  	 * dev_add() is called with the vdpa_dev_lock already set
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  652  	 * by vdpa_nl_cmd_dev_add_set_doit()
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  653  	 */
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  654  	err = _vdpa_register_device(&pdsv->vdpa_dev, pdsv->num_vqs);
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  655  	if (err) {
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  656  		dev_err(dev, "Failed to register to vDPA bus: %pe\n", ERR_PTR(err));
10cd19d8803330 Shannon Nelson 2023-05-15  657  		goto err_unevent;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  658  	}
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  659  
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  660  	pds_vdpa_debugfs_add_vdpadev(vdpa_aux);
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  661  
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  662  	return 0;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  663  
10cd19d8803330 Shannon Nelson 2023-05-15  664  err_unevent:
10cd19d8803330 Shannon Nelson 2023-05-15  665  	pds_vdpa_unregister_event_handler(pdsv);
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  666  err_unmap:
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  667  	put_device(&pdsv->vdpa_dev.dev);
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  668  	vdpa_aux->pdsv = NULL;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  669  	return err;
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  670  }
c4cc9ee57a0c5b Shannon Nelson 2023-05-15  671
Nelson, Shannon May 17, 2023, 3:56 a.m. UTC | #3
On 5/16/23 7:24 PM, kernel test robot wrote:
> 
> Hi Shannon,
> 
> kernel test robot noticed the following build warnings:
> 
> [auto build test WARNING on linus/master]
> [also build test WARNING on v6.4-rc2 next-20230516]
> [cannot apply to mst-vhost/linux-next]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch#_base_tree_information]
> 
> url:    https://github.com/intel-lab-lkp/linux/commits/Shannon-Nelson/virtio-allow-caller-to-override-device-id-in-vp_modern/20230516-110049
> base:   linus/master
> patch link:    https://lore.kernel.org/r/20230516025521.43352-12-shannon.nelson%40amd.com
> patch subject: [PATCH v6 virtio 11/11] pds_vdpa: pds_vdps.rst and Kconfig
> config: arm64-allmodconfig
> compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project b0fb98227c90adf2536c9ad644a74d5e92961111)
> reproduce (this is a W=1 build):
>          wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>          chmod +x ~/bin/make.cross
>          # install arm64 cross compiling tool for clang build
>          # apt-get install binutils-aarch64-linux-gnu
>          # https://github.com/intel-lab-lkp/linux/commit/4942556344e0c7cdf4719dfbd0e17c0f2b620b30
>          git remote add linux-review https://github.com/intel-lab-lkp/linux
>          git fetch --no-tags linux-review Shannon-Nelson/virtio-allow-caller-to-override-device-id-in-vp_modern/20230516-110049
>          git checkout 4942556344e0c7cdf4719dfbd0e17c0f2b620b30
>          # save the config file
>          mkdir build_dir && cp config build_dir/.config
>          COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 olddefconfig
>          COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/acpi/ drivers/infiniband/sw/rxe/ drivers/staging/media/deprecated/atmel/ drivers/vdpa/pds/
> 
> If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <lkp@intel.com>
> | Link: https://lore.kernel.org/oe-kbuild-all/202305171042.aJUkaxnH-lkp@intel.com/

Thank you, Mr. Kernel Test Robot, I have this on my list.

sln

> 
> All warnings (new ones prefixed by >>):
> 
>>> drivers/vdpa/pds/vdpa_dev.c:568:7: warning: variable 'err' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
>                     if (unsupp_features) {
>                         ^~~~~~~~~~~~~~~
>     drivers/vdpa/pds/vdpa_dev.c:669:9: note: uninitialized use occurs here
>             return err;
>                    ^~~
>     drivers/vdpa/pds/vdpa_dev.c:568:3: note: remove the 'if' if its condition is always false
>                     if (unsupp_features) {
>                     ^~~~~~~~~~~~~~~~~~~~~~
>     drivers/vdpa/pds/vdpa_dev.c:536:9: note: initialize the variable 'err' to silence this warning
>             int err;
>                    ^
>                     = 0
>     1 warning generated.
> 
> 
> vim +568 drivers/vdpa/pds/vdpa_dev.c
> 
> 8b05d813374db7 Shannon Nelson 2023-05-15  524
> 8b05d813374db7 Shannon Nelson 2023-05-15  525  static int pds_vdpa_dev_add(struct vdpa_mgmt_dev *mdev, const char *name,
> 8b05d813374db7 Shannon Nelson 2023-05-15  526                       const struct vdpa_dev_set_config *add_config)
> 8b05d813374db7 Shannon Nelson 2023-05-15  527  {
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  528   struct pds_vdpa_aux *vdpa_aux;
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  529   struct pds_vdpa_device *pdsv;
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  530   struct vdpa_mgmt_dev *mgmt;
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  531   u16 fw_max_vqs, vq_pairs;
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  532   struct device *dma_dev;
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  533   struct pci_dev *pdev;
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  534   struct device *dev;
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  535   u8 mac[ETH_ALEN];
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  536   int err;
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  537   int i;
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  538
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  539   vdpa_aux = container_of(mdev, struct pds_vdpa_aux, vdpa_mdev);
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  540   dev = &vdpa_aux->padev->aux_dev.dev;
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  541   mgmt = &vdpa_aux->vdpa_mdev;
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  542
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  543   if (vdpa_aux->pdsv) {
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  544           dev_warn(dev, "Multiple vDPA devices on a VF is not supported.\n");
> 8b05d813374db7 Shannon Nelson 2023-05-15  545           return -EOPNOTSUPP;
> 8b05d813374db7 Shannon Nelson 2023-05-15  546   }
> 8b05d813374db7 Shannon Nelson 2023-05-15  547
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  548   pdsv = vdpa_alloc_device(struct pds_vdpa_device, vdpa_dev,
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  549                            dev, &pds_vdpa_ops, 1, 1, name, false);
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  550   if (IS_ERR(pdsv)) {
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  551           dev_err(dev, "Failed to allocate vDPA structure: %pe\n", pdsv);
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  552           return PTR_ERR(pdsv);
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  553   }
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  554
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  555   vdpa_aux->pdsv = pdsv;
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  556   pdsv->vdpa_aux = vdpa_aux;
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  557
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  558   pdev = vdpa_aux->padev->vf_pdev;
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  559   dma_dev = &pdev->dev;
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  560   pdsv->vdpa_dev.dma_dev = dma_dev;
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  561
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  562   pdsv->supported_features = mgmt->supported_features;
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  563
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  564   if (add_config->mask & BIT_ULL(VDPA_ATTR_DEV_FEATURES)) {
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  565           u64 unsupp_features =
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  566                   add_config->device_features & ~mgmt->supported_features;
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  567
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15 @568           if (unsupp_features) {
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  569                   dev_err(dev, "Unsupported features: %#llx\n", unsupp_features);
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  570                   goto err_unmap;
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  571           }
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  572
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  573           pdsv->supported_features = add_config->device_features;
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  574   }
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  575
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  576   err = pds_vdpa_cmd_reset(pdsv);
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  577   if (err) {
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  578           dev_err(dev, "Failed to reset hw: %pe\n", ERR_PTR(err));
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  579           goto err_unmap;
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  580   }
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  581
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  582   err = pds_vdpa_init_hw(pdsv);
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  583   if (err) {
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  584           dev_err(dev, "Failed to init hw: %pe\n", ERR_PTR(err));
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  585           goto err_unmap;
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  586   }
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  587
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  588   fw_max_vqs = le16_to_cpu(pdsv->vdpa_aux->ident.max_vqs);
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  589   vq_pairs = fw_max_vqs / 2;
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  590
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  591   /* Make sure we have the queues being requested */
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  592   if (add_config->mask & (1 << VDPA_ATTR_DEV_NET_CFG_MAX_VQP))
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  593           vq_pairs = add_config->net.max_vq_pairs;
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  594
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  595   pdsv->num_vqs = 2 * vq_pairs;
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  596   if (pdsv->supported_features & BIT_ULL(VIRTIO_NET_F_CTRL_VQ))
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  597           pdsv->num_vqs++;
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  598
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  599   if (pdsv->num_vqs > fw_max_vqs) {
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  600           dev_err(dev, "%s: queue count requested %u greater than max %u\n",
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  601                   __func__, pdsv->num_vqs, fw_max_vqs);
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  602           err = -ENOSPC;
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  603           goto err_unmap;
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  604   }
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  605
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  606   if (pdsv->num_vqs != fw_max_vqs) {
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  607           err = pds_vdpa_cmd_set_max_vq_pairs(pdsv, vq_pairs);
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  608           if (err) {
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  609                   dev_err(dev, "Failed to set max_vq_pairs: %pe\n",
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  610                           ERR_PTR(err));
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  611                   goto err_unmap;
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  612           }
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  613   }
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  614
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  615   /* Set a mac, either from the user config if provided
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  616    * or set a random mac if default is 00:..:00
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  617    */
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  618   if (add_config->mask & BIT_ULL(VDPA_ATTR_DEV_NET_CFG_MACADDR)) {
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  619           ether_addr_copy(mac, add_config->net.mac);
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  620           pds_vdpa_cmd_set_mac(pdsv, mac);
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  621   } else {
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  622           struct virtio_net_config __iomem *vc;
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  623
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  624           vc = pdsv->vdpa_aux->vd_mdev.device;
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  625           memcpy_fromio(mac, vc->mac, sizeof(mac));
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  626           if (is_zero_ether_addr(mac)) {
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  627                   eth_random_addr(mac);
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  628                   dev_info(dev, "setting random mac %pM\n", mac);
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  629                   pds_vdpa_cmd_set_mac(pdsv, mac);
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  630           }
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  631   }
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  632
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  633   for (i = 0; i < pdsv->num_vqs; i++) {
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  634           pdsv->vqs[i].qid = i;
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  635           pdsv->vqs[i].pdsv = pdsv;
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  636           pdsv->vqs[i].irq = VIRTIO_MSI_NO_VECTOR;
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  637           pdsv->vqs[i].notify = vp_modern_map_vq_notify(&pdsv->vdpa_aux->vd_mdev,
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  638                                                         i, &pdsv->vqs[i].notify_pa);
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  639   }
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  640
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  641   pdsv->vdpa_dev.mdev = &vdpa_aux->vdpa_mdev;
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  642
> 10cd19d8803330 Shannon Nelson 2023-05-15  643   err = pds_vdpa_register_event_handler(pdsv);
> 10cd19d8803330 Shannon Nelson 2023-05-15  644   if (err) {
> 10cd19d8803330 Shannon Nelson 2023-05-15  645           dev_err(dev, "Failed to register for PDS events: %pe\n", ERR_PTR(err));
> 10cd19d8803330 Shannon Nelson 2023-05-15  646           goto err_unmap;
> 10cd19d8803330 Shannon Nelson 2023-05-15  647   }
> 10cd19d8803330 Shannon Nelson 2023-05-15  648
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  649   /* We use the _vdpa_register_device() call rather than the
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  650    * vdpa_register_device() to avoid a deadlock because our
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  651    * dev_add() is called with the vdpa_dev_lock already set
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  652    * by vdpa_nl_cmd_dev_add_set_doit()
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  653    */
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  654   err = _vdpa_register_device(&pdsv->vdpa_dev, pdsv->num_vqs);
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  655   if (err) {
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  656           dev_err(dev, "Failed to register to vDPA bus: %pe\n", ERR_PTR(err));
> 10cd19d8803330 Shannon Nelson 2023-05-15  657           goto err_unevent;
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  658   }
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  659
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  660   pds_vdpa_debugfs_add_vdpadev(vdpa_aux);
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  661
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  662   return 0;
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  663
> 10cd19d8803330 Shannon Nelson 2023-05-15  664  err_unevent:
> 10cd19d8803330 Shannon Nelson 2023-05-15  665   pds_vdpa_unregister_event_handler(pdsv);
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  666  err_unmap:
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  667   put_device(&pdsv->vdpa_dev.dev);
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  668   vdpa_aux->pdsv = NULL;
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  669   return err;
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  670  }
> c4cc9ee57a0c5b Shannon Nelson 2023-05-15  671
> 
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests
diff mbox series

Patch

diff --git a/Documentation/networking/device_drivers/ethernet/amd/pds_vdpa.rst b/Documentation/networking/device_drivers/ethernet/amd/pds_vdpa.rst
new file mode 100644
index 000000000000..587927d3de92
--- /dev/null
+++ b/Documentation/networking/device_drivers/ethernet/amd/pds_vdpa.rst
@@ -0,0 +1,85 @@ 
+.. SPDX-License-Identifier: GPL-2.0+
+.. note: can be edited and viewed with /usr/bin/formiko-vim
+
+==========================================================
+PCI vDPA driver for the AMD/Pensando(R) DSC adapter family
+==========================================================
+
+AMD/Pensando vDPA VF Device Driver
+
+Copyright(c) 2023 Advanced Micro Devices, Inc
+
+Overview
+========
+
+The ``pds_vdpa`` driver is an auxiliary bus driver that supplies
+a vDPA device for use by the virtio network stack.  It is used with
+the Pensando Virtual Function devices that offer vDPA and virtio queue
+services.  It depends on the ``pds_core`` driver and hardware for the PF
+and VF PCI handling as well as for device configuration services.
+
+Using the device
+================
+
+The ``pds_vdpa`` device is enabled via multiple configuration steps and
+depends on the ``pds_core`` driver to create and enable SR-IOV Virtual
+Function devices.  After the VFs are enabled, we enable the vDPA service
+in the ``pds_core`` device to create the auxiliary devices used by pds_vdpa.
+
+Example steps:
+
+.. code-block:: bash
+
+  #!/bin/bash
+
+  modprobe pds_core
+  modprobe vdpa
+  modprobe pds_vdpa
+
+  PF_BDF=`ls /sys/module/pds_core/drivers/pci\:pds_core/*/sriov_numvfs | awk -F / '{print $7}'`
+
+  # Enable vDPA VF auxiliary device(s) in the PF
+  devlink dev param set pci/$PF_BDF name enable_vnet cmode runtime value true
+
+  # Create a VF for vDPA use
+  echo 1 > /sys/bus/pci/drivers/pds_core/$PF_BDF/sriov_numvfs
+
+  # Find the vDPA services/devices available
+  PDS_VDPA_MGMT=`vdpa mgmtdev show | grep vDPA | head -1 | cut -d: -f1`
+
+  # Create a vDPA device for use in virtio network configurations
+  vdpa dev add name vdpa1 mgmtdev $PDS_VDPA_MGMT mac 00:11:22:33:44:55
+
+  # Set up an ethernet interface on the vdpa device
+  modprobe virtio_vdpa
+
+
+
+Enabling the driver
+===================
+
+The driver is enabled via the standard kernel configuration system,
+using the make command::
+
+  make oldconfig/menuconfig/etc.
+
+The driver is located in the menu structure at:
+
+  -> Device Drivers
+    -> Network device support (NETDEVICES [=y])
+      -> Ethernet driver support
+        -> Pensando devices
+          -> Pensando Ethernet PDS_VDPA Support
+
+Support
+=======
+
+For general Linux networking support, please use the netdev mailing
+list, which is monitored by Pensando personnel::
+
+  netdev@vger.kernel.org
+
+For more specific support needs, please use the Pensando driver support
+email::
+
+  drivers@pensando.io
diff --git a/Documentation/networking/device_drivers/ethernet/index.rst b/Documentation/networking/device_drivers/ethernet/index.rst
index 417ca514a4d0..94ecb67c0885 100644
--- a/Documentation/networking/device_drivers/ethernet/index.rst
+++ b/Documentation/networking/device_drivers/ethernet/index.rst
@@ -15,6 +15,7 @@  Contents:
    amazon/ena
    altera/altera_tse
    amd/pds_core
+   amd/pds_vdpa
    aquantia/atlantic
    chelsio/cxgb
    cirrus/cs89x0
diff --git a/MAINTAINERS b/MAINTAINERS
index e2fd64c2ebdc..c3f509eeaf1d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -22296,6 +22296,10 @@  F:	include/linux/vringh.h
 F:	include/uapi/linux/virtio_*.h
 F:	tools/virtio/
 
+PDS DSC VIRTIO DATA PATH ACCELERATOR
+R:	Shannon Nelson <shannon.nelson@amd.com>
+F:	drivers/vdpa/pds/
+
 VIRTIO CRYPTO DRIVER
 M:	Gonglei <arei.gonglei@huawei.com>
 L:	virtualization@lists.linux-foundation.org
diff --git a/drivers/vdpa/Kconfig b/drivers/vdpa/Kconfig
index cd6ad92f3f05..656c1cb541de 100644
--- a/drivers/vdpa/Kconfig
+++ b/drivers/vdpa/Kconfig
@@ -116,4 +116,14 @@  config ALIBABA_ENI_VDPA
 	  This driver includes a HW monitor device that
 	  reads health values from the DPU.
 
+config PDS_VDPA
+	tristate "vDPA driver for AMD/Pensando DSC devices"
+	select VIRTIO_PCI_LIB
+	depends on PCI_MSI
+	depends on PDS_CORE
+	help
+	  vDPA network driver for AMD/Pensando's PDS Core devices.
+	  With this driver, the VirtIO dataplane can be
+	  offloaded to an AMD/Pensando DSC device.
+
 endif # VDPA