misc: rtsx: Fix an error access Page fault
Subsystems (3)
PATCH 1/1 misc: rtsx: Fix an error access Page fault
an error occurs on insert SD7.0 card.
The pci slot of rtsx_pci will Link Down when the SD7.0 card inserted, but the rtsx_pci not exit from runtime_idle at that time, then do the power_saving function to access the wrong resource
--- drivers/misc/cardreader/rtsx_pcr.c | 14 ++++++++------ drivers/mmc/host/rtsx_pci_sdmmc.c | 1 + include/linux/rtsx_pci.h | 1 + 3 files changed, 10 insertions(+), 6 deletions(-)
drivers/misc/cardreader/rtsx_pcr.c +8 -6
@@ -1526,6 +1526,7 @@ static int rtsx_pci_probe(struct pci_dev *pcidev, pcr->host_sg_tbl_addr = pcr->rtsx_resv_buf_addr +HOST_CMDS_BUF_LEN ; pcr->card_inserted =0 ; pcr->card_removed =0 ; + pcr->is_sd_express = false;INIT_DELAYED_WORK (&pcr->carddet_work, rtsx_pci_card_detect); pcr->msi_en = msi_en;
@@ -1735,12 +1736,13 @@ static int rtsx_pci_runtime_idle(struct device *device) pcr->state =PDEV_STAT_IDLE ; -if (pcr->ops->disable_auto_blink) - pcr->ops->disable_auto_blink (pcr); -if (pcr->ops->turn_off_led) - pcr->ops->turn_off_led (pcr); - -rtsx_pm_power_saving (pcr); +if (!pcr->is_sd_express) { +if (pcr->ops->disable_auto_blink) + pcr->ops->disable_auto_blink (pcr); +if (pcr->ops->turn_off_led) + pcr->ops->turn_off_led (pcr); +rtsx_pm_power_saving (pcr); + }mutex_unlock (&pcr->pcr_mutex);
drivers/mmc/host/rtsx_pci_sdmmc.c +1 -0
@@ -1393,6 +1393,7 @@ static int sdmmc_init_sd_express(struct mmc_host *mmc, struct mmc_ios *ios)RTS5261_MCU_BUS_SEL_MASK |RTS5261_MCU_CLOCK_SEL_MASK |RTS5261_DRIVER_ENABLE_FW , RTS5261_MCU_CLOCK_SEL_16M | RTS5261_DRIVER_ENABLE_FW); + pcr->is_sd_express = true; host->eject = true;return 0 ; }
include/linux/rtsx_pci.h +1 -0
@@ -1262,6 +1262,7 @@ struct rtsx_pcr {u8 ocp_stat;u8 ocp_stat2;u8 rtd3_en; +bool is_sd_express; };#define PID_524A 0x524A
Signature · 1 line
2.25.1
Hi Ricky,
Quoted 5 lines · Ricky WU
an error occurs on insert SD7.0 card.
The pci slot ofrtsx_pciwill Link Down when the SD7.0 card inserted, but thertsx_pcinot exit fromruntime_idleat that time, then do thepower_savingfunction to access the wrong resource
Is it possible to attach full dmesg? Maybe the issue is coming from PCI side?
Kai-Heng
Quoted 69 lines
Fixes 597568e8df04 ("misc: rtsx: Rework runtime power management flow")Cc Kai-Heng Feng <[email protected]>Signed-off-by Ricky Wu <[email protected]>--- drivers/misc/cardreader/rtsx_pcr.c | 14 ++++++++------ drivers/mmc/host/rtsx_pci_sdmmc.c | 1 + include/linux/rtsx_pci.h | 1 + 3 files changed, 10 insertions(+), 6 deletions(-)drivers/misc/cardreader/rtsx_pcr.c +8
-6@@ -1526,6 +1526,7 @@ static int rtsx_pci_probe(struct pci_dev *pcidev, pcr->host_sg_tbl_addr = pcr->rtsx_resv_buf_addr +HOST_CMDS_BUF_LEN ; pcr->card_inserted =0 ; pcr->card_removed =0 ; + pcr->is_sd_express = false;INIT_DELAYED_WORK (&pcr->carddet_work, rtsx_pci_card_detect); pcr->msi_en = msi_en;@@ -1735,12 +1736,13 @@ static int rtsx_pci_runtime_idle(struct device *device) pcr->state =PDEV_STAT_IDLE ; -if (pcr->ops->disable_auto_blink) - pcr->ops->disable_auto_blink (pcr); -if (pcr->ops->turn_off_led) - pcr->ops->turn_off_led (pcr); - -rtsx_pm_power_saving (pcr); +if (!pcr->is_sd_express) { +if (pcr->ops->disable_auto_blink) + pcr->ops->disable_auto_blink (pcr); +if (pcr->ops->turn_off_led) + pcr->ops->turn_off_led (pcr); +rtsx_pm_power_saving (pcr); + }mutex_unlock (&pcr->pcr_mutex);drivers/mmc/host/rtsx_pci_sdmmc.c +1
-0@@ -1393,6 +1393,7 @@ static int sdmmc_init_sd_express(struct mmc_host *mmc, struct mmc_ios *ios)RTS5261_MCU_BUS_SEL_MASK |RTS5261_MCU_CLOCK_SEL_MASK |RTS5261_DRIVER_ENABLE_FW , RTS5261_MCU_CLOCK_SEL_16M | RTS5261_DRIVER_ENABLE_FW); + pcr->is_sd_express = true; host->eject = true;return 0 ; }include/linux/rtsx_pci.h +1
-1@@ -1262,6 +1262,7 @@ struct rtsx_pcr {u8 ocp_stat;u8 ocp_stat2;u8 rtd3_en; +bool is_sd_express; };#define PID_524A 0x524A --2.25.1
Quoted 4 lines
Hi Ricky,
Quoted 1 line · Ricky WU
Quoted 9 lines
Quoted 4 lines
an error occurs on insert SD7.0 card.
The pci slot ofrtsx_pciwill Link Down when the SD7.0 card inserted, but thertsx_pcinot exit fromruntime_idleat that time, then do thepower_savingfunction to access the wrong resourceIs it possible to attach full dmesg? Maybe the issue is coming from PCI side?
Kai-Heng
Dmesg as below....
------------------------------------------------------------------------------------------------------------------
[ 60.748953] pcieport 0000:00:1c.0: pciehp: Slot(8): Card present [ 60.748958] pcieport 0000:00:1c.0: pciehp: Slot(8): Link Up [ 60.884619] pci 0000:01:00.0: [10ec:5261] type 00 class 0xff0000 [ 60.884662] pci 0000:01:00.0: reg 0x10: [mem 0xa3b00000-0xa3b00fff] [ 60.884767] pci 0000:01:00.0: Upstream bridge's Max Payload Size set to 128 (was 256, max 256) [ 60.884778] pci 0000:01:00.0: Max Payload Size set to 128 (was 128, max 128) [ 60.884917] pci 0000:01:00.0: supports D1 D2 [ 60.884921] pci 0000:01:00.0: PME# supported from D1 D2 D3hot D3cold [ 60.885537] pci 0000:01:00.0: BAR 0: assigned [mem 0xa3b00000-0xa3b00fff] [ 60.885570] pcieport 0000:00:1c.0: PCI bridge to [bus 01] [ 60.885585] pcieport 0000:00:1c.0: bridge window [io 0x4000-0x4fff] [ 60.885598] pcieport 0000:00:1c.0: bridge window [mem 0xa3b00000-0xa44fffff] [ 60.885630] pcieport 0000:00:1c.0: bridge window [mem 0xa0a00000-0xa13fffff 64bit pref] [ 63.898861] pcieport 0000:00:1c.0: pciehp: Slot(8): Link Down [ 63.912118] BUG: unable to handle page fault for address: ffffb24d403e5010 [ 63.912122] #PF: supervisor read access in kernel mode [ 63.912125] #PF: error_code(0x0000) - not-present page [ 63.912126] PGD 100000067 P4D 100000067 PUD 1001fe067 PMD 100d97067 PTE 0 [ 63.912131] Oops: 0000 [#1] PREEMPT SMP PTI [ 63.912134] CPU: 3 PID: 534 Comm: kworker/3:10 Not tainted 6.4.0 #6 [ 63.912137] Hardware name: To Be Filled By O.E.M. To Be Filled By O.E.M./H370M Pro4, BIOS P3.40 10/25/2018 [ 63.912138] Workqueue: pm pm_runtime_work [ 63.912144] RIP: 0010:ioread32+0x2e/0x70 [ 63.912148] Code: ff 03 00 77 25 48 81 ff 00 00 01 00 77 14 8b 15 08 d9 54 01 b8 ff ff ff ff 85 d2 75 14 c3 cc cc cc cc 89 fa ed c3 cc cc cc cc <8b> 07 c3 cc cc cc cc 55 83 ea 01 48 89 fe 48 c7 c7 98 6f 15 99 48 [ 63.912150] RSP: 0018:ffffb24d40a5bd78 EFLAGS: 00010296 [ 63.912152] RAX: ffffb24d403e5000 RBX: 0000000000000152 RCX: 000000000000007f [ 63.912153] RDX: 000000000000ff00 RSI: ffffb24d403e5010 RDI: ffffb24d403e5010 [ 63.912155] RBP: ffffb24d40a5bd98 R08: ffffb24d403e5010 R09: 0000000000000000 [ 63.912156] R10: ffff9074cd95e7f4 R11: 0000000000000003 R12: 000000000000007f [ 63.912158] R13: ffff9074e1a68c00 R14: ffff9074e1a68d00 R15: 0000000000009003 [ 63.912159] FS: 0000000000000000(0000) GS:ffff90752a180000(0000) knlGS:0000000000000000 [ 63.912161] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 63.912162] CR2: ffffb24d403e5010 CR3: 0000000152832006 CR4: 00000000003706e0 [ 63.912164] Call Trace: [ 63.912165] <TASK> [ 63.912167] ? show_regs+0x68/0x70 [ 63.912171] ? __die_body+0x20/0x70 [ 63.912173] ? __die+0x2b/0x40 [ 63.912175] ? page_fault_oops+0x160/0x480 [ 63.912177] ? search_bpf_extables+0x63/0x90 [ 63.912180] ? ioread32+0x2e/0x70 [ 63.912183] ? search_exception_tables+0x5f/0x70 [ 63.912186] ? kernelmode_fixup_or_oops+0xa2/0x120 [ 63.912189] ? __bad_area_nosemaphore+0x179/0x230 [ 63.912191] ? bad_area_nosemaphore+0x16/0x20 [ 63.912193] ? do_kern_addr_fault+0x8b/0xa0 [ 63.912195] ? exc_page_fault+0xe5/0x180 [ 63.912198] ? asm_exc_page_fault+0x27/0x30 [ 63.912203] ? ioread32+0x2e/0x70 [ 63.912206] ? rtsx_pci_write_register+0x5b/0x90 [rtsx_pci] [ 63.912217] rtsx_set_l1off_sub+0x1c/0x30 [rtsx_pci] [ 63.912226] rts5261_set_l1off_cfg_sub_d0+0x36/0x40 [rtsx_pci] [ 63.912234] rtsx_pci_runtime_idle+0xc7/0x160 [rtsx_pci] [ 63.912243] ? __pfx_pci_pm_runtime_idle+0x10/0x10 [ 63.912246] pci_pm_runtime_idle+0x34/0x70 [ 63.912248] rpm_idle+0xc4/0x2b0 [ 63.912251] pm_runtime_work+0x93/0xc0 [ 63.912254] process_one_work+0x21a/0x430 [ 63.912258] worker_thread+0x4a/0x3c0 [ 63.912261] ? __pfx_worker_thread+0x10/0x10 [ 63.912263] kthread+0x106/0x140 [ 63.912266] ? __pfx_kthread+0x10/0x10 [ 63.912268] ret_from_fork+0x29/0x50 [ 63.912273] </TASK> [ 63.912274] Modules linked in: nvme nvme_core snd_hda_codec_hdmi snd_sof_pci_intel_cnl snd_sof_intel_hda_common snd_hda_codec_realtek snd_hda_codec_generic snd_soc_hdac_hda soundwire_intel ledtrig_audio nls_iso8859_1 soundwire_generic_allocation soundwire_cadence snd_sof_intel_hda_mlink snd_sof_intel_hda snd_sof_pci snd_sof_xtensa_dsp snd_sof snd_sof_utils snd_hda_ext_core snd_soc_acpi_intel_match snd_soc_acpi soundwire_bus snd_soc_core snd_compress ac97_bus snd_pcm_dmaengine snd_hda_intel i915 snd_intel_dspcfg snd_intel_sdw_acpi intel_rapl_msr snd_hda_codec intel_rapl_common snd_hda_core x86_pkg_temp_thermal intel_powerclamp snd_hwdep coretemp snd_pcm kvm_intel drm_buddy ttm mei_hdcp kvm drm_display_helper snd_seq_midi snd_seq_midi_event cec crct10dif_pclmul ghash_clmulni_intel sha512_ssse3 aesni_intel crypto_simd rc_core cryptd rapl snd_rawmidi drm_kms_helper binfmt_misc intel_cstate i2c_algo_bit joydev snd_seq snd_seq_device syscopyarea wmi_bmof snd_timer sysfillrect input_leds snd ee1004 sysimgblt mei_me soundcore [ 63.912324] mei intel_pch_thermal mac_hid acpi_tad acpi_pad sch_fq_codel msr parport_pc ppdev lp ramoops drm parport reed_solomon efi_pstore ip_tables x_tables autofs4 hid_generic usbhid hid rtsx_pci_sdmmc crc32_pclmul ahci e1000e i2c_i801 i2c_smbus rtsx_pci xhci_pci libahci xhci_pci_renesas video wmi [ 63.912346] CR2: ffffb24d403e5010 [ 63.912348] ---[ end trace 0000000000000000 ]--- [ 64.067753] RIP: 0010:ioread32+0x2e/0x70 [ 64.067762] Code: ff 03 00 77 25 48 81 ff 00 00 01 00 77 14 8b 15 08 d9 54 01 b8 ff ff ff ff 85 d2 75 14 c3 cc cc cc cc 89 fa ed c3 cc cc cc cc <8b> 07 c3 cc cc cc cc 55 83 ea 01 48 89 fe 48 c7 c7 98 6f 15 99 48 [ 64.067764] RSP: 0018:ffffb24d40a5bd78 EFLAGS: 00010296 [ 64.067767] RAX: ffffb24d403e5000 RBX: 0000000000000152 RCX: 000000000000007f [ 64.067769] RDX: 000000000000ff00 RSI: ffffb24d403e5010 RDI: ffffb24d403e5010 [ 64.067770] RBP: ffffb24d40a5bd98 R08: ffffb24d403e5010 R09: 0000000000000000 [ 64.067772] R10: ffff9074cd95e7f4 R11: 0000000000000003 R12: 000000000000007f [ 64.067773] R13: ffff9074e1a68c00 R14: ffff9074e1a68d00 R15: 0000000000009003 [ 64.067775] FS: 0000000000000000(0000) GS:ffff90752a180000(0000) knlGS:0000000000000000 [ 64.067776] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 64.067778] CR2: ffffb24d403e5010 CR3: 0000000119402003 CR4: 00000000003706e0 [ 64.067780] note: kworker/3:10[534] exited with irqs disabled
-------------------------------------------------------------------------------------------------------------------
Quoted 80 lines
Quoted 17 lines
Fixes 597568e8df04 ("misc: rtsx: Rework runtime power managementflow")
Cc Kai-Heng Feng <[email protected]>Signed-off-by Ricky Wu <[email protected]>--- drivers/misc/cardreader/rtsx_pcr.c | 14 ++++++++------ drivers/mmc/host/rtsx_pci_sdmmc.c | 1 + include/linux/rtsx_pci.h | 1 + 3 files changed, 10 insertions(+), 6 deletions(-)drivers/misc/cardreader/rtsx_pcr.c +0
-0drivers/misc/cardreader/rtsx_pcr.c static int rtsx_pci_probe(struct pci_dev *pcidev, · line 1526
Quoted 1 line
drivers/misc/cardreader/rtsx_pcr.c +0
-0@@ -1526,6 +1526,7 @@ static int rtsx_pci_probe(struct pci_dev *pcidev, pcr->host_sg_tbl_addr = pcr->rtsx_resv_buf_addr +
HOST_CMDS_BUF_LEN;drivers/misc/cardreader/rtsx_pcr.c static int rtsx_pci_probe(struct pci_dev *pcidev,
Quoted 4 lines
drivers/misc/cardreader/rtsx_pcr.c +1
-0pcr->card_inserted =0 ; pcr->card_removed =0 ; + pcr->is_sd_express = false; INIT_DELAYED_WORK(&pcr->carddet_work,
rtsx_pci_card_detect);drivers/mmc/host/rtsx_pci_sdmmc.c static int sdmmc_init_sd_express(struct mmc_host
Quoted 29 lines
drivers/misc/cardreader/rtsx_pcr.c +7
-6pcr->msi_en = msi_en;@@ -1735,12 +1736,13 @@ static int rtsx_pci_runtime_idle(struct device *device) pcr->state =PDEV_STAT_IDLE ; -if (pcr->ops->disable_auto_blink) - pcr->ops->disable_auto_blink (pcr); -if (pcr->ops->turn_off_led) - pcr->ops->turn_off_led (pcr); - -rtsx_pm_power_saving (pcr); +if (!pcr->is_sd_express) { +if (pcr->ops->disable_auto_blink) + pcr->ops->disable_auto_blink (pcr); +if (pcr->ops->turn_off_led) + pcr->ops->turn_off_led (pcr); +rtsx_pm_power_saving (pcr); + }mutex_unlock (&pcr->pcr_mutex);drivers/mmc/host/rtsx_pci_sdmmc.c +0
-0@@ -1393,6 +1393,7 @@ static int sdmmc_init_sd_express(struct mmc_host*mmc, struct
mmc_ios*ios)drivers/mmc/host/rtsx_pci_sdmmc.c static int sdmmc_init_sd_express(struct mmc_host · line 1393
Quoted 1 line
drivers/mmc/host/rtsx_pci_sdmmc.c +0
-0RTS5261_MCU_BUS_SEL_MASK |
RTS5261_MCU_CLOCK_SEL_MASKdrivers/mmc/host/rtsx_pci_sdmmc.c static int sdmmc_init_sd_express(struct mmc_host · line 1395
Quoted 2 lines
drivers/mmc/host/rtsx_pci_sdmmc.c +0
-0| RTS5261_DRIVER_ENABLE_FW, RTS5261_MCU_CLOCK_SEL_16M |
RTS5261_DRIVER_ENABLE_FW);Quoted 17 lines
drivers/mmc/host/rtsx_pci_sdmmc.c +1
-0+ pcr->is_sd_express = true; host->eject = true;return 0 ; }include/linux/rtsx_pci.h index renamed from include/linux/rtsx_pci.h +0
-0
534038d962e4..295e92224fd0100644include/linux/rtsx_pci.h +1
-1@@ -1262,6 +1262,7 @@ struct rtsx_pcr {u8 ocp_stat;u8 ocp_stat2;u8 rtd3_en; +bool is_sd_express; };#define PID_524A 0x524A --Quoted 2 lines
2.25.1
------Please consider the environment before printing this e-mail.
Hi Ricky,
Quoted 97 lines · Ricky WU
Quoted 5 lines
Hi Ricky,
Quoted 1 line · Ricky WU
Quoted 9 lines
Quoted 4 lines
an error occurs on insert SD7.0 card.
The pci slot ofrtsx_pciwill Link Down when the SD7.0 card inserted, but thertsx_pcinot exit fromruntime_idleat that time, then do thepower_savingfunction to access the wrong resourceIs it possible to attach full dmesg? Maybe the issue is coming from PCI side?
Kai-Heng
Dmesg as below....
------------------------------------------------------------------------------------------------------------------[ 60.748953] pcieport 0000:00:1c.0: pciehp: Slot(8): Card present [ 60.748958] pcieport 0000:00:1c.0: pciehp: Slot(8): Link Up [ 60.884619] pci 0000:01:00.0: [10ec:5261] type 00 class 0xff0000 [ 60.884662] pci 0000:01:00.0: reg 0x10: [mem 0xa3b00000-0xa3b00fff] [ 60.884767] pci 0000:01:00.0: Upstream bridge's Max Payload Size set to 128 (was 256, max 256) [ 60.884778] pci 0000:01:00.0: Max Payload Size set to 128 (was 128, max 128) [ 60.884917] pci 0000:01:00.0: supports D1 D2 [ 60.884921] pci 0000:01:00.0: PME# supported from D1 D2 D3hot D3cold [ 60.885537] pci 0000:01:00.0: BAR 0: assigned [mem 0xa3b00000-0xa3b00fff] [ 60.885570] pcieport 0000:00:1c.0: PCI bridge to [bus 01] [ 60.885585] pcieport 0000:00:1c.0: bridge window [io 0x4000-0x4fff] [ 60.885598] pcieport 0000:00:1c.0: bridge window [mem 0xa3b00000-0xa44fffff] [ 60.885630] pcieport 0000:00:1c.0: bridge window [mem 0xa0a00000-0xa13fffff 64bit pref] [ 63.898861] pcieport 0000:00:1c.0: pciehp: Slot(8): Link Down [ 63.912118] BUG: unable to handle page fault for address: ffffb24d403e5010 [ 63.912122] #PF: supervisor read access in kernel mode [ 63.912125] #PF: error_code(0x0000) - not-present page [ 63.912126] PGD 100000067 P4D 100000067 PUD 1001fe067 PMD 100d97067 PTE 0 [ 63.912131] Oops: 0000 [#1] PREEMPT SMP PTI [ 63.912134] CPU: 3 PID: 534 Comm: kworker/3:10 Not tainted 6.4.0 #6 [ 63.912137] Hardware name: To Be Filled By O.E.M. To Be Filled By O.E.M./H370M Pro4, BIOS P3.40 10/25/2018 [ 63.912138] Workqueue: pm pm_runtime_work [ 63.912144] RIP: 0010:ioread32+0x2e/0x70 [ 63.912148] Code: ff 03 00 77 25 48 81 ff 00 00 01 00 77 14 8b 15 08 d9 54 01 b8 ff ff ff ff 85 d2 75 14 c3 cc cc cc cc 89 fa ed c3 cc cc cc cc <8b> 07 c3 cc cc cc cc 55 83 ea 01 48 89 fe 48 c7 c7 98 6f 15 99 48 [ 63.912150] RSP: 0018:ffffb24d40a5bd78 EFLAGS: 00010296 [ 63.912152] RAX: ffffb24d403e5000 RBX: 0000000000000152 RCX: 000000000000007f [ 63.912153] RDX: 000000000000ff00 RSI: ffffb24d403e5010 RDI: ffffb24d403e5010 [ 63.912155] RBP: ffffb24d40a5bd98 R08: ffffb24d403e5010 R09: 0000000000000000 [ 63.912156] R10: ffff9074cd95e7f4 R11: 0000000000000003 R12: 000000000000007f [ 63.912158] R13: ffff9074e1a68c00 R14: ffff9074e1a68d00 R15: 0000000000009003 [ 63.912159] FS: 0000000000000000(0000) GS:ffff90752a180000(0000) knlGS:0000000000000000 [ 63.912161] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 63.912162] CR2: ffffb24d403e5010 CR3: 0000000152832006 CR4: 00000000003706e0 [ 63.912164] Call Trace: [ 63.912165] <TASK> [ 63.912167] ? show_regs+0x68/0x70 [ 63.912171] ? __die_body+0x20/0x70 [ 63.912173] ? __die+0x2b/0x40 [ 63.912175] ? page_fault_oops+0x160/0x480 [ 63.912177] ? search_bpf_extables+0x63/0x90 [ 63.912180] ? ioread32+0x2e/0x70 [ 63.912183] ? search_exception_tables+0x5f/0x70 [ 63.912186] ? kernelmode_fixup_or_oops+0xa2/0x120 [ 63.912189] ? __bad_area_nosemaphore+0x179/0x230 [ 63.912191] ? bad_area_nosemaphore+0x16/0x20 [ 63.912193] ? do_kern_addr_fault+0x8b/0xa0 [ 63.912195] ? exc_page_fault+0xe5/0x180 [ 63.912198] ? asm_exc_page_fault+0x27/0x30 [ 63.912203] ? ioread32+0x2e/0x70 [ 63.912206] ? rtsx_pci_write_register+0x5b/0x90 [rtsx_pci] [ 63.912217] rtsx_set_l1off_sub+0x1c/0x30 [rtsx_pci] [ 63.912226] rts5261_set_l1off_cfg_sub_d0+0x36/0x40 [rtsx_pci] [ 63.912234] rtsx_pci_runtime_idle+0xc7/0x160 [rtsx_pci] [ 63.912243] ? __pfx_pci_pm_runtime_idle+0x10/0x10 [ 63.912246] pci_pm_runtime_idle+0x34/0x70 [ 63.912248] rpm_idle+0xc4/0x2b0 [ 63.912251] pm_runtime_work+0x93/0xc0 [ 63.912254] process_one_work+0x21a/0x430 [ 63.912258] worker_thread+0x4a/0x3c0 [ 63.912261] ? __pfx_worker_thread+0x10/0x10 [ 63.912263] kthread+0x106/0x140 [ 63.912266] ? __pfx_kthread+0x10/0x10 [ 63.912268] ret_from_fork+0x29/0x50 [ 63.912273] </TASK> [ 63.912274] Modules linked in: nvme nvme_core snd_hda_codec_hdmi snd_sof_pci_intel_cnl snd_sof_intel_hda_common snd_hda_codec_realtek snd_hda_codec_generic snd_soc_hdac_hda soundwire_intel ledtrig_audio nls_iso8859_1 soundwire_generic_allocation soundwire_cadence snd_sof_intel_hda_mlink snd_sof_intel_hda snd_sof_pci snd_sof_xtensa_dsp snd_sof snd_sof_utils snd_hda_ext_core snd_soc_acpi_intel_match snd_soc_acpi soundwire_bus snd_soc_core snd_compress ac97_bus snd_pcm_dmaengine snd_hda_intel i915 snd_intel_dspcfg snd_intel_sdw_acpi intel_rapl_msr snd_hda_codec intel_rapl_common snd_hda_core x86_pkg_temp_thermal intel_powerclamp snd_hwdep coretemp snd_pcm kvm_intel drm_buddy ttm mei_hdcp kvm drm_display_helper snd_seq_midi snd_seq_midi_event cec crct10dif_pclmul ghash_clmulni_intel sha512_ssse3 aesni_intel crypto_simd rc_core cryptd rapl snd_rawmidi drm_kms_helper binfmt_misc intel_cstate i2c_algo_bit joydev snd_seq snd_seq_device syscopyarea wmi_bmof snd_timer sysfillrect input_leds snd ee1004 sysimgblt mei_me soundcore [ 63.912324] mei intel_pch_thermal mac_hid acpi_tad acpi_pad sch_fq_codel msr parport_pc ppdev lp ramoops drm parport reed_solomon efi_pstore ip_tables x_tables autofs4 hid_generic usbhid hid rtsx_pci_sdmmc crc32_pclmul ahci e1000e i2c_i801 i2c_smbus rtsx_pci xhci_pci libahci xhci_pci_renesas video wmi [ 63.912346] CR2: ffffb24d403e5010 [ 63.912348] ---[ end trace 0000000000000000 ]--- [ 64.067753] RIP: 0010:ioread32+0x2e/0x70 [ 64.067762] Code: ff 03 00 77 25 48 81 ff 00 00 01 00 77 14 8b 15 08 d9 54 01 b8 ff ff ff ff 85 d2 75 14 c3 cc cc cc cc 89 fa ed c3 cc cc cc cc <8b> 07 c3 cc cc cc cc 55 83 ea 01 48 89 fe 48 c7 c7 98 6f 15 99 48 [ 64.067764] RSP: 0018:ffffb24d40a5bd78 EFLAGS: 00010296 [ 64.067767] RAX: ffffb24d403e5000 RBX: 0000000000000152 RCX: 000000000000007f [ 64.067769] RDX: 000000000000ff00 RSI: ffffb24d403e5010 RDI: ffffb24d403e5010 [ 64.067770] RBP: ffffb24d40a5bd98 R08: ffffb24d403e5010 R09: 0000000000000000 [ 64.067772] R10: ffff9074cd95e7f4 R11: 0000000000000003 R12: 000000000000007f [ 64.067773] R13: ffff9074e1a68c00 R14: ffff9074e1a68d00 R15: 0000000000009003 [ 64.067775] FS: 0000000000000000(0000) GS:ffff90752a180000(0000) knlGS:0000000000000000 [ 64.067776] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 64.067778] CR2: ffffb24d403e5010 CR3: 0000000119402003 CR4: 00000000003706e0 [ 64.067780] note: kworker/3:10[534] exited with irqs disabled
Quoted 2 lines
-------------------------------------------------------------------------------------------------------------------
Does the following change work for you?
(quoted diff) +0 -0
b/drivers/pci/hotplug/pciehp_ctrl.c
index dcdbfcf404dd..ef93364a4422 100644
drivers/pci/hotplug/pciehp_ctrl.c +0 -0
@@ -356,6 +356,7 @@ static int pciehp_disable_slot(struct controller
*ctrl, bool safe_removal)
int ret;
pm_runtime_get_sync(&ctrl->pcie->port->dev);
+ pm_runtime_barrier(&ctrl->pcie->port->dev);
ret = __pciehp_disable_slot(ctrl, safe_removal);
pm_runtime_put(&ctrl->pcie->port->dev);Kai-Heng
Quoted 82 lines
Quoted 81 lines
Quoted 18 lines
Fixes 597568e8df04 ("misc: rtsx: Rework runtime power managementflow")
Cc Kai-Heng Feng <[email protected]>Signed-off-by Ricky Wu <[email protected]>--- drivers/misc/cardreader/rtsx_pcr.c | 14 ++++++++------ drivers/mmc/host/rtsx_pci_sdmmc.c | 1 + include/linux/rtsx_pci.h | 1 + 3 files changed, 10 insertions(+), 6 deletions(-)drivers/misc/cardreader/rtsx_pcr.c +0
-0drivers/misc/cardreader/rtsx_pcr.c static int rtsx_pci_probe(struct pci_dev *pcidev, · line 1526
Quoted 1 line
drivers/misc/cardreader/rtsx_pcr.c +0
-0@@ -1526,6 +1526,7 @@ static int rtsx_pci_probe(struct pci_dev *pcidev, pcr->host_sg_tbl_addr = pcr->rtsx_resv_buf_addr +
HOST_CMDS_BUF_LEN;drivers/misc/cardreader/rtsx_pcr.c static int rtsx_pci_probe(struct pci_dev *pcidev, · line 1530
Quoted 4 lines
drivers/misc/cardreader/rtsx_pcr.c +1
-0pcr->card_inserted =0 ; pcr->card_removed =0 ; + pcr->is_sd_express = false; INIT_DELAYED_WORK(&pcr->carddet_work,
rtsx_pci_card_detect);drivers/mmc/host/rtsx_pci_sdmmc.c static int sdmmc_init_sd_express(struct mmc_host
Quoted 29 lines
drivers/misc/cardreader/rtsx_pcr.c +7
-6pcr->msi_en = msi_en;@@ -1735,12 +1736,13 @@ static int rtsx_pci_runtime_idle(struct device *device) pcr->state =PDEV_STAT_IDLE ; -if (pcr->ops->disable_auto_blink) - pcr->ops->disable_auto_blink (pcr); -if (pcr->ops->turn_off_led) - pcr->ops->turn_off_led (pcr); - -rtsx_pm_power_saving (pcr); +if (!pcr->is_sd_express) { +if (pcr->ops->disable_auto_blink) + pcr->ops->disable_auto_blink (pcr); +if (pcr->ops->turn_off_led) + pcr->ops->turn_off_led (pcr); +rtsx_pm_power_saving (pcr); + }mutex_unlock (&pcr->pcr_mutex);drivers/mmc/host/rtsx_pci_sdmmc.c +0
-0@@ -1393,6 +1393,7 @@ static int sdmmc_init_sd_express(struct mmc_host*mmc, struct
mmc_ios*ios)drivers/mmc/host/rtsx_pci_sdmmc.c static int sdmmc_init_sd_express(struct mmc_host · line 1393
Quoted 1 line
drivers/mmc/host/rtsx_pci_sdmmc.c +0
-0RTS5261_MCU_BUS_SEL_MASK |
RTS5261_MCU_CLOCK_SEL_MASKdrivers/mmc/host/rtsx_pci_sdmmc.c static int sdmmc_init_sd_express(struct mmc_host · line 1395
Quoted 2 lines
drivers/mmc/host/rtsx_pci_sdmmc.c +0
-0| RTS5261_DRIVER_ENABLE_FW, RTS5261_MCU_CLOCK_SEL_16M |
RTS5261_DRIVER_ENABLE_FW);Quoted 17 lines
drivers/mmc/host/rtsx_pci_sdmmc.c +1
-0+ pcr->is_sd_express = true; host->eject = true;return 0 ; }include/linux/rtsx_pci.h index renamed from include/linux/rtsx_pci.h +0
-0
534038d962e4..295e92224fd0100644include/linux/rtsx_pci.h +1
-1@@ -1262,6 +1262,7 @@ struct rtsx_pcr {u8 ocp_stat;u8 ocp_stat2;u8 rtd3_en; +bool is_sd_express; };#define PID_524A 0x524A --Quoted 2 lines
2.25.1
------Please consider the environment before printing this e-mail.
Hi Kai-heng,
It is not work, still get fail..
Dmesg log as below
------------------------------------------------------------------
[ 122.214916] pcieport 0000:00:1c.0: pciehp: Slot(8): Link Down [ 122.227416] BUG: unable to handle page fault for address: ffff9fa180089010 [ 122.227428] #PF: supervisor read access in kernel mode [ 122.227430] #PF: error_code(0x0000) - not-present page [ 122.227432] PGD 100000067 P4D 100000067 PUD 1001fe067 PMD 1001ff067 PTE 0 [ 122.227438] Oops: 0000 [#1] PREEMPT SMP PTI [ 122.227441] CPU: 3 PID: 1956 Comm: kworker/3:11 Not tainted 6.4.0 #7 [ 122.227444] Hardware name: To Be Filled By O.E.M. To Be Filled By O.E.M./H370M Pro4, BIOS P3.40 10/25/2018 [ 122.227446] Workqueue: pm pm_runtime_work [ 122.227452] RIP: 0010:ioread32+0x2e/0x70 [ 122.227456] Code: ff 03 00 77 25 48 81 ff 00 00 01 00 77 14 8b 15 08 d9 54 01 b8 ff ff ff ff 85 d2 75 14 c3 cc cc cc cc 89 fa ed c3 cc cc cc cc <8b> 07 c3 cc cc cc cc 55 83 ea 01 48 89 fe 48 c7 c7 98 6f d5 a7 48 [ 122.227459] RSP: 0018:ffff9fa1836d7d78 EFLAGS: 00010296 [ 122.227461] RAX: ffff9fa180089000 RBX: 0000000000000310 RCX: 000000000000007f [ 122.227462] RDX: 000000000000ff00 RSI: ffff9fa180089010 RDI: ffff9fa180089010 [ 122.227464] RBP: ffff9fa1836d7d98 R08: ffff9fa180089010 R09: 0000000000000000 [ 122.227465] R10: ffff8ac55298deb4 R11: 0000000000000003 R12: 000000000000007f [ 122.227466] R13: ffff8ac54022e000 R14: ffff8ac54022e100 R15: 0000000000009003 [ 122.227468] FS: 0000000000000000(0000) GS:ffff8ac5aa180000(0000) knlGS:0000000000000000 [ 122.227470] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 122.227472] CR2: ffff9fa180089010 CR3: 0000000115a32006 CR4: 00000000003706e0 [ 122.227473] Call Trace: [ 122.227475] <TASK> [ 122.227477] ? show_regs+0x68/0x70 [ 122.227481] ? __die_body+0x20/0x70 [ 122.227483] ? __die+0x2b/0x40 [ 122.227485] ? page_fault_oops+0x160/0x480 [ 122.227488] ? search_bpf_extables+0x63/0x90 [ 122.227490] ? ioread32+0x2e/0x70 [ 122.227493] ? search_exception_tables+0x5f/0x70 [ 122.227497] ? kernelmode_fixup_or_oops+0xa2/0x120 [ 122.227499] ? __bad_area_nosemaphore+0x179/0x230 [ 122.227501] ? bad_area_nosemaphore+0x16/0x20 [ 122.227503] ? do_kern_addr_fault+0x8b/0xa0 [ 122.227505] ? exc_page_fault+0xe5/0x180 [ 122.227509] ? asm_exc_page_fault+0x27/0x30 [ 122.227514] ? ioread32+0x2e/0x70 [ 122.227517] ? rtsx_pci_write_register+0x5b/0x90 [rtsx_pci] [ 122.227527] rtsx_set_l1off_sub+0x1c/0x30 [rtsx_pci] [ 122.227536] rts5261_set_l1off_cfg_sub_d0+0x36/0x40 [rtsx_pci] [ 122.227545] rtsx_pci_runtime_idle+0xc7/0x160 [rtsx_pci] [ 122.227553] ? __pfx_pci_pm_runtime_idle+0x10/0x10 [ 122.227557] pci_pm_runtime_idle+0x34/0x70 [ 122.227559] rpm_idle+0xc4/0x2b0 [ 122.227562] pm_runtime_work+0x93/0xc0 [ 122.227565] process_one_work+0x21a/0x430 [ 122.227569] worker_thread+0x4a/0x3c0 [ 122.227572] ? __pfx_worker_thread+0x10/0x10 [ 122.227574] kthread+0x106/0x140 [ 122.227577] ? __pfx_kthread+0x10/0x10 [ 122.227579] ret_from_fork+0x29/0x50 [ 122.227585] </TASK> [ 122.227586] Modules linked in: nls_iso8859_1 snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic ledtrig_audio intel_rapl_msr intel_rapl_common snd_sof_pci_intel_cnl snd_sof_intel_hda_common snd_soc_hdac_hda soundwire_intel soundwire_generic_allocation soundwire_cadence snd_sof_intel_hda_mlink snd_sof_intel_hda snd_sof_pci snd_sof_xtensa_dsp snd_sof snd_sof_utils snd_hda_ext_core snd_soc_acpi_intel_match snd_soc_acpi soundwire_bus snd_soc_core snd_compress ac97_bus snd_pcm_dmaengine x86_pkg_temp_thermal intel_powerclamp coretemp snd_hda_intel kvm_intel snd_intel_dspcfg snd_intel_sdw_acpi i915 kvm mei_hdcp crct10dif_pclmul snd_hda_codec ghash_clmulni_intel sha512_ssse3 aesni_intel binfmt_misc crypto_simd snd_hda_core cryptd snd_hwdep snd_pcm input_leds drm_buddy snd_seq_midi rapl snd_seq_midi_event ttm joydev snd_rawmidi drm_display_helper ee1004 intel_cstate cec snd_seq wmi_bmof rc_core snd_seq_device snd_timer mei_me drm_kms_helper snd soundcore mei intel_pch_thermal i2c_algo_bit syscopyarea sysfillrect [ 122.227634] sysimgblt mac_hid acpi_pad acpi_tad sch_fq_codel msr parport_pc ppdev lp drm parport ramoops reed_solomon efi_pstore ip_tables x_tables autofs4 hid_generic usbhid hid rtsx_pci_sdmmc i2c_i801 e1000e ahci crc32_pclmul xhci_pci i2c_smbus rtsx_pci libahci xhci_pci_renesas video wmi [ 122.227656] CR2: ffff9fa180089010 [ 122.227658] ---[ end trace 0000000000000000 ]--- [ 122.384633] RIP: 0010:ioread32+0x2e/0x70 [ 122.384642] Code: ff 03 00 77 25 48 81 ff 00 00 01 00 77 14 8b 15 08 d9 54 01 b8 ff ff ff ff 85 d2 75 14 c3 cc cc cc cc 89 fa ed c3 cc cc cc cc <8b> 07 c3 cc cc cc cc 55 83 ea 01 48 89 fe 48 c7 c7 98 6f d5 a7 48 [ 122.384644] RSP: 0018:ffff9fa1836d7d78 EFLAGS: 00010296 [ 122.384647] RAX: ffff9fa180089000 RBX: 0000000000000310 RCX: 000000000000007f [ 122.384649] RDX: 000000000000ff00 RSI: ffff9fa180089010 RDI: ffff9fa180089010 [ 122.384650] RBP: ffff9fa1836d7d98 R08: ffff9fa180089010 R09: 0000000000000000 [ 122.384652] R10: ffff8ac55298deb4 R11: 0000000000000003 R12: 000000000000007f [ 122.384653] R13: ffff8ac54022e000 R14: ffff8ac54022e100 R15: 0000000000009003 [ 122.384654] FS: 0000000000000000(0000) GS:ffff8ac5aa180000(0000) knlGS:0000000000000000 [ 122.384656] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 122.384658] CR2: ffff9fa180089010 CR3: 0000000119526001 CR4: 00000000003706e0 [ 122.384660] note: kworker/3:11[1956] exited with irqs disabled
-------------------------------------------------------------------
Quoted 260 lines
Hi Ricky,
Quoted 4 lines · Ricky WU
Quoted 4 lines
Hi Ricky,
On Wed, Sep 6, 2023 at 4:03 PM Ricky WU <[email protected]>
Quoted 8 lines · wrote:
Quoted 8 lines
Quoted 6 lines
an error occurs on insert SD7.0 card.
The pci slot ofrtsx_pciwill Link Down when the SD7.0 card inserted, but thertsx_pcinot exit fromruntime_idleat that time, then do thepower_savingfunction to access the wrong resourceIs it possible to attach full dmesg? Maybe the issue is coming from PCI
side?
Quoted 6 lines
Quoted 3 lines
Kai-Heng
Dmesg as below....
------------------------------------------------------------------------------------------------------
------------Quoted 5 lines
[ 60.748953] pcieport 0000:00:1c.0: pciehp: Slot(8): Card present [ 60.748958] pcieport 0000:00:1c.0: pciehp: Slot(8): Link Up [ 60.884619] pci 0000:01:00.0: [10ec:5261] type 00 class 0xff0000 [ 60.884662] pci 0000:01:00.0: reg 0x10: [mem 0xa3b00000-0xa3b00fff] [ 60.884767] pci 0000:01:00.0: Upstream bridge's Max Payload Size set to128 (was 256, max 256)
Quoted 1 line
[ 60.884778] pci 0000:01:00.0: Max Payload Size set to 128 (was 128, max128)
Quoted 3 lines
[ 60.884917] pci 0000:01:00.0: supports D1 D2 [ 60.884921] pci 0000:01:00.0: PME# supported from D1 D2 D3hot D3cold [ 60.885537] pci 0000:01:00.0: BAR 0: assigned [mem0xa3b00000-0xa3b00fff]
Quoted 2 lines
[ 60.885570] pcieport 0000:00:1c.0: PCI bridge to [bus 01] [ 60.885585] pcieport 0000:00:1c.0: bridge window [io0x4000-0x4fff]
Quoted 1 line
[ 60.885598] pcieport 0000:00:1c.0: bridge window [mem0xa3b00000-0xa44fffff]
Quoted 1 line
[ 60.885630] pcieport 0000:00:1c.0: bridge window [mem0xa0a00000-0xa13fffff 64bit pref]
Quoted 2 lines
[ 63.898861] pcieport 0000:00:1c.0: pciehp: Slot(8): Link Down [ 63.912118] BUG: unable to handle page fault for address:
ffffb24d403e5010Quoted 3 lines
[ 63.912122] #PF: supervisor read access in kernel mode [ 63.912125] #PF: error_code(0x0000) - not-present page [ 63.912126] PGD 100000067 P4D 100000067 PUD 1001fe067 PMD
100d97067PTE 0Quoted 3 lines
[ 63.912131] Oops: 0000 [#1] PREEMPT SMP PTI [ 63.912134] CPU: 3 PID: 534 Comm: kworker/3:10 Not tainted 6.4.0 #6 [ 63.912137] Hardware name: To Be Filled By O.E.M. To Be Filled ByO.E.M./H370M Pro4, BIOS P3.40 10/25/2018
Quoted 3 lines
[ 63.912138] Workqueue: pm pm_runtime_work [ 63.912144] RIP: 0010:ioread32+0x2e/0x70 [ 63.912148] Code: ff 03 00 77 25 48 81 ff 00 00 01 00 77 14 8b 15 08 d954 01 b8 ff ff ff ff 85 d2 75 14 c3 cc cc cc cc 89 fa ed c3 cc cc cc cc <8b> 07 c3 cc cc cc cc 55 83 ea 01 48 89 fe 48 c7 c7 98 6f 15 99 48
Quoted 2 lines
[ 63.912150] RSP: 0018:ffffb24d40a5bd78 EFLAGS: 00010296 [ 63.912152] RAX: ffffb24d403e5000 RBX: 0000000000000152 RCX:
000000000000007fQuoted 1 line
[ 63.912153] RDX: 000000000000ff00 RSI: ffffb24d403e5010 RDI:
ffffb24d403e5010Quoted 1 line
[ 63.912155] RBP: ffffb24d40a5bd98 R08: ffffb24d403e5010 R09:0000000000000000
Quoted 1 line
[ 63.912156] R10: ffff9074cd95e7f4 R11: 0000000000000003 R12:
000000000000007fQuoted 1 line
[ 63.912158] R13: ffff9074e1a68c00 R14: ffff9074e1a68d00 R15:0000000000009003
Quoted 1 line
[ 63.912159] FS: 0000000000000000(0000) GS:ffff90752a180000(0000)knlGS:0000000000000000
Quoted 2 lines
[ 63.912161] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 63.912162] CR2: ffffb24d403e5010 CR3: 0000000152832006 CR4:
00000000003706e0Quoted 24 lines
[ 63.912164] Call Trace: [ 63.912165] <TASK> [ 63.912167] ? show_regs+0x68/0x70 [ 63.912171] ? __die_body+0x20/0x70 [ 63.912173] ? __die+0x2b/0x40 [ 63.912175] ? page_fault_oops+0x160/0x480 [ 63.912177] ? search_bpf_extables+0x63/0x90 [ 63.912180] ? ioread32+0x2e/0x70 [ 63.912183] ? search_exception_tables+0x5f/0x70 [ 63.912186] ? kernelmode_fixup_or_oops+0xa2/0x120 [ 63.912189] ? __bad_area_nosemaphore+0x179/0x230 [ 63.912191] ? bad_area_nosemaphore+0x16/0x20 [ 63.912193] ? do_kern_addr_fault+0x8b/0xa0 [ 63.912195] ? exc_page_fault+0xe5/0x180 [ 63.912198] ? asm_exc_page_fault+0x27/0x30 [ 63.912203] ? ioread32+0x2e/0x70 [ 63.912206] ? rtsx_pci_write_register+0x5b/0x90 [rtsx_pci] [ 63.912217] rtsx_set_l1off_sub+0x1c/0x30 [rtsx_pci] [ 63.912226] rts5261_set_l1off_cfg_sub_d0+0x36/0x40 [rtsx_pci] [ 63.912234] rtsx_pci_runtime_idle+0xc7/0x160 [rtsx_pci] [ 63.912243] ? __pfx_pci_pm_runtime_idle+0x10/0x10 [ 63.912246] pci_pm_runtime_idle+0x34/0x70 [ 63.912248] rpm_idle+0xc4/0x2b0 [ 63.912251] pm_runtime_work+0x93/0xc0Quoted 8 lines
[ 63.912254] process_one_work+0x21a/0x430 [ 63.912258] worker_thread+0x4a/0x3c0 [ 63.912261] ? __pfx_worker_thread+0x10/0x10 [ 63.912263] kthread+0x106/0x140 [ 63.912266] ? __pfx_kthread+0x10/0x10 [ 63.912268] ret_from_fork+0x29/0x50 [ 63.912273] </TASK> [ 63.912274] Modules linked in: nvme nvme_core snd_hda_codec_hdmi
snd_sof_pci_intel_cnlsnd_sof_intel_hda_commonsnd_hda_codec_realteksnd_hda_codec_genericsnd_soc_hdac_hdasoundwire_intelledtrig_audionls_iso8859_1soundwire_generic_allocationsoundwire_cadencesnd_sof_intel_hda_mlinksnd_sof_intel_hdasnd_sof_pcisnd_sof_xtensa_dspsnd_sofsnd_sof_utilssnd_hda_ext_coresnd_soc_acpi_intel_matchsnd_soc_acpisoundwire_bussnd_soc_coresnd_compressac97_bussnd_pcm_dmaenginesnd_hda_inteli915snd_intel_dspcfgsnd_intel_sdw_acpiintel_rapl_msrsnd_hda_codecintel_rapl_commonsnd_hda_corex86_pkg_temp_thermalintel_powerclampsnd_hwdepcoretempsnd_pcmkvm_inteldrm_buddyttmmei_hdcpkvmdrm_display_helpersnd_seq_midisnd_seq_midi_eventceccrct10dif_pclmulghash_clmulni_intelsha512_ssse3aesni_intelcrypto_simdrc_corecryptd raplsnd_rawmididrm_kms_helperbinfmt_miscintel_cstatei2c_algo_bitjoydevsnd_seqsnd_seq_devicesyscopyareawmi_bmofsnd_timersysfillrectinput_ledssnd ee1004 sysimgbltmei_mesoundcoreQuoted 1 line
[ 63.912324] mei intel_pch_thermal mac_hid acpi_tad acpi_pad
sch_fq_codelmsrparport_pcppdev lp ramoops drm parportreed_solomonefi_pstoreip_tablesx_tablesautofs4hid_genericusbhid hidrtsx_pci_sdmmccrc32_pclmulahci e1000ei2c_i801i2c_smbusrtsx_pcixhci_pcilibahcixhci_pci_renesasvideo wmiQuoted 4 lines
[ 63.912346] CR2: ffffb24d403e5010 [ 63.912348] ---[ end trace 0000000000000000 ]--- [ 64.067753] RIP: 0010:ioread32+0x2e/0x70 [ 64.067762] Code: ff 03 00 77 25 48 81 ff 00 00 01 00 77 14 8b 15 08 d954 01 b8 ff ff ff ff 85 d2 75 14 c3 cc cc cc cc 89 fa ed c3 cc cc cc cc <8b> 07 c3 cc cc cc cc 55 83 ea 01 48 89 fe 48 c7 c7 98 6f 15 99 48
Quoted 2 lines
[ 64.067764] RSP: 0018:ffffb24d40a5bd78 EFLAGS: 00010296 [ 64.067767] RAX: ffffb24d403e5000 RBX: 0000000000000152 RCX:
000000000000007fQuoted 1 line
[ 64.067769] RDX: 000000000000ff00 RSI: ffffb24d403e5010 RDI:
ffffb24d403e5010Quoted 1 line
[ 64.067770] RBP: ffffb24d40a5bd98 R08: ffffb24d403e5010 R09:0000000000000000
Quoted 1 line
[ 64.067772] R10: ffff9074cd95e7f4 R11: 0000000000000003 R12:
000000000000007fQuoted 1 line
[ 64.067773] R13: ffff9074e1a68c00 R14: ffff9074e1a68d00 R15:0000000000009003
Quoted 1 line
[ 64.067775] FS: 0000000000000000(0000) GS:ffff90752a180000(0000)knlGS:0000000000000000
Quoted 2 lines
[ 64.067776] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 64.067778] CR2: ffffb24d403e5010 CR3: 0000000119402003 CR4:
00000000003706e0Quoted 4 lines
[ 64.067780] note: kworker/3:10[534] exited with irqs disabled----------------------------------------------------------------------
---------------------------------------------Does the following change work for you?
drivers/pci/hotplug/pciehp_ctrl.c +1
-0@@ -356,6 +356,7 @@ static int pciehp_disable_slot(struct controller *ctrl, bool safe_removal)int ret;pm_runtime_get_sync (&ctrl->pcie->port->dev); +pm_runtime_barrier (&ctrl->pcie->port->dev); ret =__pciehp_disable_slot (ctrl, safe_removal);pm_runtime_put (&ctrl->pcie->port->dev);Kai-Heng
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Fixes 597568e8df04 ("misc: rtsx: Rework runtime power managementflow")
Cc Kai-Heng Feng <[email protected]>Signed-off-by Ricky Wu <[email protected]>--- drivers/misc/cardreader/rtsx_pcr.c | 14 ++++++++------ drivers/mmc/host/rtsx_pci_sdmmc.c | 1 + include/linux/rtsx_pci.h | 1 + 3 files changed, 10 insertions(+), 6 deletions(-)Quoted 6 lines
Quoted 6 lines
drivers/misc/cardreader/rtsx_pcr.c static int rtsx_pci_probe(struct pci_dev
Quoted 6 lines
drivers/misc/cardreader/rtsx_pcr.c +0
-0@@ -1526,6 +1526,7 @@ static int rtsx_pci_probe(struct pci_dev*pcidev,
Quoted 67 lines
Quoted 66 lines
drivers/misc/cardreader/rtsx_pcr.c static int rtsx_pci_probe(struct pci_dev · line 1526
Quoted 1 line
drivers/misc/cardreader/rtsx_pcr.c +0
-0pcr->host_sg_tbl_addr = pcr->rtsx_resv_buf_addr +
HOST_CMDS_BUF_LEN;drivers/misc/cardreader/rtsx_pcr.c static int rtsx_pci_probe(struct pci_dev · line 1530
Quoted 4 lines
drivers/misc/cardreader/rtsx_pcr.c +1
-0pcr->card_inserted =0 ; pcr->card_removed =0 ; + pcr->is_sd_express = false; INIT_DELAYED_WORK(&pcr->carddet_work,
rtsx_pci_card_detect);Quoted 30 lines
drivers/misc/cardreader/rtsx_pcr.c +0
-0pcr->msi_en = msi_en;@@ -1735,12 +1736,13 @@ static int rtsx_pci_runtime_idle(structdevice
*device)pcr->state = PDEV_STAT_IDLE;drivers/misc/cardreader/rtsx_pcr.c +7
-6-if (pcr->ops->disable_auto_blink) - pcr->ops->disable_auto_blink (pcr); -if (pcr->ops->turn_off_led) - pcr->ops->turn_off_led (pcr); - -rtsx_pm_power_saving (pcr); +if (!pcr->is_sd_express) { +if (pcr->ops->disable_auto_blink) + pcr->ops->disable_auto_blink (pcr); +if (pcr->ops->turn_off_led) + pcr->ops->turn_off_led (pcr); +rtsx_pm_power_saving (pcr); + }mutex_unlock (&pcr->pcr_mutex);drivers/mmc/host/rtsx_pci_sdmmc.c +0
-0@@ -1393,6 +1393,7 @@ static int sdmmc_init_sd_express(structQuoted 1 line
mmc_host*mmc, struct
mmc_ios*ios)Quoted 1 line
RTS5261_MCU_BUS_SEL_MASK |
RTS5261_MCU_CLOCK_SEL_MASKQuoted 2 lines
| RTS5261_DRIVER_ENABLE_FW, RTS5261_MCU_CLOCK_SEL_16M |
RTS5261_DRIVER_ENABLE_FW);Quoted 18 lines
drivers/mmc/host/rtsx_pci_sdmmc.c +1
-0+ pcr->is_sd_express = true; host->eject = true;return 0 ; }include/linux/rtsx_pci.h +0
-0index
534038d962e4..295e92224fd0100644include/linux/rtsx_pci.h +1
-1@@ -1262,6 +1262,7 @@ struct rtsx_pcr {u8 ocp_stat;u8 ocp_stat2;u8 rtd3_en; +bool is_sd_express; };#define PID_524A 0x524A --Quoted 2 lines
2.25.1
------Please consider the environment before printing this e-mail.
[+Cc Rafael, linux-pm]
Quoted 75 lines · Ricky WU
Hi Kai-heng,
It is not work, still get fail..
Dmesg log as below
------------------------------------------------------------------[ 122.214916] pcieport 0000:00:1c.0: pciehp: Slot(8): Link Down [ 122.227416] BUG: unable to handle page fault for address: ffff9fa180089010 [ 122.227428] #PF: supervisor read access in kernel mode [ 122.227430] #PF: error_code(0x0000) - not-present page [ 122.227432] PGD 100000067 P4D 100000067 PUD 1001fe067 PMD 1001ff067 PTE 0 [ 122.227438] Oops: 0000 [#1] PREEMPT SMP PTI [ 122.227441] CPU: 3 PID: 1956 Comm: kworker/3:11 Not tainted 6.4.0 #7 [ 122.227444] Hardware name: To Be Filled By O.E.M. To Be Filled By O.E.M./H370M Pro4, BIOS P3.40 10/25/2018 [ 122.227446] Workqueue: pm pm_runtime_work [ 122.227452] RIP: 0010:ioread32+0x2e/0x70 [ 122.227456] Code: ff 03 00 77 25 48 81 ff 00 00 01 00 77 14 8b 15 08 d9 54 01 b8 ff ff ff ff 85 d2 75 14 c3 cc cc cc cc 89 fa ed c3 cc cc cc cc <8b> 07 c3 cc cc cc cc 55 83 ea 01 48 89 fe 48 c7 c7 98 6f d5 a7 48 [ 122.227459] RSP: 0018:ffff9fa1836d7d78 EFLAGS: 00010296 [ 122.227461] RAX: ffff9fa180089000 RBX: 0000000000000310 RCX: 000000000000007f [ 122.227462] RDX: 000000000000ff00 RSI: ffff9fa180089010 RDI: ffff9fa180089010 [ 122.227464] RBP: ffff9fa1836d7d98 R08: ffff9fa180089010 R09: 0000000000000000 [ 122.227465] R10: ffff8ac55298deb4 R11: 0000000000000003 R12: 000000000000007f [ 122.227466] R13: ffff8ac54022e000 R14: ffff8ac54022e100 R15: 0000000000009003 [ 122.227468] FS: 0000000000000000(0000) GS:ffff8ac5aa180000(0000) knlGS:0000000000000000 [ 122.227470] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 122.227472] CR2: ffff9fa180089010 CR3: 0000000115a32006 CR4: 00000000003706e0 [ 122.227473] Call Trace: [ 122.227475] <TASK> [ 122.227477] ? show_regs+0x68/0x70 [ 122.227481] ? __die_body+0x20/0x70 [ 122.227483] ? __die+0x2b/0x40 [ 122.227485] ? page_fault_oops+0x160/0x480 [ 122.227488] ? search_bpf_extables+0x63/0x90 [ 122.227490] ? ioread32+0x2e/0x70 [ 122.227493] ? search_exception_tables+0x5f/0x70 [ 122.227497] ? kernelmode_fixup_or_oops+0xa2/0x120 [ 122.227499] ? __bad_area_nosemaphore+0x179/0x230 [ 122.227501] ? bad_area_nosemaphore+0x16/0x20 [ 122.227503] ? do_kern_addr_fault+0x8b/0xa0 [ 122.227505] ? exc_page_fault+0xe5/0x180 [ 122.227509] ? asm_exc_page_fault+0x27/0x30 [ 122.227514] ? ioread32+0x2e/0x70 [ 122.227517] ? rtsx_pci_write_register+0x5b/0x90 [rtsx_pci] [ 122.227527] rtsx_set_l1off_sub+0x1c/0x30 [rtsx_pci] [ 122.227536] rts5261_set_l1off_cfg_sub_d0+0x36/0x40 [rtsx_pci] [ 122.227545] rtsx_pci_runtime_idle+0xc7/0x160 [rtsx_pci] [ 122.227553] ? __pfx_pci_pm_runtime_idle+0x10/0x10 [ 122.227557] pci_pm_runtime_idle+0x34/0x70 [ 122.227559] rpm_idle+0xc4/0x2b0 [ 122.227562] pm_runtime_work+0x93/0xc0 [ 122.227565] process_one_work+0x21a/0x430 [ 122.227569] worker_thread+0x4a/0x3c0 [ 122.227572] ? __pfx_worker_thread+0x10/0x10 [ 122.227574] kthread+0x106/0x140 [ 122.227577] ? __pfx_kthread+0x10/0x10 [ 122.227579] ret_from_fork+0x29/0x50 [ 122.227585] </TASK> [ 122.227586] Modules linked in: nls_iso8859_1 snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_codec_generic ledtrig_audio intel_rapl_msr intel_rapl_common snd_sof_pci_intel_cnl snd_sof_intel_hda_common snd_soc_hdac_hda soundwire_intel soundwire_generic_allocation soundwire_cadence snd_sof_intel_hda_mlink snd_sof_intel_hda snd_sof_pci snd_sof_xtensa_dsp snd_sof snd_sof_utils snd_hda_ext_core snd_soc_acpi_intel_match snd_soc_acpi soundwire_bus snd_soc_core snd_compress ac97_bus snd_pcm_dmaengine x86_pkg_temp_thermal intel_powerclamp coretemp snd_hda_intel kvm_intel snd_intel_dspcfg snd_intel_sdw_acpi i915 kvm mei_hdcp crct10dif_pclmul snd_hda_codec ghash_clmulni_intel sha512_ssse3 aesni_intel binfmt_misc crypto_simd snd_hda_core cryptd snd_hwdep snd_pcm input_leds drm_buddy snd_seq_midi rapl snd_seq_midi_event ttm joydev snd_rawmidi drm_display_helper ee1004 intel_cstate cec snd_seq wmi_bmof rc_core snd_seq_device snd_timer mei_me drm_kms_helper snd soundcore mei intel_pch_thermal i2c_algo_bit syscopyarea sysfillrect [ 122.227634] sysimgblt mac_hid acpi_pad acpi_tad sch_fq_codel msr parport_pc ppdev lp drm parport ramoops reed_solomon efi_pstore ip_tables x_tables autofs4 hid_generic usbhid hid rtsx_pci_sdmmc i2c_i801 e1000e ahci crc32_pclmul xhci_pci i2c_smbus rtsx_pci libahci xhci_pci_renesas video wmi [ 122.227656] CR2: ffff9fa180089010 [ 122.227658] ---[ end trace 0000000000000000 ]--- [ 122.384633] RIP: 0010:ioread32+0x2e/0x70 [ 122.384642] Code: ff 03 00 77 25 48 81 ff 00 00 01 00 77 14 8b 15 08 d9 54 01 b8 ff ff ff ff 85 d2 75 14 c3 cc cc cc cc 89 fa ed c3 cc cc cc cc <8b> 07 c3 cc cc cc cc 55 83 ea 01 48 89 fe 48 c7 c7 98 6f d5 a7 48 [ 122.384644] RSP: 0018:ffff9fa1836d7d78 EFLAGS: 00010296 [ 122.384647] RAX: ffff9fa180089000 RBX: 0000000000000310 RCX: 000000000000007f [ 122.384649] RDX: 000000000000ff00 RSI: ffff9fa180089010 RDI: ffff9fa180089010 [ 122.384650] RBP: ffff9fa1836d7d98 R08: ffff9fa180089010 R09: 0000000000000000 [ 122.384652] R10: ffff8ac55298deb4 R11: 0000000000000003 R12: 000000000000007f [ 122.384653] R13: ffff8ac54022e000 R14: ffff8ac54022e100 R15: 0000000000009003 [ 122.384654] FS: 0000000000000000(0000) GS:ffff8ac5aa180000(0000) knlGS:0000000000000000 [ 122.384656] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 122.384658] CR2: ffff9fa180089010 CR3: 0000000119526001 CR4: 00000000003706e0 [ 122.384660] note: kworker/3:11[1956] exited with irqs disabled-------------------------------------------------------------------
[snipped]
Quoted 11 lines
Quoted 11 lines
Does the following change work for you?
drivers/pci/hotplug/pciehp_ctrl.c +0
-0@@ -356,6 +356,7 @@ static int pciehp_disable_slot(struct controller *ctrl, bool safe_removal)int ret;
Quoted 4 lines
drivers/pci/hotplug/pciehp_ctrl.c static int pciehp_disable_slot(struct controller *ctrl, · line 362
Quoted 4 lines
drivers/pci/hotplug/pciehp_ctrl.c +1
-0pm_runtime_get_sync (&ctrl->pcie->port->dev); +pm_runtime_barrier (&ctrl->pcie->port->dev); ret =__pciehp_disable_slot (ctrl, safe_removal);pm_runtime_put (&ctrl->pcie->port->dev);
The issue is that when the PCI cardreader gets hot unplugged, rtsx_pci_runtime_idle still gets scheduled.
And using pm_runtime_barrier() is still not enough.
Is this something should be addressed by PM core?
Kai-Heng
Quoted 90 lines
Quoted 90 lines
Kai-Heng
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Fixes 597568e8df04 ("misc: rtsx: Rework runtime power managementflow")
Cc Kai-Heng Feng <[email protected]>Signed-off-by Ricky Wu <[email protected]>--- drivers/misc/cardreader/rtsx_pcr.c | 14 ++++++++------ drivers/mmc/host/rtsx_pci_sdmmc.c | 1 + include/linux/rtsx_pci.h | 1 + 3 files changed, 10 insertions(+), 6 deletions(-)Quoted 6 lines
Quoted 6 lines
drivers/misc/cardreader/rtsx_pcr.c static int rtsx_pci_probe(struct pci_dev
Quoted 6 lines
drivers/misc/cardreader/rtsx_pcr.c +0
-0@@ -1526,6 +1526,7 @@ static int rtsx_pci_probe(struct pci_dev*pcidev,
Quoted 67 lines
Quoted 66 lines
drivers/misc/cardreader/rtsx_pcr.c static int rtsx_pci_probe(struct pci_dev · line 1526
Quoted 1 line
drivers/misc/cardreader/rtsx_pcr.c +0
-0pcr->host_sg_tbl_addr = pcr->rtsx_resv_buf_addr +
HOST_CMDS_BUF_LEN;drivers/misc/cardreader/rtsx_pcr.c static int rtsx_pci_probe(struct pci_dev · line 1530
Quoted 4 lines
drivers/misc/cardreader/rtsx_pcr.c +1
-0pcr->card_inserted =0 ; pcr->card_removed =0 ; + pcr->is_sd_express = false; INIT_DELAYED_WORK(&pcr->carddet_work,
rtsx_pci_card_detect);Quoted 30 lines
drivers/misc/cardreader/rtsx_pcr.c +0
-0pcr->msi_en = msi_en;@@ -1735,12 +1736,13 @@ static int rtsx_pci_runtime_idle(structdevice
*device)pcr->state = PDEV_STAT_IDLE;drivers/misc/cardreader/rtsx_pcr.c +7
-6-if (pcr->ops->disable_auto_blink) - pcr->ops->disable_auto_blink (pcr); -if (pcr->ops->turn_off_led) - pcr->ops->turn_off_led (pcr); - -rtsx_pm_power_saving (pcr); +if (!pcr->is_sd_express) { +if (pcr->ops->disable_auto_blink) + pcr->ops->disable_auto_blink (pcr); +if (pcr->ops->turn_off_led) + pcr->ops->turn_off_led (pcr); +rtsx_pm_power_saving (pcr); + }mutex_unlock (&pcr->pcr_mutex);drivers/mmc/host/rtsx_pci_sdmmc.c +0
-0@@ -1393,6 +1393,7 @@ static int sdmmc_init_sd_express(structQuoted 1 line
mmc_host*mmc, struct
mmc_ios*ios)Quoted 1 line
RTS5261_MCU_BUS_SEL_MASK |
RTS5261_MCU_CLOCK_SEL_MASKQuoted 2 lines
| RTS5261_DRIVER_ENABLE_FW, RTS5261_MCU_CLOCK_SEL_16M |
RTS5261_DRIVER_ENABLE_FW);Quoted 18 lines
drivers/mmc/host/rtsx_pci_sdmmc.c +1
-0+ pcr->is_sd_express = true; host->eject = true;return 0 ; }include/linux/rtsx_pci.h +0
-0index
534038d962e4..295e92224fd0100644include/linux/rtsx_pci.h +1
-1@@ -1262,6 +1262,7 @@ struct rtsx_pcr {u8 ocp_stat;u8 ocp_stat2;u8 rtd3_en; +bool is_sd_express; };#define PID_524A 0x524A --Quoted 2 lines
2.25.1
------Please consider the environment before printing this e-mail.
Quoted 9 lines · Ricky WU
an error occurs on insert SD7.0 card.
The pci slot ofrtsx_pciwill Link Down when the SD7.0 card inserted, but thertsx_pcinot exit fromruntime_idleat that time, then do thepower_savingfunction to access the wrong resourceFixes 597568e8df04 ("misc: rtsx: Rework runtime power management flow")Cc Kai-Heng Feng <[email protected]>Signed-off-by Ricky Wu <[email protected]>
Applied for fixes, thanks!
Greg/Arnd, please let me know if you prefer to funnel this via your trees instead.
Kind regards
Uffe
Quoted 65 lines
--- drivers/misc/cardreader/rtsx_pcr.c | 14 ++++++++------ drivers/mmc/host/rtsx_pci_sdmmc.c | 1 + include/linux/rtsx_pci.h | 1 + 3 files changed, 10 insertions(+), 6 deletions(-)drivers/misc/cardreader/rtsx_pcr.c +8
-6@@ -1526,6 +1526,7 @@ static int rtsx_pci_probe(struct pci_dev *pcidev, pcr->host_sg_tbl_addr = pcr->rtsx_resv_buf_addr +HOST_CMDS_BUF_LEN ; pcr->card_inserted =0 ; pcr->card_removed =0 ; + pcr->is_sd_express = false;INIT_DELAYED_WORK (&pcr->carddet_work, rtsx_pci_card_detect); pcr->msi_en = msi_en;@@ -1735,12 +1736,13 @@ static int rtsx_pci_runtime_idle(struct device *device) pcr->state =PDEV_STAT_IDLE ; -if (pcr->ops->disable_auto_blink) - pcr->ops->disable_auto_blink (pcr); -if (pcr->ops->turn_off_led) - pcr->ops->turn_off_led (pcr); - -rtsx_pm_power_saving (pcr); +if (!pcr->is_sd_express) { +if (pcr->ops->disable_auto_blink) + pcr->ops->disable_auto_blink (pcr); +if (pcr->ops->turn_off_led) + pcr->ops->turn_off_led (pcr); +rtsx_pm_power_saving (pcr); + }mutex_unlock (&pcr->pcr_mutex);drivers/mmc/host/rtsx_pci_sdmmc.c +1
-0@@ -1393,6 +1393,7 @@ static int sdmmc_init_sd_express(struct mmc_host *mmc, struct mmc_ios *ios)RTS5261_MCU_BUS_SEL_MASK |RTS5261_MCU_CLOCK_SEL_MASK |RTS5261_DRIVER_ENABLE_FW , RTS5261_MCU_CLOCK_SEL_16M | RTS5261_DRIVER_ENABLE_FW); + pcr->is_sd_express = true; host->eject = true;return 0 ; }include/linux/rtsx_pci.h +1
-1@@ -1262,6 +1262,7 @@ struct rtsx_pcr {u8 ocp_stat;u8 ocp_stat2;u8 rtd3_en; +bool is_sd_express; };#define PID_524A 0x524A --2.25.1
Quoted 8 lines · Ulf Hansson
Quoted 6 lines · Ricky WU
an error occurs on insert SD7.0 card.
The pci slot ofrtsx_pciwill Link Down when the SD7.0 card inserted, but thertsx_pcinot exit fromruntime_idleat that time, then do thepower_savingfunction to access the wrong resource
Quoted 5 lines
Quoted 3 lines
Fixes 597568e8df04 ("misc: rtsx: Rework runtime power management flow")Cc Kai-Heng Feng <[email protected]>Signed-off-by Ricky Wu <[email protected]>Applied for fixes, thanks!
This was not ready to be applied, my bad! Fortunately, I haven't submitted a pull-request with this yet, so I am simply dropping the patch for now, to make sure we find the proper solution.
[...]
Kind regards
Uffe
Ricky,
Quoted 14 lines · Ulf Hansson
Quoted 12 lines · Ulf Hansson
Quoted 9 lines · Ricky WU
an error occurs on insert SD7.0 card.
The pci slot ofrtsx_pciwill Link Down when the SD7.0 card inserted, but thertsx_pcinot exit fromruntime_idleat that time, then do thepower_savingfunction to access the wrong resourceFixes 597568e8df04 ("misc: rtsx: Rework runtime power management flow")Cc Kai-Heng Feng <[email protected]>Signed-off-by Ricky Wu <[email protected]>
Quoted 5 lines
Quoted 1 line
Applied for fixes, thanks!
This was not ready to be applied, my bad! Fortunately, I haven't submitted a pull-request with this yet, so I am simply dropping the patch for now, to make sure we find the proper solution.
Can you please see if the following change helps:
drivers/pci/hotplug/pciehp_pci.c +9 -0
@@ -18,9 +18,18 @@#include <linux/kernel.h> #include <linux/types.h> #include <linux/pci.h> +#include <linux/pm_runtime.h> #include "../pci.h" #include "pciehp.h" +int pciehp_pm_runtime_barrier (struct pci_dev *pdev,void *unused) +{ +pm_runtime_barrier (&pdev->dev); +pci_dev_set_disconnected (pdev,NULL ); + +return 0 ; +} +/** * pciehp_configure_device() - enumerate PCI devices below a hotplug bridge * @ctrl: PCIe hotplug controller
@@ -98,7 +107,7 @@ void pciehp_unconfigure_device(struct controller
*ctrl, bool presence)
__func__, pci_domain_nr(parent), parent->number);
if (!presence)- pci_walk_bus(parent, pci_dev_set_disconnected, NULL);
+ pci_walk_bus(parent, pciehp_pm_runtime_barrier, NULL);
pci_lock_rescan_remove();
Quoted 5 lines
[...]
Kind regards
Uffe
Ricky WU
Tested-byHi Kai-Heng,
I finished testing this patch it's working fine, re-plug card many time don't see the issue reproduce I think this patch can fix the problem
thank you
Quoted 67 lines
Ricky,
Quoted 16 lines · Ulf Hansson
Quoted 14 lines · Ulf Hansson
Quoted 11 lines · Ricky WU
an error occurs on insert SD7.0 card.
The pci slot ofrtsx_pciwill Link Down when the SD7.0 card inserted, but thertsx_pcinot exit fromruntime_idleat that time, then do thepower_savingfunction to access the wrong resourceFixes 597568e8df04 ("misc: rtsx: Rework runtime power managementflow")
Cc Kai-Heng Feng <[email protected]>Signed-off-by Ricky Wu <[email protected]>Quoted 5 lines
Quoted 1 line
Applied for fixes, thanks!
This was not ready to be applied, my bad! Fortunately, I haven't submitted a pull-request with this yet, so I am simply dropping the patch for now, to make sure we find the proper solution.
Can you please see if the following change helps:
drivers/pci/hotplug/pciehp_pci.c +8
-0@@ -18,9 +18,18 @@#include <linux/kernel.h> #include <linux/types.h> #include <linux/pci.h> +#include <linux/pm_runtime.h> #include "../pci.h" #include "pciehp.h" +int pciehp_pm_runtime_barrier (struct pci_dev *pdev,void *unused) { +pm_runtime_barrier (&pdev->dev); +pci_dev_set_disconnected (pdev,NULL ); + +return 0 ; +} +/** * pciehp_configure_device() - enumerate PCI devices below a hotplug bridge
* @ctrl: PCIe hotplug controllerdrivers/pci/hotplug/pciehp_pci.c +1
-1@@ -98,7 +107,7 @@ void pciehp_unconfigure_device(struct controller *ctrl, bool presence) __func__, pci_domain_nr(parent), parent->number);if (!presence) -pci_walk_bus (parent, pci_dev_set_disconnected,NULL ); +pci_walk_bus (parent, pciehp_pm_runtime_barrier,NULL );pci_lock_rescan_remove ();Quoted 7 lines
[...]
Kind regards
Uffe