From: Khalid Aziz Date: Sat, 3 Oct 2015 03:54:14 +0000 (-0600) Subject: sparc: Revert commits that broke ixgbe and igb drivers on T7 X-Git-Tag: v4.1.12-92~257^2~13 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=b95774372d5da0103cefce5e462c05d9caee36d0;p=users%2Fjedix%2Flinux-maple.git sparc: Revert commits that broke ixgbe and igb drivers on T7 Revert commits 6293dbd686528e1b9275b80234b199b9e579e547 and 8672b341047f3c28ca6e59b5177dd6d29a377f42 which break ixgbe and igb drivers on T7. These two commits can cause BAR 0 of some PCI devices to fail to map. This will cause those PCI devices to be unusable. Orabug: 21826746 Signed-off-by: Khalid Aziz (cherry picked from commit b5b765b0f2676cb42a52f771767d2548466106fc) --- diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c index bfd0b7043857..c928bc64b4ba 100644 --- a/arch/sparc/kernel/pci.c +++ b/arch/sparc/kernel/pci.c @@ -185,10 +185,8 @@ static unsigned long pci_parse_of_flags(u32 addr0) if (addr0 & 0x02000000) { flags = IORESOURCE_MEM | PCI_BASE_ADDRESS_SPACE_MEMORY; + flags |= (addr0 >> 22) & PCI_BASE_ADDRESS_MEM_TYPE_64; flags |= (addr0 >> 28) & PCI_BASE_ADDRESS_MEM_TYPE_1M; - if (addr0 & 0x01000000) - flags |= IORESOURCE_MEM_64 - | PCI_BASE_ADDRESS_MEM_TYPE_64; if (addr0 & 0x40000000) flags |= IORESOURCE_PREFETCH | PCI_BASE_ADDRESS_MEM_PREFETCH; @@ -662,9 +660,6 @@ struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm, pbm->io_space.start); pci_add_resource_offset(&resources, &pbm->mem_space, pbm->mem_space.start); - if (pbm->mem64_space.flags) - pci_add_resource_offset(&resources, &pbm->mem64_space, - pbm->mem_space.start); pbm->busn.start = pbm->pci_first_busno; pbm->busn.end = pbm->pci_last_busno; pbm->busn.flags = IORESOURCE_BUS; diff --git a/arch/sparc/kernel/pci_common.c b/arch/sparc/kernel/pci_common.c index a859a867e498..944a06536ecc 100644 --- a/arch/sparc/kernel/pci_common.c +++ b/arch/sparc/kernel/pci_common.c @@ -406,7 +406,6 @@ void pci_determine_mem_io_space(struct pci_pbm_info *pbm) } num_pbm_ranges = i / sizeof(*pbm_ranges); - memset(&pbm->mem64_space, 0, sizeof(struct resource)); for (i = 0; i < num_pbm_ranges; i++) { const struct linux_prom_pci_ranges *pr = &pbm_ranges[i]; @@ -452,11 +451,7 @@ void pci_determine_mem_io_space(struct pci_pbm_info *pbm) break; case 3: - /* 64-bit MEM handling */ - pbm->mem64_space.start = a; - pbm->mem64_space.end = a + size - 1UL; - pbm->mem64_space.flags = IORESOURCE_MEM; - break; + /* XXX 64-bit MEM handling XXX */ default: break; @@ -470,21 +465,15 @@ void pci_determine_mem_io_space(struct pci_pbm_info *pbm) prom_halt(); } - printk("%s: PCI IO[%llx] MEM[%llx]", + printk("%s: PCI IO[%llx] MEM[%llx]\n", pbm->name, pbm->io_space.start, pbm->mem_space.start); - if (pbm->mem64_space.flags) - printk(" MEM64[%llx]", - pbm->mem64_space.start); - printk("\n"); pbm->io_space.name = pbm->mem_space.name = pbm->name; request_resource(&ioport_resource, &pbm->io_space); request_resource(&iomem_resource, &pbm->mem_space); - if (pbm->mem64_space.flags) - request_resource(&iomem_resource, &pbm->mem64_space); pci_register_legacy_regions(&pbm->io_space, &pbm->mem_space); diff --git a/arch/sparc/kernel/pci_impl.h b/arch/sparc/kernel/pci_impl.h index 37222ca849df..75803c780af3 100644 --- a/arch/sparc/kernel/pci_impl.h +++ b/arch/sparc/kernel/pci_impl.h @@ -97,7 +97,6 @@ struct pci_pbm_info { /* PBM I/O and Memory space resources. */ struct resource io_space; struct resource mem_space; - struct resource mem64_space; struct resource busn; /* Base of PCI Config space, can be per-PBM or shared. */ diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c index 8bc5f0637362..6fbd3f2b5992 100644 --- a/drivers/pci/bus.c +++ b/drivers/pci/bus.c @@ -139,8 +139,6 @@ static int pci_bus_alloc_from_region(struct pci_bus *bus, struct resource *res, type_mask |= IORESOURCE_TYPE_BITS; - pci_set_pref_under_pref(res); - pci_bus_for_each_resource(bus, r, i) { if (!r) continue; @@ -172,14 +170,9 @@ static int pci_bus_alloc_from_region(struct pci_bus *bus, struct resource *res, /* Ok, try it out.. */ ret = allocate_resource(r, res, size, min, max, align, alignf, alignf_data); - if (ret == 0) { - pci_clear_pref_under_pref(res); + if (ret == 0) return 0; - } } - - pci_clear_pref_under_pref(res); - return -ENOMEM; } diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 53f6c470c97c..9bd762c237ab 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -216,17 +216,6 @@ void __pci_bus_assign_resources(const struct pci_bus *bus, struct list_head *fail_head); bool pci_bus_clip_resource(struct pci_dev *dev, int idx); -static inline void pci_set_pref_under_pref(struct resource *res) -{ - if (res->flags & IORESOURCE_UNDER_PREF) - res->flags |= IORESOURCE_PREFETCH; -} -static inline void pci_clear_pref_under_pref(struct resource *res) -{ - if (res->flags & IORESOURCE_UNDER_PREF) - res->flags &= ~IORESOURCE_PREFETCH; -} - /** * pci_ari_enabled - query ARI forwarding status * @bus: the PCI bus diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 4b76731bf836..c91185721345 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -1508,53 +1508,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 (!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 set pref bit for 64bit mmio when entire path from the host to - * the adapter is over PCI Express. - */ -static void set_pcie_64bit_under_pref(struct pci_dev *dev) -{ - int i; - - if (!pci_is_pcie(dev)) - return; - - if (!pci_up_path_over_pcie(dev->bus)) - return; - - for (i = 0; i < PCI_BRIDGE_RESOURCES; i++) { - struct resource *res = &dev->resource[i]; - enum pci_bar_type type; - int reg; - - if (!(res->flags & IORESOURCE_MEM_64)) - continue; - - if (res->flags & IORESOURCE_PREFETCH) - continue; - - reg = pci_resource_bar(dev, i, &type); - dev_printk(KERN_DEBUG, &dev->dev, "reg 0x%x %pR + under_pref\n", - reg, res); - res->flags |= IORESOURCE_UNDER_PREF; - } -} - void pci_device_add(struct pci_dev *dev, struct pci_bus *bus) { int ret; @@ -1585,9 +1538,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 and sriov bar is probed */ - set_pcie_64bit_under_pref(dev); - /* * Add the device to our list of discovered devices * and the bus list for fixup functions, etc. diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index b2c780485a76..508cc56130e3 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c @@ -1037,13 +1037,10 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask, struct resource *r = &dev->resource[i]; resource_size_t r_size; - pci_set_pref_under_pref(r); if (r->parent || ((r->flags & mask) != type && (r->flags & mask) != type2 && - (r->flags & mask) != type3)) { - pci_clear_pref_under_pref(r); + (r->flags & mask) != type3)) continue; - } r_size = resource_size(r); #ifdef CONFIG_PCI_IOV /* put SRIOV requested res to the optional list */ @@ -1053,7 +1050,6 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask, r->end = r->start - 1; add_to_list(realloc_head, dev, r, r_size, 0/* don't care */); children_add_size += r_size; - pci_clear_pref_under_pref(r); continue; } #endif @@ -1086,7 +1082,6 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask, children_add_align = get_res_add_align(realloc_head, r); add_align = max(add_align, children_add_align); } - pci_clear_pref_under_pref(r); } } diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c index a385b00320c6..232f9254c11a 100644 --- a/drivers/pci/setup-res.c +++ b/drivers/pci/setup-res.c @@ -116,14 +116,11 @@ int pci_claim_resource(struct pci_dev *dev, int resource) return -EINVAL; } - pci_set_pref_under_pref(res); - root = pci_find_parent_resource(dev, res); if (!root) { dev_info(&dev->dev, "can't claim BAR %d %pR: no compatible bridge window\n", resource, res); res->flags |= IORESOURCE_UNSET; - pci_clear_pref_under_pref(res); return -EINVAL; } @@ -132,12 +129,9 @@ int pci_claim_resource(struct pci_dev *dev, int resource) dev_info(&dev->dev, "can't claim BAR %d %pR: address conflict with %s %pR\n", resource, res, conflict->name, conflict); res->flags |= IORESOURCE_UNSET; - pci_clear_pref_under_pref(res); return -EBUSY; } - pci_clear_pref_under_pref(res); - return 0; } EXPORT_SYMBOL(pci_claim_resource); @@ -256,11 +250,9 @@ 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; struct pci_bus *bus; int ret; - pci_set_pref_under_pref(res); bus = dev->bus; while ((ret = __pci_assign_resource(bus, dev, resno, size, min_align))) { if (!bus->parent || !bus->self->transparent) @@ -268,8 +260,6 @@ static int _pci_assign_resource(struct pci_dev *dev, int resno, bus = bus->parent; } - pci_clear_pref_under_pref(res); - return ret; } diff --git a/include/linux/ioport.h b/include/linux/ioport.h index ec7451e175a7..388e3ae94f7a 100644 --- a/include/linux/ioport.h +++ b/include/linux/ioport.h @@ -49,8 +49,6 @@ struct resource { #define IORESOURCE_WINDOW 0x00200000 /* forwarded by bridge */ #define IORESOURCE_MUXED 0x00400000 /* Resource is software muxed */ -#define IORESOURCE_UNDER_PREF 0x00800000 /* non-pref could under pref */ - #define IORESOURCE_EXCLUSIVE 0x08000000 /* Userland may not map this resource */ #define IORESOURCE_DISABLED 0x10000000 #define IORESOURCE_UNSET 0x20000000 /* No address assigned yet */