]> xenbits.xensource.com Git - xen.git/commit
xen/pci: introduce PF<->VF links
authorStewart Hildebrand <stewart.hildebrand@amd.com>
Tue, 26 Nov 2024 10:22:26 +0000 (11:22 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 26 Nov 2024 10:22:26 +0000 (11:22 +0100)
commit4e18a39056d9912f8d61f7b58d181883b99f1880
tree93bae6f6d055ff8198eb80a00d9fd732840bc7fa
parentb661fe107d45713f4e1395f29180cc1ae50bba92
xen/pci: introduce PF<->VF links

Add links between a VF's struct pci_dev and its associated PF struct
pci_dev.

The hardware domain is expected to remove the associated VFs before
removing the PF. If removal happens out of order, print a warning and
return an error. This means that VFs can only exist with an associated
PF.

Additionally, if the hardware domain attempts to remove a PF with VFs
still present, mark the PF and VFs broken, because Linux Dom0 has been
observed to not respect the error returned.

Move the calls to pci_get_pdev() and pci_add_device() down to avoid
dropping and re-acquiring the pcidevs_lock().

Check !pdev->pf_pdev before adding the VF to the list to guard against
adding it multiple times.

Signed-off-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/drivers/passthrough/pci.c
xen/include/xen/pci.h