Comment 40 for bug 1968155

Revision history for this message
J.J. Berkhout (j-j-berkhout) wrote :

The problem was (partly) solved.
After asking for help in the linux kernel development mailing list Niklas Cassel (one of the developers) wrote:

- The commit 1527f69204fe ("ata: ahci: Add Green Sardine vendor ID as board_ahci_mobile") added the - PCI vendor and device id to the list of supported AHCI controllers using the low power board
- version:
 { PCI_VDEVICE(AMD, 0x7901), board_ahci_low_power }, /* AMD Green Sardine */

- Before the commit in question, your AHCI controller relied on this catch-all entry:
 /* Generic, PCI class code for AHCI */
 { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
   PCI_CLASS_STORAGE_SATA_AHCI, 0xffffff, board_ahci },
- which does not enable/allow any low power mode at all.

- Now, I do think that low power modes *should* work with this AHCI controller. Most likely, it is - simply the optical drive that does not work well when the HBA initiates a low power mode on the
- link.
.
.
.
- A way do disable lpm is to do:

$ ls -al /sys/class/scsi_host/host*

- Find your device in the list. My device is:
/sys/class/scsi_host/host13/

- Print the current lpm policy for your device:
$ cat /sys/class/scsi_host/host13/link_power_management_policy
med_power_with_dipm

- Anything other than "max_performance" means that you have (a varying degree) of low power modes
- enabled.

$ sudo sh -c "echo max_performance > /sys/class/scsi_host/host13/link_power_management_policy"

$ cat /sys/class/scsi_host/host13/link_power_management_policy
max_performance

- Try reading from the optical drive after ensuring that the policy is "max_performance".

This solved the problem.
As the kernel parameter to disable lpm only works from kernel 5.18 onwards, I had to find another way to force this setting, so I did:
$ apt install sysfsutils
and added in /etc/sysfs.conf the line:

class/scsi_host/host0/link_power_management_policy = max_performance

As long as I don't mess around with my hardware, the host number should stay the same.
Of course, if anyone uses this method, he/she should find out his host number for the controller of the optical drive in question and substitute it in the hostnn part.

A definite solution will probably be a future patch in libata.