2013-04-16 11:59:02

by Böszörményi Zoltán

[permalink] [raw]
Subject: ahci driver cannot suspend a CF card, ata_piix can

Hi,

I am working with an embedded system, using the Intel Atom CPU,
and the usual motherboard components:

# lspci
00:00.0 Host bridge: Intel Corporation Atom Processor D4xx/D5xx/N4xx/N5xx DMI Bridge (rev 02)
00:02.0 VGA compatible controller: Intel Corporation Atom Processor D4xx/D5xx/N4xx/N5xx
Integrated Graphics Controller (rev 02)
00:02.1 Display controller: Intel Corporation Atom Processor D4xx/D5xx/N4xx/N5xx
Integrated Graphics Controller (rev 02)
00:1b.0 Audio device: Intel Corporation NM10/ICH7 Family High Definition Audio Controller
(rev 02)
00:1c.0 PCI bridge: Intel Corporation NM10/ICH7 Family PCI Express Port 1 (rev 02)
00:1c.1 PCI bridge: Intel Corporation NM10/ICH7 Family PCI Express Port 2 (rev 02)
00:1c.2 PCI bridge: Intel Corporation NM10/ICH7 Family PCI Express Port 3 (rev 02)
00:1c.3 PCI bridge: Intel Corporation NM10/ICH7 Family PCI Express Port 4 (rev 02)
00:1d.0 USB controller: Intel Corporation NM10/ICH7 Family USB UHCI Controller #1 (rev 02)
00:1d.1 USB controller: Intel Corporation NM10/ICH7 Family USB UHCI Controller #2 (rev 02)
00:1d.2 USB controller: Intel Corporation NM10/ICH7 Family USB UHCI Controller #3 (rev 02)
00:1d.3 USB controller: Intel Corporation NM10/ICH7 Family USB UHCI Controller #4 (rev 02)
00:1d.7 USB controller: Intel Corporation NM10/ICH7 Family USB2 EHCI Controller (rev 02)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev e2)
00:1f.0 ISA bridge: Intel Corporation NM10 Family LPC Controller (rev 02)
00:1f.2 IDE interface: Intel Corporation NM10/ICH7 Family SATA Controller [IDE mode] (rev 02)
00:1f.3 SMBus: Intel Corporation NM10/ICH7 Family SMBus Controller (rev 02)
03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168 PCI Express
Gigabit Ethernet controller (rev 07)

The SATA interface can be switched between AHCI and legacy modes as usual:

00:1f.2 SATA controller: Intel Corporation NM10/ICH7 Family SATA Controller [AHCI mode]
(rev 02)

The device attached to the SATA controller is always a CF card via a
SiI3811 Serial ATA to Parallel ATA Device Bridge based converter board.

Recently, I have experimented with suspend to disk and suspend to RAM.
I used the pm-utils-1.4.1-22 package from Fedora 18 on this dumbed down
(OpenEmbedded-based) Linux that we run.

What I have found was that when the SATA interface is in AHCI mode,
pm-suspend (suspend to RAM via ACPI) doesn't work because the
CF card seems to return an error for SUSPEND IMMEDIATE.

However, using the legacy mode (the ata_piix driver), suspend (and resume)
works. The kernel version is 3.7.10.

The kernel messages for a successful suspend with ata_piix, resume was
user-initiated by pressing the power button:

