linux-kernelorg-stable/drivers
Damien Le Moal 4371fe1ba4 ata: libata-eh: Avoid unnecessary resets when revalidating devices
In ata_eh_revalidate_and_attach(), a link LPM policy is always
set to ATA_LPM_MAX_POWER before calling ata_dev_revalidate() to ensure
that the call to ata_phys_link_offline() does not return true, thus
causing an unnecessary device reset. This change was introduced
with commit 71d7b6e51a ("ata: libata-eh: avoid needless hard reset
when revalidating link").

However, setting the link LPM policy to ATA_LPM_MAX_POWER may be
visible only after some time, depending on the power state the link was
in. E.g. transitioning out of the Partial state should take no longer
than a few microseconds, but transitioning out of the Slumber or
DevSleep state may take several milliseconds. So despite the changes
introduced with commit 71d7b6e51a ("ata: libata-eh: avoid needless
hard reset when revalidating link"), we can still endup with
ata_phys_link_offline() seeing a link SCR_STATUS register signaling that
the device is present (DET is equal to 1h) but that the link PHY is
still in a low power mode (e.g. IPM is 2h, signaling "Interface in
Partial power management state"). In such cases, ata_phys_link_offline()
returns true, causing an EIO return for ata_eh_revalidate_and_attach()
and a device reset.

Avoid such unnecessary device resets by introducing a relaxed version
of the link offline test implemented by ata_phys_link_offline() with
the new helper function ata_eh_link_established(). This functions
returns true if for the link SCR_STATUS register we see that:
 - A device is still present, that is, the DET field is 1h (Device
   presence detected but Phy communication not established) or 3h
   (Device presence detected and Phy communication established).
 - Communication is established, that is, the IPM field is not 0h,
   indicating that the PHY is online or in a low power state.

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Niklas Cassel <cassel@kernel.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Link: https://lore.kernel.org/r/20250701125321.69496-5-dlemoal@kernel.org
Signed-off-by: Niklas Cassel <cassel@kernel.org>
2025-07-02 12:01:33 +02:00
..
accel
accessibility
acpi ACPICA: Refuse to evaluate a method if arguments are missing 2025-06-18 21:12:13 +02:00
amba
android
ata ata: libata-eh: Avoid unnecessary resets when revalidating devices 2025-07-02 12:01:33 +02:00
atm atm: idt77252: Add missing `dma_map_error()` 2025-06-25 15:28:57 -07:00
auxdisplay
base driver core: faux: Quiet probe failures 2025-06-10 19:23:25 +02:00
bcma
block block-6.16-20250626 2025-06-27 09:02:33 -07:00
bluetooth driver: bluetooth: hci_qca:fix unable to load the BT driver 2025-06-20 11:55:03 -04:00
bus
cache
cdrom
cdx
char
clk
clocksource
comedi
connector
counter
cpufreq rust: Use CpuId in place of raw CPU numbers 2025-06-12 10:31:28 +05:30
cpuidle
crypto
cxl cxl/edac: Fix using wrong repair type to check dram event record 2025-06-25 12:05:45 -07:00
dax
dca
devfreq
dio
dma
dma-buf udmabuf: use sgtable-based scatterlist wrappers 2025-06-11 13:18:07 +02:00
dpll
edac EDAC/amd64: Fix size calculation for Non-Power-of-Two DIMMs 2025-06-25 16:40:03 +02:00
eisa
extcon
firewire
firmware
fpga
fsi
fwctl
gnss
gpio gpio: mlxbf3: only get IRQ for device instance 0 2025-06-18 12:19:39 +02:00
gpu Merge tag 'drm-misc-fixes-2025-06-26' of https://gitlab.freedesktop.org/drm/misc/kernel into drm-fixes 2025-06-28 06:53:00 +10:00
greybus
hid hid-for-linus-2025062701 2025-06-26 17:06:01 -07:00
hsi
hte
hv
hwmon hwmon: (ltc4282) avoid repeated register write 2025-06-16 06:30:58 -07:00
hwspinlock
hwtracing
i2c i2c: scx200_acb: depends on HAS_IOPORT 2025-06-27 12:28:33 +02:00
i3c
idle intel_idle: Update arguments of mwait_idle_with_hints() 2025-06-10 21:09:28 +02:00
iio
infiniband
input
interconnect
iommu iommu/tegra: Fix incorrect size calculation 2025-06-13 17:02:31 +02:00
ipack
irqchip irqchip/ath79-misc: Fix missing prototypes warnings 2025-06-20 21:38:52 +02:00
isdn
leds
macintosh
mailbox
mcb
md - dm-crypt: fix a crash on 32-bit machines 2025-06-23 15:02:57 -07:00
media
memory
memstick
message
mfd
misc
mmc
most
mtd mtd: spinand: fix memory leak of ECC engine conf 2025-06-19 19:13:21 +02:00
mux
net net: libwx: fix the creation of page_pool 2025-06-26 11:02:23 +02:00
nfc
ntb
nubus
nvdimm
nvme block-6.16-20250626 2025-06-27 09:02:33 -07:00
nvmem
of
opp
parisc
parport
pci pci-v6.16-fixes-2 2025-06-27 20:17:48 -07:00
pcmcia
peci
perf
phy
pinctrl pinctrl: sunxi: dt: Consider pin base when calculating bank number from pin 2025-06-10 14:35:40 +02:00
platform platform/x86: Use i2c adapter name to fix build errors 2025-06-25 23:39:22 +02:00
pmdomain
pnp
power
powercap
pps
ps3
ptp ptp: allow reading of currently dialed frequency to succeed on free-running clocks 2025-06-17 16:13:09 -07:00
pwm
rapidio drivers/rapidio/rio_cm.c: prevent possible heap overwrite 2025-06-11 22:42:36 -07:00
ras
regulator regulator: fan53555: add enable_time support and soft-start times 2025-06-16 13:26:23 +01:00
remoteproc
reset
rpmsg
rtc
s390 s390/pkey: Prevent overflow in size calculation for memdup_user() 2025-06-16 16:15:24 +02:00
sbus
scsi scsi: fnic: Fix missing DMA mapping error in fnic_send_frame() 2025-06-19 23:07:57 -04:00
sh
siox
slimbus
soc
soundwire
spi spi: spi-cadence-quadspi: Fix pm runtime unbalance 2025-06-24 16:40:31 +01:00
spmi
ssb
staging staging: rtl8723bs: Avoid memset() in aes_cipher() and aes_decipher() 2025-06-19 17:33:43 +02:00
target scsi: target: Fix NULL pointer dereference in core_scsi3_decode_spec_i_port() 2025-06-16 14:35:57 -04:00
tc
tee
thermal
thunderbolt
tty serial: imx: Restore original RXTL for console to fix data loss 2025-06-24 15:34:21 +01:00
ufs scsi: ufs: core: Fix clk scaling to be conditional in reset and restore 2025-06-19 22:51:51 -04:00
uio
usb
vdpa
vfio
vhost
video
virt
virtio
w1
watchdog
xen
zorro
Kconfig
Makefile