Michal Suchanek b68e8b
From fa53bcdb7413e7c40170106781f6b5bb9d74db84 Mon Sep 17 00:00:00 2001
Michal Suchanek b68e8b
From: Nathan Lynch <nathanl@linux.ibm.com>
Michal Suchanek b68e8b
Date: Mon, 7 Dec 2020 15:51:57 -0600
Michal Suchanek b68e8b
Subject: [PATCH] powerpc/pseries/hibernation: perform post-suspend fixups
Michal Suchanek b68e8b
 later
Michal Suchanek b68e8b
Michal Suchanek b68e8b
References: bsc#1181674 ltc#189159
Michal Suchanek b68e8b
Patch-mainline: v5.11-rc1
Michal Suchanek b68e8b
Git-commit: fa53bcdb7413e7c40170106781f6b5bb9d74db84
Michal Suchanek b68e8b
Michal Suchanek b68e8b
The pseries hibernate code calls post_mobility_fixup() which is sort
Michal Suchanek b68e8b
of a dumping ground of fixups that need to run after resuming from
Michal Suchanek b68e8b
suspend regardless of whether suspend was a hibernation or a
Michal Suchanek b68e8b
migration. Calling post_mobility_fixup() from
Michal Suchanek b68e8b
pseries_suspend_enable_irqs() runs this code early in resume with
Michal Suchanek b68e8b
devices suspended and only one CPU up, while the much more commonly
Michal Suchanek b68e8b
used migration case runs these fixups in a more typical process
Michal Suchanek b68e8b
context.
Michal Suchanek b68e8b
Michal Suchanek b68e8b
Call post_mobility_fixup() after the suspend core returns a success
Michal Suchanek b68e8b
status to the hibernate sysfs store method and remove
Michal Suchanek b68e8b
pseries_suspend_enable_irqs().
Michal Suchanek b68e8b
Michal Suchanek b68e8b
Signed-off-by: Nathan Lynch <nathanl@linux.ibm.com>
Michal Suchanek b68e8b
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Michal Suchanek b68e8b
Link: https://lore.kernel.org/r/20201207215200.1785968-26-nathanl@linux.ibm.com
Michal Suchanek b68e8b
Acked-by: Michal Suchanek <msuchanek@suse.de>
Michal Suchanek b68e8b
---
Michal Suchanek b68e8b
 arch/powerpc/platforms/pseries/suspend.c | 21 ++++-----------------
Michal Suchanek b68e8b
 1 file changed, 4 insertions(+), 17 deletions(-)
Michal Suchanek b68e8b
Michal Suchanek b68e8b
diff --git a/arch/powerpc/platforms/pseries/suspend.c b/arch/powerpc/platforms/pseries/suspend.c
Michal Suchanek b68e8b
index 6a94cc0deb88..589a91730db8 100644
Michal Suchanek b68e8b
--- a/arch/powerpc/platforms/pseries/suspend.c
Michal Suchanek b68e8b
+++ b/arch/powerpc/platforms/pseries/suspend.c
Michal Suchanek b68e8b
@@ -50,21 +50,6 @@ static int pseries_suspend_begin(u64 stream_id)
Michal Suchanek b68e8b
 	return 0;
Michal Suchanek b68e8b
 }
Michal Suchanek b68e8b
 
Michal Suchanek b68e8b
-/**
Michal Suchanek b68e8b
- * pseries_suspend_enable_irqs
Michal Suchanek b68e8b
- *
Michal Suchanek b68e8b
- * Post suspend configuration updates
Michal Suchanek b68e8b
- *
Michal Suchanek b68e8b
- **/
Michal Suchanek b68e8b
-static void pseries_suspend_enable_irqs(void)
Michal Suchanek b68e8b
-{
Michal Suchanek b68e8b
-	/*
Michal Suchanek b68e8b
-	 * Update configuration which can be modified based on device tree
Michal Suchanek b68e8b
-	 * changes during resume.
Michal Suchanek b68e8b
-	 */
Michal Suchanek b68e8b
-	post_mobility_fixup();
Michal Suchanek b68e8b
-}
Michal Suchanek b68e8b
-
Michal Suchanek b68e8b
 /**
Michal Suchanek b68e8b
  * pseries_suspend_enter - Final phase of hibernation
Michal Suchanek b68e8b
  *
Michal Suchanek b68e8b
@@ -127,8 +112,11 @@ static ssize_t store_hibernate(struct device *dev,
Michal Suchanek b68e8b
 	if (!rc)
Michal Suchanek b68e8b
 		rc = pm_suspend(PM_SUSPEND_MEM);
Michal Suchanek b68e8b
 
Michal Suchanek b68e8b
-	if (!rc)
Michal Suchanek b68e8b
+	if (!rc) {
Michal Suchanek b68e8b
 		rc = count;
Michal Suchanek b68e8b
+		post_mobility_fixup();
Michal Suchanek b68e8b
+	}
Michal Suchanek b68e8b
+
Michal Suchanek b68e8b
 
Michal Suchanek b68e8b
 	return rc;
Michal Suchanek b68e8b
 }
Michal Suchanek b68e8b
@@ -214,7 +202,6 @@ static int __init pseries_suspend_init(void)
Michal Suchanek b68e8b
 	if ((rc = pseries_suspend_sysfs_register(&suspend_dev)))
Michal Suchanek b68e8b
 		return rc;
Michal Suchanek b68e8b
 
Michal Suchanek b68e8b
-	ppc_md.suspend_enable_irqs = pseries_suspend_enable_irqs;
Michal Suchanek b68e8b
 	suspend_set_ops(&pseries_suspend_ops);
Michal Suchanek b68e8b
 	return 0;
Michal Suchanek b68e8b
 }
Michal Suchanek b68e8b
-- 
Michal Suchanek b68e8b
2.26.2
Michal Suchanek b68e8b