...
Apr 16 19:09:52 localhost kernel: ata2.00: configured for UDMA/133
Apr 16 19:09:52 localhost kernel: ata2: EH complete
Apr 16 19:09:52 localhost kernel: sd 1:0:0:0: [sda] Write cache: enabled, read cache:
enabled, doesn't support DPO or FUA
Apr 16 19:09:58 localhost kernel: EXT4-fs (sda6): re-mounted. Opts: commit=0
Apr 16 19:09:58 localhost kernel: EXT4-fs (sda1): re-mounted. Opts: commit=0
Apr 16 19:10:23 localhost kernel: PM: Syncing filesystems ... done.
Apr 16 19:10:23 localhost kernel: Freezing user space processes ... (elapsed 0.01 seconds)
done.
Apr 16 19:10:23 localhost kernel: Freezing remaining freezable tasks ... (elapsed 0.01
seconds) done.
Apr 16 19:10:23 localhost kernel: Suspending console(s) (use no_console_suspend to debug)
Apr 16 19:10:23 localhost kernel: sd 1:0:0:0: [sda] Synchronizing SCSI cache
Apr 16 19:10:23 localhost kernel: sd 1:0:0:0: [sda] Stopping disk
Apr 16 19:10:23 localhost kernel: serial 00:0b: disabled
Apr 16 19:10:23 localhost kernel: serial 00:0a: disabled
Apr 16 19:10:23 localhost kernel: serial 00:09: disabled
Apr 16 19:10:23 localhost kernel: serial 00:08: disabled
Apr 16 19:10:23 localhost kernel: serial 00:07: disabled
Apr 16 19:10:25 localhost kernel: PM: suspend of devices complete after 47.656 msecs
Apr 16 19:10:25 localhost kernel: PM: late suspend of devices complete after 0.204 msecs
Apr 16 19:10:25 localhost kernel: pcieport 0000:00:1c.1: wake-up capability enabled by ACPI
Apr 16 19:10:25 localhost kernel: ehci_hcd 0000:00:1d.7: wake-up capability enabled by ACPI
Apr 16 19:10:25 localhost kernel: uhci_hcd 0000:00:1d.3: wake-up capability enabled by ACPI
Apr 16 19:10:25 localhost kernel: uhci_hcd 0000:00:1d.2: wake-up capability enabled by ACPI
Apr 16 19:10:25 localhost kernel: uhci_hcd 0000:00:1d.1: wake-up capability enabled by ACPI
Apr 16 19:10:25 localhost kernel: uhci_hcd 0000:00:1d.0: wake-up capability enabled by ACPI
Apr 16 19:10:25 localhost kernel: PM: noirq suspend of devices complete after 29.450 msecs
Apr 16 19:10:25 localhost kernel: ACPI: Preparing to enter system sleep state S3
Apr 16 19:10:25 localhost kernel: PM: Saving platform NVS memory
Apr 16 19:10:25 localhost kernel: Disabling non-boot CPUs ...
Apr 16 19:10:25 localhost kernel: smpboot: CPU 1 is now offline
Apr 16 19:10:25 localhost kernel: smpboot: CPU 2 is now offline
Apr 16 19:10:25 localhost kernel: smpboot: CPU 3 is now offline
Apr 16 19:10:25 localhost kernel: ACPI: Low-level resume complete
Apr 16 19:10:25 localhost kernel: PM: Restoring platform NVS memory
Apr 16 19:10:25 localhost kernel: Enabling non-boot CPUs ...
Apr 16 19:10:25 localhost kernel: smpboot: Booting Node 0 Processor 1 APIC 0x2
Apr 16 19:10:25 localhost kernel: Initializing CPU#1
Apr 16 19:10:25 localhost kernel: CPU1 is up
Apr 16 19:10:25 localhost kernel: smpboot: Booting Node 0 Processor 2 APIC 0x1
Apr 16 19:10:25 localhost kernel: Initializing CPU#2
Apr 16 19:10:25 localhost kernel: CPU2 is up
Apr 16 19:10:25 localhost kernel: smpboot: Booting Node 0 Processor 3 APIC 0x3
Apr 16 19:10:25 localhost kernel: Initializing CPU#3
Apr 16 19:10:25 localhost kernel: CPU3 is up
Apr 16 19:10:25 localhost kernel: ACPI: Waking up from system sleep state S3
Apr 16 19:10:25 localhost kernel: uhci_hcd 0000:00:1d.0: wake-up capability disabled by ACPI
Apr 16 19:10:25 localhost kernel: uhci_hcd 0000:00:1d.1: wake-up capability disabled by ACPI
Apr 16 19:10:25 localhost kernel: uhci_hcd 0000:00:1d.2: wake-up capability disabled by ACPI
Apr 16 19:10:25 localhost kernel: uhci_hcd 0000:00:1d.3: wake-up capability disabled by ACPI
Apr 16 19:10:25 localhost kernel: ehci_hcd 0000:00:1d.7: wake-up capability disabled by ACPI
Apr 16 19:10:25 localhost kernel: PM: noirq resume of devices complete after 47.721 msecs
Apr 16 19:10:25 localhost kernel: PM: early resume of devices complete after 0.145 msecs
Apr 16 19:10:25 localhost kernel: usb usb2: root hub lost power or was reset
Apr 16 19:10:25 localhost kernel: usb usb3: root hub lost power or was reset
Apr 16 19:10:25 localhost kernel: usb usb4: root hub lost power or was reset
Apr 16 19:10:25 localhost kernel: usb usb5: root hub lost power or was reset
Apr 16 19:10:25 localhost kernel: pcieport 0000:00:1c.1: wake-up capability disabled by ACPI
Apr 16 19:10:25 localhost kernel: serial 00:07: activated
Apr 16 19:10:25 localhost kernel: serial 00:08: activated
Apr 16 19:10:25 localhost kernel: serial 00:09: activated
Apr 16 19:10:25 localhost kernel: serial 00:0a: activated
Apr 16 19:10:25 localhost kernel: serial 00:0b: activated
Apr 16 19:10:25 localhost kernel: r8169 0000:03:00.0 eth0: link down
Apr 16 19:10:25 localhost kernel: ata2.00: ACPI cmd ef/03:45:00:00:00:a0 (SET FEATURES)
filtered out
Apr 16 19:10:25 localhost kernel: ata2.00: ACPI cmd ef/03:0c:00:00:00:a0 (SET FEATURES)
filtered out
Apr 16 19:10:25 localhost kernel: ata2.00: ACPI cmd f5/00:00:00:00:00:00 (SECURITY FREEZE
LOCK) filtered out
Apr 16 19:10:25 localhost kernel: ata2.00: configured for UDMA/133
Apr 16 19:10:25 localhost kernel: sd 1:0:0:0: [sda] Starting disk
Apr 16 19:10:25 localhost kernel: sd 1:0:0:0: [sda] Write cache: disabled, read cache:
enabled, doesn't support DPO or FUA
Apr 16 19:10:25 localhost kernel: usb 3-1: reset low-speed USB device number 2 using uhci_hcd
Apr 16 19:10:25 localhost kernel: PM: resume of devices complete after 843.010 msecs
Apr 16 19:10:25 localhost kernel: Restarting tasks ... done.
Apr 16 19:10:25 localhost kernel: r8169 0000:03:00.0 eth0: link up
Apr 16 19:10:26 localhost kernel: ata2.00: configured for UDMA/133
Apr 16 19:10:26 localhost kernel: ata2: EH complete
Apr 16 19:10:26 localhost kernel: sd 1:0:0:0: [sda] Write cache: enabled, read cache:
enabled, doesn't support DPO or FUA
Apr 16 19:10:30 localhost kernel: EXT4-fs (sda6): re-mounted. Opts: commit=0
Apr 16 19:10:30 localhost kernel: EXT4-fs (sda1): re-mounted. Opts: commit=0
...

