Skip to content

Commit d8bb382

Browse files
committed
Merge branch 'pds_core'
Shannon Nelson says: ==================== pds_core driver Summary: -------- This patchset implements a new driver for use with the AMD/Pensando Distributed Services Card (DSC), intended to provide core configuration services through the auxiliary_bus and through a couple of EXPORTed functions for use initially in VFio and vDPA feature specific drivers. To keep this patchset to a manageable size, the pds_vdpa and pds_vfio drivers have been split out into their own patchsets to be reviewed separately. Detail: ------- AMD/Pensando is making available a new set of devices for supporting vDPA, VFio, and potentially other features in the Distributed Services Card (DSC). These features are implemented through a PF that serves as a Core device for controlling and configuring its VF devices. These VF devices have separate drivers that use the auxiliary_bus to work through the Core device as the control path. Currently, the DSC supports standard ethernet operations using the ionic driver. This is not replaced by the Core-based devices - these new devices are in addition to the existing Ethernet device. Typical DSC configurations will include both PDS devices and Ionic Eth devices. However, there is a potential future path for ethernet services to come through this device as well. The Core device is a new PCI PF/VF device managed by a new driver 'pds_core'. The PF device has access to an admin queue for configuring the services used by the VFs, and sets up auxiliary_bus devices for each vDPA VF for communicating with the drivers for the vDPA devices. The VFs may be for VFio or vDPA, and other services in the future; these VF types are selected as part of the DSC internal FW configurations, which is out of the scope of this patchset. When the vDPA support set is enabled in the core PF through its devlink param, auxiliary_bus devices are created for each VF that supports the feature. The vDPA driver then connects to and uses this auxiliary_device to do control path configuration through the PF device. This can then be used with the vdpa kernel module to provide devices for virtio_vdpa kernel module for host interfaces, or vhost_vdpa kernel module for interfaces exported into your favorite VM. A cheap ASCII diagram of a vDPA instance looks something like this: ,----------. | vdpa | '----------' | || ctl data | || .----------. || | pds_vdpa | || '----------' || | || pds_core.vDPA.1 || | || .---------------. || | pds_core | || '---------------' || || || || 09:00.0 09:00.1 == PCI ============================================ || || .----------. .----------. ,------| PF |---| VF |-------, | '----------' '----------' | | DSC | | | ------------------------------------------ Changes: v11: - change strncpy to strscpy Reported-by: kernel test robot <lkp@intel.com> Link: https://lore.kernel.org/oe-kbuild-all/202304181137.WaZTYyAa-lkp@intel.com/ v10: Link: https://lore.kernel.org/netdev/20230418003228.28234-1-shannon.nelson@amd.com/ - remove CONFIG_DEBUG_FS guard static inline stuff - remove unnecessary 0 and null initializations - verify in driver load that PDS_CORE_DRV_NAME matches KBUILD_MODNAME - remove debugfs irqs_show(), redundant with /proc - return -ENOMEM if intr_info = kcalloc() fails - move the status code enum into pds_core_if.h as part of API definition - fix up one place in pdsc_devcmd_wait() we're using the status codes where we could use the errno - remove redundant calls to flush_workqueue() - grab config_lock before testing state bits in pdsc_fw_reporter_diagnose() - change pdsc_color_match() to return bool - remove useless VIF setup loop and just setup vDPA services for now - remove pf pointer from struct padev and have clients use pci_physfn() - drop use of "vf" in auxdev.c function names, make more generic - remove last of client ops struct and simply export the functions - drop drivers@pensando.io from MAINTAINERS and add new include dir - include dynamic_debug.h in adminq.c to protect dynamic_hex_dump() - fixed fw_slot type from u8 to int for handling error returns - fixed comment spelling - changed void arg in pdsc_adminq_post() to struct pdsc * v9: Link: https://lore.kernel.org/netdev/20230406234143.11318-1-shannon.nelson@amd.com/ - change pdsc field name id to uid to clarify the unique id used for aux device - remove unnecessary pf->state and other checks in aux device creation - hardcode fw slotnames for devlink info, don't use strings from FW - handle errors from PDS_CORE_CMD_INIT devcmd call - tighten up health thread use of config_lock - remove pdsc_queue_health_check() layer over queuing health check - start pds_core.rst file in first patch, add to it incrementally - give more user interaction info in commit messages - removed a few more extraneous includes v8: Link: https://lore.kernel.org/netdev/20230330234628.14627-1-shannon.nelson@amd.com/ - fixed deadlock problem, use devl_health_reporter_destroy() when devlink is locked - don't clear client_id until after auxiliary_device_uninit() v7: Link: https://lore.kernel.org/netdev/20230330192313.62018-1-shannon.nelson@amd.com/ - use explicit devlink locking and devl_* APIs - move some of devlink setup logic into probe and remove - use debugfs_create_u{type}() for state and queue head and tail - add include for linux/vmalloc.h Reported-by: kernel test robot <lkp@intel.com> Link: https://lore.kernel.org/oe-kbuild-all/202303260420.Tgq0qobF-lkp@intel.com/ v6: Link: https://lore.kernel.org/netdev/20230324190243.27722-1-shannon.nelson@amd.com/ - removed version.h include noticed by kernel test robot's version check Reported-by: kernel test robot <lkp@intel.com> Link: https://lore.kernel.org/oe-kbuild-all/202303230742.pX3ply0t-lkp@intel.com/ - fixed up the more egregious checkpatch line length complaints - make sure pdsc_auxbus_dev_register() checks padev pointer errcode v5: Link: https://lore.kernel.org/netdev/20230322185626.38758-1-shannon.nelson@amd.com/ - added devlink health reporter for FW issues - removed asic_type, asic_rev, serial_num, fw_version from debugfs as they are available through other means - trimed OS info in pdsc_identify(), we don't need to send that much info to the FW - removed reg/unreg from auxbus client API, they are now in the core when VF is started - removed need for pdsc definition in client by simplifying the padev to only carry struct pci_dev pointers rather than full struct pdsc to the pf and vf - removed the unused pdsc argument in pdsc_notify() - moved include/linux/pds/pds_core.h to driver/../pds_core/core.h - restored a few pds_core_if.h interface values and structs that are shared with FW source - moved final config_lock unlock to before tear down of timer and workqueue to be sure there are no deadlocks while waiting for any stragglers - changed use of PAGE_SIZE to local PDS_PAGE_SIZE to keep with FW layout needs without regard to kernel PAGE_SIZE configuration - removed the redundant *adminqcq argument from pdsc_adminq_post() v4: Link: https://lore.kernel.org/netdev/20230308051310.12544-1-shannon.nelson@amd.com/ - reworked to attach to both Core PF and vDPA VF PCI devices - now creates auxiliary_device as part of each VF PCI probe, removes them on PCI remove - auxiliary devices now use simple unique id rather than PCI address for identifier - replaced home-grown event publishing with kernel-based notifier service - dropped live_migration parameter, not needed when not creating aux device for it - replaced devm_* functions with traditional interfaces - added MAINTAINERS entry - removed lingering traces of set/get_vf attribute adminq commands - trimmed some include lists - cleaned a kernel test robot complaint about a stray unused variable Link: https://lore.kernel.org/oe-kbuild-all/202302181049.yeUQMeWY-lkp@intel.com/ v3: Link: https://lore.kernel.org/netdev/20230217225558.19837-1-shannon.nelson@amd.com/ - changed names from "pensando" to "amd" and updated copyright strings - dropped the DEVLINK_PARAM_GENERIC_ID_FW_BANK for future development - changed the auxiliary device creation to be triggered by the PCI bus event BOUND_DRIVER, and torn down at UNBIND_DRIVER in order to properly handle users using the sysfs bind/unbind functions - dropped some noisy log messages - rebased to current net-next RFC to v2: Link: https://lore.kernel.org/netdev/20221207004443.33779-1-shannon.nelson@amd.com/ - added separate devlink param patches for DEVLINK_PARAM_GENERIC_ID_ENABLE_MIGRATION and DEVLINK_PARAM_GENERIC_ID_FW_BANK, and dropped the driver specific implementations - updated descriptions for the new devlink parameters - dropped netdev support - dropped vDPA patches, will followup later - separated fw update and fw bank select into their own patches RFC: Link: https://lore.kernel.org/netdev/20221118225656.48309-1-snelson@pensando.io/ ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents 25c800b + ddbcb22 commit d8bb382

