configurationlinux-kernelpci-e

Enumeration of multiple PCIe physical functions


I would like to understand how a linux kernel identifies that a particular PCIe device attached is supporting multiple physical functions during enumeration process? Is there a particular configuration register that can be read to understand the total no. of PFs supported?

I tried googling and reading some docs online but not able to find/understand how it happens. I need to read that particular register. I am able to read and confirm the register for VF count.


Solution

  • Software simply checks the vendor id register in the config space for each function. If it is FFFF, then the function is not present.

    There is a bit in the config space for function 0 that indicates whether there are any other functions. (Offset 0E, bit 7.) If this bit is 0, software can skip checking the other seven functions, as an optimization. If the bit is 1, software should check the vendor id of all of the other seven functions to find out which ones are present.