PCI: mvebu: Handle changes to the bridge windows while enabled
authorJason Gunthorpe <jgunthorpe@obsidianresearch.com>
Mon, 12 Dec 2016 18:30:20 +0000 (11:30 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 15 Nov 2017 14:53:11 +0000 (15:53 +0100)
commit7ac8a10c8a50a73bb739c6f23a067857fe474d36
tree24192eabd0c735b08b74f868775e708b5805e4dd
parentbf41c17c2266cbfda1b76daea39ce81c5b61867d
PCI: mvebu: Handle changes to the bridge windows while enabled

[ Upstream commit d9bf28e2650fe3eeefed7e34841aea07d10c6543 ]

The PCI core will write to the bridge window config multiple times while
they are enabled.  This can lead to mbus failures like this:

 mvebu_mbus: cannot add window '4:e8', conflicts with another window
 mvebu-pcie mbus:pex@e0000000: Could not create MBus window at [mem 0xe0000000-0xe00fffff]: -22

For me this is happening during a hotplug cycle.  The PCI core is not
changing the values, just writing them twice while active.

The patch addresses the general case of any change to an active window, but
not atomically.  The code is slightly refactored so io and mem can share
more of the window logic.

Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Jason Cooper <jason@lakedaemon.net>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/pci/host/pci-mvebu.c