]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
PCI: Don't attempt config access to disconnected devices
authorKeith Busch <keith.busch@intel.com>
Thu, 30 Mar 2017 03:49:06 +0000 (22:49 -0500)
committerBjorn Helgaas <bhelgaas@google.com>
Thu, 30 Mar 2017 03:54:56 +0000 (22:54 -0500)
commit4b103883473964bbb7b0b6934999b283ee234a8a
treec03775e34f887f26d6f5eeb839006614033f2cf4
parent89ee9f7680031d7df91a1a27abac69e034c2e892
PCI: Don't attempt config access to disconnected devices

If we've  detected the PCI device is disconnected, there is no need to
attempt to access its config space since we know the operation will fail.
Make all the config reads and writes return -ENODEV error immediately when
in such a state.

If a caller requests a config read to a disconnected device, return a data
value of all 1's.  This is the same as what hardware is expected to return
when accessing a removed device, but software can do this faster without
relying on hardware.

Tested-by: Krishna Dhulipala <krishnad@fb.com>
Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Wei Zhang <wzhang@fb.com>
drivers/pci/access.c