* ahci: sata hotplug doesn't work after suspend
@ 2012-02-19 20:11 Jiri Slaby
2012-02-19 20:17 ` Jiri Slaby
2012-02-19 21:17 ` Holger Macht
0 siblings, 2 replies; 10+ messages in thread
From: Jiri Slaby @ 2012-02-19 20:11 UTC (permalink / raw)
To: Jeff Garzik; +Cc: linux-ide, LKML, Jiri Slaby
Hi,
ahci hotplug stopped working here. It always worked (-next-20111206 is
the last known working for sure). I'm using -next and after plugging a
sata disk in, nothing happens. I don't *think* (in the traffic, it's
hard to tell for sure) an interrupt is generated either. I also *think*
that it works before suspend/resume, but not after. (Or maybe uptime
matters?)
This happens before suspend on plug-in:
ata3: exception Emask 0x50 SAct 0x0 SErr 0x40d0800 action 0xe frozen
ata3: irq_stat 0x00000040, connection status changed
ata3: SError: { HostInt PHYRdyChg CommWake 10B8B DevExch }
ata3: hard resetting link
ata3: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
ata3.00: ATA-8: ST31000528AS, CC38, max UDMA/133
ata3.00: 1953525168 sectors, multi 0: LBA48 NCQ (depth 31/32)
ata3.00: configured for UDMA/133
ata3: EH complete
scsi 2:0:0:0: Direct-Access ATA ST31000528AS CC38 PQ: 0 ANSI: 5
sd 2:0:0:0: [sdc] 1953525168 512-byte logical blocks: (1.00 TB/931 GiB)
sd 2:0:0:0: [sdc] Write Protect is off
sd 2:0:0:0: [sdc] Mode Sense: 00 3a 00 00
sd 2:0:0:0: [sdc] Write cache: enabled, read cache: enabled, doesn't
support DPO or FUA
sdc: sdc1 sdc2
sd 2:0:0:0: [sdc] Attached SCSI disk
After suspend/resume and plug-in, nothing appears in dmesg. Storing "- -
-" to /sys/class/scsi_host/host*/scan doesn't help. It looks like the
line is completely dead, because only ata1 and ata2 say "hard resetting
link" after this (and another two disks are connected there).
I tried 'echo adapter >host_reset', but I get 'write error: Invalid
argument'.
00:1f.2 SATA controller [0106]: Intel Corporation 82801IR/IO/IH
(ICH9R/DO/DH) 6 port SATA Controller [AHCI mode] [8086:2922] (rev 02)
(prog-if 01 [AHCI 1.0])
Subsystem: Intel Corporation 82801IR/IO/IH (ICH9R/DO/DH) 6 port
SATA Controller [AHCI mode] [8086:2922]
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop-
ParErr- Stepping- SERR- FastB2B- DisINTx+
Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort-
<TAbort- <MAbort- >SERR- <PERR- INTx-
Latency: 0
Interrupt: pin B routed to IRQ 43
Region 0: I/O ports at cc00 [size=8]
Region 1: I/O ports at c880 [size=4]
Region 2: I/O ports at c800 [size=8]
Region 3: I/O ports at c480 [size=4]
Region 4: I/O ports at c400 [size=32]
Region 5: Memory at feb7c800 (32-bit, non-prefetchable) [size=2K]
Capabilities: [80] MSI: Enable+ Count=1/16 Maskable- 64bit-
Address: fee0100c Data: 4171
Capabilities: [70] Power Management version 3
Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA
PME(D0-,D1-,D2-,D3hot+,D3cold-)
Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME-
Capabilities: [a8] SATA HBA v1.0 BAR4 Offset=00000004
Capabilities: [b0] Vendor Specific Information: Len=06 <?>
Kernel driver in use: ahci
Any ideas what that could be?
thanks,
--
js
suse labs
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: ahci: sata hotplug doesn't work after suspend 2012-02-19 20:11 ahci: sata hotplug doesn't work after suspend Jiri Slaby @ 2012-02-19 20:17 ` Jiri Slaby 2012-02-19 21:17 ` Holger Macht 1 sibling, 0 replies; 10+ messages in thread From: Jiri Slaby @ 2012-02-19 20:17 UTC (permalink / raw) To: Jeff Garzik; +Cc: linux-ide, LKML, Jiri Slaby On 02/19/2012 09:11 PM, Jiri Slaby wrote: > Hi, > > ahci hotplug stopped working here. It always worked (-next-20111206 is > the last known working for sure). I'm using -next and after plugging a > sata disk in, nothing happens. I don't *think* (in the traffic, it's > hard to tell for sure) an interrupt is generated either. I also *think* > that it works before suspend/resume, but not after. (Or maybe uptime > matters?) > > This happens before suspend on plug-in: > ata3: exception Emask 0x50 SAct 0x0 SErr 0x40d0800 action 0xe frozen > ata3: irq_stat 0x00000040, connection status changed > ata3: SError: { HostInt PHYRdyChg CommWake 10B8B DevExch } > ata3: hard resetting link > ata3: SATA link up 3.0 Gbps (SStatus 123 SControl 300) > ata3.00: ATA-8: ST31000528AS, CC38, max UDMA/133 > ata3.00: 1953525168 sectors, multi 0: LBA48 NCQ (depth 31/32) > ata3.00: configured for UDMA/133 > ata3: EH complete > scsi 2:0:0:0: Direct-Access ATA ST31000528AS CC38 PQ: 0 ANSI: 5 > sd 2:0:0:0: [sdc] 1953525168 512-byte logical blocks: (1.00 TB/931 GiB) > sd 2:0:0:0: [sdc] Write Protect is off > sd 2:0:0:0: [sdc] Mode Sense: 00 3a 00 00 > sd 2:0:0:0: [sdc] Write cache: enabled, read cache: enabled, doesn't > support DPO or FUA > sdc: sdc1 sdc2 > sd 2:0:0:0: [sdc] Attached SCSI disk > > After suspend/resume and plug-in, nothing appears in dmesg. Storing "- - > -" to /sys/class/scsi_host/host*/scan doesn't help. It looks like the > line is completely dead, because only ata1 and ata2 say "hard resetting > link" after this (and another two disks are connected there). > > I tried 'echo adapter >host_reset', but I get 'write error: Invalid > argument'. > > 00:1f.2 SATA controller [0106]: Intel Corporation 82801IR/IO/IH > (ICH9R/DO/DH) 6 port SATA Controller [AHCI mode] [8086:2922] (rev 02) > (prog-if 01 [AHCI 1.0]) > Subsystem: Intel Corporation 82801IR/IO/IH (ICH9R/DO/DH) 6 port > SATA Controller [AHCI mode] [8086:2922] > Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- > ParErr- Stepping- SERR- FastB2B- DisINTx+ > Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- > <TAbort- <MAbort- >SERR- <PERR- INTx- > Latency: 0 > Interrupt: pin B routed to IRQ 43 > Region 0: I/O ports at cc00 [size=8] > Region 1: I/O ports at c880 [size=4] > Region 2: I/O ports at c800 [size=8] > Region 3: I/O ports at c480 [size=4] > Region 4: I/O ports at c400 [size=32] > Region 5: Memory at feb7c800 (32-bit, non-prefetchable) [size=2K] > Capabilities: [80] MSI: Enable+ Count=1/16 Maskable- 64bit- > Address: fee0100c Data: 4171 > Capabilities: [70] Power Management version 3 > Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA > PME(D0-,D1-,D2-,D3hot+,D3cold-) > Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME- > Capabilities: [a8] SATA HBA v1.0 BAR4 Offset=00000004 > Capabilities: [b0] Vendor Specific Information: Len=06 <?> > Kernel driver in use: ahci > > Any ideas what that could be? Maybe this will help (dmesg|grep -C 2 ata3)? parport_pc 00:07: activated ata4: SATA link down (SStatus 0 SControl 300) ata3: SATA link down (SStatus 0 SControl 300) firewire_core: rediscovered device fw0 usb 5-1: reset low-speed USB device number 2 using uhci_hcd -- ata2: SATA link up 3.0 Gbps (SStatus 123 SControl 300) ata2.00: configured for UDMA/133 ata3: SATA link down (SStatus 0 SControl 300) ata3: limiting SATA link speed to 1.5 Gbps sd 1:0:0:0: [sdb] Starting disk ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 300) ata1.00: configured for UDMA/133 sd 0:0:0:0: [sda] Starting disk ata3: SATA link down (SStatus 0 SControl 310) ata3.00: disabled ata3.00: detaching (SCSI 2:0:0:0) Extended CMOS year: 2000 PM: resume of devices complete after 11061.816 msecs -- ata1.00: configured for UDMA/133 sd 0:0:0:0: [sda] Starting disk ata3: softreset failed (1st FIS failed) ata3: SATA link up 1.5 Gbps (SStatus 113 SControl 310) PM: resume of devices complete after 10620.205 msecs pl2303 7-1:1.0: pl2303 converter detected > thanks, -- js suse labs ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: ahci: sata hotplug doesn't work after suspend 2012-02-19 20:11 ahci: sata hotplug doesn't work after suspend Jiri Slaby 2012-02-19 20:17 ` Jiri Slaby @ 2012-02-19 21:17 ` Holger Macht 2012-02-20 8:30 ` Lin Ming 1 sibling, 1 reply; 10+ messages in thread From: Holger Macht @ 2012-02-19 21:17 UTC (permalink / raw) To: Jiri Slaby; +Cc: Jeff Garzik, linux-ide, LKML, Jiri Slaby, Lin Ming On So 19. Feb - 21:11:33, Jiri Slaby wrote: > Hi, > > ahci hotplug stopped working here. It always worked (-next-20111206 is > the last known working for sure). I'm using -next and after plugging a > sata disk in, nothing happens. I don't *think* (in the traffic, it's > hard to tell for sure) an interrupt is generated either. I also *think* > that it works before suspend/resume, but not after. (Or maybe uptime > matters?) > > This happens before suspend on plug-in: > ata3: exception Emask 0x50 SAct 0x0 SErr 0x40d0800 action 0xe frozen > ata3: irq_stat 0x00000040, connection status changed > ata3: SError: { HostInt PHYRdyChg CommWake 10B8B DevExch } > ata3: hard resetting link > ata3: SATA link up 3.0 Gbps (SStatus 123 SControl 300) > ata3.00: ATA-8: ST31000528AS, CC38, max UDMA/133 > ata3.00: 1953525168 sectors, multi 0: LBA48 NCQ (depth 31/32) > ata3.00: configured for UDMA/133 > ata3: EH complete > scsi 2:0:0:0: Direct-Access ATA ST31000528AS CC38 PQ: 0 ANSI: 5 > sd 2:0:0:0: [sdc] 1953525168 512-byte logical blocks: (1.00 TB/931 GiB) > sd 2:0:0:0: [sdc] Write Protect is off > sd 2:0:0:0: [sdc] Mode Sense: 00 3a 00 00 > sd 2:0:0:0: [sdc] Write cache: enabled, read cache: enabled, doesn't > support DPO or FUA > sdc: sdc1 sdc2 > sd 2:0:0:0: [sdc] Attached SCSI disk > > After suspend/resume and plug-in, nothing appears in dmesg. Storing "- - > -" to /sys/class/scsi_host/host*/scan doesn't help. It looks like the > line is completely dead, because only ata1 and ata2 say "hard resetting > link" after this (and another two disks are connected there). > > I tried 'echo adapter >host_reset', but I get 'write error: Invalid > argument'. > > 00:1f.2 SATA controller [0106]: Intel Corporation 82801IR/IO/IH > (ICH9R/DO/DH) 6 port SATA Controller [AHCI mode] [8086:2922] (rev 02) > (prog-if 01 [AHCI 1.0]) > Subsystem: Intel Corporation 82801IR/IO/IH (ICH9R/DO/DH) 6 port > SATA Controller [AHCI mode] [8086:2922] > Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- > ParErr- Stepping- SERR- FastB2B- DisINTx+ > Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- > <TAbort- <MAbort- >SERR- <PERR- INTx- > Latency: 0 > Interrupt: pin B routed to IRQ 43 > Region 0: I/O ports at cc00 [size=8] > Region 1: I/O ports at c880 [size=4] > Region 2: I/O ports at c800 [size=8] > Region 3: I/O ports at c480 [size=4] > Region 4: I/O ports at c400 [size=32] > Region 5: Memory at feb7c800 (32-bit, non-prefetchable) [size=2K] > Capabilities: [80] MSI: Enable+ Count=1/16 Maskable- 64bit- > Address: fee0100c Data: 4171 > Capabilities: [70] Power Management version 3 > Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA > PME(D0-,D1-,D2-,D3hot+,D3cold-) > Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME- > Capabilities: [a8] SATA HBA v1.0 BAR4 Offset=00000004 > Capabilities: [b0] Vendor Specific Information: Len=06 <?> > Kernel driver in use: ahci > > Any ideas what that could be? I suspect this is caused by commit 9ee4f3933930abf5cc34f8e9d69fe0e08c18f602. Maybe you could verify? I bisected this a couple of days ago but didn't have time to look into it further. Maybe Lin can help here if this is the problematic commit. Regards, Holger ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: ahci: sata hotplug doesn't work after suspend 2012-02-19 21:17 ` Holger Macht @ 2012-02-20 8:30 ` Lin Ming 2012-02-20 12:52 ` Jiri Slaby 0 siblings, 1 reply; 10+ messages in thread From: Lin Ming @ 2012-02-20 8:30 UTC (permalink / raw) To: Holger Macht; +Cc: Jiri Slaby, Jeff Garzik, linux-ide, LKML, Jiri Slaby On Sun, 2012-02-19 at 22:17 +0100, Holger Macht wrote: > On So 19. Feb - 21:11:33, Jiri Slaby wrote: > > Hi, > > > > ahci hotplug stopped working here. It always worked (-next-20111206 is > > the last known working for sure). I'm using -next and after plugging a > > sata disk in, nothing happens. I don't *think* (in the traffic, it's > > hard to tell for sure) an interrupt is generated either. I also *think* > > that it works before suspend/resume, but not after. (Or maybe uptime > > matters?) > > > > This happens before suspend on plug-in: > > ata3: exception Emask 0x50 SAct 0x0 SErr 0x40d0800 action 0xe frozen > > ata3: irq_stat 0x00000040, connection status changed > > ata3: SError: { HostInt PHYRdyChg CommWake 10B8B DevExch } > > ata3: hard resetting link > > ata3: SATA link up 3.0 Gbps (SStatus 123 SControl 300) > > ata3.00: ATA-8: ST31000528AS, CC38, max UDMA/133 > > ata3.00: 1953525168 sectors, multi 0: LBA48 NCQ (depth 31/32) > > ata3.00: configured for UDMA/133 > > ata3: EH complete > > scsi 2:0:0:0: Direct-Access ATA ST31000528AS CC38 PQ: 0 ANSI: 5 > > sd 2:0:0:0: [sdc] 1953525168 512-byte logical blocks: (1.00 TB/931 GiB) > > sd 2:0:0:0: [sdc] Write Protect is off > > sd 2:0:0:0: [sdc] Mode Sense: 00 3a 00 00 > > sd 2:0:0:0: [sdc] Write cache: enabled, read cache: enabled, doesn't > > support DPO or FUA > > sdc: sdc1 sdc2 > > sd 2:0:0:0: [sdc] Attached SCSI disk > > > > After suspend/resume and plug-in, nothing appears in dmesg. Storing "- - > > -" to /sys/class/scsi_host/host*/scan doesn't help. It looks like the > > line is completely dead, because only ata1 and ata2 say "hard resetting > > link" after this (and another two disks are connected there). > > > > I tried 'echo adapter >host_reset', but I get 'write error: Invalid > > argument'. > > > > 00:1f.2 SATA controller [0106]: Intel Corporation 82801IR/IO/IH > > (ICH9R/DO/DH) 6 port SATA Controller [AHCI mode] [8086:2922] (rev 02) > > (prog-if 01 [AHCI 1.0]) > > Subsystem: Intel Corporation 82801IR/IO/IH (ICH9R/DO/DH) 6 port > > SATA Controller [AHCI mode] [8086:2922] > > Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- > > ParErr- Stepping- SERR- FastB2B- DisINTx+ > > Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- > > <TAbort- <MAbort- >SERR- <PERR- INTx- > > Latency: 0 > > Interrupt: pin B routed to IRQ 43 > > Region 0: I/O ports at cc00 [size=8] > > Region 1: I/O ports at c880 [size=4] > > Region 2: I/O ports at c800 [size=8] > > Region 3: I/O ports at c480 [size=4] > > Region 4: I/O ports at c400 [size=32] > > Region 5: Memory at feb7c800 (32-bit, non-prefetchable) [size=2K] > > Capabilities: [80] MSI: Enable+ Count=1/16 Maskable- 64bit- > > Address: fee0100c Data: 4171 > > Capabilities: [70] Power Management version 3 > > Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA > > PME(D0-,D1-,D2-,D3hot+,D3cold-) > > Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME- > > Capabilities: [a8] SATA HBA v1.0 BAR4 Offset=00000004 > > Capabilities: [b0] Vendor Specific Information: Len=06 <?> > > Kernel driver in use: ahci > > > > Any ideas what that could be? > > I suspect this is caused by commit > 9ee4f3933930abf5cc34f8e9d69fe0e08c18f602. Maybe you could verify? I > bisected this a couple of days ago but didn't have time to look into it > further. Maybe Lin can help here if this is the problematic commit. I'll try to re-produce this issue first. Regards, Lin Ming > > Regards, > Holger ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: ahci: sata hotplug doesn't work after suspend 2012-02-20 8:30 ` Lin Ming @ 2012-02-20 12:52 ` Jiri Slaby 2012-02-21 8:12 ` Lin Ming 2012-02-23 2:26 ` Lin Ming 0 siblings, 2 replies; 10+ messages in thread From: Jiri Slaby @ 2012-02-20 12:52 UTC (permalink / raw) To: Lin Ming; +Cc: Holger Macht, Jiri Slaby, Jeff Garzik, linux-ide, LKML On 02/20/2012 09:30 AM, Lin Ming wrote: > On Sun, 2012-02-19 at 22:17 +0100, Holger Macht wrote: >> On So 19. Feb - 21:11:33, Jiri Slaby wrote: >>> Hi, >>> >>> ahci hotplug stopped working here. It always worked (-next-20111206 is >>> the last known working for sure). I'm using -next and after plugging a >>> sata disk in, nothing happens. I don't *think* (in the traffic, it's >>> hard to tell for sure) an interrupt is generated either. I also *think* >>> that it works before suspend/resume, but not after. (Or maybe uptime >>> matters?) >>> >>> This happens before suspend on plug-in: >>> ata3: exception Emask 0x50 SAct 0x0 SErr 0x40d0800 action 0xe frozen >>> ata3: irq_stat 0x00000040, connection status changed >>> ata3: SError: { HostInt PHYRdyChg CommWake 10B8B DevExch } >>> ata3: hard resetting link >>> ata3: SATA link up 3.0 Gbps (SStatus 123 SControl 300) >>> ata3.00: ATA-8: ST31000528AS, CC38, max UDMA/133 >>> ata3.00: 1953525168 sectors, multi 0: LBA48 NCQ (depth 31/32) >>> ata3.00: configured for UDMA/133 >>> ata3: EH complete >>> scsi 2:0:0:0: Direct-Access ATA ST31000528AS CC38 PQ: 0 ANSI: 5 >>> sd 2:0:0:0: [sdc] 1953525168 512-byte logical blocks: (1.00 TB/931 GiB) >>> sd 2:0:0:0: [sdc] Write Protect is off >>> sd 2:0:0:0: [sdc] Mode Sense: 00 3a 00 00 >>> sd 2:0:0:0: [sdc] Write cache: enabled, read cache: enabled, doesn't >>> support DPO or FUA >>> sdc: sdc1 sdc2 >>> sd 2:0:0:0: [sdc] Attached SCSI disk >>> >>> After suspend/resume and plug-in, nothing appears in dmesg. Storing "- - >>> -" to /sys/class/scsi_host/host*/scan doesn't help. It looks like the >>> line is completely dead, because only ata1 and ata2 say "hard resetting >>> link" after this (and another two disks are connected there). >>> >>> I tried 'echo adapter >host_reset', but I get 'write error: Invalid >>> argument'. >>> >>> 00:1f.2 SATA controller [0106]: Intel Corporation 82801IR/IO/IH >>> (ICH9R/DO/DH) 6 port SATA Controller [AHCI mode] [8086:2922] (rev 02) >>> (prog-if 01 [AHCI 1.0]) >>> Subsystem: Intel Corporation 82801IR/IO/IH (ICH9R/DO/DH) 6 port >>> SATA Controller [AHCI mode] [8086:2922] >>> Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- >>> ParErr- Stepping- SERR- FastB2B- DisINTx+ >>> Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- >>> <TAbort- <MAbort- >SERR- <PERR- INTx- >>> Latency: 0 >>> Interrupt: pin B routed to IRQ 43 >>> Region 0: I/O ports at cc00 [size=8] >>> Region 1: I/O ports at c880 [size=4] >>> Region 2: I/O ports at c800 [size=8] >>> Region 3: I/O ports at c480 [size=4] >>> Region 4: I/O ports at c400 [size=32] >>> Region 5: Memory at feb7c800 (32-bit, non-prefetchable) [size=2K] >>> Capabilities: [80] MSI: Enable+ Count=1/16 Maskable- 64bit- >>> Address: fee0100c Data: 4171 >>> Capabilities: [70] Power Management version 3 >>> Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA >>> PME(D0-,D1-,D2-,D3hot+,D3cold-) >>> Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME- >>> Capabilities: [a8] SATA HBA v1.0 BAR4 Offset=00000004 >>> Capabilities: [b0] Vendor Specific Information: Len=06 <?> >>> Kernel driver in use: ahci >>> >>> Any ideas what that could be? >> >> I suspect this is caused by commit >> 9ee4f3933930abf5cc34f8e9d69fe0e08c18f602. Maybe you could verify? I >> bisected this a couple of days ago but didn't have time to look into it >> further. Maybe Lin can help here if this is the problematic commit. > > I'll try to re-produce this issue first. Ok, just a few more information. Suspend/resume cycle is needed to see the issue. Reverting of 9ee4f3933930 helps when this is applied too (I haven't tried one or the other alone): --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -5305,25 +5305,16 @@ static int ata_port_suspend_common(struct device *dev, pm_message_t mesg) static int ata_port_suspend(struct device *dev) { - if (pm_runtime_suspended(dev)) - return 0; - return ata_port_suspend_common(dev, PMSG_SUSPEND); } static int ata_port_do_freeze(struct device *dev) { - if (pm_runtime_suspended(dev)) - pm_runtime_resume(dev); - return ata_port_suspend_common(dev, PMSG_FREEZE); } static int ata_port_poweroff(struct device *dev) { - if (pm_runtime_suspended(dev)) - return 0; - return ata_port_suspend_common(dev, PMSG_HIBERNATE); } @@ -5339,16 +5330,7 @@ static int ata_port_resume_common(struct device *dev) static int ata_port_resume(struct device *dev) { - int rc; - - rc = ata_port_resume_common(dev); - if (!rc) { - pm_runtime_disable(dev); - pm_runtime_set_active(dev); - pm_runtime_enable(dev); - } - - return rc; + return ata_port_resume_common(dev); } static const struct dev_pm_ops ata_port_pm_ops = { -- js suse labs ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: ahci: sata hotplug doesn't work after suspend 2012-02-20 12:52 ` Jiri Slaby @ 2012-02-21 8:12 ` Lin Ming 2012-02-23 2:26 ` Lin Ming 1 sibling, 0 replies; 10+ messages in thread From: Lin Ming @ 2012-02-21 8:12 UTC (permalink / raw) To: Jiri Slaby; +Cc: Holger Macht, Jiri Slaby, Jeff Garzik, linux-ide, LKML On Mon, 2012-02-20 at 13:52 +0100, Jiri Slaby wrote: > On 02/20/2012 09:30 AM, Lin Ming wrote: > > On Sun, 2012-02-19 at 22:17 +0100, Holger Macht wrote: > >> On So 19. Feb - 21:11:33, Jiri Slaby wrote: > >>> Hi, > >>> > >>> ahci hotplug stopped working here. It always worked (-next-20111206 is > >>> the last known working for sure). I'm using -next and after plugging a > >>> sata disk in, nothing happens. I don't *think* (in the traffic, it's > >>> hard to tell for sure) an interrupt is generated either. I also *think* > >>> that it works before suspend/resume, but not after. (Or maybe uptime > >>> matters?) > >>> > >>> This happens before suspend on plug-in: > >>> ata3: exception Emask 0x50 SAct 0x0 SErr 0x40d0800 action 0xe frozen > >>> ata3: irq_stat 0x00000040, connection status changed > >>> ata3: SError: { HostInt PHYRdyChg CommWake 10B8B DevExch } > >>> ata3: hard resetting link > >>> ata3: SATA link up 3.0 Gbps (SStatus 123 SControl 300) > >>> ata3.00: ATA-8: ST31000528AS, CC38, max UDMA/133 > >>> ata3.00: 1953525168 sectors, multi 0: LBA48 NCQ (depth 31/32) > >>> ata3.00: configured for UDMA/133 > >>> ata3: EH complete > >>> scsi 2:0:0:0: Direct-Access ATA ST31000528AS CC38 PQ: 0 ANSI: 5 > >>> sd 2:0:0:0: [sdc] 1953525168 512-byte logical blocks: (1.00 TB/931 GiB) > >>> sd 2:0:0:0: [sdc] Write Protect is off > >>> sd 2:0:0:0: [sdc] Mode Sense: 00 3a 00 00 > >>> sd 2:0:0:0: [sdc] Write cache: enabled, read cache: enabled, doesn't > >>> support DPO or FUA > >>> sdc: sdc1 sdc2 > >>> sd 2:0:0:0: [sdc] Attached SCSI disk > >>> > >>> After suspend/resume and plug-in, nothing appears in dmesg. Storing "- - > >>> -" to /sys/class/scsi_host/host*/scan doesn't help. It looks like the > >>> line is completely dead, because only ata1 and ata2 say "hard resetting > >>> link" after this (and another two disks are connected there). > >>> > >>> I tried 'echo adapter >host_reset', but I get 'write error: Invalid > >>> argument'. > >>> > >>> 00:1f.2 SATA controller [0106]: Intel Corporation 82801IR/IO/IH > >>> (ICH9R/DO/DH) 6 port SATA Controller [AHCI mode] [8086:2922] (rev 02) > >>> (prog-if 01 [AHCI 1.0]) > >>> Subsystem: Intel Corporation 82801IR/IO/IH (ICH9R/DO/DH) 6 port > >>> SATA Controller [AHCI mode] [8086:2922] > >>> Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- > >>> ParErr- Stepping- SERR- FastB2B- DisINTx+ > >>> Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- > >>> <TAbort- <MAbort- >SERR- <PERR- INTx- > >>> Latency: 0 > >>> Interrupt: pin B routed to IRQ 43 > >>> Region 0: I/O ports at cc00 [size=8] > >>> Region 1: I/O ports at c880 [size=4] > >>> Region 2: I/O ports at c800 [size=8] > >>> Region 3: I/O ports at c480 [size=4] > >>> Region 4: I/O ports at c400 [size=32] > >>> Region 5: Memory at feb7c800 (32-bit, non-prefetchable) [size=2K] > >>> Capabilities: [80] MSI: Enable+ Count=1/16 Maskable- 64bit- > >>> Address: fee0100c Data: 4171 > >>> Capabilities: [70] Power Management version 3 > >>> Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA > >>> PME(D0-,D1-,D2-,D3hot+,D3cold-) > >>> Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME- > >>> Capabilities: [a8] SATA HBA v1.0 BAR4 Offset=00000004 > >>> Capabilities: [b0] Vendor Specific Information: Len=06 <?> > >>> Kernel driver in use: ahci > >>> > >>> Any ideas what that could be? > >> > >> I suspect this is caused by commit > >> 9ee4f3933930abf5cc34f8e9d69fe0e08c18f602. Maybe you could verify? I > >> bisected this a couple of days ago but didn't have time to look into it > >> further. Maybe Lin can help here if this is the problematic commit. > > > > I'll try to re-produce this issue first. > > Ok, just a few more information. Suspend/resume cycle is needed to see > the issue. Reverting of 9ee4f3933930 helps when this is applied too (I > haven't tried one or the other alone): I saw the issue after suspend/resume. Hotplug doesn't work because the port is runtime suspended. I'll fix it. Thanks, Lin Ming > > --- a/drivers/ata/libata-core.c > +++ b/drivers/ata/libata-core.c > @@ -5305,25 +5305,16 @@ static int ata_port_suspend_common(struct device > *dev, pm_message_t mesg) > > static int ata_port_suspend(struct device *dev) > { > - if (pm_runtime_suspended(dev)) > - return 0; > - > return ata_port_suspend_common(dev, PMSG_SUSPEND); > } > > static int ata_port_do_freeze(struct device *dev) > { > - if (pm_runtime_suspended(dev)) > - pm_runtime_resume(dev); > - > return ata_port_suspend_common(dev, PMSG_FREEZE); > } > > static int ata_port_poweroff(struct device *dev) > { > - if (pm_runtime_suspended(dev)) > - return 0; > - > return ata_port_suspend_common(dev, PMSG_HIBERNATE); > } > > @@ -5339,16 +5330,7 @@ static int ata_port_resume_common(struct device *dev) > > static int ata_port_resume(struct device *dev) > { > - int rc; > - > - rc = ata_port_resume_common(dev); > - if (!rc) { > - pm_runtime_disable(dev); > - pm_runtime_set_active(dev); > - pm_runtime_enable(dev); > - } > - > - return rc; > + return ata_port_resume_common(dev); > } > > static const struct dev_pm_ops ata_port_pm_ops = { > > > ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: ahci: sata hotplug doesn't work after suspend 2012-02-20 12:52 ` Jiri Slaby 2012-02-21 8:12 ` Lin Ming @ 2012-02-23 2:26 ` Lin Ming 2012-02-27 1:05 ` Lin Ming 1 sibling, 1 reply; 10+ messages in thread From: Lin Ming @ 2012-02-23 2:26 UTC (permalink / raw) To: Jiri Slaby; +Cc: Holger Macht, Jiri Slaby, Jeff Garzik, linux-ide, LKML On Mon, 2012-02-20 at 13:52 +0100, Jiri Slaby wrote: > On 02/20/2012 09:30 AM, Lin Ming wrote: > > On Sun, 2012-02-19 at 22:17 +0100, Holger Macht wrote: > >> On So 19. Feb - 21:11:33, Jiri Slaby wrote: > >>> Hi, > >>> > >>> ahci hotplug stopped working here. It always worked (-next-20111206 is > >>> the last known working for sure). I'm using -next and after plugging a > >>> sata disk in, nothing happens. I don't *think* (in the traffic, it's > >>> hard to tell for sure) an interrupt is generated either. I also *think* > >>> that it works before suspend/resume, but not after. (Or maybe uptime > >>> matters?) > >>> > >>> This happens before suspend on plug-in: > >>> ata3: exception Emask 0x50 SAct 0x0 SErr 0x40d0800 action 0xe frozen > >>> ata3: irq_stat 0x00000040, connection status changed > >>> ata3: SError: { HostInt PHYRdyChg CommWake 10B8B DevExch } > >>> ata3: hard resetting link > >>> ata3: SATA link up 3.0 Gbps (SStatus 123 SControl 300) > >>> ata3.00: ATA-8: ST31000528AS, CC38, max UDMA/133 > >>> ata3.00: 1953525168 sectors, multi 0: LBA48 NCQ (depth 31/32) > >>> ata3.00: configured for UDMA/133 > >>> ata3: EH complete > >>> scsi 2:0:0:0: Direct-Access ATA ST31000528AS CC38 PQ: 0 ANSI: 5 > >>> sd 2:0:0:0: [sdc] 1953525168 512-byte logical blocks: (1.00 TB/931 GiB) > >>> sd 2:0:0:0: [sdc] Write Protect is off > >>> sd 2:0:0:0: [sdc] Mode Sense: 00 3a 00 00 > >>> sd 2:0:0:0: [sdc] Write cache: enabled, read cache: enabled, doesn't > >>> support DPO or FUA > >>> sdc: sdc1 sdc2 > >>> sd 2:0:0:0: [sdc] Attached SCSI disk > >>> > >>> After suspend/resume and plug-in, nothing appears in dmesg. Storing "- - > >>> -" to /sys/class/scsi_host/host*/scan doesn't help. It looks like the > >>> line is completely dead, because only ata1 and ata2 say "hard resetting > >>> link" after this (and another two disks are connected there). > >>> > >>> I tried 'echo adapter >host_reset', but I get 'write error: Invalid > >>> argument'. > >>> > >>> 00:1f.2 SATA controller [0106]: Intel Corporation 82801IR/IO/IH > >>> (ICH9R/DO/DH) 6 port SATA Controller [AHCI mode] [8086:2922] (rev 02) > >>> (prog-if 01 [AHCI 1.0]) > >>> Subsystem: Intel Corporation 82801IR/IO/IH (ICH9R/DO/DH) 6 port > >>> SATA Controller [AHCI mode] [8086:2922] > >>> Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- > >>> ParErr- Stepping- SERR- FastB2B- DisINTx+ > >>> Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- > >>> <TAbort- <MAbort- >SERR- <PERR- INTx- > >>> Latency: 0 > >>> Interrupt: pin B routed to IRQ 43 > >>> Region 0: I/O ports at cc00 [size=8] > >>> Region 1: I/O ports at c880 [size=4] > >>> Region 2: I/O ports at c800 [size=8] > >>> Region 3: I/O ports at c480 [size=4] > >>> Region 4: I/O ports at c400 [size=32] > >>> Region 5: Memory at feb7c800 (32-bit, non-prefetchable) [size=2K] > >>> Capabilities: [80] MSI: Enable+ Count=1/16 Maskable- 64bit- > >>> Address: fee0100c Data: 4171 > >>> Capabilities: [70] Power Management version 3 > >>> Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA > >>> PME(D0-,D1-,D2-,D3hot+,D3cold-) > >>> Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME- > >>> Capabilities: [a8] SATA HBA v1.0 BAR4 Offset=00000004 > >>> Capabilities: [b0] Vendor Specific Information: Len=06 <?> > >>> Kernel driver in use: ahci > >>> > >>> Any ideas what that could be? > >> > >> I suspect this is caused by commit > >> 9ee4f3933930abf5cc34f8e9d69fe0e08c18f602. Maybe you could verify? I > >> bisected this a couple of days ago but didn't have time to look into it > >> further. Maybe Lin can help here if this is the problematic commit. > > > > I'll try to re-produce this issue first. > > Ok, just a few more information. Suspend/resume cycle is needed to see > the issue. Reverting of 9ee4f3933930 helps when this is applied too (I > haven't tried one or the other alone): For now, the simple fix is to disable runtime pm for hotpluggable port. Could you please try below patch? And please also show the debug info. dmesg |grep "DEBUG: port" >From 28bf2f0592f231c2caba816428beaffc28873d8e Mon Sep 17 00:00:00 2001 From: Lin Ming <ming.m.lin@intel.com> Date: Thu, 23 Feb 2012 10:21:18 +0800 Subject: [PATCH] libata: disable runtime pm for hotpluggable port --- drivers/ata/ahci.c | 3 +++ drivers/ata/ahci.h | 3 +++ drivers/ata/libahci.c | 21 +++++++++++++++++++++ drivers/ata/libata-transport.c | 6 ++++-- include/linux/libata.h | 4 +++- 5 files changed, 34 insertions(+), 3 deletions(-) diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index d07bf03..02e93ff 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c @@ -1145,6 +1145,9 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) if (hpriv->cap & HOST_CAP_PMP) pi.flags |= ATA_FLAG_PMP; + if (hpriv->cap & HOST_CAP_SXS) + pi.flags |= ATA_FLAG_EXTERNAL; + ahci_set_em_messages(hpriv, &pi); if (ahci_broken_system_poweroff(pdev)) { diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h index b175000..92f7172 100644 --- a/drivers/ata/ahci.h +++ b/drivers/ata/ahci.h @@ -172,6 +172,9 @@ enum { PORT_CMD_ALPE = (1 << 26), /* Aggressive Link PM enable */ PORT_CMD_ATAPI = (1 << 24), /* Device is ATAPI */ PORT_CMD_FBSCP = (1 << 22), /* FBS Capable Port */ + PORT_CMD_ESP = (1 << 21), /* External SATA Port */ + PORT_CMD_MPSP = (1 << 19), /* Mechanical Presence Switch Attached to Port */ + PORT_CMD_HPCP = (1 << 18), /* Hot Plug Capable Port */ PORT_CMD_PMP = (1 << 17), /* PMP attached */ PORT_CMD_LIST_ON = (1 << 15), /* cmd list DMA engine running */ PORT_CMD_FIS_ON = (1 << 14), /* FIS DMA engine running */ diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c index a72bfd0..a0222e9 100644 --- a/drivers/ata/libahci.c +++ b/drivers/ata/libahci.c @@ -1097,6 +1097,24 @@ static void ahci_port_init(struct device *dev, struct ata_port *ap, writel(1 << port_no, mmio + HOST_IRQ_STAT); } +static bool ahci_port_pluggable(struct ata_port *ap) +{ + void __iomem *port_mmio = ahci_port_base(ap); + u32 cmd; + + cmd = readl(port_mmio + PORT_CMD); + printk(KERN_ERR "DEBUG: port %d, PORT_CMD=0x%x\n", ap->port_no, cmd); + + if ((ap->flags & ATA_FLAG_EXTERNAL) && + (cmd & PORT_CMD_ESP)) + return true; + + if (cmd & (PORT_CMD_MPSP | PORT_CMD_HPCP)) + return true; + + return false; +} + void ahci_init_controller(struct ata_host *host) { struct ahci_host_priv *hpriv = host->private_data; @@ -1112,6 +1130,9 @@ void ahci_init_controller(struct ata_host *host) if (ata_port_is_dummy(ap)) continue; + if (ahci_port_pluggable(ap)) + ap->flags |= ATA_FLAG_PLUGGABLE; + ahci_port_init(host->dev, ap, i, mmio, port_mmio); } diff --git a/drivers/ata/libata-transport.c b/drivers/ata/libata-transport.c index 74aaee3..a7166b9 100644 --- a/drivers/ata/libata-transport.c +++ b/drivers/ata/libata-transport.c @@ -292,8 +292,10 @@ int ata_tport_add(struct device *parent, } device_enable_async_suspend(dev); - pm_runtime_set_active(dev); - pm_runtime_enable(dev); + if (!(ap->flags & ATA_FLAG_PLUGGABLE)) { + pm_runtime_set_active(dev); + pm_runtime_enable(dev); + } transport_add_device(dev); transport_configure_device(dev); diff --git a/include/linux/libata.h b/include/linux/libata.h index cafc09a..e8221cf 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -207,8 +207,10 @@ enum { ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity * led */ ATA_FLAG_NO_DIPM = (1 << 23), /* host not happy with DIPM */ + ATA_FLAG_EXTERNAL = (1 << 24), /* controller supports external SATA */ + ATA_FLAG_PLUGGABLE = (1 << 25), /* port is hotpluggable */ - /* bits 24:31 of ap->flags are reserved for LLD specific flags */ + /* bits 26:31 of ap->flags are reserved for LLD specific flags */ /* struct ata_port pflags */ -- 1.7.9 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: ahci: sata hotplug doesn't work after suspend 2012-02-23 2:26 ` Lin Ming @ 2012-02-27 1:05 ` Lin Ming 2012-02-27 8:48 ` Jiri Slaby 0 siblings, 1 reply; 10+ messages in thread From: Lin Ming @ 2012-02-27 1:05 UTC (permalink / raw) To: Jiri Slaby; +Cc: Holger Macht, Jiri Slaby, Jeff Garzik, linux-ide, LKML On Thu, Feb 23, 2012 at 10:26 AM, Lin Ming <ming.m.lin@intel.com> wrote: > On Mon, 2012-02-20 at 13:52 +0100, Jiri Slaby wrote: >> On 02/20/2012 09:30 AM, Lin Ming wrote: >> > On Sun, 2012-02-19 at 22:17 +0100, Holger Macht wrote: >> >> On So 19. Feb - 21:11:33, Jiri Slaby wrote: >> >>> Hi, >> >>> >> >>> ahci hotplug stopped working here. It always worked (-next-20111206 is >> >>> the last known working for sure). I'm using -next and after plugging a >> >>> sata disk in, nothing happens. I don't *think* (in the traffic, it's >> >>> hard to tell for sure) an interrupt is generated either. I also *think* >> >>> that it works before suspend/resume, but not after. (Or maybe uptime >> >>> matters?) >> >>> >> >>> This happens before suspend on plug-in: >> >>> ata3: exception Emask 0x50 SAct 0x0 SErr 0x40d0800 action 0xe frozen >> >>> ata3: irq_stat 0x00000040, connection status changed >> >>> ata3: SError: { HostInt PHYRdyChg CommWake 10B8B DevExch } >> >>> ata3: hard resetting link >> >>> ata3: SATA link up 3.0 Gbps (SStatus 123 SControl 300) >> >>> ata3.00: ATA-8: ST31000528AS, CC38, max UDMA/133 >> >>> ata3.00: 1953525168 sectors, multi 0: LBA48 NCQ (depth 31/32) >> >>> ata3.00: configured for UDMA/133 >> >>> ata3: EH complete >> >>> scsi 2:0:0:0: Direct-Access ATA ST31000528AS CC38 PQ: 0 ANSI: 5 >> >>> sd 2:0:0:0: [sdc] 1953525168 512-byte logical blocks: (1.00 TB/931 GiB) >> >>> sd 2:0:0:0: [sdc] Write Protect is off >> >>> sd 2:0:0:0: [sdc] Mode Sense: 00 3a 00 00 >> >>> sd 2:0:0:0: [sdc] Write cache: enabled, read cache: enabled, doesn't >> >>> support DPO or FUA >> >>> sdc: sdc1 sdc2 >> >>> sd 2:0:0:0: [sdc] Attached SCSI disk >> >>> >> >>> After suspend/resume and plug-in, nothing appears in dmesg. Storing "- - >> >>> -" to /sys/class/scsi_host/host*/scan doesn't help. It looks like the >> >>> line is completely dead, because only ata1 and ata2 say "hard resetting >> >>> link" after this (and another two disks are connected there). >> >>> >> >>> I tried 'echo adapter >host_reset', but I get 'write error: Invalid >> >>> argument'. >> >>> >> >>> 00:1f.2 SATA controller [0106]: Intel Corporation 82801IR/IO/IH >> >>> (ICH9R/DO/DH) 6 port SATA Controller [AHCI mode] [8086:2922] (rev 02) >> >>> (prog-if 01 [AHCI 1.0]) >> >>> Subsystem: Intel Corporation 82801IR/IO/IH (ICH9R/DO/DH) 6 port >> >>> SATA Controller [AHCI mode] [8086:2922] >> >>> Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- >> >>> ParErr- Stepping- SERR- FastB2B- DisINTx+ >> >>> Status: Cap+ 66MHz+ UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- >> >>> <TAbort- <MAbort- >SERR- <PERR- INTx- >> >>> Latency: 0 >> >>> Interrupt: pin B routed to IRQ 43 >> >>> Region 0: I/O ports at cc00 [size=8] >> >>> Region 1: I/O ports at c880 [size=4] >> >>> Region 2: I/O ports at c800 [size=8] >> >>> Region 3: I/O ports at c480 [size=4] >> >>> Region 4: I/O ports at c400 [size=32] >> >>> Region 5: Memory at feb7c800 (32-bit, non-prefetchable) [size=2K] >> >>> Capabilities: [80] MSI: Enable+ Count=1/16 Maskable- 64bit- >> >>> Address: fee0100c Data: 4171 >> >>> Capabilities: [70] Power Management version 3 >> >>> Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA >> >>> PME(D0-,D1-,D2-,D3hot+,D3cold-) >> >>> Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=0 PME- >> >>> Capabilities: [a8] SATA HBA v1.0 BAR4 Offset=00000004 >> >>> Capabilities: [b0] Vendor Specific Information: Len=06 <?> >> >>> Kernel driver in use: ahci >> >>> >> >>> Any ideas what that could be? >> >> >> >> I suspect this is caused by commit >> >> 9ee4f3933930abf5cc34f8e9d69fe0e08c18f602. Maybe you could verify? I >> >> bisected this a couple of days ago but didn't have time to look into it >> >> further. Maybe Lin can help here if this is the problematic commit. >> > >> > I'll try to re-produce this issue first. >> >> Ok, just a few more information. Suspend/resume cycle is needed to see >> the issue. Reverting of 9ee4f3933930 helps when this is applied too (I >> haven't tried one or the other alone): > > For now, the simple fix is to disable runtime pm for hotpluggable port. > > Could you please try below patch? > > And please also show the debug info. > dmesg |grep "DEBUG: port" Hi Jiri, Will you get a chance to test this patch? Thanks, Lin Ming > > From 28bf2f0592f231c2caba816428beaffc28873d8e Mon Sep 17 00:00:00 2001 > From: Lin Ming <ming.m.lin@intel.com> > Date: Thu, 23 Feb 2012 10:21:18 +0800 > Subject: [PATCH] libata: disable runtime pm for hotpluggable port > > --- > drivers/ata/ahci.c | 3 +++ > drivers/ata/ahci.h | 3 +++ > drivers/ata/libahci.c | 21 +++++++++++++++++++++ > drivers/ata/libata-transport.c | 6 ++++-- > include/linux/libata.h | 4 +++- > 5 files changed, 34 insertions(+), 3 deletions(-) > > diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c > index d07bf03..02e93ff 100644 > --- a/drivers/ata/ahci.c > +++ b/drivers/ata/ahci.c > @@ -1145,6 +1145,9 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) > if (hpriv->cap & HOST_CAP_PMP) > pi.flags |= ATA_FLAG_PMP; > > + if (hpriv->cap & HOST_CAP_SXS) > + pi.flags |= ATA_FLAG_EXTERNAL; > + > ahci_set_em_messages(hpriv, &pi); > > if (ahci_broken_system_poweroff(pdev)) { > diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h > index b175000..92f7172 100644 > --- a/drivers/ata/ahci.h > +++ b/drivers/ata/ahci.h > @@ -172,6 +172,9 @@ enum { > PORT_CMD_ALPE = (1 << 26), /* Aggressive Link PM enable */ > PORT_CMD_ATAPI = (1 << 24), /* Device is ATAPI */ > PORT_CMD_FBSCP = (1 << 22), /* FBS Capable Port */ > + PORT_CMD_ESP = (1 << 21), /* External SATA Port */ > + PORT_CMD_MPSP = (1 << 19), /* Mechanical Presence Switch Attached to Port */ > + PORT_CMD_HPCP = (1 << 18), /* Hot Plug Capable Port */ > PORT_CMD_PMP = (1 << 17), /* PMP attached */ > PORT_CMD_LIST_ON = (1 << 15), /* cmd list DMA engine running */ > PORT_CMD_FIS_ON = (1 << 14), /* FIS DMA engine running */ > diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c > index a72bfd0..a0222e9 100644 > --- a/drivers/ata/libahci.c > +++ b/drivers/ata/libahci.c > @@ -1097,6 +1097,24 @@ static void ahci_port_init(struct device *dev, struct ata_port *ap, > writel(1 << port_no, mmio + HOST_IRQ_STAT); > } > > +static bool ahci_port_pluggable(struct ata_port *ap) > +{ > + void __iomem *port_mmio = ahci_port_base(ap); > + u32 cmd; > + > + cmd = readl(port_mmio + PORT_CMD); > + printk(KERN_ERR "DEBUG: port %d, PORT_CMD=0x%x\n", ap->port_no, cmd); > + > + if ((ap->flags & ATA_FLAG_EXTERNAL) && > + (cmd & PORT_CMD_ESP)) > + return true; > + > + if (cmd & (PORT_CMD_MPSP | PORT_CMD_HPCP)) > + return true; > + > + return false; > +} > + > void ahci_init_controller(struct ata_host *host) > { > struct ahci_host_priv *hpriv = host->private_data; > @@ -1112,6 +1130,9 @@ void ahci_init_controller(struct ata_host *host) > if (ata_port_is_dummy(ap)) > continue; > > + if (ahci_port_pluggable(ap)) > + ap->flags |= ATA_FLAG_PLUGGABLE; > + > ahci_port_init(host->dev, ap, i, mmio, port_mmio); > } > > diff --git a/drivers/ata/libata-transport.c b/drivers/ata/libata-transport.c > index 74aaee3..a7166b9 100644 > --- a/drivers/ata/libata-transport.c > +++ b/drivers/ata/libata-transport.c > @@ -292,8 +292,10 @@ int ata_tport_add(struct device *parent, > } > > device_enable_async_suspend(dev); > - pm_runtime_set_active(dev); > - pm_runtime_enable(dev); > + if (!(ap->flags & ATA_FLAG_PLUGGABLE)) { > + pm_runtime_set_active(dev); > + pm_runtime_enable(dev); > + } > > transport_add_device(dev); > transport_configure_device(dev); > diff --git a/include/linux/libata.h b/include/linux/libata.h > index cafc09a..e8221cf 100644 > --- a/include/linux/libata.h > +++ b/include/linux/libata.h > @@ -207,8 +207,10 @@ enum { > ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity > * led */ > ATA_FLAG_NO_DIPM = (1 << 23), /* host not happy with DIPM */ > + ATA_FLAG_EXTERNAL = (1 << 24), /* controller supports external SATA */ > + ATA_FLAG_PLUGGABLE = (1 << 25), /* port is hotpluggable */ > > - /* bits 24:31 of ap->flags are reserved for LLD specific flags */ > + /* bits 26:31 of ap->flags are reserved for LLD specific flags */ > > > /* struct ata_port pflags */ > -- > 1.7.9 > > > > -- > To unsubscribe from this list: send the line "unsubscribe linux-ide" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: ahci: sata hotplug doesn't work after suspend 2012-02-27 1:05 ` Lin Ming @ 2012-02-27 8:48 ` Jiri Slaby 2012-02-28 11:36 ` Lin Ming 0 siblings, 1 reply; 10+ messages in thread From: Jiri Slaby @ 2012-02-27 8:48 UTC (permalink / raw) To: Lin Ming; +Cc: Holger Macht, Jiri Slaby, Jeff Garzik, linux-ide, LKML On 02/27/2012 02:05 AM, Lin Ming wrote: >> Could you please try below patch? >> >> And please also show the debug info. >> dmesg |grep "DEBUG: port" > > Hi Jiri, > > Will you get a chance to test this patch? Yes, yesterday I booted a kernel with that patch, today I resumed from suspend. It works fine. [ 3.544423] DEBUG: port 0, PORT_CMD=0x40006 [ 3.544445] DEBUG: port 1, PORT_CMD=0x40006 [ 3.544467] DEBUG: port 2, PORT_CMD=0x40006 [ 3.544489] DEBUG: port 3, PORT_CMD=0x40006 [ 3.544511] DEBUG: port 4, PORT_CMD=0x6 [ 3.544532] DEBUG: port 5, PORT_CMD=0x6 [ 1724.132173] DEBUG: port 0, PORT_CMD=0x40006 [ 1724.132184] DEBUG: port 1, PORT_CMD=0x40006 [ 1724.132194] DEBUG: port 2, PORT_CMD=0x40006 [ 1724.132204] DEBUG: port 3, PORT_CMD=0x40006 [ 1724.132214] DEBUG: port 4, PORT_CMD=0x6 [ 1724.132222] DEBUG: port 5, PORT_CMD=0x6 thanks, -- js suse labs ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: ahci: sata hotplug doesn't work after suspend 2012-02-27 8:48 ` Jiri Slaby @ 2012-02-28 11:36 ` Lin Ming 0 siblings, 0 replies; 10+ messages in thread From: Lin Ming @ 2012-02-28 11:36 UTC (permalink / raw) To: Jiri Slaby; +Cc: Holger Macht, Jiri Slaby, Jeff Garzik, linux-ide, LKML On Mon, Feb 27, 2012 at 4:48 PM, Jiri Slaby <jslaby@suse.cz> wrote: > On 02/27/2012 02:05 AM, Lin Ming wrote: >>> >>> Could you please try below patch? >>> >>> And please also show the debug info. >>> dmesg |grep "DEBUG: port" >> >> >> Hi Jiri, >> >> Will you get a chance to test this patch? > > > Yes, yesterday I booted a kernel with that patch, today I resumed from > suspend. It works fine. Jeff, What do you think about this patch? Need to add similar hotplugable port check for other controllers too. Regards, Lin Ming > > [ 3.544423] DEBUG: port 0, PORT_CMD=0x40006 > [ 3.544445] DEBUG: port 1, PORT_CMD=0x40006 > [ 3.544467] DEBUG: port 2, PORT_CMD=0x40006 > [ 3.544489] DEBUG: port 3, PORT_CMD=0x40006 > [ 3.544511] DEBUG: port 4, PORT_CMD=0x6 > [ 3.544532] DEBUG: port 5, PORT_CMD=0x6 > [ 1724.132173] DEBUG: port 0, PORT_CMD=0x40006 > [ 1724.132184] DEBUG: port 1, PORT_CMD=0x40006 > [ 1724.132194] DEBUG: port 2, PORT_CMD=0x40006 > [ 1724.132204] DEBUG: port 3, PORT_CMD=0x40006 > [ 1724.132214] DEBUG: port 4, PORT_CMD=0x6 > [ 1724.132222] DEBUG: port 5, PORT_CMD=0x6 > > > thanks, > -- > js > suse labs ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2012-02-28 11:36 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-02-19 20:11 ahci: sata hotplug doesn't work after suspend Jiri Slaby 2012-02-19 20:17 ` Jiri Slaby 2012-02-19 21:17 ` Holger Macht 2012-02-20 8:30 ` Lin Ming 2012-02-20 12:52 ` Jiri Slaby 2012-02-21 8:12 ` Lin Ming 2012-02-23 2:26 ` Lin Ming 2012-02-27 1:05 ` Lin Ming 2012-02-27 8:48 ` Jiri Slaby 2012-02-28 11:36 ` Lin Ming
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox