linux-stable/drivers
Adam Vodopjan c8b89f10a4 ata: ahci: Fix PCS quirk application for suspend
[ Upstream commit 37e14e4f37 ]

Since kernel 5.3.4 my laptop (ICH8M controller) does not see Kingston
SV300S37A60G SSD disk connected into a SATA connector on wake from
suspend.  The problem was introduced in c312ef1763 ("libata/ahci: Drop
PCS quirk for Denverton and beyond"): the quirk is not applied on wake
from suspend as it originally was.

It is worth to mention the commit contained another bug: the quirk is
not applied at all to controllers which require it. The fix commit
09d6ac8dc5 ("libata/ahci: Fix PCS quirk application") landed in 5.3.8.
So testing my patch anywhere between commits c312ef1763 and
09d6ac8dc5 is pointless.

Not all disks trigger the problem. For example nothing bad happens with
Western Digital WD5000LPCX HDD.

Test hardware:
- Acer 5920G with ICH8M SATA controller
- sda: some SATA HDD connnected into the DVD drive IDE port with a
  SATA-IDE caddy. It is a boot disk
- sdb: Kingston SV300S37A60G SSD connected into the only SATA port

Sample "dmesg --notime | grep -E '^(sd |ata)'" output on wake:

sd 0:0:0:0: [sda] Starting disk
sd 2:0:0:0: [sdb] Starting disk
ata4: SATA link down (SStatus 4 SControl 300)
ata3: SATA link down (SStatus 4 SControl 300)
ata1.00: ACPI cmd ef/03:0c:00:00:00:a0 (SET FEATURES) filtered out
ata1.00: ACPI cmd ef/03:42:00:00:00:a0 (SET FEATURES) filtered out
ata1: FORCE: cable set to 80c
ata5: SATA link down (SStatus 0 SControl 300)
ata3: SATA link down (SStatus 4 SControl 300)
ata3: SATA link down (SStatus 4 SControl 300)
ata3.00: disabled
sd 2:0:0:0: rejecting I/O to offline device
ata3.00: detaching (SCSI 2:0:0:0)
sd 2:0:0:0: [sdb] Start/Stop Unit failed: Result: hostbyte=DID_NO_CONNECT
	driverbyte=DRIVER_OK
sd 2:0:0:0: [sdb] Synchronizing SCSI cache
sd 2:0:0:0: [sdb] Synchronize Cache(10) failed: Result:
	hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
sd 2:0:0:0: [sdb] Stopping disk
sd 2:0:0:0: [sdb] Start/Stop Unit failed: Result: hostbyte=DID_BAD_TARGET
	driverbyte=DRIVER_OK

Commit c312ef1763 dropped ahci_pci_reset_controller() which internally
calls ahci_reset_controller() and applies the PCS quirk if needed after
that. It was called each time a reset was required instead of just
ahci_reset_controller(). This patch puts the function back in place.

Fixes: c312ef1763 ("libata/ahci: Drop PCS quirk for Denverton and beyond")
Signed-off-by: Adam Vodopjan <grozzly@protonmail.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-01-04 11:26:24 +01:00
..
accessibility speakup: replace utils' u_char with unsigned char 2022-11-26 09:27:45 +01:00
acpi ACPI: resource: do IRQ override on Lenovo 14ALC7 2023-01-04 11:26:24 +01:00
amba
android binder: validate alloc->mm in ->mmap() handler 2022-12-02 17:42:59 +01:00
ata ata: ahci: Fix PCS quirk application for suspend 2023-01-04 11:26:24 +01:00
atm
auxdisplay
base class: fix possible memory leak in __class_register() 2022-12-31 13:26:24 +01:00
bcma
block floppy: Fix memory leak in do_floppy_init() 2022-12-31 13:26:52 +01:00
bluetooth Bluetooth: hci_bcm: Add CYW4373A0 support 2022-12-31 13:26:47 +01:00
bus bus: ixp4xx: Don't touch bit 7 on IXP42x 2022-12-02 17:43:11 +01:00
cdrom
char ipmi: fix memleak when unload ipmi driver 2022-12-31 13:26:42 +01:00
clk clk: renesas: r8a779f0: Fix SD0H clock name 2022-12-31 13:26:54 +01:00
clocksource clocksource/drivers/timer-ti-dm: Fix missing clk_disable_unprepare in dmtimer_systimer_init_clock() 2022-12-31 13:25:46 +01:00
comedi
connector
counter counter: stm32-lptimer-cnt: fix the check on arr and cmp registers update 2022-12-31 13:26:26 +01:00
cpufreq cpufreq: amd_freq_sensitivity: Add missing pci_dev_put() 2022-12-31 13:25:45 +01:00
cpuidle cpuidle: dt: Return the correct numbers of parsed idle states 2022-12-31 13:25:42 +01:00
crypto crypto: hisilicon/qm - increase the memory of local variables 2022-12-31 13:26:47 +01:00
cxl cxl/pmem: Use size_add() against integer overflow 2022-11-26 09:27:21 +01:00
dax
dca
devfreq
dio drivers: dio: fix possible memory leak in dio_init() 2022-12-31 13:26:24 +01:00
dma dmaengine: apple-admac: Allocate cache SRAM to channels 2022-12-31 13:26:31 +01:00
dma-buf dma-buf: Use dma_fence_unwrap_for_each when importing fences 2022-12-02 17:43:10 +01:00
edac EDAC/i10nm: fix refcount leak in pci_get_dev_wrapper() 2022-12-31 13:25:44 +01:00
eisa
extcon extcon: usbc-tusb320: Call the Type-C IRQ handler only if a port is registered 2022-12-31 13:26:54 +01:00
firewire
firmware firmware: raspberrypi: fix possible memory leak in rpi_firmware_probe() 2022-12-31 13:26:26 +01:00
fpga fpga: m10bmc-sec: Fix kconfig dependencies 2022-12-02 17:43:12 +01:00
fsi fsi: master-ast-cf: Fix missing of_node_put in fsi_master_acf_probe 2022-10-21 12:39:26 +02:00
gnss
gpio gpiolib: protect the GPIO device against being dropped while in use by user-space 2022-12-31 13:26:28 +01:00
gpu drm/amd/display: revert Disable DRR actions during state commit 2022-12-31 13:26:54 +01:00
greybus
hid HID: mcp2221: don't connect hidraw 2022-12-31 13:26:52 +01:00
hsi HSI: omap_ssi_core: Fix error handling in ssi_init() 2022-12-31 13:26:30 +01:00
hte
hv video: hyperv_fb: Avoid taking busy spinlock on panic path 2022-12-31 13:26:40 +01:00
hwmon hwmon: (jc42) Fix missing unlock on error in jc42_write() 2022-12-31 13:26:48 +01:00
hwspinlock hwspinlock: qcom: correct MMIO max register for newer SoCs 2022-11-16 10:03:50 +01:00
hwtracing coresight: trbe: remove cpuhp instance node before remove cpuhp state 2022-12-31 13:26:27 +01:00
i2c i2c: ismt: Fix an out-of-bounds bug in ismt_access() 2022-12-31 13:26:28 +01:00
i3c
idle
iio iio: addac: ad74413r: fix integer promotion bug in ad74413_get_input_current_offset() 2022-12-31 13:26:52 +01:00
infiniband RDMA/siw: Fix pointer cast warning 2022-12-31 13:26:31 +01:00
input Input: iqs7222 - add support for IQS7222A v1.13+ 2022-12-31 13:26:51 +01:00
interconnect interconnect: qcom: sc7180: fix dropped const of qcom_icc_bcm 2022-12-31 13:26:24 +01:00
iommu iommu/mediatek: Fix forever loop in error handling 2022-12-31 13:26:36 +01:00
ipack
irqchip irqchip/loongson-liointc: Fix improper error handling in liointc_init() 2022-12-31 13:25:44 +01:00
isdn mISDN: hfcmulti: don't call dev_kfree_skb/kfree_skb() under spin_lock_irqsave() 2022-12-31 13:26:37 +01:00
leds leds: is31fl319x: Fix setting current limit for is31fl319{0,1,3} 2022-12-31 13:26:30 +01:00
macintosh macintosh/macio-adb: check the return value of ioremap() 2022-12-31 13:26:34 +01:00
mailbox mailbox: zynq-ipi: fix error handling while device_register() fails 2022-12-31 13:26:39 +01:00
mcb mcb: mcb-parse: fix error handing in chameleon_parse_gdd() 2022-12-31 13:26:27 +01:00
md md/raid1: stop mdx_raid1 thread when raid1 array run failed 2022-12-31 13:26:44 +01:00
media media: dvbdev: fix refcnt bug 2022-12-31 13:26:53 +01:00
memory memory: renesas-rpc-if: Clear HS bit during hardware initialization 2022-12-31 13:25:36 +01:00
memstick memstick/ms_block: Add check for alloc_ordered_workqueue 2022-12-31 13:26:11 +01:00
message
mfd mfd: qcom_rpm: Use devm_of_platform_populate() to simplify code 2022-12-31 13:26:54 +01:00
misc lkdtm: cfi: Make PAC test work with GCC 7 and 8 2022-12-31 13:26:50 +01:00
mmc mmc: renesas_sdhi: better reset from HS400 mode 2022-12-31 13:26:46 +01:00
most
mtd mtd: maps: pxa2xx-flash: fix memory leak in probe 2022-12-31 13:26:02 +01:00
mux
net net: stmmac: fix errno when create_singlethread_workqueue() fails 2022-12-31 13:26:53 +01:00
nfc nfc: pn533: Clear nfc_target before being used 2022-12-31 13:26:37 +01:00
ntb
nubus
nvdimm
nvme nvme-pci: fix page size checks 2023-01-04 11:26:23 +01:00
nvmem nvmem: rmem: Fix return value check in rmem_read() 2022-12-08 11:30:15 +01:00
of of: overlay: fix null pointer dereferencing in find_dup_cset_node_entry() and find_dup_cset_prop() 2022-12-31 13:26:12 +01:00
opp
parisc parisc: Export iosapic_serial_irq() symbol for serial port driver 2022-11-10 18:17:35 +01:00
parport parport_pc: Avoid FIFO port location truncation 2022-11-26 09:27:30 +01:00
pci Revert "PCI: Clear PCI_STATUS when setting up device" 2022-12-31 13:26:47 +01:00
pcmcia
peci
perf drivers/perf: hisi: Fix some event id for hisi-pcie-pmu 2022-12-31 13:25:40 +01:00
phy phy: qcom-qmp-pcie: Fix sm8450_qmp_gen4x2_pcie_pcs_tbl[] register names 2022-12-31 13:26:32 +01:00
pinctrl pinctrl: thunderbay: fix possible memory leak in thunderbay_build_functions() 2022-12-31 13:26:09 +01:00
platform regulator: core: Use different devices for resource allocation and DT lookup 2022-12-31 13:26:47 +01:00
pnp PNP: fix name memory leak in pnp_alloc_dev() 2022-12-31 13:25:43 +01:00
power power: supply: fix null pointer dereferencing in power_supply_get_battery_info 2022-12-31 13:26:30 +01:00
powercap powercap: intel_rapl: fix UBSAN shift-out-of-bounds issue 2022-10-21 12:39:04 +02:00
pps
ps3
ptp
pwm pwm: tegra: Fix 32 bit build 2022-12-31 13:26:54 +01:00
rapidio rapidio: devices: fix missing put_device in mport_cdev_open 2022-12-31 13:25:48 +01:00
ras
regulator regulator: core: fix deadlock on regulator enable 2022-12-31 13:26:52 +01:00
remoteproc remoteproc: qcom: q6v5: Fix missing clk_disable_unprepare() in q6v5_wcss_qcs404_power_on() 2022-12-31 13:26:36 +01:00
reset
rpmsg
rtc rtc: mxc_v2: Add missing clk_disable_unprepare() 2022-12-31 13:26:38 +01:00
s390 s390/lcs: Fix return type of lcs_start_xmit() 2022-12-31 13:26:43 +01:00
sbus
scsi scsi: qla2xxx: Fix crash when I/O abort times out 2022-12-31 13:26:53 +01:00
sh
siox siox: fix possible memory leak in siox_device_add() 2022-11-26 09:27:30 +01:00
slimbus slimbus: stream: correct presence rate frequencies 2022-11-26 09:27:45 +01:00
soc soc: mediatek: pm-domains: Fix the power glitch issue 2022-12-31 13:26:39 +01:00
soundwire soundwire: intel: Initialize clock stop timeout 2022-12-14 11:40:51 +01:00
spi spi: spi-gpio: Don't set MOSI as an input if not 3WIRE mode 2022-12-31 13:26:11 +01:00
spmi spmi: pmic-arb: correct duplicate APID to PPID mapping logic 2022-10-21 12:38:53 +02:00
ssb
staging vme: Fix error not catched in fake_init() 2022-12-31 13:26:27 +01:00
target scsi: target: iscsi: Fix a race condition between login_work and the login thread 2022-12-31 13:26:48 +01:00
tc
tee tee: optee: fix possible memory leak in optee_register_device() 2022-12-02 17:43:03 +01:00
thermal thermal/drivers/qcom/lmh: Fix irq handler return value 2022-12-31 13:26:28 +01:00
thunderbolt thunderbolt: Add DP OUT resource when DP tunnel is discovered 2022-11-16 10:03:48 +01:00
tty serial: sunsab: Fix error handling in sunsab_init() 2022-12-31 13:26:26 +01:00
ufs scsi: ufs: Reduce the START STOP UNIT timeout 2022-12-31 13:26:47 +01:00
uio uio: uio_dmem_genirq: Fix deadlock between irq config and handling 2022-12-31 13:26:24 +01:00
usb usb: dwc3: qcom: Fix memory leak in dwc3_qcom_interconnect_init 2023-01-04 11:26:22 +01:00
vdpa
vfio vfio: platform: Do not pass return buffer to ACPI _RST method 2022-12-31 13:26:24 +01:00
vhost
video fbdev: fbcon: release buffer when fbcon_do_set_font() failed 2022-12-31 13:26:53 +01:00
virt virt/sev-guest: Add a MODULE_ALIAS 2022-12-31 13:25:56 +01:00
virtio
vlynq
w1
watchdog watchdog: iTCO_wdt: Set NO_REBOOT if the watchdog is not already running 2022-12-31 13:26:29 +01:00
xen xen/privcmd: Fix a possible warning in privcmd_ioctl_mmap_resource() 2022-12-31 13:25:46 +01:00
zorro
Kconfig
Makefile