Introduction:
=
This patch set is direct derivative of Jan's original series [1],[2].
- This version is based on HEAD (tag: v16.11-rc1) + patch series [11]
Aim:
As of now EAL is primarly focused on PCI initialization/probing.
rte_eal_init()
|- rte_eal_pci_init(): Find PCI devices from sysfs
|- ...
|- rte_eal_memzone_init()
|- ...
`- rte_eal_pci_probe(): Driver<=>Device initialization
This patchset introduces SoC framework which would enable SoC drivers and
drivers to be plugged into EAL, very similar to how PCI drivers/devices are
done today.
This is a stripped down version of PCI framework which allows the SoC PMDs
to implement their own routines for detecting devices and linking devices to
drivers.
1) Changes to EAL
rte_eal_init()
|- rte_eal_pci_init(): Find PCI devices from sysfs
|- rte_eal_soc_init(): Calls PMDs->scan_fn
|- ...
|- rte_eal_memzone_init()
|- ...
|- rte_eal_pci_probe(): Driver<=>Device initialization, PMD->devinit()
`- rte_eal_soc_probe(): Calls PMDs->match_fn and PMDs->devinit();
2) New device/driver structures:
- rte_soc_driver (inheriting rte_driver)
- rte_soc_device (inheriting rte_device)
- rte_eth_dev and eth_driver embedded rte_soc_device and rte_soc_driver,
respectively.
3) The SoC PMDs need to:
- define rte_soc_driver with necessary scan and match callbacks
- Register themselves using DRIVER_REGISTER_SOC()
- Implement respective bus scanning in the scan callbacks to add necessary
devices to SoC device list
- Implement necessary eth_dev_init/uninint for ethernet instances
4) Design considerations that are same as PCI:
- SoC initialization is being done through rte_eal_init(), just after PCI
initialization is done.
- As in case of PCI, probe is done after rte_eal_pci_probe() to link the
devices detected with the drivers registered.
- Device attach/detach functions are available and have been designed on
the lines of PCI framework.
- PMDs register using DRIVER_REGISTER_SOC, very similar to
DRIVER_REGISTER_PCI for PCI devices.
- Linked list of SoC driver and devices exists independent of the other
driver/device list, but inheriting rte_driver/rte_driver, these are
also part of a global list.
5) Design considerations that are different from PCI:
- Each driver implements its own scan and match function. PCI uses the BDF
format to read the device from sysfs, but this _may_not_ be a case for a
SoC ethernet device.
= This is an important change from initial proposal by Jan in [2].
Unlike his attempt to use /sys/bus/platform, this patch relies on the
PMD to detect the devices. This is because SoC may require specific or
additional info for device detection. Further, SoC may have embedded
devices/MACs which require initialization which cannot be covered
through sysfs parsing.
`-> Point (6) below is a side note to above.
= PCI based PMDs rely on EAL's capability to detect devices. This
proposal puts the onus on PMD to detect devices, add to soc_device_list
and wait for Probe. Matching, of device<=>driver is again PMD's
callback.
6) Adding default scan and match helpers for PMDs
- The design warrrants the PMDs implement their own scan of devices
on bus, and match routines for probe implementation.
This patch introduces helpers which can be used by PMDs for scan of
the platform bus and matching devices against the compatible string
extracted from the scan.
- Intention is to make it easier to integrate known SoC which expose
platform bus compliant information (compat, sys/bus/platform...).
- PMDs which have deviations from this standard model can implement and
hook their bus scanning and probe match callbacks while registering
driver.
Patchset Overview:
==
- Patches 0001~0004 introduce the base infrastructure and test case
- Patch 0005 is for command line support for no-soc, on lines of no-pci
- Patch 0006 enables EAL to handle SoC type devices
- Patch 0007 adds support for scan and probe callbacks and updates the test
framework with relevant test case.
- Patch 0008~0010 enable device argument, driver specific flags and
interrupt handling related basic infra. Subsequent patches build up on
them.
- Patch 0011~0012 add support for default function which PMDs can use for
scanning platform bus. These functions are optional and need to be hooked
to by PMDs.
- Patch 0013~0014 makes changes to PCI as well as ethdev code to remove
assumption that eth_driver is a PCI driver.
- Patch 0016 adds necessary ethdev probe/remove functions for PMDs to use
- Patch 0017 adds support for SoC driver/devices, along with probe/remove
functions for Cryptodev devices.
Future/Pending Changes:
===
- Device whitelisting/blacklist still relies on command line '-b' and '-c'
which are internally implemented using OPT_PCI_BLACKLIST/OPT_PCI_WHITELIST.
This needs to be changed to a generi