aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHaren Myneni <hbabu@us.ibm.com>2014-02-25 23:02:18 -0500
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2014-03-06 23:54:49 -0500
commit6b36ba8492abd1c819e949e085cc547b062d8593 (patch)
tree83f51a02cb13333cbd9675a135828e4316699107
parent39a33b59f43088aa33f29ace6b978333dd0bca4a (diff)
powerpc/pseries: Update dynamic cache nodes for suspend/resume operation
pHyp can change cache nodes for suspend/resume operation. Currently the device tree is updated by drmgr in userspace after all non boot CPUs are enabled. Hence, we do not modify the cache list based on the latest cache nodes. Also we do not remove cache entries for the primary CPU. This patch removes the cache list for the boot CPU, updates the device tree before enabling nonboot CPUs and adds cache list for the boot cpu. This patch also has the side effect that older versions of drmgr will perform a second device tree update from userspace. While this is a redundant waste of a couple cycles it is harmless since firmware returns the same data for the subsequent update-nodes/properties rtas calls. Signed-off-by: Haren Myneni <hbabu@us.ibm.com> Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r--arch/powerpc/include/asm/rtas.h1
-rw-r--r--arch/powerpc/kernel/cacheinfo.c7
-rw-r--r--arch/powerpc/platforms/pseries/suspend.c19
3 files changed, 25 insertions, 2 deletions
diff --git a/arch/powerpc/include/asm/rtas.h b/arch/powerpc/include/asm/rtas.h
index 9bd52c65e66f..a0e1add01ef5 100644
--- a/arch/powerpc/include/asm/rtas.h
+++ b/arch/powerpc/include/asm/rtas.h
@@ -283,6 +283,7 @@ extern void pSeries_log_error(char *buf, unsigned int err_type, int fatal);
283 283
284#ifdef CONFIG_PPC_PSERIES 284#ifdef CONFIG_PPC_PSERIES
285extern int pseries_devicetree_update(s32 scope); 285extern int pseries_devicetree_update(s32 scope);
286extern void post_mobility_fixup(void);
286#endif 287#endif
287 288
288#ifdef CONFIG_PPC_RTAS_DAEMON 289#ifdef CONFIG_PPC_RTAS_DAEMON
diff --git a/arch/powerpc/kernel/cacheinfo.c b/arch/powerpc/kernel/cacheinfo.c
index 2912b8787aa4..40198d50b4c2 100644
--- a/arch/powerpc/kernel/cacheinfo.c
+++ b/arch/powerpc/kernel/cacheinfo.c
@@ -756,7 +756,10 @@ void cacheinfo_cpu_online(unsigned int cpu_id)
756 cacheinfo_sysfs_populate(cpu_id, cache); 756 cacheinfo_sysfs_populate(cpu_id, cache);
757} 757}
758 758
759#ifdef CONFIG_HOTPLUG_CPU /* functions needed for cpu offline */ 759/* functions needed to remove cache entry for cpu offline or suspend/resume */
760
761#if (defined(CONFIG_PPC_PSERIES) && defined(CONFIG_SUSPEND)) || \
762 defined(CONFIG_HOTPLUG_CPU)
760 763
761static struct cache *cache_lookup_by_cpu(unsigned int cpu_id) 764static struct cache *cache_lookup_by_cpu(unsigned int cpu_id)
762{ 765{
@@ -843,4 +846,4 @@ void cacheinfo_cpu_offline(unsigned int cpu_id)
843 if (cache) 846 if (cache)
844 cache_cpu_clear(cache, cpu_id); 847 cache_cpu_clear(cache, cpu_id);
845} 848}
846#endif /* CONFIG_HOTPLUG_CPU */ 849#endif /* (CONFIG_PPC_PSERIES && CONFIG_SUSPEND) || CONFIG_HOTPLUG_CPU */
diff --git a/arch/powerpc/platforms/pseries/suspend.c b/arch/powerpc/platforms/pseries/suspend.c
index 16a255255d30..1d9c580ab772 100644
--- a/arch/powerpc/platforms/pseries/suspend.c
+++ b/arch/powerpc/platforms/pseries/suspend.c
@@ -26,6 +26,7 @@
26#include <asm/mmu.h> 26#include <asm/mmu.h>
27#include <asm/rtas.h> 27#include <asm/rtas.h>
28#include <asm/topology.h> 28#include <asm/topology.h>
29#include "../../kernel/cacheinfo.h"
29 30
30static u64 stream_id; 31static u64 stream_id;
31static struct device suspend_dev; 32static struct device suspend_dev;
@@ -79,6 +80,23 @@ static int pseries_suspend_cpu(void)
79} 80}
80 81
81/** 82/**
83 * pseries_suspend_enable_irqs
84 *
85 * Post suspend configuration updates
86 *
87 **/
88static void pseries_suspend_enable_irqs(void)
89{
90 /*
91 * Update configuration which can be modified based on device tree
92 * changes during resume.
93 */
94 cacheinfo_cpu_offline(smp_processor_id());
95 post_mobility_fixup();
96 cacheinfo_cpu_online(smp_processor_id());
97}
98
99/**
82 * pseries_suspend_enter - Final phase of hibernation 100 * pseries_suspend_enter - Final phase of hibernation
83 * 101 *
84 * Return value: 102 * Return value:
@@ -235,6 +253,7 @@ static int __init pseries_suspend_init(void)
235 return rc; 253 return rc;
236 254
237 ppc_md.suspend_disable_cpu = pseries_suspend_cpu; 255 ppc_md.suspend_disable_cpu = pseries_suspend_cpu;
256 ppc_md.suspend_enable_irqs = pseries_suspend_enable_irqs;
238 suspend_set_ops(&pseries_suspend_ops); 257 suspend_set_ops(&pseries_suspend_ops);
239 return 0; 258 return 0;
240} 259}