The messages using AHCI mode are below. The suspend is initiated, the screen
definitely goes black, then it immediately and automatically resumes.

...
Apr 16 19:31:32 localhost kernel: ata2.00: configured for UDMA/133
Apr 16 19:31:32 localhost kernel: ata2: EH complete
Apr 16 19:31:36 localhost kernel: EXT4-fs (sda6): re-mounted. Opts: commit=0
Apr 16 19:31:36 localhost kernel: EXT4-fs (sda1): re-mounted. Opts: commit=0
Apr 16 19:31:47 localhost kernel: PM: Syncing filesystems ... done.
Apr 16 19:31:47 localhost kernel: Freezing user space processes ... (elapsed 0.01 seconds)
done.
Apr 16 19:31:47 localhost kernel: Freezing remaining freezable tasks ... (elapsed 0.01
seconds) done.
Apr 16 19:31:47 localhost kernel: Suspending console(s) (use no_console_suspend to debug)
Apr 16 19:31:47 localhost kernel: sd 1:0:0:0: [sda] Synchronizing SCSI cache
Apr 16 19:31:47 localhost kernel: sd 1:0:0:0: [sda] Stopping disk
Apr 16 19:31:47 localhost kernel: ata2.00: exception Emask 0x10 SAct 0x0 SErr 0x10000
action 0xe frozen
Apr 16 19:31:47 localhost kernel: ata2.00: irq_stat 0x00400001, PHY RDY changed
Apr 16 19:31:47 localhost kernel: ata2: SError: { PHYRdyChg }
Apr 16 19:31:47 localhost kernel: ata2.00: failed command: STANDBY IMMEDIATE
Apr 16 19:31:47 localhost kernel: ata2.00: cmd e0/00:00:00:00:00/00:00:00:00:00/a0 tag 0
Apr 16 19:31:48 localhost kernel: res 50/00:00:00:00:00/00:00:00:00:00/a0 Emask
0x10 (ATA bus error)
Apr 16 19:31:48 localhost kernel: ata2.00: status: { DRDY }
Apr 16 19:31:48 localhost kernel: ata2: hard resetting link
Apr 16 19:31:48 localhost kernel: serial 00:0b: disabled
Apr 16 19:31:48 localhost kernel: serial 00:0a: disabled
Apr 16 19:31:48 localhost kernel: serial 00:09: disabled
Apr 16 19:31:48 localhost kernel: serial 00:08: disabled
Apr 16 19:31:48 localhost kernel: serial 00:07: disabled
Apr 16 19:31:48 localhost kernel: ata2: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
Apr 16 19:31:48 localhost kernel: ata2.00: configured for UDMA/133
Apr 16 19:31:48 localhost kernel: ata2.00: device reported invalid CHS sector 0
Apr 16 19:31:48 localhost kernel: ata2: EH complete
Apr 16 19:31:48 localhost kernel: sd 1:0:0:0: [sda] START_STOP FAILED
Apr 16 19:31:48 localhost kernel: sd 1:0:0:0: [sda]
Apr 16 19:31:48 localhost kernel: Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
Apr 16 19:31:48 localhost kernel: sd 1:0:0:0: [sda]
Apr 16 19:31:48 localhost kernel: Sense Key : Aborted Command [current] [descriptor]
Apr 16 19:31:48 localhost kernel: sd 1:0:0:0: [sda]
Apr 16 19:31:48 localhost kernel: Add. Sense: No additional sense information
Apr 16 19:31:48 localhost kernel: dpm_run_callback(): scsi_bus_suspend+0x0/0xf returns
134217730
Apr 16 19:31:48 localhost kernel: PM: Device 1:0:0:0 failed to suspend async: error 134217730
Apr 16 19:31:48 localhost kernel: PM: Some devices failed to suspend
Apr 16 19:31:48 localhost kernel: sd 1:0:0:0: [sda] Write cache: disabled, read cache:
enabled, doesn't support DPO or FUA
Apr 16 19:31:48 localhost kernel: usb usb2: root hub lost power or was reset
Apr 16 19:31:48 localhost kernel: usb usb3: root hub lost power or was reset
Apr 16 19:31:48 localhost kernel: usb usb4: root hub lost power or was reset
Apr 16 19:31:48 localhost kernel: usb usb5: root hub lost power or was reset
Apr 16 19:31:48 localhost kernel: serial 00:07: activated
Apr 16 19:31:48 localhost kernel: serial 00:08: activated
Apr 16 19:31:48 localhost kernel: serial 00:09: activated
Apr 16 19:31:48 localhost kernel: serial 00:0a: activated
Apr 16 19:31:48 localhost kernel: serial 00:0b: activated
Apr 16 19:31:48 localhost kernel: r8169 0000:03:00.0 eth0: link down
Apr 16 19:31:48 localhost kernel: ata1: SATA link down (SStatus 0 SControl 300)
Apr 16 19:31:48 localhost kernel: usb 3-1: reset low-speed USB device number 2 using uhci_hcd
Apr 16 19:31:48 localhost kernel: PM: resume of devices complete after 837.269 msecs
Apr 16 19:31:48 localhost kernel: Restarting tasks ... done.
Apr 16 19:31:48 localhost kernel: r8169 0000:03:00.0 eth0: link up
Apr 16 19:31:48 localhost kernel: ata2.00: configured for UDMA/133
Apr 16 19:31:48 localhost kernel: ata2: EH complete
Apr 16 19:31:48 localhost kernel: sd 1:0:0:0: [sda] Write cache: enabled, read cache:
enabled, doesn't support DPO or FUA
Apr 16 19:31:53 localhost kernel: EXT4-fs (sda6): re-mounted. Opts: commit=0
Apr 16 19:31:53 localhost kernel: EXT4-fs (sda1): re-mounted. Opts: commit=0
...

