public inbox for linux-sh@vger.kernel.org
 help / color / mirror / Atom feed
From: Francesco VIRLINZI <francesco.virlinzi@st.com>
To: linux-sh@vger.kernel.org
Subject: [Proposal][PATCH] sh: PMB hibernation support
Date: Wed, 11 Mar 2009 10:39:02 +0000	[thread overview]
Message-ID: <49B794C6.8000806@st.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 539 bytes --]

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

[-- Attachment #2: 0004-sh_mmu-Added-hibernation-support-in-the-PMB.patch --]
[-- Type: text/x-patch, Size: 1742 bytes --]

From f7ac0e9ecd48c8987a747968a79a94ac3f424adc Mon Sep 17 00:00:00 2001
From: Francesco Virlinzi <francesco.virlinzi@st.com>
Date: Wed, 11 Mar 2009 11:31:52 +0100
Subject: [PATCH] sh_mmu: Added hibernation support in the PMB


Signed-off-by: Francesco Virlinzi <francesco.virlinzi@st.com>
---
 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 <linux/init.h>
 #include <linux/kernel.h>
+#include <linux/sysdev.h>
+#include <linux/cpu.h>
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/bitops.h>
@@ -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


             reply	other threads:[~2009-03-11 10:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-11 10:39 Francesco VIRLINZI [this message]
2009-03-16 11:05 ` [Proposal][PATCH] sh: PMB hibernation support Paul Mundt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49B794C6.8000806@st.com \
    --to=francesco.virlinzi@st.com \
    --cc=linux-sh@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox