Re: AHCI hotplug no longer functions on ICH7

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Tasos,

On Sun, May 19, 2024 at 02:40:12PM +0300, Tasos Sahanidis wrote:
> Hi,
> 
> I have a hot swap bay connected to an Intel Corporation NM10/ICH7 Family
> SATA Controller [AHCI mode] [8086:27c1] (rev 01) (prog-if 01 [AHCI 1.0])
> and since commit 7627a0edef54 ("ata: ahci: Drop low power policy board
> type") SATA AHCI hotplug no longer functions. Plugging a device in after
> the system has booted results in it not being detected.
> 
> Looking at ahci_update_initial_lpm_policy(), it is evident that
> ATA_PFLAG_EXTERNAL is not set (ad->pflags == 0x84 when the function is
> called) and there is no option in firmware to mark these ports as external.

If your port is external or hot plug capable, then your platform firmware/BIOS
should set either the "PORT_CMD_ESP and HOST_CAP_SXS" bits or the
"PORT_CMD_HPCP" bit.

See:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/drivers/ata?id=45b96d65ec68f625ad26ee16d2f556e29f715005

Is there any option in your BIOS to mark the port as external or hot plug
capable?


If not, then your platform firmware is broken and needs to be quirked.

Please provde the output from
# dmidecode
so that we can apply a quirk for your broken platform.


> My kernel was always built with CONFIG_SATA_MOBILE_LPM_POLICY=3. Booting
> with ahci.mobile_lpm_policy=2 or ahci.mobile_lpm_policy=1 results in the
> device being detected on hotplug, but the unplug event is never detected
> and the system thinks the device remains connected, resulting in hangs.

In older kernels, regardless if your AHCI controller reported support for
low-power modes or not, you also needed an explicit entry in ahci_pci_tbl for
it to be enabled.

Thus, even if you built with CONFIG_SATA_MOBILE_LPM_POLICY=3, and LPM was
being reported as supported by your AHCI controller, LPM was most likely not
enabled for your AHCI controller with older kernels.

In newer kernels, if CONFIG_SATA_MOBILE_LPM_POLICY=3, and the AHCI controller
reports that it supports LPM, we will enable it.
(We will not enable LPM if the port is external or hot plug capable, as that
breaks hot plug, as you found out.)


> The only way to restore functionality is with ahci.mobile_lpm_policy=0,
> which if I am not mistaken has the same effect as an early return. Is
> this the intended way of getting hotplug to work again from now on, on
> systems that don't mark ports as external, or is this a regression?

According to the AHCI specification, a port that is external or hot plug
capable should set the "PORT_CMD_ESP and HOST_CAP_SXS" bits or the
"PORT_CMD_HPCP" bit.

If your platform fails to follow the AHCI specification, then it will need to
be quirked.


Kind regards,
Niklas




[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux