scsi: ufs-pci: Fix restore from S4 for Intel controllers
authorAdrian Hunter <adrian.hunter@intel.com>
Mon, 7 Dec 2020 08:31:17 +0000 (10:31 +0200)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 9 Dec 2020 16:34:20 +0000 (11:34 -0500)
commitc763729a10e538d997744317cf4a1c4f25266066
tree37dcff392cebd015700e968d8d70e99ae230ca63
parentb3f3d31a528f78d9903253a23a5e5c6bf5280f40
scsi: ufs-pci: Fix restore from S4 for Intel controllers

Currently, ufshcd-pci is the only UFS driver with support for
suspend-to-disk PM callbacks (i.e. freeze/thaw/restore/poweroff). These
callbacks are set by the macro SET_SYSTEM_SLEEP_PM_OPS to the same
functions as system suspend/resume. That will work with spm_lvl 5 because
spm_lvl 5 will result in a full restore for the ->restore() callback.  In
the absence of a full restore, the host controller registers will have
values set up by the restore kernel (the kernel that boots and loads the
restore image) which are not necessarily the same. However it turns out,
the only registers that sometimes need restore are the base address
registers. This has gone un-noticed because, depending on IOMMU settings,
the kernel can end up allocating the same addresses every time.

For Intel controllers, an spm_lvl other than 5 can be used, so to support
S4 (suspend-to-disk) with spm_lvl other than 5, restore the base address
registers.

Link: https://lore.kernel.org/r/20201207083120.26732-2-adrian.hunter@intel.com
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/ufs/ufshcd-pci.c