android_kernel_xiaomi_sm7250/drivers/pci
Bjorn Helgaas 54a7a9d75c PCI: Probe bridge window attributes once at enumeration-time
commit 51c48b310183ab6ba5419edfc6a8de889cc04521 upstream.

pci_bridge_check_ranges() determines whether a bridge supports the optional
I/O and prefetchable memory windows and sets the flag bits in the bridge
resources.  This *could* be done once during enumeration except that the
resource allocation code completely clears the flag bits, e.g., in the
pci_assign_unassigned_bridge_resources() path.

The problem with pci_bridge_check_ranges() in the resource allocation path
is that we may allocate resources after devices have been claimed by
drivers, and pci_bridge_check_ranges() *changes* the window registers to
determine whether they're writable.  This may break concurrent accesses to
devices behind the bridge.

Add a new pci_read_bridge_windows() to determine whether a bridge supports
the optional windows, call it once during enumeration, remember the
results, and change pci_bridge_check_ranges() so it doesn't touch the
bridge windows but sets the flag bits based on those remembered results.

Link: https://lore.kernel.org/linux-pci/1506151482-113560-1-git-send-email-wangzhou1@hisilicon.com
Link: https://lists.gnu.org/archive/html/qemu-devel/2018-12/msg02082.html
Reported-by: Yandong Xu <xuyandong2@huawei.com>
Tested-by: Yandong Xu <xuyandong2@huawei.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: Ofer Hayut <ofer@lightbitslabs.com>
Cc: Roy Shterman <roys@lightbitslabs.com>
Cc: Keith Busch <keith.busch@intel.com>
Cc: Zhou Wang <wangzhou1@hisilicon.com>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=208371
Signed-off-by: Dima Stepanov <dimastep@yandex-team.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-08-21 11:05:29 +02:00
..
controller PCI: qcom: Add support for tx term offset for rev 2.1.0 2020-08-21 11:05:29 +02:00
endpoint PCI: endpoint: Fix for concurrent memory allocation in OB address region 2020-04-17 10:48:46 +02:00
hotplug PCI: hotplug: ACPI: Fix context refcounting in acpiphp_grab_context() 2020-08-21 11:05:29 +02:00
pcie PCI/ASPM: Add missing newline in sysfs 'policy' 2020-08-19 08:14:58 +02:00
switch
access.c PCI: Fix pci_cfg_wait queue locking problem 2020-08-19 08:14:56 +02:00
ats.c
bus.c PCI: Add device even if driver attach failed 2020-08-21 11:05:29 +02:00
ecam.c
host-bridge.c
iov.c
irq.c
Kconfig
Makefile
mmap.c
msi.c
of.c
pci-acpi.c
pci-driver.c
pci-label.c
pci-mid.c
pci-pf-stub.c
pci-stub.c
pci-sysfs.c
pci.c
pci.h
probe.c PCI: Probe bridge window attributes once at enumeration-time 2020-08-21 11:05:29 +02:00
proc.c
quirks.c PCI: Mark AMD Navi10 GPU rev 0x00 ATS as broken 2020-08-21 11:05:29 +02:00
remove.c
rom.c
search.c
setup-bus.c PCI: Probe bridge window attributes once at enumeration-time 2020-08-21 11:05:29 +02:00
setup-irq.c
setup-res.c PCI: Allow pci_resize_resource() for devices on root bus 2020-06-25 15:32:48 +02:00
slot.c
syscall.c
vc.c
vpd.c
xen-pcifront.c