20 files changed

Lines changed: 4481 additions & 0 deletions

File tree

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
.. SPDX-License-Identifier: GPL-2.0+
2+
3+
========================================================
4+
Linux Driver for the AMD/Pensando(R) DSC adapter family
5+
========================================================
6+
7+
Copyright(c) 2023 Advanced Micro Devices, Inc
8+
9+
Identifying the Adapter
10+
=======================
11+
12+
To find if one or more AMD/Pensando PCI Core devices are installed on the
13+
host, check for the PCI devices::
14+
15+
# lspci -d 1dd8:100c
16+
b5:00.0 Processing accelerators: Pensando Systems Device 100c
17+
b6:00.0 Processing accelerators: Pensando Systems Device 100c
18+
19+
If such devices are listed as above, then the pds_core.ko driver should find
20+
and configure them for use. There should be log entries in the kernel
21+
messages such as these::
22+
23+
$ dmesg | grep pds_core
24+
pds_core 0000:b5:00.0: 252.048 Gb/s available PCIe bandwidth (16.0 GT/s PCIe x16 link)
25+
pds_core 0000:b5:00.0: FW: 1.60.0-73
26+
pds_core 0000:b6:00.0: 252.048 Gb/s available PCIe bandwidth (16.0 GT/s PCIe x16 link)
27+
pds_core 0000:b6:00.0: FW: 1.60.0-73
28+
29+
Driver and firmware version information can be gathered with devlink::
30+
31+
$ devlink dev info pci/0000:b5:00.0
32+
pci/0000:b5:00.0:
33+
driver pds_core
34+
serial_number FLM18420073
35+
versions:
36+
fixed:
37+
asic.id 0x0
38+
asic.rev 0x0
39+
running:
40+
fw 1.51.0-73
41+
stored:
42+
fw.goldfw 1.15.9-C-22
43+
fw.mainfwa 1.60.0-73
44+
fw.mainfwb 1.60.0-57
45+
46+
Info versions
47+
=============
48+
49+
The ``pds_core`` driver reports the following versions
50+
51+
.. list-table:: devlink info versions implemented
52+
:widths: 5 5 90
53+
54+
* - Name
55+
- Type
56+
- Description
57+
* - ``fw``
58+
- running
59+
- Version of firmware running on the device
60+
* - ``fw.goldfw``
61+
- stored
62+
- Version of firmware stored in the goldfw slot
63+
* - ``fw.mainfwa``
64+
- stored
65+
- Version of firmware stored in the mainfwa slot
66+
* - ``fw.mainfwb``
67+
- stored
68+
- Version of firmware stored in the mainfwb slot
69+
* - ``asic.id``
70+
- fixed
71+
- The ASIC type for this device
72+
* - ``asic.rev``
73+
- fixed
74+
- The revision of the ASIC for this device
75+
76+
Parameters
77+
==========
78+
79+
The ``pds_core`` driver implements the following generic
80+
parameters for controlling the functionality to be made available
81+
as auxiliary_bus devices.
82+
83+
.. list-table:: Generic parameters implemented
84+
:widths: 5 5 8 82
85+
86+
* - Name
87+
- Mode
88+
- Type
89+
- Description
90+
* - ``enable_vnet``
91+
- runtime
92+
- Boolean
93+
- Enables vDPA functionality through an auxiliary_bus device
94+
95+
Firmware Management
96+
===================
97+
98+
The ``flash`` command can update a the DSC firmware. The downloaded firmware
99+
will be saved into either of firmware bank 1 or bank 2, whichever is not
100+
currently in use, and that bank will used for the next boot::
101+
102+
# devlink dev flash pci/0000:b5:00.0 \
103+
file pensando/dsc_fw_1.63.0-22.tar
104+
105+
Health Reporters
106+
================
107+
108+
The driver supports a devlink health reporter for FW status::
109+
110+
# devlink health show pci/0000:2b:00.0 reporter fw
111+
pci/0000:2b:00.0:
112+
reporter fw
113+
state healthy error 0 recover 0
114+
# devlink health diagnose pci/0000:2b:00.0 reporter fw
115+
Status: healthy State: 1 Generation: 0 Recoveries: 0
116+
117+
Enabling the driver
118+
===================
119+
120+
The driver is enabled via the standard kernel configuration system,
121+
using the make command::
122+
123+
make oldconfig/menuconfig/etc.
124+
125+
The driver is located in the menu structure at:
126+
127+
-> Device Drivers
128+
-> Network device support (NETDEVICES [=y])
129+
-> Ethernet driver support
130+
-> AMD devices
131+
-> AMD/Pensando Ethernet PDS_CORE Support
132+
133+
Support
134+
=======
135+
136+
For general Linux networking support, please use the netdev mailing
137+
list, which is monitored by AMD/Pensando personnel::
138+
139+
netdev@vger.kernel.org

