From patchwork Wed Mar 11 10:39:02 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Francesco VIRLINZI X-Patchwork-Id: 11105 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n2BAbVle016979 for ; Wed, 11 Mar 2009 10:39:14 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754169AbZCKKjO (ORCPT ); Wed, 11 Mar 2009 06:39:14 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754193AbZCKKjO (ORCPT ); Wed, 11 Mar 2009 06:39:14 -0400 Received: from eu1sys200aog117.obsmtp.com ([207.126.144.143]:59880 "EHLO eu1sys200aog117.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754169AbZCKKjN (ORCPT ); Wed, 11 Mar 2009 06:39:13 -0400 Received: from source ([164.129.1.35]) (using TLSv1) by eu1sys200aob117.postini.com ([207.126.147.11]) with SMTP ID DSNKSbeUzLPzaK4QQWchZSsIuM3fd7gzobVr@postini.com; Wed, 11 Mar 2009 10:39:12 UTC Received: from zeta.dmz-eu.st.com (ns2.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 2F713DAB5; Wed, 11 Mar 2009 10:38:09 +0000 (GMT) Received: from mail1.ctn.st.com (mail1.ctn.st.com [164.130.116.128]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 2AA674C0B2; Wed, 11 Mar 2009 10:39:03 +0000 (GMT) Received: from [10.52.139.41] (mdt-dhcp41.ctn.st.com [10.52.139.41]) by mail1.ctn.st.com (MOS 3.8.7a) with ESMTP id CZV45529 (AUTH virlinzi); Wed, 11 Mar 2009 11:39:03 +0100 (CET) Message-ID: <49B794C6.8000806@st.com> Date: Wed, 11 Mar 2009 11:39:02 +0100 From: Francesco VIRLINZI User-Agent: Thunderbird 2.0.0.19 (X11/20090105) MIME-Version: 1.0 To: Paul Mundt , Magnus Damm , linux-sh@vger.kernel.org Cc: Francesco VIRLINZI Subject: [Proposal][PATCH] sh: PMB hibernation support References: <20090306064156.27281.35572.sendpatchset@rx1.opensource.se> <49B0CB82.7030708@st.com> <49B0F56F.2090806@st.com> <20090307061208.GB14735@linux-sh.org> <49B4DD7E.8080602@st.com> <20090309173505.GB3546@linux-sh.org> In-Reply-To: <20090309173505.GB3546@linux-sh.org> Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org Hi Paul > > Feel free to post what you already have, even if it doesn't apply. This > sort of stuff by nature tends to take several iterations before it's in > any shape to merge anyways. > > In attach there is a proposal on how manage the PMB after a resume from hibernation. My assumption in background is that "just because the kernel runs.. the "core" PMB (main memory) are already ok" In our kernel I'm doing something very similar. I can say: it compiles but I have no way to really test this code as it is. Regards Francesco From f7ac0e9ecd48c8987a747968a79a94ac3f424adc Mon Sep 17 00:00:00 2001 From: Francesco Virlinzi Date: Wed, 11 Mar 2009 11:31:52 +0100 Subject: [PATCH] sh_mmu: Added hibernation support in the PMB Signed-off-by: Francesco Virlinzi --- arch/sh/mm/pmb.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 38 insertions(+), 0 deletions(-) diff --git a/arch/sh/mm/pmb.c b/arch/sh/mm/pmb.c index 8424167..b1a714a 100644 --- a/arch/sh/mm/pmb.c +++ b/arch/sh/mm/pmb.c @@ -15,6 +15,8 @@ */ #include #include +#include +#include #include #include #include @@ -402,3 +404,39 @@ static int __init pmb_debugfs_init(void) return 0; } postcore_initcall(pmb_debugfs_init); + +#ifdef CONFIG_PM +static int pmb_sysdev_suspend(struct sys_device *dev, pm_message_t state) +{ + static pm_message_t prev_state; + + /* Restore the PMB after a resume from hibernation */ + if (state.event == PM_EVENT_ON && + prev_state.event == PM_EVENT_FREEZE) { + struct pmb_entry *pmbe; + spin_lock_irq(&pmb_list_lock); + for (pmbe = pmb_list; pmbe; pmbe = pmbe->next) + set_pmb_entry(pmbe); + spin_unlock_irq(&pmb_list_lock); + } + prev_state = state; + return 0; +} + +static int pmb_sysdev_resume(struct sys_device *dev) +{ + return pmb_sysdev_suspend(dev, PMSG_ON); +} + +static struct sysdev_driver pmb_sysdev_driver = { + .suspend = pmb_sysdev_suspend, + .resume = pmb_sysdev_resume, +}; + +static int __init pmb_sysdev_init(void) +{ + return sysdev_driver_register(&cpu_sysdev_class, &pmb_sysdev_driver); +} + +subsys_initcall(pmb_sysdev_init); +#endif -- 1.5.6.6