Bug 200717

Summary: mmc1: error -110 doing runtime resume
Product: Drivers Reporter: youling257
Component: MMC/SDAssignee: drivers_mmc-sd
Status: NEW ---    
Severity: normal CC: adrian.hunter, jwrdegoede, Kitsune2222, vaaghoofdharry
Priority: P1    
Hardware: Intel   
OS: Linux   
Kernel Version: 4.18 Subsystem:
Regression: No Bisected commit-id:
Attachments: dmesg
config
dsdt
Android dmesg

Description youling257 2018-08-03 11:22:03 UTC
my BYTCR z3735f tablet mmc is on acpi,
/sys/bus/platform/drivers/sdhci-acpi/80860F14:00/mmc_host/mmc1

now,BYTCR can reach s0i3 state,
cat /sys/kernel/debug/pmc_atom/sleep_state
S0IR Residency: 512us
S0I1 Residency: 576us
S0I2 Residency: 9696us
S0I3 Residency: 2824192us
S0   Residency: 10737944320us

but resume failed,auto reboot,

mmc1: error -110 doing runtime resume
[cut here]
bdi-block not register
call trace:
_set_page_dirty
Comment 1 youling257 2018-08-03 11:25:13 UTC
f8870ae6e2d6be75b1accc2db981169fdfbea7ab mmc: sdhci-pci: Fix S0i3 for Intel BYT-based controllers

