Bug 93561 - PCI bus needs to be rescanned for internal SD Card Reader to be recognized on Dell XPS 15 with EFI
Summary: PCI bus needs to be rescanned for internal SD Card Reader to be recognized on...
Status: NEEDINFO
Alias: None
Product: Drivers
Classification: Unclassified
Component: MMC/SD (show other bugs)
Hardware: x86-64 Linux
: P1 normal
Assignee: drivers_mmc-sd
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-20 18:35 UTC by Maarten Deprez
Modified: 2015-07-08 16:04 UTC (History)
1 user (show)

See Also:
Kernel Version: 3.18.1
Subsystem:
Regression: No
Bisected commit-id:


Attachments
Kernel Config (104.45 KB, text/plain)
2015-02-22 12:50 UTC, Maarten Deprez
Details
lspci -vvv before rescan (36.60 KB, text/plain)
2015-02-22 12:52 UTC, Maarten Deprez
Details
lspci -vvv after rescan (42.33 KB, text/plain)
2015-02-22 12:55 UTC, Maarten Deprez
Details
dmesg before rescan (72.44 KB, text/plain)
2015-02-22 12:56 UTC, Maarten Deprez
Details
dmesg after rescan (1.89 KB, text/plain)
2015-02-22 12:57 UTC, Maarten Deprez
Details
ACPI dump (241.10 KB, application/octet-stream)
2015-03-06 02:07 UTC, Maarten Deprez
Details
Dmesg with notes (80.25 KB, text/plain)
2015-03-06 14:25 UTC, Maarten Deprez
Details
add debug (2.57 KB, patch)
2015-03-10 03:03 UTC, Bjorn Helgaas
Details | Diff
_OSC debug patch (1.58 KB, patch)
2015-03-10 04:18 UTC, Bjorn Helgaas
Details | Diff

Description Maarten Deprez 2015-02-20 18:35:46 UTC
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.
Comment 1 Maarten Deprez 2015-02-22 12:50:31 UTC
Created attachment 167851 [details]
Kernel Config
Comment 2 Maarten Deprez 2015-02-22 12:52:35 UTC
Created attachment 167861 [details]
lspci -vvv before rescan
Comment 3 Maarten Deprez 2015-02-22 12:55:23 UTC
Created attachment 167871 [details]
lspci -vvv after rescan
Comment 4 Maarten Deprez 2015-02-22 12:56:16 UTC
Created attachment 167881 [details]
dmesg before rescan
Comment 5 Maarten Deprez 2015-02-22 12:57:05 UTC
Created attachment 167891 [details]
dmesg after rescan
Comment 6 Bjorn Helgaas 2015-03-04 21:49:19 UTC
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.
Comment 7 Maarten Deprez 2015-03-05 15:24:02 UTC
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.
Comment 8 Bjorn Helgaas 2015-03-05 16:09:54 UTC
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.
Comment 9 Maarten Deprez 2015-03-06 02:07:39 UTC
Created attachment 169451 [details]
ACPI dump
Comment 10 Maarten Deprez 2015-03-06 14:25:58 UTC
Created attachment 169561 [details]
Dmesg with notes
Comment 11 Bjorn Helgaas 2015-03-10 03:03:24 UTC
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.
Comment 12 Bjorn Helgaas 2015-03-10 04:18:04 UTC
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.
Comment 13 Bjorn Helgaas 2015-03-10 15:35:47 UTC
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?
Comment 14 Maarten Deprez 2015-03-16 19:40:03 UTC
Done. Btw, (another) card now works from the first time i insert it with the patch applied.
Comment 15 Bjorn Helgaas 2015-07-08 16:04:49 UTC
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.

Note You need to log in before you can comment on or make changes to this bug.