Since ata-piix can properly suspend the CF card, I assume it's
a bug in the ahci driver. Is it known and perhaps fixed in a later version?
However, I haven't seen anything that would point to fixing it in git log.

Please, use "reply-all" when answering, I am not subscribed to either LKML
or linux-ide.

Best regards,
Zolt?n B?sz?rm?nyi


2013-04-19 15:14:52

by Aaron Lu

[permalink] [raw]
Subject: Re: ahci driver cannot suspend a CF card, ata_piix can

On 04/16/2013 07:58 PM, Boszormenyi Zoltan wrote:
> Hi,
>
> The SATA interface can be switched between AHCI and legacy modes as usual:
>
> 00:1f.2 SATA controller: Intel Corporation NM10/ICH7 Family SATA
> Controller [AHCI mode] (rev 02)
>
> The device attached to the SATA controller is always a CF card via a
> SiI3811 Serial ATA to Parallel ATA Device Bridge based converter board.

Can you please attach a normal sata disk and try again with the
controller set to AHCI mode? I suspect it may be the SiI3811 bridge that
caused this command.

Thanks,
Aaron

2013-04-19 17:29:59

by Böszörményi Zoltán

[permalink] [raw]
Subject: Re: ahci driver cannot suspend a CF card, ata_piix can

Hi,

