From patchwork Wed Jan 22 19:58:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyrel Datwyler X-Patchwork-Id: 313396 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id 5FC642C0628 for ; Thu, 23 Jan 2014 07:08:01 +1100 (EST) Received: from e37.co.us.ibm.com (e37.co.us.ibm.com [32.97.110.158]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 56A432C00CC for ; Thu, 23 Jan 2014 07:06:17 +1100 (EST) Received: from /spool/local by e37.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 22 Jan 2014 13:06:15 -0700 Received: from d03dlp03.boulder.ibm.com (9.17.202.179) by e37.co.us.ibm.com (192.168.1.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 22 Jan 2014 13:06:14 -0700 Received: from b03cxnp08025.gho.boulder.ibm.com (b03cxnp08025.gho.boulder.ibm.com [9.17.130.17]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id 062E519D804C for ; Wed, 22 Jan 2014 13:06:04 -0700 (MST) Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by b03cxnp08025.gho.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s0MK6Dff48627774 for ; Wed, 22 Jan 2014 21:06:13 +0100 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s0MK6AYE013582 for ; Wed, 22 Jan 2014 13:06:13 -0700 Received: from hera-lp2.pok.stglabs.ibm.com (hera-lp2.pok.stglabs.ibm.com [9.114.211.127]) by d03av04.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s0MK6429012265; Wed, 22 Jan 2014 13:06:10 -0700 From: Tyrel Datwyler To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH v2 2/3] powerpc/pseries: Update dynamic cache nodes for suspend/resume operation Date: Wed, 22 Jan 2014 14:58:36 -0500 Message-Id: <1390420717-23907-3-git-send-email-tyreld@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <1390420717-23907-1-git-send-email-tyreld@linux.vnet.ibm.com> References: <1390420717-23907-1-git-send-email-tyreld@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14012220-7164-0000-0000-00000555A405 Cc: nfont@linux.vnet.ibm.com, Tyrel Datwyler X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" From: Haren Myneni From: Haren Myneni pHyp can change cache nodes for suspend/resume operation. The current code updates the device tree 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. Signed-off-by: Haren Myneni Signed-off-by: Tyrel Datwyler --- arch/powerpc/include/asm/rtas.h | 4 ++++ arch/powerpc/kernel/rtas.c | 17 +++++++++++++++++ arch/powerpc/kernel/time.c | 6 ++++++ 3 files changed, 27 insertions(+) diff --git a/arch/powerpc/include/asm/rtas.h b/arch/powerpc/include/asm/rtas.h index 9bd52c6..da9d733 100644 --- a/arch/powerpc/include/asm/rtas.h +++ b/arch/powerpc/include/asm/rtas.h @@ -283,6 +283,10 @@ extern void pSeries_log_error(char *buf, unsigned int err_type, int fatal); #ifdef CONFIG_PPC_PSERIES extern int pseries_devicetree_update(s32 scope); +extern void post_mobility_fixup(void); +extern void update_dynamic_configuration(void); +#else /* !CONFIG_PPC_PSERIES */ +void update_dynamic_configuration(void) { } #endif #ifdef CONFIG_PPC_RTAS_DAEMON diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c index 4cf674d..8249eb2 100644 --- a/arch/powerpc/kernel/rtas.c +++ b/arch/powerpc/kernel/rtas.c @@ -43,6 +43,7 @@ #include #include #include +#include "cacheinfo.h" struct rtas_t rtas = { .lock = __ARCH_SPIN_LOCK_UNLOCKED @@ -972,6 +973,22 @@ out: free_cpumask_var(offline_mask); return atomic_read(&data.error); } + +/* + * The device tree cache nodes can be modified during suspend/ resume. + * So delete all cache entries and recreate them again after the device tree + * update. + * We already deleted cache entries for notboot CPUs before suspend. So delete + * entries for the primary CPU, recreate entries after the device tree update. + * We can create entries for nonboot CPU when enable them later. + */ + +void update_dynamic_configuration(void) +{ + cacheinfo_cpu_offline(smp_processor_id()); + post_mobility_fixup(); + cacheinfo_cpu_online(smp_processor_id()); +} #else /* CONFIG_PPC_PSERIES */ int rtas_ibm_suspend_me(struct rtas_args *args) { diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c index b3b1441..5f1ca28 100644 --- a/arch/powerpc/kernel/time.c +++ b/arch/powerpc/kernel/time.c @@ -69,6 +69,7 @@ #include #include #include +#include /* powerpc clocksource/clockevent code */ @@ -592,6 +593,11 @@ void arch_suspend_enable_irqs(void) generic_suspend_enable_irqs(); if (ppc_md.suspend_enable_irqs) ppc_md.suspend_enable_irqs(); + /* + * Update configuration which can be modified based on devicetree + * changes during resume. + */ + update_dynamic_configuration(); } #endif