my BYTCR mmc is on sdhci-acpi.
Comment 2 Adrian Hunter 2018-08-22 09:01:40 UTC
Please provide complete kernel messages (dmesg output).  Is there a kernel version that does not experience this problem?
Comment 3 youling257 2018-08-22 11:22:56 UTC
(In reply to Adrian Hunter from comment #2)
> Please provide complete kernel messages (dmesg output).  Is there a kernel
> version that does not experience this problem?

Revert "ACPI / LPSS: Avoid PM quirks on suspend and resume from hibernation",no this problem.
4.18 rc7 no this problem.

with ACPI / LPSS: Avoid PM quirks on suspend and resume from hibernation,we can reach s0i3 state on z3735f.

if you think this is s0ix problem,not emmc problem.
Comment 4 youling257 2018-08-22 11:26:40 UTC
(In reply to Adrian Hunter from comment #2)
> Please provide complete kernel messages (dmesg output).  Is there a kernel
> version that does not experience this problem?

<6>[ 161.997610] Freezing user space processes ... (elapsed 0.001 seconds) done.
<6>[ 161.999338] OOM killer disabled.
<6>[ 161.999398] Freezing remaining freezable tasks ... (elapsed 0.001
seconds) done.
<6>[ 162.000820] Suspending console(s) (use no_console_suspend to debug)
<6>[ 162.001264] rt5640 i2c-10EC5640:00: disabling jack detect before suspend
<6>[ 162.016990] android_work: did not send uevent (0 0 (null))
<6>[ 162.018206] serial 00:02: disabled
<7>[ 162.018245] rtc_cmos 00:00: suspend, alarm may wake, ctrl 22
<5>[ 162.023160] sd 0:0:0:0: [sda] Synchronizing SCSI cache
<4>[ 164.440277] mmc0: error -110 during resume (card was removed?)
<3>[ 164.440587] dpm_run_callback(): rtw_sdio_resume+0x0/0x70
[r8723bs] returns -1
<3>[ 164.440607] PM: Device mmc0:0001:1 failed to resume async: error -1
<3>[ 164.491335] rtc_cmos 00:00: Could not get RTC status
<7>[ 164.491351] rtc_cmos 00:00: resume, ctrl 22
<3>[ 164.548230] dwc3 dwc3.3.auto: failed to enable ep0out
<6>[ 164.818687] rt5640 i2c-10EC5640:00: re-enabling jack detect after resume
<6>[ 164.819958] rt5640 i2c-10EC5640:00: irq status 0x110
<6>[ 164.847715] OOM killer enabled.
<6>[ 164.847770] Restarting tasks ... done.
<6>[ 164.852076] PM: suspend exit

<3>[ 166.266787] mmc2: card never left busy state
<3>[ 166.266864] mmc2: error -110 doing runtime resume
<6>[ 166.268370] mmc2: card 59b4 removed

<3>[ 166.415248] mmc1: error -110 doing runtime resume

<3>[ 167.724788] mmc2: card never left busy state
<3>[ 167.733567] mmc2: error -110 whilst initialising SD card

<3>[ 171.928786] mmc2: card never left busy state
<3>[ 171.928862] mmc2: error -110 whilst initialising SD card
<3>[ 176.673780] mmc1: Timeout waiting for hardware interrupt.
<3>[ 176.673871] mmc1: sdhci: ============ SDHCI REGISTER DUMP ===========
<3>[ 176.673958] mmc1: sdhci: Sys addr: 0x00000020 | Version: 0x00001002
<3>[ 176.674043] mmc1: sdhci: Blk size: 0x00007200 | Blk cnt: 0x00000020
<3>[ 176.674127] mmc1: sdhci: Argument: 0x0703d270 | Trn mode: 0x0000002b
<3>[ 176.674210] mmc1: sdhci: Present: 0x1fff0001 | Host ctl: 0x00000011
<3>[ 176.674294] mmc1: sdhci: Power: 0x0000000b | Blk gap: 0x00000080
<3>[ 176.674378] mmc1: sdhci: Wake-up: 0x00000000 | Clock: 0x0000fa07
<3>[ 176.674461] mmc1: sdhci: Timeout: 0x00000000 | Int stat: 0x00000000
<3>[ 176.674545] mmc1: sdhci: Int enab: 0x02ff000b | Sig enab: 0x02ff000b
<3>[ 176.674629] mmc1: sdhci: AC12 err: 0x00000000 | Slot int: 0x00000000
<3>[ 176.674712] mmc1: sdhci: Caps: 0x446cc801 | Caps_1: 0x00000807
<3>[ 176.674796] mmc1: sdhci: Cmd: 0x0000193a | Max curr: 0x00000000
<3>[ 176.674880] mmc1: sdhci: Resp[0]: 0x00000000 | Resp[1]: 0x00000000
<3>[ 176.674964] mmc1: sdhci: Resp[2]: 0x00000000 | Resp[3]: 0x00000000
<3>[ 176.675047] mmc1: sdhci: Host ctl2: 0x00000000
<3>[ 176.675108] mmc1: sdhci: ADMA Err: 0x00000000 | ADMA Ptr: 0x37072200
<3>[ 176.675190] mmc1: sdhci: ============================================
<3>[ 176.682513] mmcblk1: error -110 requesting status
<3>[ 176.684204] mmc1: cache flush error -110
<4>[ 176.689193] mmc1: tried to HW reset card, got error -110
<3>[ 176.689270] mmcblk1: recovery failed!
Comment 5 Adrian Hunter 2018-08-22 11:40:04 UTC
I would really like to see all the kernel messages i.e. do dmesg > kernel_messages.txt and attach it to this bug.

Are you using a particular linux distribution?
Comment 6 youling257 2018-08-22 12:06:50 UTC
(In reply to Adrian Hunter from comment #5)
> I would really like to see all the kernel messages i.e. do dmesg >
> kernel_messages.txt and attach it to this bug.
> 
> Are you using a particular linux distribution?

so you doubt my userspace problem,i tell you must solve problem from kernel.
you need what my kernel info,i build 4.18.4 kernel using GCC 8,do you need my kernel config.

i tell you my userspace is Androidx86,running Linux mainline kernel on Androidx86 project.

if you despise Androidx86 project.
Comment 7 youling257 2018-08-22 12:10:21 UTC
(In reply to Adrian Hunter from comment #5)
> I would really like to see all the kernel messages i.e. do dmesg >
> kernel_messages.txt and attach it to this bug.
> 
> Are you using a particular linux distribution?

chen yu despise Androidx86 project,https://bugzilla.kernel.org/show_bug.cgi?id=199309#c2 https://bugzilla.kernel.org/show_bug.cgi?id=199135#c1
Comment 8 youling257 2018-08-22 12:18:06 UTC
Created attachment 278023 [details]
dmesg

(In reply to Adrian Hunter from comment #5)
> I would really like to see all the kernel messages i.e. do dmesg >
> kernel_messages.txt and attach it to this bug.
> 
> Are you using a particular linux distribution?
Comment 9 Adrian Hunter 2018-08-22 12:31:19 UTC
Thanks for the dmesg.  Yes please attach the kernel config also.
Comment 10 youling257 2018-08-22 12:40:32 UTC
Created attachment 278025 [details]
config

(In reply to Adrian Hunter from comment #9)
> Thanks for the dmesg.  Yes please attach the kernel config also.
Comment 11 youling257 2018-08-31 14:42:40 UTC
Created attachment 278215 [details]
dsdt
Comment 12 Hans de Goede 2018-09-03 20:35:42 UTC
Hi,

I've been working on fixing S0ix support for most Bay and Cherry Trail devices recently. I've a Windows only (non dual boot) version of the ONDA V891w myself (BIOS version ONDA.W89EBBN08) and with my v4.18-footrail branch, which contains a number of SOix related fixes suspend/resume including S0ix works fine on this device for me:

https://github.com/jwrdegoede/linux-sunxi/tree/v4.18-footrail

The following patches on top of 4.18.x are relevant for this:

1) A fix for the i2c controller connected to the PMIC
no longer working after suspend/resume:

https://github.com/jwrdegoede/linux-sunxi/commit/49ae76ac49f104fd06a96b7e41c5c02991a33684

2) A set of fixes to make sure the PMC clocks are disabled during boot

https://github.com/jwrdegoede/linux-sunxi/commit/21727f53891a3b7162474680a3ad7725a1b19308
https://github.com/jwrdegoede/linux-sunxi/commit/1c0f485edb8bdc0def5ba4aebe394bf11e207d16
https://github.com/jwrdegoede/linux-sunxi/commit/a2290d4ab214753162f3d89d4e72921ca22f46ad

I think the first patch should fix the MMC issues you are seeing.

It would be good if you can test 4.18 with these patches added and report if this fixes things for you.

Regards,

Hans
Comment 13 youling257 2018-09-04 02:28:20 UTC
(In reply to Hans de Goede from comment #12)
> Hi,
> 
> I've been working on fixing S0ix support for most Bay and Cherry Trail
> devices recently. I've a Windows only (non dual boot) version of the ONDA
> V891w myself (BIOS version ONDA.W89EBBN08) and with my v4.18-footrail
> branch, which contains a number of SOix related fixes suspend/resume
> including S0ix works fine on this device for me:
> 
> https://github.com/jwrdegoede/linux-sunxi/tree/v4.18-footrail
> 
> The following patches on top of 4.18.x are relevant for this:
> 
> 1) A fix for the i2c controller connected to the PMIC
> no longer working after suspend/resume:
> 
> https://github.com/jwrdegoede/linux-sunxi/commit/
> 49ae76ac49f104fd06a96b7e41c5c02991a33684
> 
> 2) A set of fixes to make sure the PMC clocks are disabled during boot
> 
> https://github.com/jwrdegoede/linux-sunxi/commit/
> 21727f53891a3b7162474680a3ad7725a1b19308
> https://github.com/jwrdegoede/linux-sunxi/commit/
> 1c0f485edb8bdc0def5ba4aebe394bf11e207d16
> https://github.com/jwrdegoede/linux-sunxi/commit/
> a2290d4ab214753162f3d89d4e72921ca22f46ad
> 
> I think the first patch should fix the MMC issues you are seeing.
> 
> It would be good if you can test 4.18 with these patches added and report if
> this fixes things for you.
> 
> Regards,
> 
> Hans

I refresh your master branch everyday,i tested your patch first time,no help for me.
Comment 14 youling257 2018-09-04 02:35:05 UTC
no people see this problem on linux distribution,until someone can reproduce this problem.
Comment 15 youling257 2018-09-04 08:14:55 UTC
# cat /sys/devices/LNXSYSTM:00/LNXSYBUS:00/80860F14:00/power_state
D3hot
# cat /sys/devices/LNXSYSTM:00/LNXSYBUS:00/80860F14:02/power_state
D3hot
# cat /sys/devices/LNXSYSTM:00/LNXSYBUS:00/INT33BB:00/power_state
D0

I want to change 80860F14:02/power_state and 80860F14:00/power_state to D0.
Comment 16 youling257 2018-09-04 18:04:58 UTC
many Insyde bios Dual os z3735f tablet,insyde setup utility,default os selection,Windows or Android.

select Android,save&exit,then boot grub,boot my linux os,suspend/resume can't reach s0i3,and has "mmc2: Tuning timeout, falling back to fixed sampling clock" problem,

above mmc1 resume error problem happen with bios setting select Windows,and must bios setting select windows can reach s0i3.
Comment 17 Hans de Goede 2018-09-05 05:08:07 UTC
I've tested using the "Android" setting on my Chuwi Vi8 (CWI513) which is the only Bay Trail device I have which has this setting.

Indeed it no longer reaches S0i3, looking at the output of:

https://github.com/jwrdegoede/linux-sunxi/commit/c95aa27c3db080189708be6a1442ec40fa512742

I believe this is caused by the SS OTG phy which is in D0 under the "Android" settings and not under the "Windows" settings. I also get a bunch of i2c devices reported / registered by the firmware which are simply just not there at all.

All in all it seems better to just use the "Windows" settings.

I know that you are seeing the MMC problems using Android-x86.

Can you give me instructions for installing Android-x86 to an USB disk?

And can you give me instructions how to replace the kernel which comes with Android-x86 with my own kernel ?

I need both of these to try and reproduce (and fix) this.
Comment 18 youling257 2018-09-05 06:47:26 UTC
(In reply to Hans de Goede from comment #17)
> I've tested using the "Android" setting on my Chuwi Vi8 (CWI513) which is
> the only Bay Trail device I have which has this setting.
> 
> Indeed it no longer reaches S0i3, looking at the output of:
> 
> https://github.com/jwrdegoede/linux-sunxi/commit/
> c95aa27c3db080189708be6a1442ec40fa512742
> 
> I believe this is caused by the SS OTG phy which is in D0 under the
> "Android" settings and not under the "Windows" settings. I also get a bunch
> of i2c devices reported / registered by the firmware which are simply just
> not there at all.
> 
> All in all it seems better to just use the "Windows" settings.
> 
> I know that you are seeing the MMC problems using Android-x86.
> 
> Can you give me instructions for installing Android-x86 to an USB disk?
> 
> And can you give me instructions how to replace the kernel which comes with
> Android-x86 with my own kernel ?
> 
> I need both of these to try and reproduce (and fix) this.

comment 4 is boot live from u disk,emmc no mounted,also will resume error,
"sd 0:0:0:0: [sda] Synchronizing SCSI cache" is u disk.
Comment 19 youling257 2018-09-05 07:05:17 UTC
(In reply to Hans de Goede from comment #17)
> I've tested using the "Android" setting on my Chuwi Vi8 (CWI513) which is
> the only Bay Trail device I have which has this setting.
> 
> Indeed it no longer reaches S0i3, looking at the output of:
> 
> https://github.com/jwrdegoede/linux-sunxi/commit/
> c95aa27c3db080189708be6a1442ec40fa512742
> 
> I believe this is caused by the SS OTG phy which is in D0 under the
> "Android" settings and not under the "Windows" settings. I also get a bunch
> of i2c devices reported / registered by the firmware which are simply just
> not there at all.
> 
> All in all it seems better to just use the "Windows" settings.
> 
> I know that you are seeing the MMC problems using Android-x86.
> 
> Can you give me instructions for installing Android-x86 to an USB disk?
> 
> And can you give me instructions how to replace the kernel which comes with
> Android-x86 with my own kernel ?
> 
> I need both of these to try and reproduce (and fix) this.

build Android x86 kernel,https://github.com/youling257/android-4.9/commit/dedc404917f0e494e350096bc7084200252f17d4,"drm: disable permission check" is important.
kernel config Android part,CONFIG_ASHMEM=y 
CONFIG_ANDROID=y
CONFIG_ANDROID_BINDER_IPC=y
CONFIG_ANDROID_BINDER_DEVICES="binder,hwbinder,vndbinder"

"make targz-pkg -j4" command get linux-4.19.0-rc2-android-x86_64+-x86.tar.gz
boot/vmlinuz-4.19.0-rc2-android-x86_64+ replace Androidx86 kernel,
lib/modules/4.19.0-rc2-android-x86_64+ copy to Androidx86 system/lib/modules

you need to know Androidx86 file list,just a folder,we call SRC,kernel command line SRC=w,SRC=q,……
you can mkdir 'SRC' folder on a ext4/f2fs partition,
Androidx86 system、data、ramdisk.img、initrd.img、kernel in SRC folder.
Comment 20 Hans de Goede 2018-09-09 13:29:55 UTC
Thank you for the info on how to test Android X86. I'm not sure if I will be able to make time for this any time soon though.

I've done another related fix recently:

https://github.com/jwrdegoede/linux-sunxi/commit/ff5199cca643d67bb5fe46334d8b89593f534bd6

This applies on top of:
https://github.com/jwrdegoede/linux-sunxi/commit/49ae76ac49f104fd06a96b7e41c5c02991a33684

Which I assume you are already using and another patch.

So in total you need to add these 3 patches on top of 4.18.x:

https://github.com/jwrdegoede/linux-sunxi/commit/49ae76ac49f104fd06a96b7e41c5c02991a33684
https://github.com/jwrdegoede/linux-sunxi/commit/3d98415f0ccd906b0a1a8d080ceb861885dca23b
https://github.com/jwrdegoede/linux-sunxi/commit/ff5199cca643d67bb5fe46334d8b89593f534bd6

Please give this a try and let me know if it resolves the mmc resume issue under android-x86.
Comment 21 youling257 2018-09-09 14:54:12 UTC
(In reply to Hans de Goede from comment #20)
> Thank you for the info on how to test Android X86. I'm not sure if I will be
> able to make time for this any time soon though.
> 
> I've done another related fix recently:
> 
> https://github.com/jwrdegoede/linux-sunxi/commit/
> ff5199cca643d67bb5fe46334d8b89593f534bd6
> 
> This applies on top of:
> https://github.com/jwrdegoede/linux-sunxi/commit/
> 49ae76ac49f104fd06a96b7e41c5c02991a33684
> 
> Which I assume you are already using and another patch.
> 
> So in total you need to add these 3 patches on top of 4.18.x:
> 
> https://github.com/jwrdegoede/linux-sunxi/commit/
> 49ae76ac49f104fd06a96b7e41c5c02991a33684
> https://github.com/jwrdegoede/linux-sunxi/commit/
> 3d98415f0ccd906b0a1a8d080ceb861885dca23b
> https://github.com/jwrdegoede/linux-sunxi/commit/
> ff5199cca643d67bb5fe46334d8b89593f534bd6
> 
> Please give this a try and let me know if it resolves the mmc resume issue
> under android-x86.

look https://bugzilla.kernel.org/show_bug.cgi?id=198631#c20
I can make my v891w run Androidx86 on 4.9.125/4.14.68/4.15.18/4.16.18 branch kernel all can reach s0i3,they all have mmc resume failed problem.
Comment 22 youling257 2018-09-09 14:59:01 UTC
22 hours ago,i have been cherry-pick your patches with my 4.19rc2 kernel,no help for me.

[PATCH 1/8] ACPI / LPSS: debugfoo, drop me
[PATCH 2/8] ACPI / LPSS: Only add device links from consumer to
 supplier
[PATCH 3/8] ACPI / LPSS: Make hid_uid_match helper take an
 acpi_device as first argument
[PATCH 4/8] ACPI / LPSS: Make hid_uid_match helper accept a NULL uid
 argument
[PATCH 5/8] ACPI / LPSS: Exclude I2C busses shared with PUNIT from
 pmc_atom_d3_mask
[PATCH 6/8] i2c: designware: use generic table matching
[PATCH 7/8] i2c: designware: Remove Cherry Trail PMIC I2C bus
 pm_disabled workaround
[PATCH 8/8] i2c: designware: Resume PMICs shared with the PUNIT
 earlier
Comment 23 youling257 2018-09-24 17:46:10 UTC
[PATCH v2 0/7] Resume BYT/CHT LPSS I2C controller before the iGPU,seem solve my problem,i use this branch https://github.com/youling257/android-4.9/commits/experimental/android-mainline-4.19-tracking ,mmc resume no problem.

when i reset --hard my b886bb821f1fab1de12dddc593af0cb0d763142c, "mmc -110 resume" happen again,
reset --hard my f4f172810079678e2de72b81a412ae372671198f,mmc resume no problem.
Comment 24 youling257 2018-10-12 17:09:14 UTC
Created attachment 279009 [details]
Android dmesg

(In reply to Hans de Goede from comment #17)
> I've tested using the "Android" setting on my Chuwi Vi8 (CWI513) which is
> the only Bay Trail device I have which has this setting.
> 
> Indeed it no longer reaches S0i3, looking at the output of:
> 
> https://github.com/jwrdegoede/linux-sunxi/commit/
> c95aa27c3db080189708be6a1442ec40fa512742
> 
> I believe this is caused by the SS OTG phy which is in D0 under the
> "Android" settings and not under the "Windows" settings. I also get a bunch
> of i2c devices reported / registered by the firmware which are simply just
> not there at all.
> 
> All in all it seems better to just use the "Windows" settings.


dual os Android dmesg,dual os Android can improve battery life.
Comment 25 youling257 2018-10-13 08:49:46 UTC
(In reply to Hans de Goede from comment #17)
> I've tested using the "Android" setting on my Chuwi Vi8 (CWI513) which is
> the only Bay Trail device I have which has this setting.
> 
> Indeed it no longer reaches S0i3, looking at the output of:
> 
> https://github.com/jwrdegoede/linux-sunxi/commit/
> c95aa27c3db080189708be6a1442ec40fa512742
> 
> I believe this is caused by the SS OTG phy which is in D0 under the
> "Android" settings and not under the "Windows" settings. I also get a bunch
> of i2c devices reported / registered by the firmware which are simply just
> not there at all.
> 
> All in all it seems better to just use the "Windows" settings.
> 

you have been make t102b otg chip work under Linux,the bios setting otg auto/enable/disable,
select "windows",and enable otg,boot os,can suspend reach s0i3.
select "Android",enable otg,can't reach s0i3.
select "Android",disable otg,can't reach s0i3.