AHCI on Intel 82801GBM/GHM using pci quirk - cannot resume
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
AHCI on Intel 82801GBM/GHM using pci quirk - cannot resume
I recently came across a patch to force my eee 1000h to use ahci without it being available as a bios option. Since I applied the patch I can't resume from suspend. I found the patch here: http://mjg59.livejournal.com/85504.html. I'm using it on kernel 2.6.31-rc6, although the patch is clearly from a fair while ago.
I am wondering if this patch has since been looked at elsewhere. One of the comments is about fixing this problem and mentions this:
Quote:
I will try adding 27c5 to the list of "DECLARE_PCI_FIXUP_RESUME_EARLY" lines
I am guessing this would help me too as I have this:
Code:
root@eeepc:/home/tom# lspci -nn
00:1f.2 SATA controller [0106]: Intel Corporation 82801GBM/GHM (ICH7 Family) SATA AHCI Controller [8086:27c5] (rev 02)
I read and noticed myself that changing the driver from the other one (PIIX) changes the number 27c4 to 27c5. Sadly this is as far as my knowledge of the matter extends.
Anyone have any ideas how I can get my laptop to resume from suspend again?
Well I'm guessing no-one has any ideas about this then. I've gone back to the ata_piix driver for now. Should this problem be pointed out anywhere else to get more attention?
nice one for getting back about this, had all but given up the ghost! i just tried putting in the line you said but it still didn't work..maybe i put it in the wrong place? i put it after these lines in drivers/pci/quirks.c:
just a little C background:
the stuff betwee "#if 0" and "#endif" doesn't get compiled in because "#if 0" evaluates to false, so the preprocessor (the thing that reads all the stuff with # in front before the compiler compiles the code) deletes those lines before the compiler reads them, so putting it there won't help.
yeah i also tried putting the line there. thanks for the background anyway! even with the line in the correct place the laptop won't resume. is there something else i might be missing?
so I finally upgraded to 2.6.31 and found the problem.
you can skip the following stuff from my notes and just download the attachment (patch)
Quote:
Kernel 2.6.31 brought with it:
author Alek Du <alek.du@intel.com>
Sat, 8 Aug 2009 00:46:19 +0000 (08:46 +0800)
committer Jesse Barnes <jbarnes@virtuousgeek.org>
Thu, 20 Aug 2009 16:08:45 +0000 (09:08 -0700)
commit c82f63e411f1b58427c103bd95af2863b1c96dd1
tree 4a18447facd22c384c871e312cb3183c01a44b2c tree | snapshot
parent 6c30c53fd5ae6a99a23ad78e90c428d2c8ffb07f commit | diff
PCI: check saved state before restore
Without the check, the config space may be filled with zeros. Though
the driver should try to avoid call restoring before saving, but the
pci layer also should check this.
Also removes the existing check in pci_restore_standard_config, since
it's superfluous with the new check in restore_state.
Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Alek Du <alek.du@intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
However, this is a problem. During resume from suspend to ram, the kernel pci layer restores the registers for the SATA controller once, then says okay, and sets dev->state_saved = false. However, since the restore goes from highest address (the BARs [base address registers]) to lowest register, some of the higher registers are set as RO because according to the lower registers controller is in PIIX mode. Then the quirk ICH to AHCI mode quirk runs, changing some bits in the register configuration space and making the higher registers RW. Prior to 2.6.31, when the driver resumed the device, it would also call pci_restore_state() (in drivers/ata/libata-core.c) and it would restore the registers that were not written the first round (during the kernel pci layer restore). But since this commit added a check to see if saved_state is true, it won't restore the registers into the register space, which is now RW. This patch deletes this check. heh
2.6.30.6-debug-dmesg-resume -> generated using PCI debugging (kernel config: CONFIG_PCI_DEBUG=y)
the 2.6.31.5 dmesg would say: instead of:
[ 90.901283] ahci 0000:00:1f.2: resume
[ 90.901314] ahci 0000:00:1f.2: restoring config space at offset 0x9 (was 0x0, writing 0x58544000)
[ 90.901340] ahci 0000:00:1f.2: restoring config space at offset 0x1 (was 0x2b00405, writing 0x2b00407)
[ 90.901394] ahci 0000:00:1f.2: setting latency timer to 64
(this dmesg obtained by leaving the computer alone for >180 seconds (the time ahci takes to give up on reset) and resuming to a computer with no disk access but memory cache access for commands already run previously)
So, to clarify, I need the ahci quirk patch, the extra line in quirks.c and the pci-state patch?
For other reasons I'm using 2.6.32-rc7 at the moment and the combination of the three changes doesn't compile on that kernel. My fault I know! I'll try 2.6.31 when I get the chance. I can post the error if you're at all interested, it is complaining about previous redefinitions of all the variables. Maybe I just have messed up the patching.
Look forward to seeing it all come together!
UPDATE: Just put in the two patches and added the line. It works! Thanks!
Last edited by trumpet_tom; 11-17-2009 at 08:30 AM.
Reason: update
I updated (well, changed) the patch so that it doesn't affect the whole PCI system.
my notes:
Quote:
ahci-pci-restore-1.diff overrides the check in the ahci driver. We can keep the above commit and not affect all the PCI drivers. In the patch, ahci_pci_device_resume(pdev) (file drivers/ata/ahci.c) calls ata_pci_device_do_resume(pdev) (file drivers/ata/libata-core.c), which then calls pci_restore_state(pdev) (file drivers/pci/pci.c), where the check is located. Since the same device descriptor (pdev pointer) is passed down this call stack, we can just change the device descriptor's state_saved to = true in ahci_pci_device_resume (file drivers/ata/ahci.c), and the check in pci_restore_state(pdev) (file drivers/pci/pci.c) will pass.
I thought of this after seeing this commit:
author Kleber Sacilotto de Souza <klebers@linux.vnet.ibm.com>
Wed, 25 Nov 2009 22:13:43 +0000 (20:13 -0200)
committer Greg Kroah-Hartman <gregkh@suse.de>
Wed, 6 Jan 2010 23:03:11 +0000 (15:03 -0800)
commit c1d17da3cf8a961254fd18f4ddc8bbb743a33ab7
tree 60c3aa53504ac0496f12cacc548407f6a3c3ff69 tree | snapshot
parent a1092bf3809c7ec7b730d0cca3bdba964a813147 commit | diff
SCSI: ipr: fix EEH recovery
After commits c82f63e411f1b58427c103bd95af2863b1c96dd1 (PCI: check saved
state before restore) and 4b77b0a2ba27d64f58f16d8d4d48d8319dda36ff (PCI:
Clear saved_state after the state has been restored) PCI drivers are
prevented from restoring the device standard configuration registers
twice in a row. These changes introduced a regression on ipr EEH
recovery.
The ipr device driver saves the PCI state only during the device probe
and restores it on ipr_reset_restore_cfg_space() during IOA resets. This
behavior is causing the EEH recovery to fail after the second error
detected, since the registers are not being restored.
One possible solution would be saving the registers after restoring
them. The problem with this approach is that while recovering from an
EEH error if pci_save_state() results in an EEH error, the adapter/slot
will be reset, and end up back in ipr_reset_restore_cfg_space(), but it
won't have a valid saved state to restore, so pci_restore_state() will
fail.
The following patch introduces a workaround for this problem, hacking
around the PCI API by setting pdev->state_saved = true before we do the
restore. It fixes the EEH regression and prevents that we hit another
EEH error during EEH recovery.
[jejb: fix is a hack ... Jesse and Rafael will fix properly]
Signed-off-by: Kleber Sacilotto de Souza <klebers@linux.vnet.ibm.com>
Acked-by: Brian King <brking@linux.vnet.ibm.com>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
patch in plaintext for those who don't want to download (i intend to create a site with this patch...eventually)
+ //override check to see if PCI configuration space is already restored in pci_restore_state
+ pdev->state_saved = true;
rc = ata_pci_device_do_resume(pdev);
if (rc)
return rc;
Last edited by lambchops468; 01-31-2010 at 02:18 PM.
Reason: forgot to attach patch
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.