2013-04-19 17:14 keltez?ssel, Aaron Lu ?rta:
> On 04/16/2013 07:58 PM, Boszormenyi Zoltan wrote:
>> Hi,
>>
>> The SATA interface can be switched between AHCI and legacy modes as usual:
>>
>> 00:1f.2 SATA controller: Intel Corporation NM10/ICH7 Family SATA
>> Controller [AHCI mode] (rev 02)
>>
>> The device attached to the SATA controller is always a CF card via a
>> SiI3811 Serial ATA to Parallel ATA Device Bridge based converter board.
>
> Can you please attach a normal sata disk and try again with the
> controller set to AHCI mode? I suspect it may be the SiI3811 bridge that
> caused this command.
>
> Thanks,
> Aaron

Unfortunately, there's no way for me to open the box at the moment.
This particular computer is very compact and the screws are very tight.
All the interesting devices are sealed behind its touchscreen.

But: how comes that by using the ata_piix, the SUSPEND IMMEDIATE
ATA command succeeds? Is it sent at all using the legacy mode?

Thanks,
Zolt?n B?sz?rm?nyi

2013-04-22 20:52:55

by Böszörményi Zoltán

[permalink] [raw]
Subject: Re: ahci driver cannot suspend a CF card, ata_piix can

Hi,

2013-04-19 17:14 keltez?ssel, Aaron Lu ?rta:
> On 04/16/2013 07:58 PM, Boszormenyi Zoltan wrote:
>> Hi,
>>
>> The SATA interface can be switched between AHCI and legacy modes as usual:
>>
>> 00:1f.2 SATA controller: Intel Corporation NM10/ICH7 Family SATA
>> Controller [AHCI mode] (rev 02)
>>
>> The device attached to the SATA controller is always a CF card via a
>> SiI3811 Serial ATA to Parallel ATA Device Bridge based converter board.
>
> Can you please attach a normal sata disk and try again with the
> controller set to AHCI mode? I suspect it may be the SiI3811 bridge that
> caused this command.

I have finally got around to testing a different beast, a Zotax ZBOX with
mostly the same motherboard components that the previously mentioned
embedded PC had. It turned out that this embedded PC (a POS machine)
doesn't have regular SATA connectors but a special one to connect only
this SATA-EIDE converter card with the SiI3811 chip.

Anyway, using the Zotac box, both a shiny new Samsung 840 SSD
and a CF card using a different IDE bridge chip (Sunplus SATALink SPIF223A)
can suspend to RAM using AHCI mode.

Your suspicion turned out to be correct.

Best regards,
Zolt?n B?sz?rm?nyi