Documentation/networking/device_drivers/ethernet/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Contents:
1414
3com/vortex
1515
amazon/ena
1616
altera/altera_tse
17+
amd/pds_core
1718
aquantia/atlantic
1819
chelsio/cxgb
1920
cirrus/cs89x0

MAINTAINERS

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,6 +1041,15 @@ F: drivers/gpu/drm/amd/include/vi_structs.h
10411041
F: include/uapi/linux/kfd_ioctl.h
10421042
F: include/uapi/linux/kfd_sysfs.h
10431043

1044+
AMD PDS CORE DRIVER
1045+
M: Shannon Nelson <shannon.nelson@amd.com>
1046+
M: Brett Creeley <brett.creeley@amd.com>
1047+
L: netdev@vger.kernel.org
1048+
S: Supported
1049+
F: Documentation/networking/device_drivers/ethernet/amd/pds_core.rst
1050+
F: drivers/net/ethernet/amd/pds_core/
1051+
F: include/linux/pds/
1052+
10441053
AMD SPI DRIVER
10451054
M: Sanjay R Mehta <sanju.mehta@amd.com>
10461055
S: Maintained

drivers/net/ethernet/amd/Kconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,4 +186,16 @@ config AMD_XGBE_HAVE_ECC
186186
bool
187187
default n
188188

