diff options
-rw-r--r-- | Documentation/ABI/testing/sysfs-bus-pci | 13 | ||||
-rw-r--r-- | drivers/pci/hotplug/ibmphp_res.c | 5 | ||||
-rw-r--r-- | drivers/pci/iov.c | 11 | ||||
-rw-r--r-- | drivers/pci/pci-acpi.c | 3 | ||||
-rw-r--r-- | drivers/pci/pci-sysfs.c | 27 | ||||
-rw-r--r-- | drivers/pci/pci.c | 21 | ||||
-rw-r--r-- | drivers/pci/pci.h | 6 | ||||
-rw-r--r-- | drivers/pci/probe.c | 80 | ||||
-rw-r--r-- | drivers/pci/search.c | 3 | ||||
-rw-r--r-- | drivers/pci/xen-pcifront.c | 13 | ||||
-rw-r--r-- | include/linux/pci_hotplug.h | 1 |
11 files changed, 99 insertions, 84 deletions
diff --git a/Documentation/ABI/testing/sysfs-bus-pci b/Documentation/ABI/testing/sysfs-bus-pci index ee6c04036492..b3bc50f650ee 100644 --- a/Documentation/ABI/testing/sysfs-bus-pci +++ b/Documentation/ABI/testing/sysfs-bus-pci | |||
@@ -281,3 +281,16 @@ Description: | |||
281 | opt-out of driver binding using a driver_override name such as | 281 | opt-out of driver binding using a driver_override name such as |
282 | "none". Only a single driver may be specified in the override, | 282 | "none". Only a single driver may be specified in the override, |
283 | there is no support for parsing delimiters. | 283 | there is no support for parsing delimiters. |
284 | |||
285 | What: /sys/bus/pci/devices/.../numa_node | ||
286 | Date: Oct 2014 | ||
287 | Contact: Prarit Bhargava <prarit@redhat.com> | ||
288 | Description: | ||
289 | This file contains the NUMA node to which the PCI device is | ||
290 | attached, or -1 if the node is unknown. The initial value | ||
291 | comes from an ACPI _PXM method or a similar firmware | ||
292 | source. If that is missing or incorrect, this file can be | ||
293 | written to override the node. In that case, please report | ||
294 | a firmware bug to the system vendor. Writing to this file | ||
295 | taints the kernel with TAINT_FIRMWARE_WORKAROUND, which | ||
296 | reduces the supportability of your system. | ||
diff --git a/drivers/pci/hotplug/ibmphp_res.c b/drivers/pci/hotplug/ibmphp_res.c index 219ba8090a37..f279060cf6e2 100644 --- a/drivers/pci/hotplug/ibmphp_res.c +++ b/drivers/pci/hotplug/ibmphp_res.c | |||
@@ -376,10 +376,7 @@ int __init ibmphp_rsrc_init (void) | |||
376 | if (rc) | 376 | if (rc) |
377 | return rc; | 377 | return rc; |
378 | } | 378 | } |
379 | rc = once_over (); /* This is to align ranges (so no -1) */ | 379 | return once_over (); /* This is to align ranges (so no -1) */ |
380 | if (rc) | ||
381 | return rc; | ||
382 | return 0; | ||
383 | } | 380 | } |
384 | 381 | ||
385 | /******************************************************************************** | 382 | /******************************************************************************** |
diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c index 4d109c07294a..4b3a4eaad996 100644 --- a/drivers/pci/iov.c +++ b/drivers/pci/iov.c | |||
@@ -479,20 +479,16 @@ void pci_iov_release(struct pci_dev *dev) | |||
479 | * pci_iov_resource_bar - get position of the SR-IOV BAR | 479 | * pci_iov_resource_bar - get position of the SR-IOV BAR |
480 | * @dev: the PCI device | 480 | * @dev: the PCI device |
481 | * @resno: the resource number | 481 | * @resno: the resource number |
482 | * @type: the BAR type to be filled in | ||
483 | * | 482 | * |
484 | * Returns position of the BAR encapsulated in the SR-IOV capability. | 483 | * Returns position of the BAR encapsulated in the SR-IOV capability. |
485 | */ | 484 | */ |
486 | int pci_iov_resource_bar(struct pci_dev *dev, int resno, | 485 | int pci_iov_resource_bar(struct pci_dev *dev, int resno) |
487 | enum pci_bar_type *type) | ||
488 | { | 486 | { |
489 | if (resno < PCI_IOV_RESOURCES || resno > PCI_IOV_RESOURCE_END) | 487 | if (resno < PCI_IOV_RESOURCES || resno > PCI_IOV_RESOURCE_END) |
490 | return 0; | 488 | return 0; |
491 | 489 | ||
492 | BUG_ON(!dev->is_physfn); | 490 | BUG_ON(!dev->is_physfn); |
493 | 491 | ||
494 | *type = pci_bar_unknown; | ||
495 | |||
496 | return dev->sriov->pos + PCI_SRIOV_BAR + | 492 | return dev->sriov->pos + PCI_SRIOV_BAR + |
497 | 4 * (resno - PCI_IOV_RESOURCES); | 493 | 4 * (resno - PCI_IOV_RESOURCES); |
498 | } | 494 | } |
@@ -510,13 +506,12 @@ int pci_iov_resource_bar(struct pci_dev *dev, int resno, | |||
510 | resource_size_t pci_sriov_resource_alignment(struct pci_dev *dev, int resno) | 506 | resource_size_t pci_sriov_resource_alignment(struct pci_dev *dev, int resno) |
511 | { | 507 | { |
512 | struct resource tmp; | 508 | struct resource tmp; |
513 | enum pci_bar_type type; | 509 | int reg = pci_iov_resource_bar(dev, resno); |
514 | int reg = pci_iov_resource_bar(dev, resno, &type); | ||
515 | 510 | ||
516 | if (!reg) | 511 | if (!reg) |
517 | return 0; | 512 | return 0; |
518 | 513 | ||
519 | __pci_read_base(dev, type, &tmp, reg); | 514 | __pci_read_base(dev, pci_bar_unknown, &tmp, reg); |
520 | return resource_alignment(&tmp); | 515 | return resource_alignment(&tmp); |
521 | } | 516 | } |
522 | 517 | ||
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index 6ebf8edc5f3c..3542150fc8a3 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
@@ -322,8 +322,7 @@ static void pci_acpi_wake_dev(struct work_struct *work) | |||
322 | pci_wakeup_event(pci_dev); | 322 | pci_wakeup_event(pci_dev); |
323 | pm_runtime_resume(&pci_dev->dev); | 323 | pm_runtime_resume(&pci_dev->dev); |
324 | 324 | ||
325 | if (pci_dev->subordinate) | 325 | pci_pme_wakeup_bus(pci_dev->subordinate); |
326 | pci_pme_wakeup_bus(pci_dev->subordinate); | ||
327 | } | 326 | } |
328 | 327 | ||
329 | /** | 328 | /** |
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index 92b6d9ab00e4..91e760f9655b 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c | |||
@@ -221,12 +221,37 @@ static ssize_t enabled_show(struct device *dev, struct device_attribute *attr, | |||
221 | static DEVICE_ATTR_RW(enabled); | 221 | static DEVICE_ATTR_RW(enabled); |
222 | 222 | ||
223 | #ifdef CONFIG_NUMA | 223 | #ifdef CONFIG_NUMA |
224 | static ssize_t numa_node_store(struct device *dev, | ||
225 | struct device_attribute *attr, const char *buf, | ||
226 | size_t count) | ||
227 | { | ||
228 | struct pci_dev *pdev = to_pci_dev(dev); | ||
229 | int node, ret; | ||
230 | |||
231 | if (!capable(CAP_SYS_ADMIN)) | ||
232 | return -EPERM; | ||
233 | |||
234 | ret = kstrtoint(buf, 0, &node); | ||
235 | if (ret) | ||
236 | return ret; | ||
237 | |||
238 | if (!node_online(node)) | ||
239 | return -EINVAL; | ||
240 | |||
241 | add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK); | ||
242 | dev_alert(&pdev->dev, FW_BUG "Overriding NUMA node to %d. Contact your vendor for updates.", | ||
243 | node); | ||
244 | |||
245 | dev->numa_node = node; | ||
246 | return count; | ||
247 | } | ||
248 | |||
224 | static ssize_t numa_node_show(struct device *dev, struct device_attribute *attr, | 249 | static ssize_t numa_node_show(struct device *dev, struct device_attribute *attr, |
225 | char *buf) | 250 | char *buf) |
226 | { | 251 | { |
227 | return sprintf(buf, "%d\n", dev->numa_node); | 252 | return sprintf(buf, "%d\n", dev->numa_node); |
228 | } | 253 | } |
229 | static DEVICE_ATTR_RO(numa_node); | 254 | static DEVICE_ATTR_RW(numa_node); |
230 | #endif | 255 | #endif |
231 | 256 | ||
232 | static ssize_t dma_mask_bits_show(struct device *dev, | 257 | static ssize_t dma_mask_bits_show(struct device *dev, |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 625a4ace10b4..a7ac72639c52 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -1012,11 +1012,7 @@ int pci_save_state(struct pci_dev *dev) | |||
1012 | if (i != 0) | 1012 | if (i != 0) |
1013 | return i; | 1013 | return i; |
1014 | 1014 | ||
1015 | i = pci_save_vc_state(dev); | 1015 | return pci_save_vc_state(dev); |
1016 | if (i != 0) | ||
1017 | return i; | ||
1018 | |||
1019 | return 0; | ||
1020 | } | 1016 | } |
1021 | EXPORT_SYMBOL(pci_save_state); | 1017 | EXPORT_SYMBOL(pci_save_state); |
1022 | 1018 | ||
@@ -3144,12 +3140,10 @@ static int pcie_flr(struct pci_dev *dev, int probe) | |||
3144 | return 0; | 3140 | return 0; |
3145 | 3141 | ||
3146 | if (!pci_wait_for_pending_transaction(dev)) | 3142 | if (!pci_wait_for_pending_transaction(dev)) |
3147 | dev_err(&dev->dev, "transaction is not cleared; proceeding with reset anyway\n"); | 3143 | dev_err(&dev->dev, "timed out waiting for pending transaction; performing function level reset anyway\n"); |
3148 | 3144 | ||
3149 | pcie_capability_set_word(dev, PCI_EXP_DEVCTL, PCI_EXP_DEVCTL_BCR_FLR); | 3145 | pcie_capability_set_word(dev, PCI_EXP_DEVCTL, PCI_EXP_DEVCTL_BCR_FLR); |
3150 | |||
3151 | msleep(100); | 3146 | msleep(100); |
3152 | |||
3153 | return 0; | 3147 | return 0; |
3154 | } | 3148 | } |
3155 | 3149 | ||
@@ -3174,16 +3168,12 @@ static int pci_af_flr(struct pci_dev *dev, int probe) | |||
3174 | * is used, so we use the conrol offset rather than status and shift | 3168 | * is used, so we use the conrol offset rather than status and shift |
3175 | * the test bit to match. | 3169 | * the test bit to match. |
3176 | */ | 3170 | */ |
3177 | if (pci_wait_for_pending(dev, pos + PCI_AF_CTRL, | 3171 | if (!pci_wait_for_pending(dev, pos + PCI_AF_CTRL, |
3178 | PCI_AF_STATUS_TP << 8)) | 3172 | PCI_AF_STATUS_TP << 8)) |
3179 | goto clear; | 3173 | dev_err(&dev->dev, "timed out waiting for pending transaction; performing AF function level reset anyway\n"); |
3180 | |||
3181 | dev_err(&dev->dev, "transaction is not cleared; proceeding with reset anyway\n"); | ||
3182 | 3174 | ||
3183 | clear: | ||
3184 | pci_write_config_byte(dev, pos + PCI_AF_CTRL, PCI_AF_CTRL_FLR); | 3175 | pci_write_config_byte(dev, pos + PCI_AF_CTRL, PCI_AF_CTRL_FLR); |
3185 | msleep(100); | 3176 | msleep(100); |
3186 | |||
3187 | return 0; | 3177 | return 0; |
3188 | } | 3178 | } |
3189 | 3179 | ||
@@ -4180,7 +4170,8 @@ int pci_resource_bar(struct pci_dev *dev, int resno, enum pci_bar_type *type) | |||
4180 | return dev->rom_base_reg; | 4170 | return dev->rom_base_reg; |
4181 | } else if (resno < PCI_BRIDGE_RESOURCES) { | 4171 | } else if (resno < PCI_BRIDGE_RESOURCES) { |
4182 | /* device specific resource */ | 4172 | /* device specific resource */ |
4183 | reg = pci_iov_resource_bar(dev, resno, type); | 4173 | *type = pci_bar_unknown; |
4174 | reg = pci_iov_resource_bar(dev, resno); | ||
4184 | if (reg) | 4175 | if (reg) |
4185 | return reg; | 4176 | return reg; |
4186 | } | 4177 | } |
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 0601890db22d..a0905a0985ce 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h | |||
@@ -251,8 +251,7 @@ static inline void pci_restore_ats_state(struct pci_dev *dev) | |||
251 | #ifdef CONFIG_PCI_IOV | 251 | #ifdef CONFIG_PCI_IOV |
252 | int pci_iov_init(struct pci_dev *dev); | 252 | int pci_iov_init(struct pci_dev *dev); |
253 | void pci_iov_release(struct pci_dev *dev); | 253 | void pci_iov_release(struct pci_dev *dev); |
254 | int pci_iov_resource_bar(struct pci_dev *dev, int resno, | 254 | int pci_iov_resource_bar(struct pci_dev *dev, int resno); |
255 | enum pci_bar_type *type); | ||
256 | resource_size_t pci_sriov_resource_alignment(struct pci_dev *dev, int resno); | 255 | resource_size_t pci_sriov_resource_alignment(struct pci_dev *dev, int resno); |
257 | void pci_restore_iov_state(struct pci_dev *dev); | 256 | void pci_restore_iov_state(struct pci_dev *dev); |
258 | int pci_iov_bus_range(struct pci_bus *bus); | 257 | int pci_iov_bus_range(struct pci_bus *bus); |
@@ -266,8 +265,7 @@ static inline void pci_iov_release(struct pci_dev *dev) | |||
266 | 265 | ||
267 | { | 266 | { |
268 | } | 267 | } |
269 | static inline int pci_iov_resource_bar(struct pci_dev *dev, int resno, | 268 | static inline int pci_iov_resource_bar(struct pci_dev *dev, int resno) |
270 | enum pci_bar_type *type) | ||
271 | { | 269 | { |
272 | return 0; | 270 | return 0; |
273 | } | 271 | } |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 5ed99309c758..a9e34ca119e1 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -87,8 +87,7 @@ static void release_pcibus_dev(struct device *dev) | |||
87 | { | 87 | { |
88 | struct pci_bus *pci_bus = to_pci_bus(dev); | 88 | struct pci_bus *pci_bus = to_pci_bus(dev); |
89 | 89 | ||
90 | if (pci_bus->bridge) | 90 | put_device(pci_bus->bridge); |
91 | put_device(pci_bus->bridge); | ||
92 | pci_bus_remove_resources(pci_bus); | 91 | pci_bus_remove_resources(pci_bus); |
93 | pci_release_bus_of_node(pci_bus); | 92 | pci_release_bus_of_node(pci_bus); |
94 | kfree(pci_bus); | 93 | kfree(pci_bus); |
@@ -175,7 +174,6 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type, | |||
175 | u64 l64, sz64, mask64; | 174 | u64 l64, sz64, mask64; |
176 | u16 orig_cmd; | 175 | u16 orig_cmd; |
177 | struct pci_bus_region region, inverted_region; | 176 | struct pci_bus_region region, inverted_region; |
178 | bool bar_too_big = false, bar_too_high = false, bar_invalid = false; | ||
179 | 177 | ||
180 | mask = type ? PCI_ROM_ADDRESS_MASK : ~0; | 178 | mask = type ? PCI_ROM_ADDRESS_MASK : ~0; |
181 | 179 | ||
@@ -201,8 +199,8 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type, | |||
201 | * memory BAR or a ROM, bit 0 must be clear; if it's an io BAR, bit | 199 | * memory BAR or a ROM, bit 0 must be clear; if it's an io BAR, bit |
202 | * 1 must be clear. | 200 | * 1 must be clear. |
203 | */ | 201 | */ |
204 | if (!sz || sz == 0xffffffff) | 202 | if (sz == 0xffffffff) |
205 | goto fail; | 203 | sz = 0; |
206 | 204 | ||
207 | /* | 205 | /* |
208 | * I don't know how l can have all bits set. Copied from old code. | 206 | * I don't know how l can have all bits set. Copied from old code. |
@@ -215,23 +213,22 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type, | |||
215 | res->flags = decode_bar(dev, l); | 213 | res->flags = decode_bar(dev, l); |
216 | res->flags |= IORESOURCE_SIZEALIGN; | 214 | res->flags |= IORESOURCE_SIZEALIGN; |
217 | if (res->flags & IORESOURCE_IO) { | 215 | if (res->flags & IORESOURCE_IO) { |
218 | l &= PCI_BASE_ADDRESS_IO_MASK; | 216 | l64 = l & PCI_BASE_ADDRESS_IO_MASK; |
219 | mask = PCI_BASE_ADDRESS_IO_MASK & (u32) IO_SPACE_LIMIT; | 217 | sz64 = sz & PCI_BASE_ADDRESS_IO_MASK; |
218 | mask64 = PCI_BASE_ADDRESS_IO_MASK & (u32)IO_SPACE_LIMIT; | ||
220 | } else { | 219 | } else { |
221 | l &= PCI_BASE_ADDRESS_MEM_MASK; | 220 | l64 = l & PCI_BASE_ADDRESS_MEM_MASK; |
222 | mask = (u32)PCI_BASE_ADDRESS_MEM_MASK; | 221 | sz64 = sz & PCI_BASE_ADDRESS_MEM_MASK; |
222 | mask64 = (u32)PCI_BASE_ADDRESS_MEM_MASK; | ||
223 | } | 223 | } |
224 | } else { | 224 | } else { |
225 | res->flags |= (l & IORESOURCE_ROM_ENABLE); | 225 | res->flags |= (l & IORESOURCE_ROM_ENABLE); |
226 | l &= PCI_ROM_ADDRESS_MASK; | 226 | l64 = l & PCI_ROM_ADDRESS_MASK; |
227 | mask = (u32)PCI_ROM_ADDRESS_MASK; | 227 | sz64 = sz & PCI_ROM_ADDRESS_MASK; |
228 | mask64 = (u32)PCI_ROM_ADDRESS_MASK; | ||
228 | } | 229 | } |
229 | 230 | ||
230 | if (res->flags & IORESOURCE_MEM_64) { | 231 | if (res->flags & IORESOURCE_MEM_64) { |
231 | l64 = l; | ||
232 | sz64 = sz; | ||
233 | mask64 = mask | (u64)~0 << 32; | ||
234 | |||
235 | pci_read_config_dword(dev, pos + 4, &l); | 232 | pci_read_config_dword(dev, pos + 4, &l); |
236 | pci_write_config_dword(dev, pos + 4, ~0); | 233 | pci_write_config_dword(dev, pos + 4, ~0); |
237 | pci_read_config_dword(dev, pos + 4, &sz); | 234 | pci_read_config_dword(dev, pos + 4, &sz); |
@@ -239,18 +236,30 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type, | |||
239 | 236 | ||
240 | l64 |= ((u64)l << 32); | 237 | l64 |= ((u64)l << 32); |
241 | sz64 |= ((u64)sz << 32); | 238 | sz64 |= ((u64)sz << 32); |
239 | mask64 |= ((u64)~0 << 32); | ||
240 | } | ||
242 | 241 | ||
243 | sz64 = pci_size(l64, sz64, mask64); | 242 | if (!dev->mmio_always_on && (orig_cmd & PCI_COMMAND_DECODE_ENABLE)) |
243 | pci_write_config_word(dev, PCI_COMMAND, orig_cmd); | ||
244 | 244 | ||
245 | if (!sz64) | 245 | if (!sz64) |
246 | goto fail; | 246 | goto fail; |
247 | 247 | ||
248 | sz64 = pci_size(l64, sz64, mask64); | ||
249 | if (!sz64) { | ||
250 | dev_info(&dev->dev, FW_BUG "reg 0x%x: invalid BAR (can't size)\n", | ||
251 | pos); | ||
252 | goto fail; | ||
253 | } | ||
254 | |||
255 | if (res->flags & IORESOURCE_MEM_64) { | ||
248 | if ((sizeof(dma_addr_t) < 8 || sizeof(resource_size_t) < 8) && | 256 | if ((sizeof(dma_addr_t) < 8 || sizeof(resource_size_t) < 8) && |
249 | sz64 > 0x100000000ULL) { | 257 | sz64 > 0x100000000ULL) { |
250 | res->flags |= IORESOURCE_UNSET | IORESOURCE_DISABLED; | 258 | res->flags |= IORESOURCE_UNSET | IORESOURCE_DISABLED; |
251 | res->start = 0; | 259 | res->start = 0; |
252 | res->end = 0; | 260 | res->end = 0; |
253 | bar_too_big = true; | 261 | dev_err(&dev->dev, "reg 0x%x: can't handle BAR larger than 4GB (size %#010llx)\n", |
262 | pos, (unsigned long long)sz64); | ||
254 | goto out; | 263 | goto out; |
255 | } | 264 | } |
256 | 265 | ||
@@ -259,22 +268,15 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type, | |||
259 | res->flags |= IORESOURCE_UNSET; | 268 | res->flags |= IORESOURCE_UNSET; |
260 | res->start = 0; | 269 | res->start = 0; |
261 | res->end = sz64; | 270 | res->end = sz64; |
262 | bar_too_high = true; | 271 | dev_info(&dev->dev, "reg 0x%x: can't handle BAR above 4GB (bus address %#010llx)\n", |
272 | pos, (unsigned long long)l64); | ||
263 | goto out; | 273 | goto out; |
264 | } else { | ||
265 | region.start = l64; | ||
266 | region.end = l64 + sz64; | ||
267 | } | 274 | } |
268 | } else { | ||
269 | sz = pci_size(l, sz, mask); | ||
270 | |||
271 | if (!sz) | ||
272 | goto fail; | ||
273 | |||
274 | region.start = l; | ||
275 | region.end = l + sz; | ||
276 | } | 275 | } |
277 | 276 | ||
277 | region.start = l64; | ||
278 | region.end = l64 + sz64; | ||
279 | |||
278 | pcibios_bus_to_resource(dev->bus, res, ®ion); | 280 | pcibios_bus_to_resource(dev->bus, res, ®ion); |
279 | pcibios_resource_to_bus(dev->bus, &inverted_region, res); | 281 | pcibios_resource_to_bus(dev->bus, &inverted_region, res); |
280 | 282 | ||
@@ -293,7 +295,8 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type, | |||
293 | res->flags |= IORESOURCE_UNSET; | 295 | res->flags |= IORESOURCE_UNSET; |
294 | res->start = 0; | 296 | res->start = 0; |
295 | res->end = region.end - region.start; | 297 | res->end = region.end - region.start; |
296 | bar_invalid = true; | 298 | dev_info(&dev->dev, "reg 0x%x: initial BAR value %#010llx invalid\n", |
299 | pos, (unsigned long long)region.start); | ||
297 | } | 300 | } |
298 | 301 | ||
299 | goto out; | 302 | goto out; |
@@ -302,19 +305,6 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type, | |||
302 | fail: | 305 | fail: |
303 | res->flags = 0; | 306 | res->flags = 0; |
304 | out: | 307 | out: |
305 | if (!dev->mmio_always_on && | ||
306 | (orig_cmd & PCI_COMMAND_DECODE_ENABLE)) | ||
307 | pci_write_config_word(dev, PCI_COMMAND, orig_cmd); | ||
308 | |||
309 | if (bar_too_big) | ||
310 | dev_err(&dev->dev, "reg 0x%x: can't handle BAR larger than 4GB (size %#010llx)\n", | ||
311 | pos, (unsigned long long) sz64); | ||
312 | if (bar_too_high) | ||
313 | dev_info(&dev->dev, "reg 0x%x: can't handle BAR above 4G (bus address %#010llx)\n", | ||
314 | pos, (unsigned long long) l64); | ||
315 | if (bar_invalid) | ||
316 | dev_info(&dev->dev, "reg 0x%x: initial BAR value %#010llx invalid\n", | ||
317 | pos, (unsigned long long) region.start); | ||
318 | if (res->flags) | 308 | if (res->flags) |
319 | dev_printk(KERN_DEBUG, &dev->dev, "reg 0x%x: %pR\n", pos, res); | 309 | dev_printk(KERN_DEBUG, &dev->dev, "reg 0x%x: %pR\n", pos, res); |
320 | 310 | ||
diff --git a/drivers/pci/search.c b/drivers/pci/search.c index a81f413083e4..a20ce7d5e2a7 100644 --- a/drivers/pci/search.c +++ b/drivers/pci/search.c | |||
@@ -271,8 +271,7 @@ static struct pci_dev *pci_get_dev_by_id(const struct pci_device_id *id, | |||
271 | match_pci_dev_by_id); | 271 | match_pci_dev_by_id); |
272 | if (dev) | 272 | if (dev) |
273 | pdev = to_pci_dev(dev); | 273 | pdev = to_pci_dev(dev); |
274 | if (from) | 274 | pci_dev_put(from); |
275 | pci_dev_put(from); | ||
276 | return pdev; | 275 | return pdev; |
277 | } | 276 | } |
278 | 277 | ||
diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c index 116ca3746adb..b1ffebec9b9e 100644 --- a/drivers/pci/xen-pcifront.c +++ b/drivers/pci/xen-pcifront.c | |||
@@ -596,8 +596,7 @@ static pci_ers_result_t pcifront_common_process(int cmd, | |||
596 | pcidev = pci_get_bus_and_slot(bus, devfn); | 596 | pcidev = pci_get_bus_and_slot(bus, devfn); |
597 | if (!pcidev || !pcidev->driver) { | 597 | if (!pcidev || !pcidev->driver) { |
598 | dev_err(&pdev->xdev->dev, "device or AER driver is NULL\n"); | 598 | dev_err(&pdev->xdev->dev, "device or AER driver is NULL\n"); |
599 | if (pcidev) | 599 | pci_dev_put(pcidev); |
600 | pci_dev_put(pcidev); | ||
601 | return result; | 600 | return result; |
602 | } | 601 | } |
603 | pdrv = pcidev->driver; | 602 | pdrv = pcidev->driver; |
@@ -866,6 +865,11 @@ static int pcifront_try_connect(struct pcifront_device *pdev) | |||
866 | xenbus_dev_error(pdev->xdev, err, | 865 | xenbus_dev_error(pdev->xdev, err, |
867 | "No PCI Roots found, trying 0000:00"); | 866 | "No PCI Roots found, trying 0000:00"); |
868 | err = pcifront_scan_root(pdev, 0, 0); | 867 | err = pcifront_scan_root(pdev, 0, 0); |
868 | if (err) { | ||
869 | xenbus_dev_fatal(pdev->xdev, err, | ||
870 | "Error scanning PCI root 0000:00"); | ||
871 | goto out; | ||
872 | } | ||
869 | num_roots = 0; | 873 | num_roots = 0; |
870 | } else if (err != 1) { | 874 | } else if (err != 1) { |
871 | if (err == 0) | 875 | if (err == 0) |
@@ -947,6 +951,11 @@ static int pcifront_attach_devices(struct pcifront_device *pdev) | |||
947 | xenbus_dev_error(pdev->xdev, err, | 951 | xenbus_dev_error(pdev->xdev, err, |
948 | "No PCI Roots found, trying 0000:00"); | 952 | "No PCI Roots found, trying 0000:00"); |
949 | err = pcifront_rescan_root(pdev, 0, 0); | 953 | err = pcifront_rescan_root(pdev, 0, 0); |
954 | if (err) { | ||
955 | xenbus_dev_fatal(pdev->xdev, err, | ||
956 | "Error scanning PCI root 0000:00"); | ||
957 | goto out; | ||
958 | } | ||
950 | num_roots = 0; | 959 | num_roots = 0; |
951 | } else if (err != 1) { | 960 | } else if (err != 1) { |
952 | if (err == 0) | 961 | if (err == 0) |
diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h index 2706ee9a4327..8c7895061121 100644 --- a/include/linux/pci_hotplug.h +++ b/include/linux/pci_hotplug.h | |||
@@ -109,7 +109,6 @@ struct hotplug_slot { | |||
109 | struct list_head slot_list; | 109 | struct list_head slot_list; |
110 | struct pci_slot *pci_slot; | 110 | struct pci_slot *pci_slot; |
111 | }; | 111 | }; |
112 | #define to_hotplug_slot(n) container_of(n, struct hotplug_slot, kobj) | ||
113 | 112 | ||
114 | static inline const char *hotplug_slot_name(const struct hotplug_slot *slot) | 113 | static inline const char *hotplug_slot_name(const struct hotplug_slot *slot) |
115 | { | 114 | { |