]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit
powerpc/pci: Assign fixed PHB number based on device-tree properties
authorGuilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>
Mon, 18 Jul 2016 15:57:20 +0000 (09:57 -0600)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 9 Aug 2016 13:07:34 +0000 (15:07 +0200)
commitb169dfdd0bebb8b419bfe836a13ec579e9a70bd4
tree609b6565be372f61f6d2e55234684282d8a282d0
parent5a8d4f9739574fbeddce71b905fb8fef90912f27
powerpc/pci: Assign fixed PHB number based on device-tree properties

BugLink: http://bugs.launchpad.net/bugs/1603574
The domain/PHB field of PCI addresses has its value obtained from a
global variable, incremented each time a new domain (represented by
struct pci_controller) is added on the system. The domain addition
process happens during boot or due to PHB hotplug add.

As recent kernels are using predictable naming for network interfaces,
the network stack is more tied to PCI naming. This can be a problem in
hotplug scenarios, because PCI addresses will change if devices are
removed and then re-added. This situation seems unusual, but it can
happen if a user wants to replace a NIC without rebooting the machine,
for example.

This patch changes the way PCI domain values are generated: now, we use
device-tree properties to assign fixed PHB numbers to PCI addresses
when available (meaning pSeries and PowerNV cases). We also use a bitmap
to allow dynamic PHB numbering when device-tree properties are not
used. This bitmap keeps track of used PHB numbers and if a PHB is
released (by hotplug operations for example), it allows the reuse of
this PHB number, avoiding PCI address to change in case of device remove
and re-add soon after. No functional changes were introduced.

Signed-off-by: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>
Reviewed-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Reviewed-by: Ian Munsie <imunsie@au1.ibm.com>
Acked-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
[mpe: Drop unnecessary machine_is(pseries) test]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(cherry picked from linux-next commit 63a72284b159c569ec52f380c9a8dd9342d43bb8)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Brad Figg <brad.figg@canonical.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
arch/powerpc/kernel/pci-common.c