Appendix – PCIe BDF to VUID Translation


PCIe BDF (Bus, Device, Function) is a unique identifier assigned to every PCIe device connected to a computer. By identifying each device with a unique BDF number, the computer's OS can manage the system's resources efficiently and effectively.

PCIe BDF values are determined by host OS and are hence subject to change between different runs, or even in a single run. Therefore, the BDF identifier is not the best fit for permanent configuration.

To overcome this problem, NVIDIA devices add an extension to PCIe attributes, called VUIDs. As opposed to BDF, VUID is persistent across runs which makes it useful as a PCIe function identifier.

PCI BDF and VUID can be extracted one out of the other, using `lspci` command:

  1. To extract VUID out of BDF:


    [host] lspci -s <BDF> -vvv | grep -i VU | awk '{print $4}'

  2. To extract BDF out of VUID:


    [host] ./ <VUID> [host] cat ./ #!/usr/bin/python3   import subprocess import sys   vuid = sys.argv[1]   # Split the output into individual PCI function entries lspci_output = subprocess.check_output(['lspci']).decode().strip().split('\n')   # Create an empty dictionary to store the results pci_functions = {}   # Loop through each PCI function and extract the BDF and full info for line in lspci_output: bdf = line.split()[0] if vuid in subprocess.check_output(['lspci', '-s', bdf, '-vvv']).decode(): print(bdf) exit(0)   print("Not Found")

© Copyright 2023, NVIDIA. Last updated on Dec 13, 2023.