]> www.infradead.org Git - users/jedix/linux-maple.git/commit
xen/pcifront: Walk the PCI bus after XenStore notification
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Thu, 30 Nov 2017 15:31:58 +0000 (10:31 -0500)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Mon, 4 Dec 2017 18:51:07 +0000 (13:51 -0500)
commita9da9373003fe863935060838275037fe46dfbd5
tree28f4f4098c5b5844789909a29f4dfb9d8f8418b8
parent4470c8de18d0f442b06b25ba292c9dec50b72144
xen/pcifront: Walk the PCI bus after XenStore notification

Prior to this patch we would only update the 'struct pci_dev'
if a PCI hotplug (new device) event would happen.

This works fine if the device is part of the guest config, that is:

pci=["0a:11.1"]

or such.

Unfortunatly if you are doing PCI hotplug:

xm pci-attach vnuma 0a:11.1

There are two events we need to stamp the 'struct pci_dev'
with the PXM node information:
 - ACPI hotplug to inject the PCI device.
 - XenBus entries being created

And those are created in the wrong order - first is the
ACPI hotplug event, followed by the XenBus update.

That means 'pcifront_hvm_notifier' gets called when
the ACPI hotplug even has started, but XenBus hasn't been
yet created so the scan from there returns NULL.

Later on we get an XenBus notification (pcifront_hvm_xenbus_probe),
update our internal list, and then the PCI notifier would find it.

The one way to make this work is to listen to an
extra event: BUS_NOTIFY_BOUND_DRIVER

That is signaled once the driver has loaded itself and is
ready. When the 'pcifront_hvm_notifier' gets that information
it can walk over the PCI bus and stamp all the 'struct pci_dev'
with the updated PXM data. In other words the operations
are now:

 - ACPI hotplug to inject the PCI device.
 - udev is called, modprobe <XYZ> is invoked
 - XenBus entries being created
 - <XYZ> driver is finished
 - pcifront_hvm_notifier is called, figures out which
   'struct pci_dev' needs its PXM update and updates.

OraBug: 27200813

Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
drivers/pci/xen-pcifront.c