Merge patch series "scsi: ensure writes are flushed to disk"
authorTom Rini <trini@konsulko.com>
Thu, 10 Apr 2025 20:21:46 +0000 (14:21 -0600)
committerTom Rini <trini@konsulko.com>
Thu, 10 Apr 2025 20:21:46 +0000 (14:21 -0600)
commitd82f7bc94c1b2fc82ebb8be5f743fd7c5292531f
tree3a8c3a0bcd90a0af2cf162399386889dc2a8026b
parent0d6e005a8cd7312cddaa4125125c4fc3470f5e18
parent77c13f30b67c1a30b33b4dd4820c5a2528c3a3bb
Merge patch series "scsi: ensure writes are flushed to disk"

Caleb Connolly <caleb.connolly@linaro.org> says:

SCSI devices like UFS may maintain their own cache to speed up writes,
however this is lost on board reset (and may be lost on device removal
or reset by OS drivers).

Currently this can be worked around by "waiting for a while" after
writing data to disk, but of course this is not an acceptable solution.

Ideally U-Boot would have a mechanism to flush caches during board
reset, but until that logic is hooked up let's be sure that all writes
are actually propagated to the storage device so that we don't lose data
on board reset.

The same logic was already implemented just for the AHCI backend, this
duplicated logic has been removed and support for the SYNC_CACHE command
is added to AHCI.

This is particularly noticeable during capsule updates, since the update
file is deleted and the board is reset immediately afterwards which
resulted in the same capsule update being applied over and over again.

This specifically fixes Qualcomm SDM845 devices with UFS 2.1, but likely
all UFS devices that use a cache.

Link: https://lore.kernel.org/r/20250326-scsi-sync-on-write-v2-0-12ab05bd464b@linaro.org
drivers/ata/ahci.c