PCI: Don't disable decoding when mmio_always_on is set
authorJiaxun Yang <jiaxun.yang@flygoat.com>
Tue, 26 May 2020 09:21:12 +0000 (17:21 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 22 Jun 2020 07:05:19 +0000 (09:05 +0200)
[ Upstream commit b6caa1d8c80cb71b6162cb1f1ec13aa655026c9f ]

Don't disable MEM/IO decoding when a device have both non_compliant_bars
and mmio_always_on.

That would allow us quirk devices with junk in BARs but can't disable
their decoding.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Acked-by: Bjorn Helgaas <helgaas@kernel.org>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/pci/probe.c

index fa4c386c8cd84d439c2767bfc3c3ef37b5a00e42..a21c04d8a40b7d82e19785ae2623405a5f03466a 100644 (file)
@@ -1634,7 +1634,7 @@ int pci_setup_device(struct pci_dev *dev)
        /* Device class may be changed after fixup */
        class = dev->class >> 8;
 
-       if (dev->non_compliant_bars) {
+       if (dev->non_compliant_bars && !dev->mmio_always_on) {
                pci_read_config_word(dev, PCI_COMMAND, &cmd);
                if (cmd & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) {
                        pci_info(dev, "device has non-compliant BARs; disabling IO/MEM decoding\n");