From: Anju T Sudhakar <a...@linux.vnet.ibm.com> This patch disables the core imc engine when we offline all the cpus available in a core. Also it enables core imc when any of the cpu in that core comes back. Enable/disable core imc is done through the opal calls OPAL_CORE_IMC_ENABLE and OPAL_CORE_IMC_DISABLE respectively.
Cc: Gautham R. Shenoy <e...@linux.vnet.ibm.com> Cc: Balbir Singh <bsinghar...@gmail.com> Cc: Benjamin Herrenschmidt <b...@kernel.crashing.org> Cc: Paul Mackerras <pau...@samba.org> Cc: Anton Blanchard <an...@samba.org> Cc: Sukadev Bhattiprolu <suka...@linux.vnet.ibm.com> Cc: Michael Neuling <mi...@neuling.org> Cc: Stewart Smith <stew...@linux.vnet.ibm.com> Cc: Daniel Axtens <d...@axtens.net> Cc: Stephane Eranian <eran...@google.com> Signed-off-by: Anju T Sudhakar <a...@linux.vnet.ibm.com> Signed-off-by: Madhavan Srinivasan <ma...@linux.vnet.ibm.com> --- arch/powerpc/perf/imc-pmu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/perf/imc-pmu.c b/arch/powerpc/perf/imc-pmu.c index 2ff39fe2a5ce..278c7a427b43 100644 --- a/arch/powerpc/perf/imc-pmu.c +++ b/arch/powerpc/perf/imc-pmu.c @@ -127,6 +127,7 @@ static int ppc_core_imc_cpu_online(unsigned int cpu) /* Else, set the cpu in the mask, and change the context */ cpumask_set_cpu(cpu, &core_imc_cpumask); + opal_core_imc_counters_control(OPAL_CORE_IMC_ENABLE, 0, 0, 0); core_imc_change_cpu_context(-1, cpu); return 0; } @@ -149,8 +150,10 @@ static int ppc_core_imc_cpu_offline(unsigned int cpu) if (ncpu < nr_cpu_ids) { target = ncpu; cpumask_set_cpu(target, &core_imc_cpumask); - } else + } else { + opal_core_imc_counters_control(OPAL_CORE_IMC_DISABLE, 0, 0, 0); target = -1; + } /* migrate the context */ core_imc_change_cpu_context(cpu, target); -- 2.7.4