]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
Revert "PCI: Check pref compatible bit for mem64 resource of PCIe device"
authorKhalid Aziz <khalid.aziz@oracle.com>
Tue, 3 May 2016 14:12:22 +0000 (08:12 -0600)
committerChuck Anderson <chuck.anderson@oracle.com>
Sun, 28 May 2017 02:43:55 +0000 (19:43 -0700)
This reverts commit 40990901003330e03db71f9f7b8966a6b5c6e5ba. This
commit causes hotplug to break as documented in Orabug 22855133.

Orabug: 22855133

Signed-off-by: Khalid Aziz <khalid.aziz@oracle.com>
(cherry picked from commit bb9160790d346bcbfc0b5ca701e7e6f6d5d56f87)
Signed-off-by: Allen Pais <allen.pais@oracle.com>
drivers/pci/pci.c
drivers/pci/pci.h
drivers/pci/probe.c
drivers/pci/setup-bus.c
drivers/pci/setup-res.c
include/linux/pci.h

index 238664157e3973f2860d6686d020a6bac89f2223..49d1d848d315edcd9b4e60d7d8205af97040416d 100644 (file)
@@ -414,7 +414,6 @@ EXPORT_SYMBOL_GPL(pci_find_ht_capability);
 struct resource *pci_find_parent_resource(const struct pci_dev *dev,
                                          struct resource *res)
 {
-       int flags = pci_resource_pref_compatible(dev, res);
        const struct pci_bus *bus = dev->bus;
        struct resource *r;
        int i;
@@ -429,7 +428,7 @@ struct resource *pci_find_parent_resource(const struct pci_dev *dev,
                         * not, the allocator made a mistake.
                         */
                        if (r->flags & IORESOURCE_PREFETCH &&
-                           !(flags & IORESOURCE_PREFETCH))
+                           !(res->flags & IORESOURCE_PREFETCH))
                                return NULL;
 
                        /*
index 58019e4d94fcf1d5b87af69c024f579732c99dc6..9bd762c237abe2fd679e8c7163947c7a0453c46b 100644 (file)
@@ -325,6 +325,4 @@ static inline int pci_dev_specific_reset(struct pci_dev *dev, int probe)
 
 struct pci_host_bridge *pci_find_host_bridge(struct pci_bus *bus);
 
-int pci_resource_pref_compatible(const struct pci_dev *dev,
-                                struct resource *res);
 #endif /* DRIVERS_PCI_H */
index 7d9ece4a07a04eef599ae7dcc350f65e1b3a3925..f0157e2f447d9d8904999c4d861683ca03e95e6f 100644 (file)
@@ -1580,36 +1580,6 @@ static void pci_init_capabilities(struct pci_dev *dev)
        pci_enable_acs(dev);
 }
 
-static bool pci_up_path_over_pcie(struct pci_bus *bus)
-{
-       if (pci_is_root_bus(bus))
-               return true;
-
-       if (bus->self && !pci_is_pcie(bus->self))
-               return false;
-
-       return pci_up_path_over_pcie(bus->parent);
-}
-
-/*
- * According to
- * https://www.pcisig.com/specifications/pciexpress/base2/PCIe_Base_r2.1_Errata_08Jun10.pdf
- * page 13, system firmware could put some 64bit non-pref under 64bit pref,
- * on some cases.
- * Let's mark if entire path from the host to the adapter is over PCI
- * Express. later will use that compute pref compaitable bit.
- */
-static void pci_set_on_all_pcie_path(struct pci_dev *dev)
-{
-       if (!pci_is_pcie(dev))
-               return;
-
-       if (!pci_up_path_over_pcie(dev->bus))
-               return;
-
-       dev->on_all_pcie_path = 1;
-}
-
 void pci_device_add(struct pci_dev *dev, struct pci_bus *bus)
 {
        int ret;
@@ -1640,9 +1610,6 @@ void pci_device_add(struct pci_dev *dev, struct pci_bus *bus)
        /* Initialize various capabilities */
        pci_init_capabilities(dev);
 
-       /* After pcie_cap is assigned */
-       pci_set_on_all_pcie_path(dev);
-
        /*
         * Add the device to our list of discovered devices
         * and the bus list for fixup functions, etc.
index 6c43c43d5d610eda21a409b10a0df063a5f3ea06..508cc56130e3f88d1b01716a7a00fead250fdf1c 100644 (file)
@@ -739,20 +739,6 @@ int pci_claim_bridge_resource(struct pci_dev *bridge, int i)
        return -EINVAL;
 }
 
-int pci_resource_pref_compatible(const struct pci_dev *dev,
-                                struct resource *res)
-{
-       if (res->flags & IORESOURCE_PREFETCH)
-               return res->flags;
-
-       if ((res->flags & IORESOURCE_MEM) &&
-           (res->flags & IORESOURCE_MEM_64) &&
-           dev->on_all_pcie_path)
-               return res->flags | IORESOURCE_PREFETCH;
-
-       return res->flags;
-}
-
 /* Check whether the bridge supports optional I/O and
    prefetchable memory ranges. If not, the respective
    base/limit registers must be read-only and read as 0. */
@@ -1050,11 +1036,10 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask,
                for (i = 0; i < PCI_NUM_RESOURCES; i++) {
                        struct resource *r = &dev->resource[i];
                        resource_size_t r_size;
-                       int flags = pci_resource_pref_compatible(dev, r);
 
-                       if (r->parent || ((flags & mask) != type &&
-                                         (flags & mask) != type2 &&
-                                         (flags & mask) != type3))
+                       if (r->parent || ((r->flags & mask) != type &&
+                                         (r->flags & mask) != type2 &&
+                                         (r->flags & mask) != type3))
                                continue;
                        r_size = resource_size(r);
 #ifdef CONFIG_PCI_IOV
index b19aa5bec47e5e8bae898ade703a1aeda2e5a70d..232f9254c11acf5b45d9b20f9fc4169dfad79084 100644 (file)
@@ -250,19 +250,15 @@ static int __pci_assign_resource(struct pci_bus *bus, struct pci_dev *dev,
 static int _pci_assign_resource(struct pci_dev *dev, int resno,
                                resource_size_t size, resource_size_t min_align)
 {
-       struct resource *res = dev->resource + resno;
-       int old_flags = res->flags;
        struct pci_bus *bus;
        int ret;
 
-       res->flags = pci_resource_pref_compatible(dev, res);
        bus = dev->bus;
        while ((ret = __pci_assign_resource(bus, dev, resno, size, min_align))) {
                if (!bus->parent || !bus->self->transparent)
                        break;
                bus = bus->parent;
        }
-       res->flags = old_flags;
 
        return ret;
 }
index 3ab7e209557e15f4bf3fe955c391162d1bdc0904..8726b6ef1bcba172dbc2d002b36cdc924f597ca9 100644 (file)
@@ -311,7 +311,6 @@ struct pci_dev {
                                                   powered on/off by the
                                                   corresponding bridge */
        unsigned int    ignore_hotplug:1;       /* Ignore hotplug events */
-       unsigned int    on_all_pcie_path:1;     /* up to host-bridge all pcie */
        unsigned int    d3_delay;       /* D3->D0 transition time in ms */
        unsigned int    d3cold_delay;   /* D3cold->D0 transition time in ms */