189+
config PDS_CORE
190+
tristate "AMD/Pensando Data Systems Core Device Support"
191+
depends on 64BIT && PCI
192+
help
193+
This enables the support for the AMD/Pensando Core device family of
194+
adapters. More specific information on this driver can be
195+
found in
196+
<file:Documentation/networking/device_drivers/ethernet/amd/pds_core.rst>.
197+
198+
To compile this driver as a module, choose M here. The module
199+
will be called pds_core.
200+
189201
endif # NET_VENDOR_AMD

drivers/net/ethernet/amd/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ obj-$(CONFIG_PCNET32) += pcnet32.o
1717
obj-$(CONFIG_SUN3LANCE) += sun3lance.o
1818
obj-$(CONFIG_SUNLANCE) += sunlance.o
1919
obj-$(CONFIG_AMD_XGBE) += xgbe/
20+
obj-$(CONFIG_PDS_CORE) += pds_core/
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# SPDX-License-Identifier: GPL-2.0
2+
# Copyright (c) 2023 Advanced Micro Devices, Inc.
3+
4+
obj-$(CONFIG_PDS_CORE) := pds_core.o
5+
6+
pds_core-y := main.o \
7+
devlink.o \
8+
auxbus.o \
9+
dev.o \
10+
adminq.o \
11+
core.o \
12+
fw.o
13+
14+
pds_core-$(CONFIG_DEBUG_FS) += debugfs.o

0 commit comments

Comments
 (0)