I first reported this problem in a comment to bug #44021. That bug was resolved; however the same symptoms as described are still present when booting in EFI mode from modified (unofficial) firmware. (Booting in EFI mode is disabled in official BIOSes.) Steps to reproduce: 1. Modify firmware of Dell XPS 15 (L502X) and enable EFI booting. 2. Do a fresh boot. 3. Insert an SD card in the internal card reader. 4. Noting happens. Expected: SD Card is recognized. Workaround: manually rescan pci bus (echo 1 > /sys/bus/pci/rescan) Note that this was not resolved by enabling CONFIG_HOTPLUG_PCI_PCIE as was suggested. Will add documentation as soon as i reboot.
Created attachment 167851 [details] Kernel Config
Created attachment 167861 [details] lspci -vvv before rescan
Created attachment 167871 [details] lspci -vvv after rescan
Created attachment 167881 [details] dmesg before rescan
Created attachment 167891 [details] dmesg after rescan
From your config: CONFIG_HOTPLUG_PCI_PCIE=y # CONFIG_HOTPLUG_PCI_ACPI is not set From your dmesg: acpi PNP0A08:00: _OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI] \_SB_.PCI0:_OSC invalid UUID _OSC request data:1 1f 0 acpi PNP0A08:00: _OSC failed (AE_ERROR); disabling ASPM I don't know what's up with the _OSC invalid UUID failure. This works correctly on most machines, so I don't know if Dell botched the UUID in their BIOS (hard to imagine) or what. If you attach a DSDT dump, we might be able to disassemble it and get a hint. Linux will not use PCIe native hotplug unless the platform grants us control via _OSC. _OSC failed, hence Linux does not have permission to use native hotplug. Try turning on CONFIG_HOTPLUG_PCI_ACPI. It's possible the BIOS expects to use ACPI hotplug and doesn't even intend to let us use PCIe native hotplug.
With CONFIG_HOTPLUG_PCI_ACPI, dmesg reports pci hotplug capability. When i insert an SD card, it produces some output and the card reader appears in the lspci listing, but the SD card is only recognised after removing it and inserting it again. In subsequent removal / insertion cycles everything works fine. * gzip -cd /proc/config.gz | grep HOTPLUG --> # CONFIG_MEMORY_HOTPLUG is not set CONFIG_HOTPLUG_CPU=y # CONFIG_BOOTPARAM_HOTPLUG_CPU0 is not set # CONFIG_DEBUG_HOTPLUG_CPU0 is not set CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y CONFIG_ACPI_HOTPLUG_CPU=y CONFIG_HOTPLUG_PCI_PCIE=y CONFIG_HOTPLUG_PCI=y CONFIG_HOTPLUG_PCI_ACPI=y # CONFIG_HOTPLUG_PCI_ACPI_IBM is not set # CONFIG_HOTPLUG_PCI_CPCI is not set CONFIG_HOTPLUG_PCI_SHPC=m * dmesg | grep _OSC --> acpi PNP0A08:00: _OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI] acpi PNP0A08:00: _OSC: OS now controls [PCIeHotplug PME AER PCIeCapability] * dmesg after inserting SD card --> [ 3823.979099] pci 0000:05:00.0: [197b:2392] type 00 class 0x088000 [ 3823.979148] pci 0000:05:00.0: reg 0x10: [mem 0x00000000-0x000000ff] [ 3823.979480] pci 0000:05:00.0: System wakeup disabled by ACPI [ 3823.979676] pci 0000:05:00.2: [197b:2391] type 00 class 0x080501 [ 3823.979713] pci 0000:05:00.2: reg 0x10: [mem 0x00000000-0x000000ff] [ 3823.980137] pci 0000:05:00.3: [197b:2393] type 00 class 0x088000 [ 3823.980185] pci 0000:05:00.3: reg 0x10: [mem 0x00000000-0x000000ff] [ 3823.980668] pci 0000:05:00.4: [197b:2394] type 00 class 0x088000 [ 3823.980707] pci 0000:05:00.4: reg 0x10: [mem 0x00000000-0x000000ff] [ 3823.982332] pci 0000:05:00.0: BAR 0: assigned [mem 0xf1900000-0xf19000ff] [ 3823.982349] pci 0000:05:00.2: BAR 0: assigned [mem 0xf1900100-0xf19001ff] [ 3823.982363] pci 0000:05:00.3: BAR 0: assigned [mem 0xf1900200-0xf19002ff] [ 3823.982376] pci 0000:05:00.4: BAR 0: assigned [mem 0xf1900300-0xf19003ff] [ 3824.830383] sdhci: Secure Digital Host Controller Interface driver [ 3824.830387] sdhci: Copyright(c) Pierre Ossman [ 3824.854135] sdhci-pci 0000:05:00.0: SDHCI controller found [197b:2392] (rev 30) [ 3824.854151] sdhci-pci 0000:05:00.0: enabling device (0000 -> 0002) [ 3824.854263] sdhci-pci 0000:05:00.0: No vmmc regulator found [ 3824.854266] sdhci-pci 0000:05:00.0: No vqmmc regulator found [ 3824.856003] mmc0: SDHCI controller on PCI [0000:05:00.0] using DMA [ 3824.856018] sdhci-pci 0000:05:00.2: SDHCI controller found [197b:2391] (rev 30) [ 3824.856031] sdhci-pci 0000:05:00.2: enabling device (0000 -> 0002) [ 3824.856075] sdhci-pci 0000:05:00.2: Refusing to bind to secondary interface. * lspci --> 05:00.0 System peripheral: JMicron Technology Corp. SD/MMC Host Controller (rev 30) 05:00.2 SD Host controller: JMicron Technology Corp. Standard SD Host Controller (rev 30) 05:00.3 System peripheral: JMicron Technology Corp. MS Host Controller (rev 30) 05:00.4 System peripheral: JMicron Technology Corp. xD Host Controller (rev 30) * dmesg after re-inserting the card --> [ 4583.047563] mmc0: new SDHC card at address 59b4 [ 4583.188798] Driver 'mmcblk' needs updating - please use bus_type methods [ 4583.188973] mmcblk0: mmc0:59b4 14.9 GiB [ 4583.191027] mmcblk0: p1 (removing card...) [ 4728.632523] mmc0: card 59b4 removed (inserting card...) [ 4734.455853] mmc0: new SDHC card at address 59b4 [ 4734.456118] mmcblk0: mmc0:59b4 14.9 GiB [ 4734.457561] mmcblk0: p1 (removing card...) [ 4738.620596] mmc0: card 59b4 removed So i suppose this is nearly resolved. I will test a few times on reboots to check if it the card needs to be double-inserted every time.
Hmm, it's very strange that _OSC failed when CONFIG_HOTPLUG_PCI_ACPI was not set, but worked fine when CONFIG_HOTPLUG_PCI_ACPI=y. That doesn't seem right to me. Can you attach a DSDT dump, please? Also, please attach the complete dmesg log from one of your reboots, along with notes ("inserted card, didn't work, removed card, inserted card, worked, etc.") so I can match the events up with the log.
Created attachment 169451 [details] ACPI dump
Created attachment 169561 [details] Dmesg with notes
Created attachment 170221 [details] add debug Thanks, Maarten. Can you try with this patch? It's not a fix, but the "error -123" is -ETIMEDOUT. I *think* this is more likely an SDHC issue than a PCI one now. But I still want to look at the _OSC thing, and it seems like we could emit better messages about how we're doing PCI hotplug.
Created attachment 170231 [details] _OSC debug patch Maarten, would you mind putting this patch in and doing two boots: one with CONFIG_HOTPLUG_PCI_ACPI not set, and another with CONFIG_HOTPLUG_PCI_ACPI=y? I looked at your DSDT and at the Linux code, and I don't see why _OSC would fail in the first case. It's OK to apply both debug patches at once.
Maarten, if you do the boots from comment #12 for the _OSC issue, can you attach the results to bug #94661 instead of here, so we can keep the _OSC issue separate from the SD card reader problem?
Done. Btw, (another) card now works from the first time i insert it with the patch applied.
Sorry I haven't been paying attention to this. It sounds like adding the msleeps works around the card recognition problem? I'm reassigning to MMC/SD on the assumption that this is a driver problem. If not, feel free to reassign it back.