PCI: Enable ARI if dev and upstream bridge support it; disable otherwise
authorYijing Wang <wangyijing@huawei.com>
Tue, 15 Jan 2013 03:12:16 +0000 (11:12 +0800)
committerBen Hutchings <ben@decadent.org.uk>
Sat, 15 Feb 2014 19:20:10 +0000 (19:20 +0000)
commit3a6ac4b93f6c2fb3d2b1aa95f32c6729fa4e9676
treed28896db9a8ab8ee02e63ab5f7be8d1c039317fc
parent1c7a9417edf13a32244bba86cf8197073ebad9a7
PCI: Enable ARI if dev and upstream bridge support it; disable otherwise

commit b0cc6020e1cc62f1253215f189611b34be4a83c7 upstream.

Currently, we enable ARI in a device's upstream bridge if the bridge and
the device support it.  But we never disable ARI, even if the device is
removed and replaced with a device that doesn't support ARI.

This means that if we hot-remove an ARI device and replace it with a
non-ARI multi-function device, we find only function 0 of the new device
because the upstream bridge still has ARI enabled, and next_ari_fn()
only returns function 0 for the new non-ARI device.

This patch disables ARI in the upstream bridge if the device doesn't
support ARI.  See the PCIe spec, r3.0, sec 6.13.

[bhelgaas: changelog, function comment]
[yijing: replace PCIe Cap accessor with legacy PCI accessor]
Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/pci/pci.c