Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'pci-v3.17-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci

Pull PCI fixes from Bjorn Helgaas:
"These fix:

- Boot video device detection on dual-GPU Apple systems
- Hotplug fiascos on VGA switcheroo with radeon & nouveau drivers
- Boot hang on Freescale i.MX6 systems
- Excessive "no hotplug settings from platform" warnings

In particular:

Enumeration
- Don't default exclusively to first video device (Bruno Prémont)

PCI device hotplug
- Remove "no hotplug settings from platform" warning (Bjorn Helgaas)
- Add pci_ignore_hotplug() for VGA switcheroo (Bjorn Helgaas)

Freescale i.MX6
- Put LTSSM in "Detect" state before disabling (Lucas Stach)"

* tag 'pci-v3.17-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci:
vgaarb: Drop obsolete #ifndef
vgaarb: Don't default exclusively to first video device with mem+io
ACPIPHP / radeon / nouveau: Remove acpi_bus_no_hotplug()
PCI: Remove "no hotplug settings from platform" warning
PCI: Add pci_ignore_hotplug() to ignore hotplug events for a device
PCI: imx6: Put LTSSM in "Detect" state before disabling it
MAINTAINERS: Add Lucas Stach as co-maintainer for i.MX6 PCI driver

+110 -114
+1 -1
MAINTAINERS
··· 6876 6876 6877 6877 PCI DRIVER FOR IMX6 6878 6878 M: Richard Zhu <r65037@freescale.com> 6879 - M: Shawn Guo <shawn.guo@freescale.com> 6879 + M: Lucas Stach <l.stach@pengutronix.de> 6880 6880 L: linux-pci@vger.kernel.org 6881 6881 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 6882 6882 S: Maintained
+1 -23
arch/ia64/pci/fixup.c
··· 38 38 return; 39 39 /* Maybe, this machine supports legacy memory map. */ 40 40 41 - if (!vga_default_device()) { 42 - resource_size_t start, end; 43 - int i; 44 - 45 - /* Does firmware framebuffer belong to us? */ 46 - for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { 47 - if (!(pci_resource_flags(pdev, i) & IORESOURCE_MEM)) 48 - continue; 49 - 50 - start = pci_resource_start(pdev, i); 51 - end = pci_resource_end(pdev, i); 52 - 53 - if (!start || !end) 54 - continue; 55 - 56 - if (screen_info.lfb_base >= start && 57 - (screen_info.lfb_base + screen_info.lfb_size) < end) 58 - vga_set_default_device(pdev); 59 - } 60 - } 61 - 62 41 /* Is VGA routed to us? */ 63 42 bus = pdev->bus; 64 43 while (bus) { ··· 62 83 pci_read_config_word(pdev, PCI_COMMAND, &config); 63 84 if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) { 64 85 pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW; 65 - dev_printk(KERN_DEBUG, &pdev->dev, "Boot video device\n"); 66 - vga_set_default_device(pdev); 86 + dev_printk(KERN_DEBUG, &pdev->dev, "Video device with shadowed ROM\n"); 67 87 } 68 88 } 69 89 }
+1 -23
arch/x86/pci/fixup.c
··· 326 326 struct pci_bus *bus; 327 327 u16 config; 328 328 329 - if (!vga_default_device()) { 330 - resource_size_t start, end; 331 - int i; 332 - 333 - /* Does firmware framebuffer belong to us? */ 334 - for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { 335 - if (!(pci_resource_flags(pdev, i) & IORESOURCE_MEM)) 336 - continue; 337 - 338 - start = pci_resource_start(pdev, i); 339 - end = pci_resource_end(pdev, i); 340 - 341 - if (!start || !end) 342 - continue; 343 - 344 - if (screen_info.lfb_base >= start && 345 - (screen_info.lfb_base + screen_info.lfb_size) < end) 346 - vga_set_default_device(pdev); 347 - } 348 - } 349 - 350 329 /* Is VGA routed to us? */ 351 330 bus = pdev->bus; 352 331 while (bus) { ··· 350 371 pci_read_config_word(pdev, PCI_COMMAND, &config); 351 372 if (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) { 352 373 pdev->resource[PCI_ROM_RESOURCE].flags |= IORESOURCE_ROM_SHADOW; 353 - dev_printk(KERN_DEBUG, &pdev->dev, "Boot video device\n"); 354 - vga_set_default_device(pdev); 374 + dev_printk(KERN_DEBUG, &pdev->dev, "Video device with shadowed ROM\n"); 355 375 } 356 376 } 357 377 }
-10
drivers/acpi/bus.c
··· 177 177 } 178 178 EXPORT_SYMBOL_GPL(acpi_bus_detach_private_data); 179 179 180 - void acpi_bus_no_hotplug(acpi_handle handle) 181 - { 182 - struct acpi_device *adev = NULL; 183 - 184 - acpi_bus_get_device(handle, &adev); 185 - if (adev) 186 - adev->flags.no_hotplug = true; 187 - } 188 - EXPORT_SYMBOL_GPL(acpi_bus_no_hotplug); 189 - 190 180 static void acpi_print_osc_error(acpi_handle handle, 191 181 struct acpi_osc_context *context, char *error) 192 182 {
+2 -14
drivers/gpu/drm/nouveau/nouveau_acpi.c
··· 46 46 bool dsm_detected; 47 47 bool optimus_detected; 48 48 acpi_handle dhandle; 49 - acpi_handle other_handle; 50 49 acpi_handle rom_handle; 51 50 } nouveau_dsm_priv; 52 51 ··· 221 222 if (!dhandle) 222 223 return false; 223 224 224 - if (!acpi_has_method(dhandle, "_DSM")) { 225 - nouveau_dsm_priv.other_handle = dhandle; 225 + if (!acpi_has_method(dhandle, "_DSM")) 226 226 return false; 227 - } 227 + 228 228 if (acpi_check_dsm(dhandle, nouveau_dsm_muid, 0x00000102, 229 229 1 << NOUVEAU_DSM_POWER)) 230 230 retval |= NOUVEAU_DSM_HAS_MUX; ··· 299 301 printk(KERN_INFO "VGA switcheroo: detected DSM switching method %s handle\n", 300 302 acpi_method_name); 301 303 nouveau_dsm_priv.dsm_detected = true; 302 - /* 303 - * On some systems hotplug events are generated for the device 304 - * being switched off when _DSM is executed. They cause ACPI 305 - * hotplug to trigger and attempt to remove the device from 306 - * the system, which causes it to break down. Prevent that from 307 - * happening by setting the no_hotplug flag for the involved 308 - * ACPI device objects. 309 - */ 310 - acpi_bus_no_hotplug(nouveau_dsm_priv.dhandle); 311 - acpi_bus_no_hotplug(nouveau_dsm_priv.other_handle); 312 304 ret = true; 313 305 } 314 306
+1
drivers/gpu/drm/nouveau/nouveau_drm.c
··· 627 627 628 628 pci_save_state(pdev); 629 629 pci_disable_device(pdev); 630 + pci_ignore_hotplug(pdev); 630 631 pci_set_power_state(pdev, PCI_D3hot); 631 632 return 0; 632 633 }
+2 -14
drivers/gpu/drm/radeon/radeon_atpx_handler.c
··· 33 33 bool atpx_detected; 34 34 /* handle for device - and atpx */ 35 35 acpi_handle dhandle; 36 - acpi_handle other_handle; 37 36 struct radeon_atpx atpx; 38 37 } radeon_atpx_priv; 39 38 ··· 452 453 return false; 453 454 454 455 status = acpi_get_handle(dhandle, "ATPX", &atpx_handle); 455 - if (ACPI_FAILURE(status)) { 456 - radeon_atpx_priv.other_handle = dhandle; 456 + if (ACPI_FAILURE(status)) 457 457 return false; 458 - } 458 + 459 459 radeon_atpx_priv.dhandle = dhandle; 460 460 radeon_atpx_priv.atpx.handle = atpx_handle; 461 461 return true; ··· 538 540 printk(KERN_INFO "VGA switcheroo: detected switching method %s handle\n", 539 541 acpi_method_name); 540 542 radeon_atpx_priv.atpx_detected = true; 541 - /* 542 - * On some systems hotplug events are generated for the device 543 - * being switched off when ATPX is executed. They cause ACPI 544 - * hotplug to trigger and attempt to remove the device from 545 - * the system, which causes it to break down. Prevent that from 546 - * happening by setting the no_hotplug flag for the involved 547 - * ACPI device objects. 548 - */ 549 - acpi_bus_no_hotplug(radeon_atpx_priv.dhandle); 550 - acpi_bus_no_hotplug(radeon_atpx_priv.other_handle); 551 543 return true; 552 544 } 553 545 return false;
+1
drivers/gpu/drm/radeon/radeon_drv.c
··· 440 440 ret = radeon_suspend_kms(drm_dev, false, false); 441 441 pci_save_state(pdev); 442 442 pci_disable_device(pdev); 443 + pci_ignore_hotplug(pdev); 443 444 pci_set_power_state(pdev, PCI_D3cold); 444 445 drm_dev->switch_power_state = DRM_SWITCH_POWER_DYNAMIC_OFF; 445 446
+37 -9
drivers/gpu/vga/vgaarb.c
··· 41 41 #include <linux/poll.h> 42 42 #include <linux/miscdevice.h> 43 43 #include <linux/slab.h> 44 + #include <linux/screen_info.h> 44 45 45 46 #include <linux/uaccess.h> 46 47 ··· 113 112 return 1; 114 113 } 115 114 116 - #ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE 117 115 /* this is only used a cookie - it should not be dereferenced */ 118 116 static struct pci_dev *vga_default; 119 - #endif 120 117 121 118 static void vga_arb_device_card_gone(struct pci_dev *pdev); 122 119 ··· 130 131 } 131 132 132 133 /* Returns the default VGA device (vgacon's babe) */ 133 - #ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE 134 134 struct pci_dev *vga_default_device(void) 135 135 { 136 136 return vga_default; ··· 145 147 pci_dev_put(vga_default); 146 148 vga_default = pci_dev_get(pdev); 147 149 } 148 - #endif 149 150 150 151 static inline void vga_irq_set_state(struct vga_device *vgadev, bool state) 151 152 { ··· 580 583 /* Deal with VGA default device. Use first enabled one 581 584 * by default if arch doesn't have it's own hook 582 585 */ 583 - #ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE 584 586 if (vga_default == NULL && 585 - ((vgadev->owns & VGA_RSRC_LEGACY_MASK) == VGA_RSRC_LEGACY_MASK)) 587 + ((vgadev->owns & VGA_RSRC_LEGACY_MASK) == VGA_RSRC_LEGACY_MASK)) { 588 + pr_info("vgaarb: setting as boot device: PCI:%s\n", 589 + pci_name(pdev)); 586 590 vga_set_default_device(pdev); 587 - #endif 591 + } 588 592 589 593 vga_arbiter_check_bridge_sharing(vgadev); 590 594 ··· 619 621 goto bail; 620 622 } 621 623 622 - #ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE 623 624 if (vga_default == pdev) 624 625 vga_set_default_device(NULL); 625 - #endif 626 626 627 627 if (vgadev->decodes & (VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM)) 628 628 vga_decode_count--; ··· 1316 1320 pr_info("vgaarb: loaded\n"); 1317 1321 1318 1322 list_for_each_entry(vgadev, &vga_list, list) { 1323 + #if defined(CONFIG_X86) || defined(CONFIG_IA64) 1324 + /* Override I/O based detection done by vga_arbiter_add_pci_device() 1325 + * as it may take the wrong device (e.g. on Apple system under EFI). 1326 + * 1327 + * Select the device owning the boot framebuffer if there is one. 1328 + */ 1329 + resource_size_t start, end; 1330 + int i; 1331 + 1332 + /* Does firmware framebuffer belong to us? */ 1333 + for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { 1334 + if (!(pci_resource_flags(vgadev->pdev, i) & IORESOURCE_MEM)) 1335 + continue; 1336 + 1337 + start = pci_resource_start(vgadev->pdev, i); 1338 + end = pci_resource_end(vgadev->pdev, i); 1339 + 1340 + if (!start || !end) 1341 + continue; 1342 + 1343 + if (screen_info.lfb_base < start || 1344 + (screen_info.lfb_base + screen_info.lfb_size) >= end) 1345 + continue; 1346 + if (!vga_default_device()) 1347 + pr_info("vgaarb: setting as boot device: PCI:%s\n", 1348 + pci_name(vgadev->pdev)); 1349 + else if (vgadev->pdev != vga_default_device()) 1350 + pr_info("vgaarb: overriding boot device: PCI:%s\n", 1351 + pci_name(vgadev->pdev)); 1352 + vga_set_default_device(vgadev->pdev); 1353 + } 1354 + #endif 1319 1355 if (vgadev->bridge_has_one_vga) 1320 1356 pr_info("vgaarb: bridge control possible %s\n", pci_name(vgadev->pdev)); 1321 1357 else
+38
drivers/pci/host/pci-imx6.c
··· 49 49 50 50 /* PCIe Port Logic registers (memory-mapped) */ 51 51 #define PL_OFFSET 0x700 52 + #define PCIE_PL_PFLR (PL_OFFSET + 0x08) 53 + #define PCIE_PL_PFLR_LINK_STATE_MASK (0x3f << 16) 54 + #define PCIE_PL_PFLR_FORCE_LINK (1 << 15) 52 55 #define PCIE_PHY_DEBUG_R0 (PL_OFFSET + 0x28) 53 56 #define PCIE_PHY_DEBUG_R1 (PL_OFFSET + 0x2c) 54 57 #define PCIE_PHY_DEBUG_R1_XMLH_LINK_IN_TRAINING (1 << 29) ··· 217 214 static int imx6_pcie_assert_core_reset(struct pcie_port *pp) 218 215 { 219 216 struct imx6_pcie *imx6_pcie = to_imx6_pcie(pp); 217 + u32 val, gpr1, gpr12; 218 + 219 + /* 220 + * If the bootloader already enabled the link we need some special 221 + * handling to get the core back into a state where it is safe to 222 + * touch it for configuration. As there is no dedicated reset signal 223 + * wired up for MX6QDL, we need to manually force LTSSM into "detect" 224 + * state before completely disabling LTSSM, which is a prerequisite 225 + * for core configuration. 226 + * 227 + * If both LTSSM_ENABLE and REF_SSP_ENABLE are active we have a strong 228 + * indication that the bootloader activated the link. 229 + */ 230 + regmap_read(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, &gpr1); 231 + regmap_read(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, &gpr12); 232 + 233 + if ((gpr1 & IMX6Q_GPR1_PCIE_REF_CLK_EN) && 234 + (gpr12 & IMX6Q_GPR12_PCIE_CTL_2)) { 235 + val = readl(pp->dbi_base + PCIE_PL_PFLR); 236 + val &= ~PCIE_PL_PFLR_LINK_STATE_MASK; 237 + val |= PCIE_PL_PFLR_FORCE_LINK; 238 + writel(val, pp->dbi_base + PCIE_PL_PFLR); 239 + 240 + regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, 241 + IMX6Q_GPR12_PCIE_CTL_2, 0 << 10); 242 + } 220 243 221 244 regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, 222 245 IMX6Q_GPR1_PCIE_TEST_PD, 1 << 18); ··· 618 589 return 0; 619 590 } 620 591 592 + static void imx6_pcie_shutdown(struct platform_device *pdev) 593 + { 594 + struct imx6_pcie *imx6_pcie = platform_get_drvdata(pdev); 595 + 596 + /* bring down link, so bootloader gets clean state in case of reboot */ 597 + imx6_pcie_assert_core_reset(&imx6_pcie->pp); 598 + } 599 + 621 600 static const struct of_device_id imx6_pcie_of_match[] = { 622 601 { .compatible = "fsl,imx6q-pcie", }, 623 602 {}, ··· 638 601 .owner = THIS_MODULE, 639 602 .of_match_table = imx6_pcie_of_match, 640 603 }, 604 + .shutdown = imx6_pcie_shutdown, 641 605 }; 642 606 643 607 /* Freescale PCIe driver does not allow module unload */
+6 -10
drivers/pci/hotplug/acpiphp_glue.c
··· 560 560 slot->flags &= (~SLOT_ENABLED); 561 561 } 562 562 563 - static bool acpiphp_no_hotplug(struct acpi_device *adev) 564 - { 565 - return adev && adev->flags.no_hotplug; 566 - } 567 - 568 563 static bool slot_no_hotplug(struct acpiphp_slot *slot) 569 564 { 570 - struct acpiphp_func *func; 565 + struct pci_bus *bus = slot->bus; 566 + struct pci_dev *dev; 571 567 572 - list_for_each_entry(func, &slot->funcs, sibling) 573 - if (acpiphp_no_hotplug(func_to_acpi_device(func))) 568 + list_for_each_entry(dev, &bus->devices, bus_list) { 569 + if (PCI_SLOT(dev->devfn) == slot->device && dev->ignore_hotplug) 574 570 return true; 575 - 571 + } 576 572 return false; 577 573 } 578 574 ··· 641 645 642 646 status = acpi_evaluate_integer(adev->handle, "_STA", NULL, &sta); 643 647 alive = (ACPI_SUCCESS(status) && device_status_valid(sta)) 644 - || acpiphp_no_hotplug(adev); 648 + || dev->ignore_hotplug; 645 649 } 646 650 if (!alive) 647 651 alive = pci_device_is_present(dev);
+12
drivers/pci/hotplug/pciehp_hpc.c
··· 506 506 { 507 507 struct controller *ctrl = (struct controller *)dev_id; 508 508 struct pci_dev *pdev = ctrl_dev(ctrl); 509 + struct pci_bus *subordinate = pdev->subordinate; 510 + struct pci_dev *dev; 509 511 struct slot *slot = ctrl->slot; 510 512 u16 detected, intr_loc; 511 513 ··· 539 537 ctrl->cmd_busy = 0; 540 538 smp_mb(); 541 539 wake_up(&ctrl->queue); 540 + } 541 + 542 + if (subordinate) { 543 + list_for_each_entry(dev, &subordinate->devices, bus_list) { 544 + if (dev->ignore_hotplug) { 545 + ctrl_dbg(ctrl, "ignoring hotplug event %#06x (%s requested no hotplug)\n", 546 + intr_loc, pci_name(dev)); 547 + return IRQ_HANDLED; 548 + } 549 + } 542 550 } 543 551 544 552 if (!(intr_loc & ~PCI_EXP_SLTSTA_CC))
+1 -5
drivers/pci/hotplug/pcihp_slot.c
··· 46 46 */ 47 47 if (pci_is_pcie(dev)) 48 48 return; 49 - dev_info(&dev->dev, "using default PCI settings\n"); 50 49 hpp = &pci_default_type0; 51 50 } 52 51 ··· 152 153 { 153 154 struct pci_dev *cdev; 154 155 struct hotplug_params hpp; 155 - int ret; 156 156 157 157 if (!(dev->hdr_type == PCI_HEADER_TYPE_NORMAL || 158 158 (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE && ··· 161 163 pcie_bus_configure_settings(dev->bus); 162 164 163 165 memset(&hpp, 0, sizeof(hpp)); 164 - ret = pci_get_hp_params(dev, &hpp); 165 - if (ret) 166 - dev_warn(&dev->dev, "no hotplug settings from platform\n"); 166 + pci_get_hp_params(dev, &hpp); 167 167 168 168 program_hpp_type2(dev, hpp.t2); 169 169 program_hpp_type1(dev, hpp.t1);
+1 -3
include/acpi/acpi_bus.h
··· 204 204 u32 match_driver:1; 205 205 u32 initialized:1; 206 206 u32 visited:1; 207 - u32 no_hotplug:1; 208 207 u32 hotplug_notify:1; 209 208 u32 is_dock_station:1; 210 - u32 reserved:22; 209 + u32 reserved:23; 211 210 }; 212 211 213 212 /* File System */ ··· 410 411 int acpi_bus_get_private_data(acpi_handle, void **); 411 412 int acpi_bus_attach_private_data(acpi_handle, void *); 412 413 void acpi_bus_detach_private_data(acpi_handle); 413 - void acpi_bus_no_hotplug(acpi_handle handle); 414 414 extern int acpi_notifier_call_chain(struct acpi_device *, u32, u32); 415 415 extern int register_acpi_notifier(struct notifier_block *); 416 416 extern int unregister_acpi_notifier(struct notifier_block *);
+6
include/linux/pci.h
··· 303 303 D3cold, not set for devices 304 304 powered on/off by the 305 305 corresponding bridge */ 306 + unsigned int ignore_hotplug:1; /* Ignore hotplug events */ 306 307 unsigned int d3_delay; /* D3->D0 transition time in ms */ 307 308 unsigned int d3cold_delay; /* D3cold->D0 transition time in ms */ 308 309 ··· 1021 1020 bool pci_dev_run_wake(struct pci_dev *dev); 1022 1021 bool pci_check_pme_status(struct pci_dev *dev); 1023 1022 void pci_pme_wakeup_bus(struct pci_bus *bus); 1023 + 1024 + static inline void pci_ignore_hotplug(struct pci_dev *dev) 1025 + { 1026 + dev->ignore_hotplug = 1; 1027 + } 1024 1028 1025 1029 static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state, 1026 1030 bool enable)
-2
include/linux/vgaarb.h
··· 182 182 * vga_get()... 183 183 */ 184 184 185 - #ifndef __ARCH_HAS_VGA_DEFAULT_DEVICE 186 185 #ifdef CONFIG_VGA_ARB 187 186 extern struct pci_dev *vga_default_device(void); 188 187 extern void vga_set_default_device(struct pci_dev *pdev); 189 188 #else 190 189 static inline struct pci_dev *vga_default_device(void) { return NULL; }; 191 190 static inline void vga_set_default_device(struct pci_dev *pdev) { }; 192 - #endif 193 191 #endif 194 192 195 193 /**