Skip to content

Replace bus/slot/function with full PCI paths #8681

@DemiMarie

Description

@DemiMarie

How to file a helpful issue

The problem you're addressing (if any)

PCI devices are currently assigned via bus/slot/function, which is not a stable identifier.

The solution you'd like

Use PCI paths instead, which are much more likely to be stable.

Specifically, replace the "bus" part with the bridges path starting from bus 0. For example:

# lspci -t
-[0000:00]-+-00.0
           +-00.2
           +-01.0
           +-02.0
           +-02.2-[01]----00.0
           +-02.4-[02]----00.0
           +-03.0
           +-03.1-[03-61]--
           +-04.0
           +-04.1-[62-c0]--
           +-08.0
           +-08.1-[c1]--+-00.0
           |            +-00.1
           |            +-00.2
           |            +-00.3
           |            +-00.4
           |            +-00.5
           |            \-00.6
...

The device 0000:c1:00.0 is behind bridge at 0000:00:08.1. In some cases there may be more bridges. There may be more devices behind a single bridge (in the example above it's just a single multi-function device).
You can get bus ranges handled by a given bridge by looking at "secondary" and "subordinate" attributes on lspci (and similarly in sysfs):

00:08.1 PCI bridge: Advanced Micro Devices, Inc. [AMD] Phoenix Internal GPP Bridge to Bus [C:A] (prog-if 00 [Normal decode])
	Subsystem: Device 0006:f111
	Flags: bus master, fast devsel, latency 0, IRQ 106
	Bus: primary=00, secondary=c1, subordinate=c1, sec-latency=0
...

I imagine the path for the 0000:c1:00.0 device would look something like this: 0000:00:08.1-00:00.0, where the -00 part means "the first bus behind this bridge". The important part is to not include "c1" in the address (but use the address relative to the bridge range), because if the bus will get renumbered (when somebody plugs some other devices for example), that number may change.

If there would be device at bus 5, (which is the third bus behind bridge at 00:03.1), for example at 0000:05:01.5, it would have a path like 0000:00:03.1-02:01.5

PCI bridges cannot cross the PCI segment boundaries, so the first "0000" will stay the same (doesn't need to be duplicated in the address).

The value to a user, and who that user might be

Users will be less likely to have problems with PCI device renumbering.

Metadata

Metadata

Assignees

Labels

C: coreThis issue pertains to a Qubes core component.P: defaultPriority: default. Default priority for new issues, to be replaced given sufficient information.pr submittedA pull request has been submitted for this issue.r4.3-host-cur-testtargets-4.3Feature planned for Qubes 4.3. Remove label if not implemented by release; leave if implemented.

Projects

Status

Done

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions