aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorKevin Hilman <khilman@linaro.org>2013-08-19 13:22:10 -0400
committerKevin Hilman <khilman@linaro.org>2013-08-19 13:22:31 -0400
commit5515d9981f5f30e82d096921f86ba016911c9ea8 (patch)
tree7680a87d16e2c2c1f0ca07a8606a65b53ab10ead /drivers/pci
parentf668adebf43556df9834f254479a44a20294dcf1 (diff)
parentcf470a1b1a741bca00080ebc70968b4f22d9b1ea (diff)
Merge tag 'omap-for-v3.12/dra7xx' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap into next/soc
From Tony Lindgren: Minimal DRA7xx based SoC core support via Rajendra Nayak <rnayak@ti.com> * tag 'omap-for-v3.12/dra7xx' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap: (849 commits) ARM: DRA7: Add the build support in omap2plus ARM: DRA7: hwmod: Reuse the soc_ops used for OMAP4/5 ARM: DRA7: id: Add cpu detection support for DRA7xx based SoCs' ARM: DRA7: Kconfig: Make ARCH_NR_GPIO default to 512 ARM: DRA7: board-generic: Add basic DT support ARM: DRA7: Resue the clocksource, clockevent support ARM: DRA7: Reuse io tables and add a new .init_early ARM: DRA7: Reuse all of PRCM and MPUSS SMP infra Linux 3.11-rc5 btrfs: don't loop on large offsets in readdir Btrfs: check to see if root_list is empty before adding it to dead roots Btrfs: release both paths before logging dir/changed extents Btrfs: allow splitting of hole em's when dropping extent cache Btrfs: make sure the backref walker catches all refs to our extent Btrfs: fix backref walking when we hit a compressed extent Btrfs: do not offset physical if we're compressed Btrfs: fix extent buffer leak after backref walking Btrfs: fix a bug of snapshot-aware defrag to make it work on partial extents btrfs: fix file truncation if FALLOC_FL_KEEP_SIZE is specified dlm: kill the unnecessary and wrong device_close()->recalc_sigpending() ... Signed-off-by: Kevin Hilman <khilman@linaro.org>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/host/pci-mvebu.c27
-rw-r--r--drivers/pci/hotplug/Kconfig5
-rw-r--r--drivers/pci/hotplug/pciehp_pci.c9
-rw-r--r--drivers/pci/hotplug/rpadlpar_core.c1
-rw-r--r--drivers/pci/pci-acpi.c15
-rw-r--r--drivers/pci/pcie/Kconfig5
-rw-r--r--drivers/pci/setup-bus.c69
7 files changed, 90 insertions, 41 deletions
diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
index 338691b616d9..847c10971182 100644
--- a/drivers/pci/host/pci-mvebu.c
+++ b/drivers/pci/host/pci-mvebu.c
@@ -86,10 +86,6 @@ struct mvebu_sw_pci_bridge {
86 u16 secondary_status; 86 u16 secondary_status;
87 u16 membase; 87 u16 membase;
88 u16 memlimit; 88 u16 memlimit;
89 u16 prefmembase;
90 u16 prefmemlimit;
91 u32 prefbaseupper;
92 u32 preflimitupper;
93 u16 iobaseupper; 89 u16 iobaseupper;
94 u16 iolimitupper; 90 u16 iolimitupper;
95 u8 cappointer; 91 u8 cappointer;
@@ -420,15 +416,7 @@ static int mvebu_sw_pci_bridge_read(struct mvebu_pcie_port *port,
420 break; 416 break;
421 417
422 case PCI_PREF_MEMORY_BASE: 418 case PCI_PREF_MEMORY_BASE:
423 *value = (bridge->prefmemlimit << 16 | bridge->prefmembase); 419 *value = 0;
424 break;
425
426 case PCI_PREF_BASE_UPPER32:
427 *value = bridge->prefbaseupper;
428 break;
429
430 case PCI_PREF_LIMIT_UPPER32:
431 *value = bridge->preflimitupper;
432 break; 420 break;
433 421
434 case PCI_IO_BASE_UPPER16: 422 case PCI_IO_BASE_UPPER16:
@@ -502,19 +490,6 @@ static int mvebu_sw_pci_bridge_write(struct mvebu_pcie_port *port,
502 mvebu_pcie_handle_membase_change(port); 490 mvebu_pcie_handle_membase_change(port);
503 break; 491 break;
504 492
505 case PCI_PREF_MEMORY_BASE:
506 bridge->prefmembase = value & 0xffff;
507 bridge->prefmemlimit = value >> 16;
508 break;
509
510 case PCI_PREF_BASE_UPPER32:
511 bridge->prefbaseupper = value;
512 break;
513
514 case PCI_PREF_LIMIT_UPPER32:
515 bridge->preflimitupper = value;
516 break;
517
518 case PCI_IO_BASE_UPPER16: 493 case PCI_IO_BASE_UPPER16:
519 bridge->iobaseupper = value & 0xffff; 494 bridge->iobaseupper = value & 0xffff;
520 bridge->iolimitupper = value >> 16; 495 bridge->iolimitupper = value >> 16;
diff --git a/drivers/pci/hotplug/Kconfig b/drivers/pci/hotplug/Kconfig
index bb7ebb22db01..d85009de713d 100644
--- a/drivers/pci/hotplug/Kconfig
+++ b/drivers/pci/hotplug/Kconfig
@@ -3,16 +3,13 @@
3# 3#
4 4
5menuconfig HOTPLUG_PCI 5menuconfig HOTPLUG_PCI
6 tristate "Support for PCI Hotplug" 6 bool "Support for PCI Hotplug"
7 depends on PCI && SYSFS 7 depends on PCI && SYSFS
8 ---help--- 8 ---help---
9 Say Y here if you have a motherboard with a PCI Hotplug controller. 9 Say Y here if you have a motherboard with a PCI Hotplug controller.
10 This allows you to add and remove PCI cards while the machine is 10 This allows you to add and remove PCI cards while the machine is
11 powered up and running. 11 powered up and running.
12 12
13 To compile this driver as a module, choose M here: the
14 module will be called pci_hotplug.
15
16 When in doubt, say N. 13 When in doubt, say N.
17 14
18if HOTPLUG_PCI 15if HOTPLUG_PCI
diff --git a/drivers/pci/hotplug/pciehp_pci.c b/drivers/pci/hotplug/pciehp_pci.c
index aac7a40e4a4a..0e0d0f7f63fd 100644
--- a/drivers/pci/hotplug/pciehp_pci.c
+++ b/drivers/pci/hotplug/pciehp_pci.c
@@ -92,7 +92,14 @@ int pciehp_unconfigure_device(struct slot *p_slot)
92 if (ret) 92 if (ret)
93 presence = 0; 93 presence = 0;
94 94
95 list_for_each_entry_safe(dev, temp, &parent->devices, bus_list) { 95 /*
96 * Stopping an SR-IOV PF device removes all the associated VFs,
97 * which will update the bus->devices list and confuse the
98 * iterator. Therefore, iterate in reverse so we remove the VFs
99 * first, then the PF. We do the same in pci_stop_bus_device().
100 */
101 list_for_each_entry_safe_reverse(dev, temp, &parent->devices,
102 bus_list) {
96 pci_dev_get(dev); 103 pci_dev_get(dev);
97 if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE && presence) { 104 if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE && presence) {
98 pci_read_config_byte(dev, PCI_BRIDGE_CONTROL, &bctl); 105 pci_read_config_byte(dev, PCI_BRIDGE_CONTROL, &bctl);
diff --git a/drivers/pci/hotplug/rpadlpar_core.c b/drivers/pci/hotplug/rpadlpar_core.c
index b29e20b7862f..bb7af78e4eed 100644
--- a/drivers/pci/hotplug/rpadlpar_core.c
+++ b/drivers/pci/hotplug/rpadlpar_core.c
@@ -388,7 +388,6 @@ int dlpar_remove_pci_slot(char *drc_name, struct device_node *dn)
388 /* Remove the EADS bridge device itself */ 388 /* Remove the EADS bridge device itself */
389 BUG_ON(!bus->self); 389 BUG_ON(!bus->self);
390 pr_debug("PCI: Now removing bridge device %s\n", pci_name(bus->self)); 390 pr_debug("PCI: Now removing bridge device %s\n", pci_name(bus->self));
391 eeh_remove_bus_device(bus->self, true);
392 pci_stop_and_remove_bus_device(bus->self); 391 pci_stop_and_remove_bus_device(bus->self);
393 392
394 return 0; 393 return 0;
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index dbdc5f7e2b29..01e264fb50e0 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -317,13 +317,20 @@ void acpi_pci_remove_bus(struct pci_bus *bus)
317/* ACPI bus type */ 317/* ACPI bus type */
318static int acpi_pci_find_device(struct device *dev, acpi_handle *handle) 318static int acpi_pci_find_device(struct device *dev, acpi_handle *handle)
319{ 319{
320 struct pci_dev * pci_dev; 320 struct pci_dev *pci_dev = to_pci_dev(dev);
321 u64 addr; 321 bool is_bridge;
322 u64 addr;
322 323
323 pci_dev = to_pci_dev(dev); 324 /*
325 * pci_is_bridge() is not suitable here, because pci_dev->subordinate
326 * is set only after acpi_pci_find_device() has been called for the
327 * given device.
328 */
329 is_bridge = pci_dev->hdr_type == PCI_HEADER_TYPE_BRIDGE
330 || pci_dev->hdr_type == PCI_HEADER_TYPE_CARDBUS;
324 /* Please ref to ACPI spec for the syntax of _ADR */ 331 /* Please ref to ACPI spec for the syntax of _ADR */
325 addr = (PCI_SLOT(pci_dev->devfn) << 16) | PCI_FUNC(pci_dev->devfn); 332 addr = (PCI_SLOT(pci_dev->devfn) << 16) | PCI_FUNC(pci_dev->devfn);
326 *handle = acpi_get_child(DEVICE_ACPI_HANDLE(dev->parent), addr); 333 *handle = acpi_find_child(ACPI_HANDLE(dev->parent), addr, is_bridge);
327 if (!*handle) 334 if (!*handle)
328 return -ENODEV; 335 return -ENODEV;
329 return 0; 336 return 0;
diff --git a/drivers/pci/pcie/Kconfig b/drivers/pci/pcie/Kconfig
index 569f82fc9e22..3b94cfcfa03b 100644
--- a/drivers/pci/pcie/Kconfig
+++ b/drivers/pci/pcie/Kconfig
@@ -14,15 +14,12 @@ config PCIEPORTBUS
14# Include service Kconfig here 14# Include service Kconfig here
15# 15#
16config HOTPLUG_PCI_PCIE 16config HOTPLUG_PCI_PCIE
17 tristate "PCI Express Hotplug driver" 17 bool "PCI Express Hotplug driver"
18 depends on HOTPLUG_PCI && PCIEPORTBUS 18 depends on HOTPLUG_PCI && PCIEPORTBUS
19 help 19 help
20 Say Y here if you have a motherboard that supports PCI Express Native 20 Say Y here if you have a motherboard that supports PCI Express Native
21 Hotplug 21 Hotplug
22 22
23 To compile this driver as a module, choose M here: the
24 module will be called pciehp.
25
26 When in doubt, say N. 23 When in doubt, say N.
27 24
28source "drivers/pci/pcie/aer/Kconfig" 25source "drivers/pci/pcie/aer/Kconfig"
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index d254e2379533..64a7de22d9af 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -300,6 +300,47 @@ static void assign_requested_resources_sorted(struct list_head *head,
300 } 300 }
301} 301}
302 302
303static unsigned long pci_fail_res_type_mask(struct list_head *fail_head)
304{
305 struct pci_dev_resource *fail_res;
306 unsigned long mask = 0;
307
308 /* check failed type */
309 list_for_each_entry(fail_res, fail_head, list)
310 mask |= fail_res->flags;
311
312 /*
313 * one pref failed resource will set IORESOURCE_MEM,
314 * as we can allocate pref in non-pref range.
315 * Will release all assigned non-pref sibling resources
316 * according to that bit.
317 */
318 return mask & (IORESOURCE_IO | IORESOURCE_MEM | IORESOURCE_PREFETCH);
319}
320
321static bool pci_need_to_release(unsigned long mask, struct resource *res)
322{
323 if (res->flags & IORESOURCE_IO)
324 return !!(mask & IORESOURCE_IO);
325
326 /* check pref at first */
327 if (res->flags & IORESOURCE_PREFETCH) {
328 if (mask & IORESOURCE_PREFETCH)
329 return true;
330 /* count pref if its parent is non-pref */
331 else if ((mask & IORESOURCE_MEM) &&
332 !(res->parent->flags & IORESOURCE_PREFETCH))
333 return true;
334 else
335 return false;
336 }
337
338 if (res->flags & IORESOURCE_MEM)
339 return !!(mask & IORESOURCE_MEM);
340
341 return false; /* should not get here */
342}
343
303static void __assign_resources_sorted(struct list_head *head, 344static void __assign_resources_sorted(struct list_head *head,
304 struct list_head *realloc_head, 345 struct list_head *realloc_head,
305 struct list_head *fail_head) 346 struct list_head *fail_head)
@@ -312,11 +353,24 @@ static void __assign_resources_sorted(struct list_head *head,
312 * if could do that, could get out early. 353 * if could do that, could get out early.
313 * if could not do that, we still try to assign requested at first, 354 * if could not do that, we still try to assign requested at first,
314 * then try to reassign add_size for some resources. 355 * then try to reassign add_size for some resources.
356 *
357 * Separate three resource type checking if we need to release
358 * assigned resource after requested + add_size try.
359 * 1. if there is io port assign fail, will release assigned
360 * io port.
361 * 2. if there is pref mmio assign fail, release assigned
362 * pref mmio.
363 * if assigned pref mmio's parent is non-pref mmio and there
364 * is non-pref mmio assign fail, will release that assigned
365 * pref mmio.
366 * 3. if there is non-pref mmio assign fail or pref mmio
367 * assigned fail, will release assigned non-pref mmio.
315 */ 368 */
316 LIST_HEAD(save_head); 369 LIST_HEAD(save_head);
317 LIST_HEAD(local_fail_head); 370 LIST_HEAD(local_fail_head);
318 struct pci_dev_resource *save_res; 371 struct pci_dev_resource *save_res;
319 struct pci_dev_resource *dev_res; 372 struct pci_dev_resource *dev_res, *tmp_res;
373 unsigned long fail_type;
320 374
321 /* Check if optional add_size is there */ 375 /* Check if optional add_size is there */
322 if (!realloc_head || list_empty(realloc_head)) 376 if (!realloc_head || list_empty(realloc_head))
@@ -348,6 +402,19 @@ static void __assign_resources_sorted(struct list_head *head,
348 return; 402 return;
349 } 403 }
350 404
405 /* check failed type */
406 fail_type = pci_fail_res_type_mask(&local_fail_head);
407 /* remove not need to be released assigned res from head list etc */
408 list_for_each_entry_safe(dev_res, tmp_res, head, list)
409 if (dev_res->res->parent &&
410 !pci_need_to_release(fail_type, dev_res->res)) {
411 /* remove it from realloc_head list */
412 remove_from_list(realloc_head, dev_res->res);
413 remove_from_list(&save_head, dev_res->res);
414 list_del(&dev_res->list);
415 kfree(dev_res);
416 }
417
351 free_list(&local_fail_head); 418 free_list(&local_fail_head);
352 /* Release assigned resource */ 419 /* Release assigned resource */
353 list_for_each_entry(dev_res, head, list) 420 list_for_each_entry(dev_res, head, list)