On 10/14/2016 7:52 AM, Jike Song wrote:
> On 10/11/2016 04:28 AM, Kirti Wankhede wrote:
>> +
>> +Under per-physical device sysfs:
>> +--------------------------------
>> +
>> +* mdev_supported_types:
>> +    List of current supported mediated device types and its details are 
>> added
>> +in this directory in following format:
>> +
>> +|- <parent phy device>
>> +|--- Vendor-specific-attributes [optional]
>> +|--- mdev_supported_types
>> +|     |--- <type id>
>> +|     |   |--- create
>> +|     |   |--- name
>> +|     |   |--- available_instances
>> +|     |   |--- description /class
>> +|     |   |--- [devices]
>> +|     |--- <type id>
>> +|     |   |--- create
>> +|     |   |--- name
>> +|     |   |--- available_instances
>> +|     |   |--- description /class
>> +|     |   |--- [devices]
>> +|     |--- <type id>
>> +|          |--- create
>> +|          |--- name
>> +|          |--- available_instances
>> +|          |--- description /class
>> +|          |--- [devices]
>> +
>> +[TBD : description or class is yet to be decided. This will change.]
>> +
>> +Under per mdev device:
>> +----------------------
>> +
>> +|- <parent phy device>
>> +|--- $MDEV_UUID
>> +         |--- remove
>> +         |--- {link to its type}
>> +         |--- vendor-specific-attributes [optional]
>> +
> 
> All mdev directories are placed under physical device directly.
> 
> Looking at the sysfs directory of physical device, you get:
> 
>         <parent phy device>
>         |--- mdev_supported_types/
>         |        |--- type1/
>         |        |--- type2/
>         |        |--- type3/
>         |--- mdev1/
>         |--- mdev2/
> 
> 
> 
> With an independent device between physical and mdev, and names
> simplified, you will get:
> 
>         <parent phy device>
>         |--- mdev/
>         |        |--- supported_type1/
>         |        |--- supported_type2/
>         |        |--- supported_type3/
>         |        |--- mdev1/
>         |        |--- mdev2/
> 
> i.e. everything related to mdev are placed under one single directory -
> the same as SR-IOV.  I'm not sure if it is possible without
> introducing an independent device (which you apparently dislike), but
> placing so many mdev directories under physical doesn't seems clean.
> 
> 

I'm repeating the same example that I had in reply to Alex's question,
the parent-child relationship between devices is reflected in sysfs.
There are cases when there are multiple children and all are placed in
same parent directory:

80:01.0 PCI bridge: Intel Corporation Xeon E5/Core i7 IIO PCI Express
Root Port 1a (rev 07)
80:02.0 PCI bridge: Intel Corporation Xeon E5/Core i7 IIO PCI Express
Root Port 2a (rev 07)
80:03.0 PCI bridge: Intel Corporation Xeon E5/Core i7 IIO PCI Express
Root Port 3a in PCI Express Mode (rev 07)
80:04.0 System peripheral: Intel Corporation Xeon E5/Core i7 DMA Channel
0 (rev 07)
80:04.1 System peripheral: Intel Corporation Xeon E5/Core i7 DMA Channel
1 (rev 07)
80:04.2 System peripheral: Intel Corporation Xeon E5/Core i7 DMA Channel
2 (rev 07)
80:04.3 System peripheral: Intel Corporation Xeon E5/Core i7 DMA Channel
3 (rev 07)
80:04.4 System peripheral: Intel Corporation Xeon E5/Core i7 DMA Channel
4 (rev 07)
80:04.5 System peripheral: Intel Corporation Xeon E5/Core i7 DMA Channel
5 (rev 07)
80:04.6 System peripheral: Intel Corporation Xeon E5/Core i7 DMA Channel
6 (rev 07)
80:04.7 System peripheral: Intel Corporation Xeon E5/Core i7 DMA Channel
7 (rev 07)
80:05.0 System peripheral: Intel Corporation Xeon E5/Core i7 Address
Map, VTd_Misc, System Management (rev 07)
80:05.2 System peripheral: Intel Corporation Xeon E5/Core i7 Control
Status and Global Errors (rev 07)
80:05.4 PIC: Intel Corporation Xeon E5/Core i7 I/O APIC (rev 07)
81:00.0 Ethernet controller: Intel Corporation I350 Gigabit Network
Connection (rev 01)
81:00.1 Ethernet controller: Intel Corporation I350 Gigabit Network
Connection (rev 01)
83:00.0 PCI bridge: PLX Technology, Inc. PEX 8747 48-Lane, 5-Port PCI
Express Gen 3 (8.0 GT/s) Switch (rev ca)
84:08.0 PCI bridge: PLX Technology, Inc. PEX 8747 48-Lane, 5-Port PCI
Express Gen 3 (8.0 GT/s) Switch (rev ca)
84:10.0 PCI bridge: PLX Technology, Inc. PEX 8747 48-Lane, 5-Port PCI
Express Gen 3 (8.0 GT/s) Switch (rev ca)
85:00.0 VGA compatible controller: NVIDIA Corporation Device 13f2 (rev a1)
86:00.0 VGA compatible controller: NVIDIA Corporation Device 13f2 (rev a1)

In sysfs, those are in same parent folder of its parent root port:

# ls /sys/devices/pci0000\:80/ -l
total 0
drwxr-xr-x 8 root root    0 Oct 13 13:30 0000:80:01.0
drwxr-xr-x 7 root root    0 Oct 13 13:30 0000:80:02.0
drwxr-xr-x 6 root root    0 Oct 13 13:30 0000:80:03.0
drwxr-xr-x 6 root root    0 Oct 13 13:30 0000:80:04.0
drwxr-xr-x 6 root root    0 Oct 13 13:30 0000:80:04.1
drwxr-xr-x 6 root root    0 Oct 13 13:30 0000:80:04.2
drwxr-xr-x 6 root root    0 Oct 13 13:30 0000:80:04.3
drwxr-xr-x 6 root root    0 Oct 13 13:30 0000:80:04.4
drwxr-xr-x 6 root root    0 Oct 13 13:30 0000:80:04.5
drwxr-xr-x 6 root root    0 Oct 13 13:30 0000:80:04.6
drwxr-xr-x 6 root root    0 Oct 13 13:30 0000:80:04.7
drwxr-xr-x 3 root root    0 Oct 13 13:30 0000:80:05.0
drwxr-xr-x 3 root root    0 Oct 13 13:30 0000:80:05.2
drwxr-xr-x 3 root root    0 Oct 13 13:30 0000:80:05.4
lrwxrwxrwx 1 root root    0 Oct 13 13:30 firmware_node ->
../LNXSYSTM:00/LNXSYBUS:00/PNP0A08:01
drwxr-xr-x 3 root root    0 Oct 13 13:30 pci_bus
drwxr-xr-x 2 root root    0 Oct 13 13:30 power
-rw-r--r-- 1 root root 4096 Oct 13 13:25 uevent


This is not only the case with pci devices, another example, i2c
devices. Nvidia driver registers to i2c bus and when nvidia.ko is
loaded, you can see i2c devices, which forms child of GPU @0000:85:00.0,
are places in 0000:85:00.0 directory.

/sys/bus/pci/devices/0000:85:00.0/i2c-4
/sys/bus/pci/devices/0000:85:00.0/i2c-5

Thanks,
Kirti

Reply via email to