diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-22 19:39:28 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-22 19:39:28 -0500 |
commit | e1ba84597c9012b9f9075aac283ac7537d7561ba (patch) | |
tree | 41ab1a74c71ce55e72ef73424346e8e0a7f4616e /drivers/pci/hotplug/acpiphp_glue.c | |
parent | 60eaa0190f6b39dce18eb1975d9773ed8bc9a534 (diff) | |
parent | cef09b808e584c13b7126b83dc37c80b00234137 (diff) |
Merge tag 'pci-v3.14-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci
Pull PCI updates from Bjorn Helgaas:
"PCI changes for the v3.14 merge window:
Resource management
- Change pci_bus_region addresses to dma_addr_t (Bjorn Helgaas)
- Support 64-bit AGP BARs (Bjorn Helgaas, Yinghai Lu)
- Add pci_bus_address() to get bus address of a BAR (Bjorn Helgaas)
- Use pci_resource_start() for CPU address of AGP BARs (Bjorn Helgaas)
- Enforce bus address limits in resource allocation (Yinghai Lu)
- Allocate 64-bit BARs above 4G when possible (Yinghai Lu)
- Convert pcibios_resource_to_bus() to take pci_bus, not pci_dev (Yinghai Lu)
PCI device hotplug
- Major rescan/remove locking update (Rafael J. Wysocki)
- Make ioapic builtin only (not modular) (Yinghai Lu)
- Fix release/free issues (Yinghai Lu)
- Clean up pciehp (Bjorn Helgaas)
- Announce pciehp slot info during enumeration (Bjorn Helgaas)
MSI
- Add pci_msi_vec_count(), pci_msix_vec_count() (Alexander Gordeev)
- Add pci_enable_msi_range(), pci_enable_msix_range() (Alexander Gordeev)
- Deprecate "tri-state" interfaces: fail/success/fail+info (Alexander Gordeev)
- Export MSI mode using attributes, not kobjects (Greg Kroah-Hartman)
- Drop "irq" param from *_restore_msi_irqs() (DuanZhenzhong)
SR-IOV
- Clear NumVFs when disabling SR-IOV in sriov_init() (ethan.zhao)
Virtualization
- Add support for save/restore of extended capabilities (Alex Williamson)
- Add Virtual Channel to save/restore support (Alex Williamson)
- Never treat a VF as a multifunction device (Alex Williamson)
- Add pci_try_reset_function(), et al (Alex Williamson)
AER
- Ignore non-PCIe error sources (Betty Dall)
- Support ACPI HEST error sources for domains other than 0 (Betty Dall)
- Consolidate HEST error source parsers (Bjorn Helgaas)
- Add a TLP header print helper (Borislav Petkov)
Freescale i.MX6
- Remove unnecessary code (Fabio Estevam)
- Make reset-gpio optional (Marek Vasut)
- Report "link up" only after link training completes (Marek Vasut)
- Start link in Gen1 before negotiating for Gen2 mode (Marek Vasut)
- Fix PCIe startup code (Richard Zhu)
Marvell MVEBU
- Remove duplicate of_clk_get_by_name() call (Andrew Lunn)
- Drop writes to bridge Secondary Status register (Jason Gunthorpe)
- Obey bridge PCI_COMMAND_MEM and PCI_COMMAND_IO bits (Jason Gunthorpe)
- Support a bridge with no IO port window (Jason Gunthorpe)
- Use max_t() instead of max(resource_size_t,) (Jingoo Han)
- Remove redundant of_match_ptr (Sachin Kamat)
- Call pci_ioremap_io() at startup instead of dynamically (Thomas Petazzoni)
NVIDIA Tegra
- Disable Gen2 for Tegra20 and Tegra30 (Eric Brower)
Renesas R-Car
- Add runtime PM support (Valentine Barshak)
- Fix rcar_pci_probe() return value check (Wei Yongjun)
Synopsys DesignWare
- Fix crash in dw_msi_teardown_irq() (Bjørn Erik Nilsen)
- Remove redundant call to pci_write_config_word() (Bjørn Erik Nilsen)
- Fix missing MSI IRQs (Harro Haan)
- Add dw_pcie prefix before cfg_read/write (Pratyush Anand)
- Fix I/O transfers by using CPU (not realio) address (Pratyush Anand)
- Whitespace cleanup (Jingoo Han)
EISA
- Call put_device() if device_register() fails (Levente Kurusa)
- Revert EISA initialization breakage ((Bjorn Helgaas)
Miscellaneous
- Remove unused code, including PCIe 3.0 interfaces (Stephen Hemminger)
- Prevent bus conflicts while checking for bridge apertures (Bjorn Helgaas)
- Stop clearing bridge Secondary Status when setting up I/O aperture (Bjorn Helgaas)
- Use dev_is_pci() to identify PCI devices (Yijing Wang)
- Deprecate DEFINE_PCI_DEVICE_TABLE (Joe Perches)
- Update documentation 00-INDEX (Erik Ekman)"
* tag 'pci-v3.14-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (119 commits)
Revert "EISA: Initialize device before its resources"
Revert "EISA: Log device resources in dmesg"
vfio-pci: Use pci "try" reset interface
PCI: Check parent kobject in pci_destroy_dev()
xen/pcifront: Use global PCI rescan-remove locking
powerpc/eeh: Use global PCI rescan-remove locking
PCI: Fix pci_check_and_unmask_intx() comment typos
PCI: Add pci_try_reset_function(), pci_try_reset_slot(), pci_try_reset_bus()
MPT / PCI: Use pci_stop_and_remove_bus_device_locked()
platform / x86: Use global PCI rescan-remove locking
PCI: hotplug: Use global PCI rescan-remove locking
pcmcia: Use global PCI rescan-remove locking
ACPI / hotplug / PCI: Use global PCI rescan-remove locking
ACPI / PCI: Use global PCI rescan-remove locking in PCI root hotplug
PCI: Add global pci_lock_rescan_remove()
PCI: Cleanup pci.h whitespace
PCI: Reorder so actual code comes before stubs
PCI/AER: Support ACPI HEST AER error sources for PCI domains other than 0
ACPICA: Add helper macros to extract bus/segment numbers from HEST table.
PCI: Make local functions static
...
Diffstat (limited to 'drivers/pci/hotplug/acpiphp_glue.c')
-rw-r--r-- | drivers/pci/hotplug/acpiphp_glue.c | 43 |
1 files changed, 38 insertions, 5 deletions
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index e86439283a5d..ee26bac2d378 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c | |||
@@ -432,6 +432,7 @@ static void cleanup_bridge(struct acpiphp_bridge *bridge) | |||
432 | pr_err("failed to remove notify handler\n"); | 432 | pr_err("failed to remove notify handler\n"); |
433 | } | 433 | } |
434 | } | 434 | } |
435 | slot->flags |= SLOT_IS_GOING_AWAY; | ||
435 | if (slot->slot) | 436 | if (slot->slot) |
436 | acpiphp_unregister_hotplug_slot(slot); | 437 | acpiphp_unregister_hotplug_slot(slot); |
437 | } | 438 | } |
@@ -439,6 +440,8 @@ static void cleanup_bridge(struct acpiphp_bridge *bridge) | |||
439 | mutex_lock(&bridge_mutex); | 440 | mutex_lock(&bridge_mutex); |
440 | list_del(&bridge->list); | 441 | list_del(&bridge->list); |
441 | mutex_unlock(&bridge_mutex); | 442 | mutex_unlock(&bridge_mutex); |
443 | |||
444 | bridge->is_going_away = true; | ||
442 | } | 445 | } |
443 | 446 | ||
444 | /** | 447 | /** |
@@ -757,6 +760,10 @@ static void acpiphp_check_bridge(struct acpiphp_bridge *bridge) | |||
757 | { | 760 | { |
758 | struct acpiphp_slot *slot; | 761 | struct acpiphp_slot *slot; |
759 | 762 | ||
763 | /* Bail out if the bridge is going away. */ | ||
764 | if (bridge->is_going_away) | ||
765 | return; | ||
766 | |||
760 | list_for_each_entry(slot, &bridge->slots, node) { | 767 | list_for_each_entry(slot, &bridge->slots, node) { |
761 | struct pci_bus *bus = slot->bus; | 768 | struct pci_bus *bus = slot->bus; |
762 | struct pci_dev *dev, *tmp; | 769 | struct pci_dev *dev, *tmp; |
@@ -827,6 +834,8 @@ void acpiphp_check_host_bridge(acpi_handle handle) | |||
827 | } | 834 | } |
828 | } | 835 | } |
829 | 836 | ||
837 | static int acpiphp_disable_and_eject_slot(struct acpiphp_slot *slot); | ||
838 | |||
830 | static void hotplug_event(acpi_handle handle, u32 type, void *data) | 839 | static void hotplug_event(acpi_handle handle, u32 type, void *data) |
831 | { | 840 | { |
832 | struct acpiphp_context *context = data; | 841 | struct acpiphp_context *context = data; |
@@ -856,6 +865,9 @@ static void hotplug_event(acpi_handle handle, u32 type, void *data) | |||
856 | } else { | 865 | } else { |
857 | struct acpiphp_slot *slot = func->slot; | 866 | struct acpiphp_slot *slot = func->slot; |
858 | 867 | ||
868 | if (slot->flags & SLOT_IS_GOING_AWAY) | ||
869 | break; | ||
870 | |||
859 | mutex_lock(&slot->crit_sect); | 871 | mutex_lock(&slot->crit_sect); |
860 | enable_slot(slot); | 872 | enable_slot(slot); |
861 | mutex_unlock(&slot->crit_sect); | 873 | mutex_unlock(&slot->crit_sect); |
@@ -871,6 +883,9 @@ static void hotplug_event(acpi_handle handle, u32 type, void *data) | |||
871 | struct acpiphp_slot *slot = func->slot; | 883 | struct acpiphp_slot *slot = func->slot; |
872 | int ret; | 884 | int ret; |
873 | 885 | ||
886 | if (slot->flags & SLOT_IS_GOING_AWAY) | ||
887 | break; | ||
888 | |||
874 | /* | 889 | /* |
875 | * Check if anything has changed in the slot and rescan | 890 | * Check if anything has changed in the slot and rescan |
876 | * from the parent if that's the case. | 891 | * from the parent if that's the case. |
@@ -900,9 +915,11 @@ static void hotplug_event_work(void *data, u32 type) | |||
900 | acpi_handle handle = context->handle; | 915 | acpi_handle handle = context->handle; |
901 | 916 | ||
902 | acpi_scan_lock_acquire(); | 917 | acpi_scan_lock_acquire(); |
918 | pci_lock_rescan_remove(); | ||
903 | 919 | ||
904 | hotplug_event(handle, type, context); | 920 | hotplug_event(handle, type, context); |
905 | 921 | ||
922 | pci_unlock_rescan_remove(); | ||
906 | acpi_scan_lock_release(); | 923 | acpi_scan_lock_release(); |
907 | acpi_evaluate_hotplug_ost(handle, type, ACPI_OST_SC_SUCCESS, NULL); | 924 | acpi_evaluate_hotplug_ost(handle, type, ACPI_OST_SC_SUCCESS, NULL); |
908 | put_bridge(context->func.parent); | 925 | put_bridge(context->func.parent); |
@@ -1070,12 +1087,19 @@ void acpiphp_remove_slots(struct pci_bus *bus) | |||
1070 | */ | 1087 | */ |
1071 | int acpiphp_enable_slot(struct acpiphp_slot *slot) | 1088 | int acpiphp_enable_slot(struct acpiphp_slot *slot) |
1072 | { | 1089 | { |
1090 | pci_lock_rescan_remove(); | ||
1091 | |||
1092 | if (slot->flags & SLOT_IS_GOING_AWAY) | ||
1093 | return -ENODEV; | ||
1094 | |||
1073 | mutex_lock(&slot->crit_sect); | 1095 | mutex_lock(&slot->crit_sect); |
1074 | /* configure all functions */ | 1096 | /* configure all functions */ |
1075 | if (!(slot->flags & SLOT_ENABLED)) | 1097 | if (!(slot->flags & SLOT_ENABLED)) |
1076 | enable_slot(slot); | 1098 | enable_slot(slot); |
1077 | 1099 | ||
1078 | mutex_unlock(&slot->crit_sect); | 1100 | mutex_unlock(&slot->crit_sect); |
1101 | |||
1102 | pci_unlock_rescan_remove(); | ||
1079 | return 0; | 1103 | return 0; |
1080 | } | 1104 | } |
1081 | 1105 | ||
@@ -1083,10 +1107,12 @@ int acpiphp_enable_slot(struct acpiphp_slot *slot) | |||
1083 | * acpiphp_disable_and_eject_slot - power off and eject slot | 1107 | * acpiphp_disable_and_eject_slot - power off and eject slot |
1084 | * @slot: ACPI PHP slot | 1108 | * @slot: ACPI PHP slot |
1085 | */ | 1109 | */ |
1086 | int acpiphp_disable_and_eject_slot(struct acpiphp_slot *slot) | 1110 | static int acpiphp_disable_and_eject_slot(struct acpiphp_slot *slot) |
1087 | { | 1111 | { |
1088 | struct acpiphp_func *func; | 1112 | struct acpiphp_func *func; |
1089 | int retval = 0; | 1113 | |
1114 | if (slot->flags & SLOT_IS_GOING_AWAY) | ||
1115 | return -ENODEV; | ||
1090 | 1116 | ||
1091 | mutex_lock(&slot->crit_sect); | 1117 | mutex_lock(&slot->crit_sect); |
1092 | 1118 | ||
@@ -1104,9 +1130,18 @@ int acpiphp_disable_and_eject_slot(struct acpiphp_slot *slot) | |||
1104 | } | 1130 | } |
1105 | 1131 | ||
1106 | mutex_unlock(&slot->crit_sect); | 1132 | mutex_unlock(&slot->crit_sect); |
1107 | return retval; | 1133 | return 0; |
1108 | } | 1134 | } |
1109 | 1135 | ||
1136 | int acpiphp_disable_slot(struct acpiphp_slot *slot) | ||
1137 | { | ||
1138 | int ret; | ||
1139 | |||
1140 | pci_lock_rescan_remove(); | ||
1141 | ret = acpiphp_disable_and_eject_slot(slot); | ||
1142 | pci_unlock_rescan_remove(); | ||
1143 | return ret; | ||
1144 | } | ||
1110 | 1145 | ||
1111 | /* | 1146 | /* |
1112 | * slot enabled: 1 | 1147 | * slot enabled: 1 |
@@ -1117,7 +1152,6 @@ u8 acpiphp_get_power_status(struct acpiphp_slot *slot) | |||
1117 | return (slot->flags & SLOT_ENABLED); | 1152 | return (slot->flags & SLOT_ENABLED); |
1118 | } | 1153 | } |
1119 | 1154 | ||
1120 | |||
1121 | /* | 1155 | /* |
1122 | * latch open: 1 | 1156 | * latch open: 1 |
1123 | * latch closed: 0 | 1157 | * latch closed: 0 |
@@ -1127,7 +1161,6 @@ u8 acpiphp_get_latch_status(struct acpiphp_slot *slot) | |||
1127 | return !(get_slot_status(slot) & ACPI_STA_DEVICE_UI); | 1161 | return !(get_slot_status(slot) & ACPI_STA_DEVICE_UI); |
1128 | } | 1162 | } |
1129 | 1163 | ||
1130 | |||
1131 | /* | 1164 | /* |
1132 | * adapter presence : 1 | 1165 | * adapter presence : 1 |
1133 | * absence : 0 | 1166 | * absence : 0 |