This series enables the node device driver to report information about the
existing mediated devices on the host. There is no device creation involved
yet. The information reported by the node device driver is split into two
parts, one that is reported within the physical parent's capabilities
(the generic stuff that comes from the mdev types' sysfs attributes, note the
'description' attribute which is verbatim - raw,unstructured string) and the
other that is reported within the mdev child device and merely contains the
mdev type id, which the device was instantiated from, and the iommu group
number.
Basically, the format of the XML I went for is as follows:
PCI parent:
<device>
<name>pci_0000_06_00_0</name>
<path>/sys/devices/.../0000:06:00.0</path>
<parent>pci_0000_05_08_0</parent>
...
<capability type='pci'>
...
<capability type='mdev'>
<type id='nvidia-11'>
<name>GRID M60-0B</name>
<description>num_heads=2, frl_config=45, framebuffer=512M,
max_resolution=2560x1600, max_instance=16</description>
<device_api>vfio-pci</device_api>
<available_instances>16</available_instances>
</type>
...
</capability>
<iommuGroup number='20'>
<address domain='0x0000' bus='0x06' slot='0x00'
function='0x0'/>
</iommuGroup>
...
</capability>
</device>
mdev child:
<device>
<name>mdev_ef1212ff_ff23_4534_ffcd_01ff12017801</name>
<path>/sys/devices/.../ef1212ff-ff23-4534-ffcd-01ff12017801</path>
<parent>pci_0000_06_00_0</parent>
<driver>
<name>vfio_mdev</name>
</driver>
<capability type='mdev'>
<type id='nvidia-18'/>
<iommuGroup number='63'/>
</capability>
</device>
Also, since we didn't have any node device driver documentation, I created a
stub (comments are very welcome, you can shred it to pieces ;)) focusing on the
PCI devices and then adding the mdev part into that. As I said, it's still a
stub that needs lots of work on it, namely adding USBs and SCSI devices, but I
figured that the fact some parts are missing should not be a show stopper for
the nodedev-mdev patches.
Thanks,
Erik
Erik Skultety (11):
nodedev: Fix guideline violations in nodedev modules
nodedev: Make use of the compile-time missing enum in switch error
conf: nodedev: Split virNodeDeviceDefFormat into more functions
nodedev: udevProcessPCI: Drop syspath variable
docs: Use our XSLT template to generate list of supported pool types
nodedev: Introduce the mdev capability to the nodedev driver structure
nodedev: Fill in the mdev info for the parent PCI device
nodedev: Introduce udevProcessMediatedDevice
nodedev: Format the mdev capability of the PCI parent device
docs: Provide a nodedev driver stub documentation
docs: Document the mediated devices within the nodedev driver
docs/drivers.html.in | 6 +-
docs/drvnodedev.html.in | 275 +++++++++++++
docs/storage.html.in | 62 +--
include/libvirt/libvirt-nodedev.h | 1 +
src/conf/node_device_conf.c | 625 ++++++++++++++++++------------
src/conf/node_device_conf.h | 21 +-
src/conf/virnodedeviceobj.c | 3 +-
src/libvirt-nodedev.c | 1 +
src/libvirt_private.syms | 1 +
src/node_device/node_device_driver.c | 30 +-
src/node_device/node_device_driver.h | 82 ++--
src/node_device/node_device_hal.c | 9 +
src/node_device/node_device_linux_sysfs.c | 1 +
src/node_device/node_device_linux_sysfs.h | 9 +-
src/node_device/node_device_udev.c | 456 ++++++++++++++++------
tools/virsh-nodedev.c | 2 +
16 files changed, 1110 insertions(+), 474 deletions(-)
create mode 100644 docs/drvnodedev.html.in
--
2.12.2