All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: linuxppc-dev@ozlabs.org
Subject: [RFC 4/6] powerpc: mark pages that dont exist as nosave
Date: Wed, 21 Mar 2007 11:40:41 +0100	[thread overview]
Message-ID: <20070321104211.584777000@sipsolutions.net> (raw)
In-Reply-To: 20070321104037.696668000@sipsolutions.net

On some powerpc architectures (notably 64-bit powermac) there is a memory
hole, for example on powermacs between 2G and 4G. Since we use the flat
memory model regardless, these pages must be marked as nosave (for suspend
to disk.)

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>

---
Tested on powerbook and G5 powermac.

---
 arch/powerpc/mm/mem.c |   25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

--- linux-2.6-git.orig/arch/powerpc/mm/mem.c	2007-03-21 11:05:32.853447142 +0100
+++ linux-2.6-git/arch/powerpc/mm/mem.c	2007-03-21 11:06:08.338447142 +0100
@@ -31,6 +31,7 @@
 #include <linux/highmem.h>
 #include <linux/initrd.h>
 #include <linux/pagemap.h>
+#include <linux/suspend.h>
 
 #include <asm/pgalloc.h>
 #include <asm/prom.h>
@@ -280,6 +281,28 @@ void __init do_init_bootmem(void)
 	init_bootmem_done = 1;
 }
 
+/* mark pages that don't exist as nosave */
+static int __init mark_nonram_nosave(void)
+{
+	unsigned long lmb_next_region_start_pfn,
+		      lmb_region_max_pfn;
+	int i;
+
+	for (i = 0; i < lmb.memory.cnt - 1; i++) {
+		lmb_region_max_pfn =
+			(lmb.memory.region[i].base >> PAGE_SHIFT) +
+			(lmb.memory.region[i].size >> PAGE_SHIFT);
+		lmb_next_region_start_pfn =
+			lmb.memory.region[i+1].base >> PAGE_SHIFT;
+
+		if (lmb_region_max_pfn < lmb_next_region_start_pfn)
+			register_nosave_region(lmb_region_max_pfn,
+					       lmb_next_region_start_pfn);
+	}
+
+	return 0;
+}
+
 /*
  * paging_init() sets up the page tables - in fact we've already done this.
  */
@@ -311,6 +334,8 @@ void __init paging_init(void)
 	max_zone_pfns[ZONE_DMA] = top_of_ram >> PAGE_SHIFT;
 #endif
 	free_area_init_nodes(max_zone_pfns);
+
+	mark_nonram_nosave();
 }
 #endif /* ! CONFIG_NEED_MULTIPLE_NODES */
 

--

  parent reply	other threads:[~2007-03-21 12:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-21 10:40 [RFC 0/6] suspend on G5 Johannes Berg
2007-03-21 10:40 ` [RFC 1/6] powermac: support G5 CPU hotplug Johannes Berg
2007-03-21 10:40 ` [RFC 2/6] powerpc: MPIC sys_device & suspend/resume Johannes Berg
2007-03-21 10:40 ` [RFC 3/6] powerpc: dart iommu suspend Johannes Berg
2007-03-21 10:40 ` Johannes Berg [this message]
2007-03-21 10:40 ` [RFC 5/6] powermac: fix G5-cpufreq for cpu on/offline Johannes Berg
2007-03-21 10:40 ` [RFC 6/6] powermac: suspend to disk on G5 Johannes Berg

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=20070321104211.584777000@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=linuxppc-dev@ozlabs.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.