scsi: ufs-pci: Force a full restore after suspend-to-disk
v2 cover scsi: ufs-pci: Force a full restore after suspend-to-disk
Hi
This patch ensures suspend-to-disk works with Host Performance Booster. Since the Host Perfomance Booster feature was added in v5.15, please consider this for v5.15 fixes.
Changes in V2:
scsi: ufs-pci: Force a full restore after suspend-to-disk
Add missing #ifdef CONFIG_PM_SLEEP as per
kernel test robot <[email protected]>
Add Reviewed-by: Avri Altman <[email protected]>
Adrian Hunter (1):
scsi: ufs-pci: Force a full restore after suspend-to-disk
drivers/scsi/ufs/ufshcd-pci.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-)
Regards
Adrian
PATCH v2 1/1 scsi: ufs-pci: Force a full restore after suspend-to-disk
Implement the ->restore() PM operation and set the link to off, which will force a full reset and restore. This ensures that Host Performance Booster is reset after suspend-to-disk.
The Host Performance Booster feature caches logical-to-physical mapping information in the host memory. After suspend-to-disk, such information is not valid, so a full reset and restore is needed.
A full reset and restore is done if the SPM level is 5 or 6, but not for other SPM levels, so this change fixes those cases.
A full reset and restore also restores base address registers, so that code is removed.
--- drivers/scsi/ufs/ufshcd-pci.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-)
drivers/scsi/ufs/ufshcd-pci.c +18 -15
@@ -370,20 +370,6 @@ static void ufs_intel_common_exit(struct ufs_hba *hba)static int ufs_intel_resume (struct ufs_hba *hba,enum ufs_pm_op op) { -/* -* To support S4 (suspend-to-disk) with spm_lvl other than 5, the base -* address registers must be restored because the restore kernel can -* have used different addresses. -*/ -ufshcd_writel (hba,lower_32_bits (hba->utrdl_dma_addr), -REG_UTP_TRANSFER_REQ_LIST_BASE_L ); -ufshcd_writel (hba,upper_32_bits (hba->utrdl_dma_addr), -REG_UTP_TRANSFER_REQ_LIST_BASE_H ); -ufshcd_writel (hba,lower_32_bits (hba->utmrdl_dma_addr), -REG_UTP_TASK_REQ_LIST_BASE_L ); -ufshcd_writel (hba,upper_32_bits (hba->utmrdl_dma_addr), -REG_UTP_TASK_REQ_LIST_BASE_H ); -if (ufshcd_is_link_hibern8 (hba)) {int ret =ufshcd_uic_hibern8_exit (hba);
@@ -463,6 +449,18 @@ static struct ufs_hba_variant_ops ufs_intel_lkf_hba_vops = { .device_reset = ufs_intel_device_reset, }; +#ifdef CONFIG_PM_SLEEP +static int ufshcd_pci_restore (struct device *dev) +{ +struct ufs_hba *hba =dev_get_drvdata (dev); + +/* Force a full reset and restore */ +ufshcd_set_link_off (hba); + +return ufshcd_system_resume (dev); +} +#endif +/** * ufshcd_pci_shutdown - main function to put the controller in reset state * @pdev: pointer to PCI device handle
@@ -546,9 +544,14 @@ ufshcd_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) }static const struct dev_pm_ops ufshcd_pci_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(ufshcd_system_suspend, ufshcd_system_resume)SET_RUNTIME_PM_OPS (ufshcd_runtime_suspend, ufshcd_runtime_resume,NULL ) #ifdef CONFIG_PM_SLEEP + .suspend = ufshcd_system_suspend, + .resume = ufshcd_system_resume, + .freeze = ufshcd_system_suspend, + .thaw = ufshcd_system_resume, + .poweroff = ufshcd_system_suspend, + .restore = ufshcd_pci_restore, .prepare = ufshcd_suspend_prepare, .complete = ufshcd_resume_complete, #endif
Signature · 1 line
2.25.1
Martin K. Petersen
AppliedQuoted 8 lines · Adrian Hunter
This patch ensures suspend-to-disk works with Host Performance Booster. Since the Host Perfomance Booster feature was added in v5.15, please consider this for v5.15 fixes.
Changes in V2:
[...]
Applied to 5.15/scsi-fixes, thanks!
[1/1] scsi: ufs-pci: Force a full restore after suspend-to-disk
https://git.kernel.org/mkp/scsi/c/4e5483b8440d
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering