diff options
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/bus.c | 6 | ||||
-rw-r--r-- | drivers/pci/hotplug/pciehp_core.c | 2 | ||||
-rw-r--r-- | drivers/pci/intel-iommu.c | 7 | ||||
-rw-r--r-- | drivers/pci/pci-acpi.c | 24 | ||||
-rw-r--r-- | drivers/pci/pci.c | 21 |
5 files changed, 29 insertions, 31 deletions
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c index 6a9403d79e0c..d708358326e5 100644 --- a/drivers/pci/bus.c +++ b/drivers/pci/bus.c | |||
@@ -143,14 +143,18 @@ void pci_bus_add_devices(struct pci_bus *bus) | |||
143 | /* register the bus with sysfs as the parent is now | 143 | /* register the bus with sysfs as the parent is now |
144 | * properly registered. */ | 144 | * properly registered. */ |
145 | child_bus = dev->subordinate; | 145 | child_bus = dev->subordinate; |
146 | if (child_bus->is_added) | ||
147 | continue; | ||
146 | child_bus->dev.parent = child_bus->bridge; | 148 | child_bus->dev.parent = child_bus->bridge; |
147 | retval = device_register(&child_bus->dev); | 149 | retval = device_register(&child_bus->dev); |
148 | if (retval) | 150 | if (retval) |
149 | dev_err(&dev->dev, "Error registering pci_bus," | 151 | dev_err(&dev->dev, "Error registering pci_bus," |
150 | " continuing...\n"); | 152 | " continuing...\n"); |
151 | else | 153 | else { |
154 | child_bus->is_added = 1; | ||
152 | retval = device_create_file(&child_bus->dev, | 155 | retval = device_create_file(&child_bus->dev, |
153 | &dev_attr_cpuaffinity); | 156 | &dev_attr_cpuaffinity); |
157 | } | ||
154 | if (retval) | 158 | if (retval) |
155 | dev_err(&dev->dev, "Error creating cpuaffinity" | 159 | dev_err(&dev->dev, "Error creating cpuaffinity" |
156 | " file, continuing...\n"); | 160 | " file, continuing...\n"); |
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c index 7f4836b8e71e..5fa4ba0d9934 100644 --- a/drivers/pci/hotplug/pciehp_core.c +++ b/drivers/pci/hotplug/pciehp_core.c | |||
@@ -467,7 +467,7 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_ | |||
467 | t_slot = pciehp_find_slot(ctrl, ctrl->slot_device_offset); | 467 | t_slot = pciehp_find_slot(ctrl, ctrl->slot_device_offset); |
468 | 468 | ||
469 | t_slot->hpc_ops->get_adapter_status(t_slot, &value); /* Check if slot is occupied */ | 469 | t_slot->hpc_ops->get_adapter_status(t_slot, &value); /* Check if slot is occupied */ |
470 | if (value) { | 470 | if (value && pciehp_force) { |
471 | rc = pciehp_enable_slot(t_slot); | 471 | rc = pciehp_enable_slot(t_slot); |
472 | if (rc) /* -ENODEV: shouldn't happen, but deal with it */ | 472 | if (rc) /* -ENODEV: shouldn't happen, but deal with it */ |
473 | value = 0; | 473 | value = 0; |
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index 977d29b32295..4cb949f0ebd9 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c | |||
@@ -1097,6 +1097,8 @@ static void iommu_free_domain(struct dmar_domain *domain) | |||
1097 | } | 1097 | } |
1098 | 1098 | ||
1099 | static struct iova_domain reserved_iova_list; | 1099 | static struct iova_domain reserved_iova_list; |
1100 | static struct lock_class_key reserved_alloc_key; | ||
1101 | static struct lock_class_key reserved_rbtree_key; | ||
1100 | 1102 | ||
1101 | static void dmar_init_reserved_ranges(void) | 1103 | static void dmar_init_reserved_ranges(void) |
1102 | { | 1104 | { |
@@ -1107,6 +1109,11 @@ static void dmar_init_reserved_ranges(void) | |||
1107 | 1109 | ||
1108 | init_iova_domain(&reserved_iova_list, DMA_32BIT_PFN); | 1110 | init_iova_domain(&reserved_iova_list, DMA_32BIT_PFN); |
1109 | 1111 | ||
1112 | lockdep_set_class(&reserved_iova_list.iova_alloc_lock, | ||
1113 | &reserved_alloc_key); | ||
1114 | lockdep_set_class(&reserved_iova_list.iova_rbtree_lock, | ||
1115 | &reserved_rbtree_key); | ||
1116 | |||
1110 | /* IOAPIC ranges shouldn't be accessed by DMA */ | 1117 | /* IOAPIC ranges shouldn't be accessed by DMA */ |
1111 | iova = reserve_iova(&reserved_iova_list, IOVA_PFN(IOAPIC_RANGE_START), | 1118 | iova = reserve_iova(&reserved_iova_list, IOVA_PFN(IOAPIC_RANGE_START), |
1112 | IOVA_PFN(IOAPIC_RANGE_END)); | 1119 | IOVA_PFN(IOAPIC_RANGE_END)); |
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index 4a23654184fc..72f7476930c8 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
@@ -272,21 +272,29 @@ static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) | |||
272 | { | 272 | { |
273 | acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev); | 273 | acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev); |
274 | acpi_handle tmp; | 274 | acpi_handle tmp; |
275 | static int state_conv[] = { | 275 | static const u8 state_conv[] = { |
276 | [0] = 0, | 276 | [PCI_D0] = ACPI_STATE_D0, |
277 | [1] = 1, | 277 | [PCI_D1] = ACPI_STATE_D1, |
278 | [2] = 2, | 278 | [PCI_D2] = ACPI_STATE_D2, |
279 | [3] = 3, | 279 | [PCI_D3hot] = ACPI_STATE_D3, |
280 | [4] = 3 | 280 | [PCI_D3cold] = ACPI_STATE_D3 |
281 | }; | 281 | }; |
282 | int acpi_state = state_conv[(int __force) state]; | ||
283 | 282 | ||
284 | if (!handle) | 283 | if (!handle) |
285 | return -ENODEV; | 284 | return -ENODEV; |
286 | /* If the ACPI device has _EJ0, ignore the device */ | 285 | /* If the ACPI device has _EJ0, ignore the device */ |
287 | if (ACPI_SUCCESS(acpi_get_handle(handle, "_EJ0", &tmp))) | 286 | if (ACPI_SUCCESS(acpi_get_handle(handle, "_EJ0", &tmp))) |
288 | return 0; | 287 | return 0; |
289 | return acpi_bus_set_power(handle, acpi_state); | 288 | |
289 | switch (state) { | ||
290 | case PCI_D0: | ||
291 | case PCI_D1: | ||
292 | case PCI_D2: | ||
293 | case PCI_D3hot: | ||
294 | case PCI_D3cold: | ||
295 | return acpi_bus_set_power(handle, state_conv[state]); | ||
296 | } | ||
297 | return -EINVAL; | ||
290 | } | 298 | } |
291 | 299 | ||
292 | 300 | ||
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 183fddaa38b7..a4445b7210bf 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -314,24 +314,6 @@ int pci_find_ht_capability(struct pci_dev *dev, int ht_cap) | |||
314 | } | 314 | } |
315 | EXPORT_SYMBOL_GPL(pci_find_ht_capability); | 315 | EXPORT_SYMBOL_GPL(pci_find_ht_capability); |
316 | 316 | ||
317 | void pcie_wait_pending_transaction(struct pci_dev *dev) | ||
318 | { | ||
319 | int pos; | ||
320 | u16 reg16; | ||
321 | |||
322 | pos = pci_find_capability(dev, PCI_CAP_ID_EXP); | ||
323 | if (!pos) | ||
324 | return; | ||
325 | while (1) { | ||
326 | pci_read_config_word(dev, pos + PCI_EXP_DEVSTA, ®16); | ||
327 | if (!(reg16 & PCI_EXP_DEVSTA_TRPND)) | ||
328 | break; | ||
329 | cpu_relax(); | ||
330 | } | ||
331 | |||
332 | } | ||
333 | EXPORT_SYMBOL_GPL(pcie_wait_pending_transaction); | ||
334 | |||
335 | /** | 317 | /** |
336 | * pci_find_parent_resource - return resource region of parent bus of given region | 318 | * pci_find_parent_resource - return resource region of parent bus of given region |
337 | * @dev: PCI device structure contains resources to be searched | 319 | * @dev: PCI device structure contains resources to be searched |
@@ -936,9 +918,6 @@ pci_disable_device(struct pci_dev *dev) | |||
936 | if (atomic_sub_return(1, &dev->enable_cnt) != 0) | 918 | if (atomic_sub_return(1, &dev->enable_cnt) != 0) |
937 | return; | 919 | return; |
938 | 920 | ||
939 | /* Wait for all transactions are finished before disabling the device */ | ||
940 | pcie_wait_pending_transaction(dev); | ||
941 | |||
942 | pci_read_config_word(dev, PCI_COMMAND, &pci_command); | 921 | pci_read_config_word(dev, PCI_COMMAND, &pci_command); |
943 | if (pci_command & PCI_COMMAND_MASTER) { | 922 | if (pci_command & PCI_COMMAND_MASTER) { |
944 | pci_command &= ~PCI_COMMAND_MASTER; | 923 | pci_command &= ~PCI_COMMAND_MASTER; |